:root {
            --bg: #f5f7fb;
            --panel: rgba(255, 255, 255, 0.94);
            --panel-strong: #ffffff;
            --line: rgba(15, 23, 42, 0.08);
            --line-strong: rgba(15, 23, 42, 0.14);
            --text: #141826;
            --muted: #6a7386;
            --brand: #2563ff;
            --brand-strong: #173da6;
            --brand-soft: rgba(37, 99, 255, 0.1);
            --success: #0f7a50;
            --warning: #b7791f;
            --danger: #cf3f4f;
            --shadow: 0 24px 60px rgba(15, 23, 42, 0.08);
            --shadow-soft: 0 12px 24px rgba(15, 23, 42, 0.06);
            --radius-xl: 28px;
            --radius-lg: 22px;
            --radius-md: 16px;
            --radius-sm: 12px;
            --chat-sidebar-width: 272px;
            --chat-sidebar-resizer-width: 10px;
        }

        * {
            box-sizing: border-box;
        }

        html,
        body {
            min-height: 100%;
        }

        body {
            margin: 0;
            font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
            color: var(--text);
            background:
                radial-gradient(circle at top left, rgba(37, 99, 255, 0.12), transparent 24%),
                radial-gradient(circle at top right, rgba(16, 185, 129, 0.08), transparent 16%),
                linear-gradient(180deg, #fbfcfe 0%, #f4f6fa 100%);
        }

        body[data-ui-theme="dark"] {
            --bg: #09111f;
            --panel: rgba(13, 22, 38, 0.92);
            --panel-strong: #0f1b2f;
            --line: rgba(148, 163, 184, 0.16);
            --line-strong: rgba(148, 163, 184, 0.22);
            --text: #edf2ff;
            --muted: #98a6bf;
            --brand: #6aa1ff;
            --brand-strong: #bfd3ff;
            --brand-soft: rgba(92, 140, 255, 0.16);
            --shadow: 0 24px 60px rgba(2, 6, 23, 0.46);
            --shadow-soft: 0 12px 24px rgba(2, 6, 23, 0.28);
            background:
                radial-gradient(circle at top left, rgba(54, 92, 183, 0.34), transparent 26%),
                radial-gradient(circle at top right, rgba(26, 146, 130, 0.2), transparent 18%),
                linear-gradient(180deg, #08101d 0%, #0d1626 100%);
        }

        .site-topbar {
            display: none;
        }

        .site-topbar-inner {
            width: min(1780px, calc(100vw - 28px));
            margin: 0 auto;
            min-height: 54px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 18px;
        }

        .site-topbar-main {
            min-width: 0;
            flex: 1 1 auto;
            display: flex;
            align-items: center;
            gap: 14px;
        }

        .topbar-brand {
            min-width: 0;
            flex: 0 0 auto;
            display: inline-flex;
            align-items: center;
            gap: 10px;
            padding-right: 4px;
        }

        .topbar-brand-mark,
        .topbar-brand img {
            width: 34px;
            height: 34px;
            border-radius: 12px;
            flex: 0 0 34px;
            display: block;
            object-fit: cover;
            background: #e8edf6;
            border: 1px solid rgba(15, 23, 42, 0.06);
        }

        .topbar-brand-mark {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            background: linear-gradient(135deg, #2563ff 0%, #15b9ac 100%);
            color: #fff;
            font-size: 12px;
            font-weight: 800;
            letter-spacing: .08em;
            border: none;
        }

        .topbar-brand-copy {
            min-width: 0;
        }

        .topbar-brand-copy strong {
            display: block;
            max-width: 220px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            font-size: 14px;
            line-height: 1.2;
            color: #172135;
        }

        .topbar-brand-copy span {
            display: block;
            margin-top: 2px;
            font-size: 11px;
            color: #7a8598;
            line-height: 1.3;
        }

        .site-topbar-actions {
            display: flex;
            align-items: center;
            gap: 10px;
            flex: 0 0 auto;
        }

        .topbar-link,
        .topbar-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            min-height: 34px;
            padding: 0 14px;
            border-radius: 999px;
            font-size: 12px;
            font-weight: 700;
        }

        .topbar-link {
            color: #4d5a70;
            background: transparent;
        }

        .topbar-btn {
            border: none;
            cursor: pointer;
            color: #fff;
            background: linear-gradient(135deg, #2563ff 0%, #15b9ac 100%);
            box-shadow: 0 12px 24px rgba(37, 99, 255, 0.18);
        }

        a {
            color: inherit;
            text-decoration: none;
        }

        button,
        input,
        select,
        textarea {
            font: inherit;
        }

        .hidden {
            display: none !important;
        }

        .app {
            width: 100%;
            margin: 0;
            padding: 0;
            min-height: 100vh;
            display: grid;
            grid-template-columns: 260px minmax(0, 1fr);
            gap: 0;
            align-items: stretch;
            background: #f8f9fb;
        }

        .desktop-sidebar-resizer {
            display: none;
        }

        .card {
            background: var(--panel);
            backdrop-filter: blur(20px);
            border: 1px solid var(--line);
            border-radius: var(--radius-xl);
            box-shadow: var(--shadow);
        }

        .rail {
            display: none;
        }

        .rail-stack {
            display: flex;
            flex-direction: column;
            gap: 12px;
            width: 100%;
        }

        .rail-brand {
            display: none;
        }

        .brand-mark {
            width: 46px;
            height: 46px;
            border-radius: 18px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: linear-gradient(135deg, #2563ff 0%, #15b9ac 100%);
            color: #fff;
            font-weight: 800;
            letter-spacing: .08em;
            box-shadow: 0 16px 30px rgba(37, 99, 255, 0.24);
        }

        .rail-btn {
            width: 100%;
            border: none;
            background: transparent;
            border-radius: 18px;
            color: #7a8396;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 0;
            padding: 10px 4px;
            cursor: pointer;
            transition: transform .18s ease, background .18s ease, color .18s ease;
        }

        .rail-btn:hover,
        .rail-btn.active {
            background: rgba(255, 255, 255, 0.84);
            color: var(--brand-strong);
            transform: translateY(-1px);
        }

        .rail-icon {
            width: 100%;
            min-height: 42px;
            padding: 0 8px;
            border-radius: 14px;
            display: inline-flex;
            align-items: center;
            justify-content: flex-start;
            gap: 8px;
            background: #eef2f8;
            border: 1px solid rgba(37, 99, 255, 0.06);
            font-size: 13px;
            font-weight: 700;
            line-height: 1.15;
            white-space: nowrap;
            text-align: left;
            color: currentColor;
            overflow: hidden;
        }

        .rail-glyph {
            width: 16px;
            height: 16px;
            flex: 0 0 16px;
            display: block;
        }

        .rail-text {
            display: inline-block;
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .rail-btn.active .rail-icon,
        .rail-btn:hover .rail-icon {
            background: linear-gradient(135deg, rgba(37, 99, 255, 0.16) 0%, rgba(21, 185, 172, 0.14) 100%);
            border-color: rgba(37, 99, 255, 0.12);
        }

        .rail-label {
            display: none;
        }

        .history {
            position: sticky;
            top: 0;
            min-height: 100vh;
            max-height: 100vh;
            padding: 12px 10px 10px;
            display: grid;
            grid-template-rows: auto minmax(0, 1fr) auto auto;
            gap: 6px;
            overflow: hidden;
            background: #f7f7f8;
            border-radius: 0;
            border-top: none;
            border-bottom: none;
            border-left: none;
            border-right: 1px solid rgba(15, 23, 42, 0.05);
            box-shadow: none;
        }

        .sidebar-shell {
            display: grid;
            gap: 8px;
            align-content: start;
            min-height: 0;
        }

        .sidebar-search-trigger {
            width: 100%;
            min-height: 44px;
            padding: 0 12px 0 14px;
            border-radius: 16px;
            border: 1px solid rgba(15, 23, 42, 0.06);
            background: rgba(255, 255, 255, 0.96);
            color: #637086;
            display: grid;
            grid-template-columns: auto minmax(0, 1fr) auto;
            align-items: center;
            gap: 10px;
            cursor: pointer;
            box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
            transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
        }

        .sidebar-search-trigger:hover {
            border-color: rgba(37, 99, 255, 0.18);
            box-shadow: 0 14px 28px rgba(37, 99, 255, 0.08);
            transform: translateY(-1px);
        }

        .sidebar-search-trigger svg {
            width: 18px;
            height: 18px;
            color: #8c97aa;
            flex: 0 0 18px;
        }

        .sidebar-search-trigger-label {
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            font-size: 14px;
            text-align: left;
        }

        .sidebar-search-trigger-shortcut {
            min-height: 24px;
            padding: 0 8px;
            border-radius: 999px;
            background: rgba(15, 23, 42, 0.05);
            color: #8c97aa;
            font-size: 11px;
            font-weight: 700;
            display: inline-flex;
            align-items: center;
            justify-content: center;
        }

        .history-main {
            min-height: 0;
            overflow-y: auto;
            overflow-x: hidden;
            display: grid;
            align-content: start;
            gap: 10px;
            padding-right: 4px;
        }

        .history-main::-webkit-scrollbar {
            width: 8px;
        }

        .history-main::-webkit-scrollbar-thumb {
            background: rgba(120, 130, 149, 0.3);
            border-radius: 999px;
        }

        .history-main::-webkit-scrollbar-track {
            background: transparent;
        }

       .history-account {
            margin-top: 0;
            padding-top: 10px;
        }

        .history-account .workspace-account-menu {
            width: 100%;
            display: grid;
            gap: 8px;
        }

        .workspace-account-card {
            width: 100%;
            min-height: 68px;
            padding: 0 10px 0 12px;
            display: flex;
            align-items: center;
            gap: 6px;
            border: 1px solid #dfe7f2;
            border-radius: 11px;
            background: #fff;
            box-sizing: border-box;
        }

        .workspace-account-card .workspace-account-toggle {
            flex: 1 1 auto;
            min-width: 0;
            min-height: 66px;
            padding: 0;
            border: 0;
            border-radius: 0;
            background: transparent;
            justify-content: flex-start;
            gap: 11px;
            color: #1f2937;
        }

        .workspace-account-card .workspace-account-toggle::after {
            margin-left: 8px;
        }

        .workspace-account-card .workspace-account-toggle > span:last-child {
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .workspace-account-settings {
            width: 32px;
            height: 32px;
            padding: 0;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border: 0;
            border-radius: 8px;
            background: transparent;
            color: #6c7b91;
            cursor: pointer;
            transition: color .18s ease, background .18s ease;
        }

        .workspace-account-settings:hover {
            background: #f1f5fb;
            color: #2563eb;
        }

        .workspace-account-settings svg {
            width: 20px;
            height: 20px;
            display: block;
        }

        .workspace-header-user-fallback.guest-avatar {
            width: 42px;
            height: 42px;
            background: #e7f0ff;
            color: #2877ee;
        }

        .workspace-header-user-fallback.guest-avatar svg {
            width: 24px;
            height: 24px;
            display: block;
        }

        .sidebar-safety-link {
            width: 100%;
            min-height: 40px;
            padding: 0 12px;
            display: inline-flex;
            align-items: center;
            gap: 9px;
            border: 1px solid transparent;
            border-radius: 9px;
            color: #71809a;
            font-size: 13px;
            text-decoration: none;
            box-sizing: border-box;
            transition: color .18s ease, background .18s ease;
        }

        .sidebar-safety-link:hover {
            background: #f4f8ff;
            color: #0b6ff0;
        }

        .sidebar-safety-link svg {
            width: 17px;
            height: 17px;
            flex: 0 0 17px;
            display: block;
        }

        .history-account .workspace-account-dropdown {
            left: 0;
            right: auto;
            top: auto;
            bottom: calc(100% + 10px);
            min-width: 188px;
        }

        .sidebar-brand {
            display: flex;
            align-items: center;
            gap: 10px;
            min-width: 0;
            padding: 4px 8px 8px;
        }

        .sidebar-brand-mark {
            width: 30px;
            height: 30px;
            border-radius: 50%;
            flex: 0 0 24px;
            object-fit: cover;
            display: block;
            background: #e8edf6;
            border: 1px solid rgba(15, 23, 42, 0.06);
        }

        .sidebar-brand img {
            width: 30px;
            height: 30px;
            flex: 0 0 24px;
            object-fit: contain;
            display: block;
            background: transparent;
            border: 0;
            border-radius: 0;
        }

        .sidebar-brand-mark {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            background: linear-gradient(135deg, #2563ff 0%, #15b9ac 100%);
            border: none;
            color: #fff;
            font-size: 12px;
            font-weight: 800;
            letter-spacing: .08em;
        }

        .sidebar-brand-copy {
            min-width: 0;
        }

        .sidebar-brand-copy strong {
            display: block;
            color: #0872e6;
            font-size: 15px;
            font-weight: 700;
            line-height: 1.2;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .sidebar-brand-copy span {
            display: block;
            margin-top: 1px;
            color: #0d72f5;
            font-size: 10px;
            line-height: 1.2;
        }

        .sidebar-brand-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
        }
        .sidebar-toggle-slot {
            display: flex;
            align-items: center;
            flex: 0 0 auto;
        }
        .sidebar-toggle-slot .desktop-history-toggle {
            position: static;
            width: 28px;
            height: 28px;
            border: 0;
            background: transparent;
            color: #6b7b93;
            cursor: pointer;
            border-radius: 8px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            flex: 0 0 auto;
        }
        .sidebar-toggle-slot .desktop-history-toggle:hover {
            background: rgba(15, 23, 42, 0.04);
            color: #1e293b;
        }
        body[data-ui-theme="dark"] .sidebar-toggle-slot .desktop-history-toggle {
            color: #8b9ab5;
        }
        body[data-ui-theme="dark"] .sidebar-toggle-slot .desktop-history-toggle:hover {
            background: rgba(148, 163, 184, 0.1);
            color: #e2e8f0;
        }
        .sidebar-nav {
            display: grid;
            gap: 4px;
        }

        .sidebar-nav-btn {
            width: 100%;
            min-height: 30px;
            justify-content: flex-start;
            padding: 0 8px;
            border-radius: 8px;
            background: transparent;
            border: 1px solid transparent;
            color: #1f2937;
            display: inline-flex;
            align-items: center;
            gap: 9px;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            transition: background .18s ease, border-color .18s ease, box-shadow .18s ease;
        }

        .sidebar-nav-btn .rail-icon {
            width: auto;
            min-height: 0;
            padding: 0;
            background: transparent;
            border: none;
            gap: 6px;
        }

        .sidebar-nav-btn .rail-glyph {
            width: 14px;
            height: 14px;
        }

        .sidebar-nav-btn:hover {
            background: rgba(255, 255, 255, 0.96);
            border-color: rgba(15, 23, 42, 0.04);
            box-shadow: 0 8px 16px rgba(15, 23, 42, 0.04);
            transform: none;
        }

        .sidebar-nav-btn.active {
            background: #ffffff;
            border-color: rgba(15, 23, 42, 0.03);
            color: #111827;
            box-shadow: 0 6px 14px rgba(15, 23, 42, 0.04);
            transform: none;
        }

        .sidebar-nav-btn.active .rail-text {
            font-weight: 700;
        }

        .sidebar-section-label {
            padding: 8px 4px 0;
            color: #9aa3b2;
            font-size: 12px;
            line-height: 1.2;
        }

        body[data-tool-mode="image"] .task-list,
        body[data-tool-mode="video"] .task-list,
        body[data-tool-mode="image"] .pagination,
        body[data-tool-mode="video"] .pagination {
            display: none !important;
        }

        .sidebar-action-btn {
            width: 100%;
            justify-content: flex-start;
            border-radius: 14px;
            min-height: 42px;
            padding: 0 14px;
            box-shadow: none;
        }

        .sidebar-footer {
            margin-top: auto;
            display: grid;
            gap: 10px;
            padding-top: 14px;
            border-top: 1px solid rgba(15, 23, 42, 0.05);
        }

        .sidebar-account {
            display: grid;
            gap: 4px;
        }

        .sidebar-account-row {
            display: flex;
            align-items: center;
            gap: 10px;
            min-width: 0;
        }

        .sidebar-account-avatar {
            width: 30px;
            height: 30px;
            border-radius: 10px;
            object-fit: cover;
            flex: 0 0 24px;
            display: block;
            background: #e8edf6;
            border: 1px solid rgba(15, 23, 42, 0.06);
        }

        .sidebar-account-avatar-fallback {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            background: linear-gradient(135deg, #2563ff 0%, #15b9ac 100%);
            color: #fff;
            font-size: 12px;
            font-weight: 800;
            border: none;
        }

        .sidebar-account-meta {
            min-width: 0;
            display: grid;
            gap: 2px;
        }

        .sidebar-account strong {
            display: block;
            color: #172135;
            font-size: 13px;
            line-height: 1.3;
        }

        .sidebar-account span {
            display: block;
            color: #8b96a8;
            font-size: 11px;
            line-height: 1.4;
        }

        .sidebar-footer-actions {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
        }

        .sidebar-footer-link {
            text-decoration: none;
        }

        body[data-mode="chat"] .sidebar-footer-actions {
            display: grid;
            grid-template-columns: 1fr 1fr;
        }

        .sidebar-footer-actions .btn {
            flex: 1 1 auto;
            min-height: 38px;
            padding: 0 12px;
            font-size: 12px;
            border-radius: 12px;
            justify-content: center;
        }

        .mobile-history-account {
            display: none;
        }

        .mobile-history-account-name {
            font-size: 14px;
            font-weight: 700;
            color: #142033;
        }

        .mobile-history-account-meta {
            color: #6f7b8f;
            font-size: 12px;
        }

        .history-composer-slot {
            display: none;
            min-height: 0;
            gap: 18px;
            align-content: start;
        }

        body[data-mode="image"] .history-composer-slot,
        body[data-mode="video"] .history-composer-slot {
            display: grid;
        }

        body[data-mode="image"] .history,
        body[data-mode="video"] .history {
            overflow-y: auto;
            overflow-x: hidden;
            transition: opacity .22s ease, transform .22s ease, width .22s ease, padding .22s ease, border-color .22s ease;
        }

        body[data-mode="image"] .history .task-list,
        body[data-mode="video"] .history .task-list,
        body[data-mode="image"] .history .pagination,
        body[data-mode="video"] .history .pagination {
            display: none;
        }

        body.show-record-history[data-mode="image"] .history .task-list,
        body.show-record-history[data-mode="video"] .history .task-list {
            display: grid;
        }

        body.show-record-history[data-mode="image"] .history .pagination,
        body.show-record-history[data-mode="video"] .history .pagination {
            display: flex;
        }

        body.show-record-history[data-mode="image"] .history-composer-slot,
        body.show-record-history[data-mode="video"] .history-composer-slot,
        body.show-record-history[data-mode="image"] .workspace-records,
        body.show-record-history[data-mode="video"] .workspace-records {
            display: none;
        }

        .workspace {
            min-width: 0;
            min-height: 100vh;
            display: grid;
            grid-template-rows: auto minmax(0, 1fr) auto;
            gap: 16px;
            padding: 0 28px 0 20px;
        }

        body[data-mode="chat"] .workspace {
            display: flex;
            flex-direction: column;
            min-height: 0;
            gap: 0;
            height: 100vh;
            min-height: 100vh;
            max-height: 100vh;
            overflow: hidden;
        }

        body[data-mode="chat"] .workspace-records {
            display: none;
        }

        .hero {
            padding: 18px 22px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 18px;
            background:
                radial-gradient(circle at top left, rgba(37, 99, 255, 0.1), transparent 24%),
                linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.98) 100%);
        }

        body[data-mode="chat"] .hero {
            display: none;
        }

        body[data-mode="image"] .hero,
        body[data-mode="video"] .hero {
            display: none;
        }

        body[data-mode="image"] .hero-user,
        body[data-mode="video"] .hero-user {
            display: none;
        }

        .hero-copy {
            min-width: 0;
        }

        .hero-brand {
            display: flex;
            align-items: center;
            gap: 14px;
            margin-bottom: 14px;
        }

        .site-icon,
        .avatar {
            width: 52px;
            height: 52px;
            border-radius: 18px;
            object-fit: cover;
            display: block;
            background: #e8edf6;
            border: 1px solid rgba(15, 23, 42, 0.06);
        }

        .site-icon-fallback,
        .avatar-fallback {
            width: 52px;
            height: 52px;
            border-radius: 18px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: linear-gradient(135deg, #2563ff 0%, #15b9ac 100%);
            color: #fff;
            font-weight: 800;
            font-size: 17px;
        }

        .hero-brand-text strong {
            display: block;
            font-size: 24px;
            line-height: 1.15;
        }

        .hero-brand-text span {
            display: block;
            margin-top: 4px;
            font-size: 12px;
            color: var(--muted);
            text-transform: uppercase;
            letter-spacing: .08em;
        }

        .hero-title {
            margin: 0;
            font-size: 26px;
            line-height: 1.18;
        }

        .hero-desc {
            margin: 8px 0 0;
            max-width: 620px;
            color: var(--muted);
            font-size: 13px;
            line-height: 1.8;
        }

        .hero-user {
            min-width: 280px;
            padding: 16px;
            display: flex;
            align-items: center;
            gap: 12px;
            border-radius: 20px;
            border: 1px solid var(--line);
            background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(246, 249, 252, 0.98) 100%);
        }

        .hero-user .user-links {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
        }

        .guest-hero {
            margin-bottom: 16px;
        }

        .guest-hero-main {
            display: grid;
            grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
            gap: 18px;
            padding: 22px;
            background:
                radial-gradient(circle at top left, rgba(37, 99, 255, 0.08), transparent 22%),
                linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(246,249,252,0.98) 100%);
        }

        .guest-hero-copy {
            display: flex;
            flex-direction: column;
            gap: 16px;
        }

        .guest-badge {
            width: fit-content;
            min-height: 30px;
            padding: 0 12px;
            display: inline-flex;
            align-items: center;
            border-radius: 999px;
            background: rgba(37, 99, 255, 0.1);
            color: var(--brand-strong);
            font-size: 12px;
            font-weight: 800;
            letter-spacing: .08em;
        }

        .guest-title {
            margin: 0;
            font-size: 38px;
            line-height: 1.14;
            letter-spacing: -0.02em;
        }

        .guest-summary {
            margin: 0;
            max-width: 640px;
            color: var(--muted);
            font-size: 15px;
            line-height: 1.9;
        }

        .guest-actions {
            display: flex;
            flex-wrap: wrap;
            gap: 12px;
        }

        .guest-highlight-grid {
            display: grid;
            grid-template-columns: repeat(3, minmax(0, 1fr));
            gap: 12px;
        }

        .guest-highlight {
            padding: 16px;
            border-radius: 20px;
            border: 1px solid rgba(15, 23, 42, 0.08);
            background: rgba(255,255,255,0.84);
        }

        .guest-highlight-tag {
            color: var(--brand-strong);
            font-size: 12px;
            font-weight: 800;
        }

        .guest-highlight h3 {
            margin: 10px 0 8px;
            font-size: 16px;
        }

        .guest-highlight p {
            margin: 0;
            color: var(--muted);
            font-size: 13px;
            line-height: 1.8;
        }

        .guest-preview {
            min-width: 0;
        }

        .guest-preview-shell {
            height: 100%;
            min-height: 470px;
            display: grid;
            grid-template-columns: 118px minmax(0, 1fr);
            border-radius: 26px;
            overflow: hidden;
            background: #fbfcff;
            border: 1px solid rgba(15, 23, 42, 0.08);
            box-shadow: 0 24px 50px rgba(15, 23, 42, 0.08);
        }

        .guest-preview-sidebar {
            padding: 18px 12px;
            background: linear-gradient(180deg, #f3f7ff 0%, #eef4fb 100%);
            border-right: 1px solid rgba(15, 23, 42, 0.05);
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .guest-preview-logo {
            width: 46px;
            height: 46px;
            border-radius: 18px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: linear-gradient(135deg, #2563ff 0%, #15b9ac 100%);
            color: #fff;
            font-weight: 800;
            box-shadow: 0 16px 26px rgba(37, 99, 255, 0.2);
        }

        .guest-preview-side-item {
            min-height: 38px;
            padding: 0 10px;
            display: flex;
            align-items: center;
            border-radius: 14px;
            color: #65748b;
            font-size: 13px;
            font-weight: 700;
        }

        .guest-preview-side-item.active {
            color: var(--brand-strong);
            background: rgba(37, 99, 255, 0.12);
        }

        .guest-preview-main {
            display: flex;
            flex-direction: column;
            min-width: 0;
            padding: 18px;
            gap: 16px;
        }

        .guest-preview-header {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 14px;
        }

        .guest-preview-header strong {
            display: block;
            font-size: 18px;
        }

        .guest-preview-header span {
            display: block;
            margin-top: 6px;
            color: var(--muted);
            font-size: 13px;
            line-height: 1.7;
        }

        .guest-preview-login {
            border: none;
            border-radius: 999px;
            min-height: 38px;
            padding: 0 16px;
            background: rgba(37, 99, 255, 0.1);
            color: var(--brand-strong);
            font-size: 13px;
            font-weight: 700;
            cursor: pointer;
        }

        .guest-preview-thread {
            min-height: 0;
            flex: 1 1 auto;
            display: flex;
            flex-direction: column;
            gap: 14px;
            padding: 8px 0;
        }

        .guest-bubble {
            max-width: 88%;
            padding: 14px 16px;
            border-radius: 20px;
            font-size: 14px;
            line-height: 1.9;
        }

        .guest-bubble.user {
            align-self: flex-end;
            background: linear-gradient(135deg, #2d67ff 0%, #1cb6b3 100%);
            color: #fff;
            border-bottom-right-radius: 8px;
        }

        .guest-bubble.assistant {
            align-self: flex-start;
            background: #f4f7fc;
            color: #172135;
            border: 1px solid rgba(15, 23, 42, 0.06);
            border-bottom-left-radius: 8px;
        }

        .guest-preview-input {
            min-height: 64px;
            padding: 0 16px;
            border-radius: 20px;
            background: #f4f7fc;
            border: 1px solid rgba(15, 23, 42, 0.06);
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            color: #788295;
            font-size: 13px;
        }

        .guest-preview-input button {
            border: none;
            border-radius: 999px;
            min-height: 36px;
            padding: 0 16px;
            color: #fff;
            background: linear-gradient(135deg, #2563ff 0%, #15b9ac 100%);
            font-size: 13px;
            font-weight: 700;
            cursor: pointer;
        }

        .viewer-name {
            font-size: 15px;
            font-weight: 700;
        }

        .tiny,
        .viewer-meta,
        .status-text,
        .task-meta,
        .conversation-meta,
        .upload-meta {
            color: var(--muted);
            font-size: 12px;
            line-height: 1.7;
        }

        .status-text {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            min-height: 24px;
            transition: color .2s ease;
        }

        .status-text::before {
            content: '';
            width: 8px;
            height: 8px;
            border-radius: 999px;
            background: rgba(18, 78, 125, 0.28);
            flex: 0 0 auto;
        }

        .status-text.is-loading::before {
            width: 12px;
            height: 12px;
            background: transparent;
            border: 2px solid rgba(18, 78, 125, 0.18);
            border-top-color: var(--accent);
            animation: status-spin .8s linear infinite;
        }

        .status-text.is-success {
            color: #0f7b43;
        }

        .status-text.is-success::before {
            background: #2eb872;
        }

        .status-text.is-warning {
            color: #9a6a08;
        }

        .status-text.is-warning::before {
            background: #f0ab00;
        }

        .status-text.is-error {
            color: #bb2d3b;
        }

        .status-text.is-error::before {
            background: #e04f5f;
        }

        .toast-stack {
            position: fixed;
            right: 24px;
            bottom: 24px;
            z-index: 90;
            display: flex;
            flex-direction: column;
            gap: 10px;
            pointer-events: none;
        }

        .toast {
            min-width: 220px;
            max-width: 340px;
            padding: 12px 14px;
            border-radius: 16px;
            border: 1px solid rgba(18, 78, 125, 0.12);
            background: rgba(255, 255, 255, 0.96);
            color: var(--text);
            box-shadow: 0 18px 38px rgba(15, 37, 57, 0.12);
            opacity: 0;
            transform: translateY(10px);
            animation: toast-in .22s ease forwards;
        }

        .toast.error {
            border-color: rgba(224, 79, 95, 0.22);
            color: #9d2030;
        }

        .toast.success {
            border-color: rgba(46, 184, 114, 0.22);
            color: #0f7b43;
        }

        .toast.warning {
            border-color: rgba(240, 171, 0, 0.22);
            color: #9a6a08;
        }

        .auth-overlay {
            position: fixed;
            inset: 0;
            z-index: 120;
        }

        .auth-mask {
            position: absolute;
            inset: 0;
            background: rgba(9, 16, 29, 0.56);
            backdrop-filter: blur(8px);
        }

        .auth-dialog {
            position: absolute;
            left: 50%;
            top: 50%;
            width: min(920px, calc(100vw - 32px));
            transform: translate(-50%, -50%);
            padding: 30px;
            border-radius: 32px;
            border: 1px solid rgba(255,255,255,0.2);
            background:
                radial-gradient(circle at top left, rgba(37, 99, 255, 0.12), transparent 24%),
                radial-gradient(circle at bottom right, rgba(21, 185, 172, 0.1), transparent 28%),
                linear-gradient(180deg, rgba(255,255,255,0.99) 0%, rgba(247,249,252,0.99) 100%);
            box-shadow: 0 36px 90px rgba(15, 23, 42, 0.24);
        }

        .auth-close {
            position: absolute;
            right: 16px;
            top: 14px;
            width: 34px;
            height: 34px;
            border: none;
            border-radius: 999px;
            background: rgba(15, 23, 42, 0.06);
            color: #5f6e82;
            font-size: 22px;
            line-height: 1;
            cursor: pointer;
        }

        .auth-dialog-head {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .auth-dialog-badge {
            width: fit-content;
            min-height: 30px;
            padding: 0 12px;
            display: inline-flex;
            align-items: center;
            border-radius: 999px;
            background: rgba(37, 99, 255, 0.12);
            color: var(--brand-strong);
            font-size: 12px;
            font-weight: 800;
            letter-spacing: .08em;
        }

        .auth-dialog-head h3 {
            margin: 0;
            font-size: 34px;
            line-height: 1.2;
        }

        .auth-dialog-head p {
            margin: 0;
            color: var(--muted);
            font-size: 15px;
            line-height: 1.85;
        }

        .auth-layout {
            display: grid;
            grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
            gap: 26px;
            align-items: stretch;
        }

        .auth-main {
            display: grid;
            gap: 18px;
            min-width: 0;
        }

        .auth-dialog-actions {
            display: flex;
            gap: 12px;
            margin-top: 22px;
        }

        .auth-dialog-actions .btn {
            flex: 1 1 0;
            justify-content: center;
        }

        .auth-dialog-tips {
            margin-top: 18px;
            display: grid;
            gap: 8px;
            color: #627089;
            font-size: 13px;
        }

        .legal-doc-overlay {
            z-index: 160;
        }

        .legal-doc-dialog {
            width: min(720px, calc(100vw - 28px));
            max-height: min(78vh, 760px);
            padding: 24px 24px 20px;
            border-radius: 28px;
            overflow: hidden;
            display: grid;
            grid-template-rows: auto minmax(0, 1fr);
            gap: 16px;
        }

        .legal-doc-head {
            display: grid;
            gap: 8px;
            padding-right: 30px;
        }

        .legal-doc-head h3 {
            margin: 0;
            font-size: 24px;
            line-height: 1.3;
            color: #111827;
        }

        .legal-doc-head span {
            font-size: 12px;
            color: #94a3b8;
            line-height: 1.5;
        }

        .legal-doc-content {
            min-height: 0;
            overflow-y: auto;
            padding: 2px 4px 2px 0;
            color: #475569;
            font-size: 14px;
            line-height: 1.85;
            white-space: pre-wrap;
        }

        @keyframes status-spin {
            from { transform: rotate(0deg); }
            to { transform: rotate(360deg); }
        }

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

        .user-links,
        .task-actions,
        .history-actions,
        .pagination-actions,
        .upload-actions,
        .result-actions,
        .mode-switch,
        .mobile-actions {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 10px;
        }

        .history-head,
        .section-head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
        }

        .history-head {
            padding-bottom: 12px;
            border-bottom: 1px solid rgba(15, 23, 42, 0.05);
        }

        .history-head-copy {
            min-width: 0;
        }

        .history.is-conversation-view .history-head,
        .history.is-conversation-view .history-search,
        .history.is-conversation-view .history-actions {
            display: none !important;
        }

        .history.is-conversation-view .history-main {
            gap: 8px;
        }

        .history.is-conversation-view .sidebar-section-label {
            margin: 2px 0 4px;
            padding: 0 4px;
            font-size: 12px;
            font-weight: 600;
            color: #8a94a6;
            letter-spacing: 0;
        }

        .mobile-history-inline {
            display: none;
        }

        .section-head h3,
        .history-title {
            margin: 0;
            font-size: 18px;
            line-height: 1.2;
        }

        .history-switch {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            padding: 4px;
            border-radius: 999px;
            border: 1px solid var(--line);
            background: #f2f5fa;
        }

        .switch-btn {
            border: none;
            background: transparent;
            color: #788295;
            border-radius: 999px;
            padding: 8px 12px;
            font-size: 12px;
            font-weight: 700;
            cursor: pointer;
        }

        .switch-btn.active {
            color: var(--brand-strong);
            background: #fff;
            box-shadow: 0 10px 18px rgba(15, 23, 42, 0.08);
        }

        .history-search {
            display: grid;
            grid-template-columns: minmax(0, 1fr) auto;
            gap: 8px;
            align-items: center;
            padding: 8px;
            border-radius: 18px;
            background: rgba(244, 247, 252, 0.92);
            border: 1px solid rgba(15, 23, 42, 0.05);
        }

        .history-search input {
            width: 100%;
            min-width: 0;
            border: 1px solid var(--line);
            border-radius: 16px;
            background: #fff;
            color: var(--text);
            padding: 10px 12px;
            outline: none;
            font-size: 13px;
        }

        .history-search input:focus {
            border-color: rgba(37, 99, 255, 0.34);
            box-shadow: 0 0 0 3px rgba(37, 99, 255, 0.08);
        }

        .history-search button {
            min-height: 38px;
            padding: 0 12px;
            border-radius: 14px;
            white-space: nowrap;
        }

        .history-chat-summary {
            display: grid;
            gap: 6px;
            padding: 12px 14px;
            border-radius: 18px;
            background: rgba(255, 255, 255, 0.86);
            border: 1px solid rgba(15, 23, 42, 0.05);
        }

        body[data-mode="image"] .history-chat-summary,
        body[data-mode="video"] .history-chat-summary {
            display: none;
        }

        .history-chat-summary strong {
            display: block;
            font-size: 13px;
            color: #24324a;
            line-height: 1.4;
        }

        .history-chat-summary span {
            display: block;
            font-size: 12px;
            color: #5f6e84;
            line-height: 1.7;
        }

        .conversation-list,
        .task-list {
            display: grid;
            gap: 12px;
            overflow: visible;
            padding-right: 0;
            min-width: 0;
        }

        .rail,
        .history,
        .workspace,
        .result-card,
        .result-content,
        .composer,
        .task-item,
        .conversation-item {
            min-width: 0;
        }

        .conversation-list {
            max-height: none;
        }

        .history.is-conversation-view .conversation-list {
            gap: 4px;
        }

        body[data-mode="chat"] .conversation-list {
            max-height: none;
            padding-bottom: 8px;
        }

        .conversation-load-more {
            padding: 8px 6px 4px;
            color: #8994a7;
            font-size: 11px;
            line-height: 1.5;
            text-align: center;
        }

        .task-list {
            min-height: 0;
        }

        .task-date-group {
            display: grid;
            gap: 10px;
        }

        .task-date-group-title {
            padding: 2px 2px 0;
            font-size: 12px;
            font-weight: 700;
            color: #64748b;
        }

        .task-date-group-list {
            display: grid;
            gap: 12px;
        }

        .conversation-item,
        .task-item {
            cursor: pointer;
            transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
            min-width: 0;
            position: relative;
            overflow: visible;
        }

        .conversation-item {
            border: 1px solid transparent;
            border-radius: 14px;
            background: transparent;
            padding: 9px 10px;
            box-shadow: none;
            z-index: 0;
        }

        .history.is-conversation-view .conversation-item {
            padding: 10px 12px;
            border-radius: 12px;
            background: transparent;
            border-color: transparent;
            transform: none !important;
            box-shadow: none !important;
        }

        .conversation-item.menu-open {
            z-index: 40;
        }

        .task-item {
            border: 1px solid var(--line);
            border-radius: 18px;
            background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(246,248,252,0.98) 100%);
            padding: 12px;
        }

        .conversation-item:hover,
        .task-item:hover,
        .conversation-item.active,
        .task-item.active {
            transform: translateY(-1px);
        }

        .conversation-item:hover {
            border-color: rgba(15, 23, 42, 0.03);
            background: rgba(255,255,255,0.72);
            box-shadow: 0 4px 10px rgba(15, 23, 42, 0.03);
        }

        .task-item:hover,
        .task-item.active {
            border-color: rgba(37, 99, 255, 0.18);
            box-shadow: var(--shadow-soft);
        }

        .conversation-item.active {
            border-color: rgba(37, 99, 255, 0.07);
            background: rgba(255,255,255,0.95);
            box-shadow: 0 6px 14px rgba(15, 23, 42, 0.04);
        }

        .conversation-item.active::before {
            content: "";
            position: absolute;
            left: 4px;
            top: 10px;
            bottom: 10px;
            width: 2px;
            border-radius: 999px;
            background: linear-gradient(180deg, #2563ff 0%, #15b9ac 100%);
        }

        .history.is-conversation-view .conversation-item.active::before {
            display: none;
        }

        .conversation-item.active .conversation-title {
            color: #1f4fd6;
        }

        .history.is-conversation-view .conversation-item:hover,
        .history.is-conversation-view .conversation-item.active {
            background: rgba(255,255,255,0.9);
            border-color: rgba(15, 23, 42, 0.04);
            box-shadow: 0 4px 10px rgba(15, 23, 42, 0.03) !important;
        }

        .history.is-conversation-view .conversation-item.active .conversation-title,
        .history.is-conversation-view .conversation-item:hover .conversation-title {
            color: #172033;
        }

        .conversation-head {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 8px;
            min-width: 0;
        }

        .conversation-item-icon {
            width: 22px;
            height: 22px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            flex: 0 0 22px;
            color: #1f3558;
        }

        .conversation-item-icon svg {
            width: 20px;
            height: 20px;
            display: block;
        }

        .conversation-time {
            flex: 0 0 auto;
            min-width: 42px;
            padding-top: 1px;
            color: #7e8aa0;
            font-size: 12px;
            line-height: 1.5;
            text-align: right;
            white-space: nowrap;
        }

        .conversation-title-wrap {
            min-width: 0;
            flex: 1 1 auto;
            padding-right: 6px;
        }

        .conversation-actions {
            position: relative;
            flex: 0 0 auto;
            display: inline-flex;
            align-items: center;
            padding-right: 6px;
        }

        .conversation-more-btn {
            width: 28px;
            height: 28px;
            border: 0;
            border-radius: 10px;
            background: rgba(148, 163, 184, 0.08);
            color: #7b8798;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            flex: 0 0 auto;
            cursor: pointer;
            transition: background .18s ease, color .18s ease, transform .18s ease, opacity .18s ease;
            opacity: 0;
            pointer-events: none;
        }

        .conversation-more-btn:hover,
        .conversation-item.menu-open .conversation-more-btn {
            background: rgba(15, 23, 42, 0.08);
            color: #334155;
        }

        .conversation-more-btn svg {
            width: 14px;
            height: 14px;
            display: block;
        }

        .conversation-item:hover .conversation-more-btn,
        .conversation-item.active .conversation-more-btn,
        .conversation-item.menu-open .conversation-more-btn {
            opacity: 1;
            pointer-events: auto;
        }

        .conversation-menu {
            position: absolute;
            top: calc(100% + 8px);
            right: 4px;
            z-index: 25;
            min-width: 162px;
            padding: 8px;
            border-radius: 18px;
            border: 1px solid rgba(15, 23, 42, 0.06);
            background: rgba(255, 255, 255, 0.98);
            box-shadow: 0 20px 48px rgba(15, 23, 42, 0.16);
            backdrop-filter: blur(16px);
        }

        .conversation-menu.conversation-menu-floating {
            position: fixed;
            top: 0;
            right: auto;
            left: 0;
            z-index: 180;
        }

        .conversation-menu.hidden {
            display: none;
        }

        .conversation-menu-item {
            width: 100%;
            border: 0;
            background: transparent;
            border-radius: 14px;
            min-height: 40px;
            padding: 0 12px;
            display: flex;
            align-items: center;
            gap: 10px;
            color: #1f2937;
            font-size: 13px;
            font-weight: 500;
            cursor: pointer;
            text-align: left;
            transition: background .18s ease, color .18s ease;
        }

        .conversation-menu-item:hover {
            background: rgba(241, 245, 249, 0.95);
        }

        .conversation-menu-item svg {
            width: 15px;
            height: 15px;
            flex: 0 0 auto;
        }

        .conversation-menu-item.is-divider {
            margin-top: 4px;
            padding-top: 6px;
            border-top: 1px solid rgba(15, 23, 42, 0.06);
            border-radius: 0 0 14px 14px;
        }

        .conversation-menu-item.is-danger {
            color: #dc2626;
        }

        .conversation-menu-item.is-danger:hover {
            background: rgba(254, 226, 226, 0.82);
        }

        .conversation-pin-mark {
            display: none;
            align-items: center;
            justify-content: center;
            width: 16px;
            height: 16px;
            margin-right: 6px;
            color: #2563ff;
        }

        .conversation-pinned-chip {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            min-width: 34px;
            height: 18px;
            margin-left: 8px;
            padding: 0 7px;
            border-radius: 999px;
            background: rgba(37, 99, 255, 0.1);
            color: #1d4ed8;
            font-size: 10px;
            font-weight: 700;
            line-height: 1;
            vertical-align: middle;
        }

        .conversation-item.is-pinned .conversation-title {
            color: #1e3a8a;
        }

        .conversation-title,
        .task-title {
            font-size: 14px;
            font-weight: 700;
            line-height: 1.6;
            word-break: break-word;
        }

        .conversation-title {
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            color: #1b2740;
            font-weight: 600;
            font-size: 13px;
        }

        .history.is-conversation-view .conversation-title {
            font-size: 13px;
            font-weight: 600;
            color: #1b2435;
        }

        .conversation-preview {
            margin-top: 3px;
            color: #8a94a6;
            font-size: 11px;
            line-height: 1.5;
            display: block;
            max-width: 100%;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .history.is-conversation-view .conversation-preview,
        .history.is-conversation-view .conversation-meta,
        .history.is-conversation-view .conversation-pinned-chip {
            display: none !important;
        }

        .history.is-conversation-view .conversation-head {
            align-items: center;
            gap: 6px;
        }

        .history.is-conversation-view .conversation-title-wrap {
            padding-right: 2px;
        }

        .history.is-conversation-view .conversation-actions {
            padding-right: 0;
        }

        body[data-mode="chat"] .conversation-preview {
            max-width: 100%;
        }

        .task-item {
            display: grid;
            grid-template-columns: 96px minmax(0, 1fr);
            gap: 12px;
        }

        .task-thumb {
            position: relative;
            min-height: 96px;
            border-radius: 16px;
            overflow: hidden;
            background: #eef2f8;
        }

        .task-thumb img,
        .task-thumb video,
        .asset-preview img,
        .asset-preview video,
        .upload-preview img,
        .upload-preview video {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
        }

        .task-thumb-fallback {
            width: 100%;
            height: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #6c7788;
            font-size: 12px;
            line-height: 1.6;
            text-align: center;
            padding: 10px;
        }

        .task-type-chip {
            position: absolute;
            left: 8px;
            bottom: 8px;
            z-index: 2;
            padding: 4px 8px;
            border-radius: 999px;
            font-size: 11px;
            font-weight: 700;
            color: #fff;
            background: rgba(20, 24, 38, 0.72);
        }

        .task-main {
            min-width: 0;
        }

        .task-headline {
            display: grid;
            gap: 6px;
            margin-bottom: 6px;
        }

        .task-status-line {
            display: flex;
            align-items: center;
            gap: 8px;
            min-width: 0;
        }

        .badge {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            min-width: 64px;
            padding: 5px 9px;
            border-radius: 999px;
            font-size: 11px;
            font-weight: 700;
            white-space: nowrap;
        }

        .badge.queued,
        .badge.callback_wait {
            background: rgba(183, 121, 31, 0.12);
            color: var(--warning);
        }

        .badge.processing {
            background: rgba(37, 99, 255, 0.12);
            color: var(--brand-strong);
        }

        .badge.succeeded {
            background: rgba(15, 122, 80, 0.12);
            color: var(--success);
        }

        .badge.failed {
            background: rgba(207, 63, 79, 0.12);
            color: var(--danger);
        }

        .pagination {
            margin-top: auto;
            padding-top: 12px;
            border-top: 1px solid var(--line);
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
        }

        .task-pagination-actions {
            display: none !important;
        }

        .stage {
            min-height: 0;
            display: grid;
            grid-template-rows: auto minmax(0, 1fr);
            gap: 16px;
        }

        .result-card {
            min-height: 0;
            padding: 18px 0 0;
            display: flex;
            flex-direction: column;
            gap: 14px;
            background: transparent;
            border: none;
            box-shadow: none;
        }

        body[data-mode="chat"] .result-card {
            flex: 1 1 auto;
            flex-basis: 0;
            height: 100%;
            min-height: 0;
            overflow: hidden;
            display: flex;
            flex-direction: column;
            border-bottom-left-radius: 0;
            border-bottom-right-radius: 0;
            padding-top: 18px;
            padding-bottom: 10px;
        }

        body[data-mode="chat"] .stage {
            display: flex;
            flex: 1 1 auto;
            min-height: 0;
            height: 0;
            overflow: hidden;
        }

        body[data-mode="chat"] .result-card .section-head {
            position: relative;
            top: auto;
            z-index: auto;
            padding-top: 0;
            padding-bottom: 10px;
            background: none;
            backdrop-filter: none;
        }

        .empty-state {
            min-height: 220px;
            border: 1px dashed rgba(15, 23, 42, 0.1);
            border-radius: 28px;
            background:
                radial-gradient(circle at top left, rgba(37, 99, 255, 0.06), transparent 22%),
                linear-gradient(180deg, #fcfdff 0%, #f7f9fc 100%);
            color: #768195;
            display: flex;
            align-items: center;
            justify-content: center;
            text-align: center;
            line-height: 1.9;
            padding: 30px;
        }

        .conversation-empty-state {
            min-height: 132px;
            padding: 18px 14px;
            border-radius: 18px;
            font-size: 12px;
            line-height: 1.7;
            color: #7a8598;
        }

        .chat-empty {
            width: min(980px, 100%);
            min-height: calc(100vh - 320px);
            margin: 0 auto;
            display: grid;
            align-content: center;
            gap: 18px;
            justify-items: center;
        }

        .chat-empty-badge {
            display: inline-flex;
            align-items: center;
            min-height: 36px;
            padding: 0 16px;
            border-radius: 999px;
            background: rgba(37, 99, 255, 0.08);
            color: var(--brand-strong);
            font-size: 12px;
            font-weight: 800;
            letter-spacing: .06em;
        }

        .chat-empty-copy {
            display: grid;
            gap: 10px;
            justify-items: center;
            text-align: center;
        }

        .ui-language-switch {
            display: inline-flex;
            align-items: center;
            gap: 0;
            padding: 0;
            border: 0;
            border-radius: 0;
            background: transparent;
            box-shadow: none;
        }

        .ui-language-switch-btn {
            min-width: auto;
            min-height: 36px;
            padding: 0 8px;
            border: none;
            border-radius: 0;
            background: transparent;
            color: #8a95a6;
            font-size: 15px;
            font-weight: 600;
            cursor: pointer;
            transition: color .18s ease;
        }

        .ui-language-switch-btn:hover {
            color: #111827;
        }

        .ui-language-switch-btn.active {
            background: transparent;
            color: #111827;
            box-shadow: none;
            font-weight: 700;
        }

        .ui-language-switch-btn + .ui-language-switch-btn {
            border-left: 1px solid #d8e1ee;
        }

        .chat-empty-title {
            margin: 0;
            font-size: 46px;
            line-height: 1.08;
            color: #172135;
            letter-spacing: -0.035em;
            font-weight: 800;
        }

        .chat-empty-desc {
            margin: 0;
            max-width: 560px;
            color: #8a93a3;
            font-size: 13px;
            line-height: 1.7;
            white-space: pre-line;
        }

        .core-feature-actions {
            width: min(650px, 100%);
            margin: 6px auto 2px;
            display: flex;
            flex-wrap: nowrap;
            justify-content: center;
            gap: 14px;
        }

        .core-feature-btn {
            min-width: 0;
            min-height: 56px;
            padding: 0 14px;
            flex: 1 1 0;
            display: inline-flex;
            align-items: center;
            gap: 8px;
            border: 1px solid #d6e0ee;
            border-radius: 9px;
            background: #fff;
            color: #18345d;
            font-size: 13px;
            font-weight: 400;
            cursor: pointer;
            box-shadow: none;
            transition: transform .18s ease, border-color .18s ease, background .18s ease, color .18s ease;
        }

        .core-feature-btn:hover,
        .core-feature-btn:focus-visible {
            border-color: rgba(37, 99, 255, 0.48);
            background: #f4f8ff;
            color: #1748c7;
            transform: translateY(-1px);
            outline: none;
        }

        .core-feature-add-wrap {
            position: relative;
            min-width: 0;
            flex: 1 1 0;
            display: flex;
        }

        .core-feature-add-wrap > .core-feature-btn {
            width: 100%;
            flex: 1 1 auto;
        }

        .core-feature-add-label {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            color: inherit;
            font-size: 14px;
            font-weight: 500;
            line-height: 1.2;
            white-space: nowrap;
        }

        .core-feature-add-menu {
            position: absolute;
            top: calc(100% + 8px);
            right: 0;
            z-index: 90;
            width: min(520px, calc(100vw - 32px));
            max-height: min(540px, calc(100vh - 180px));
            padding: 14px;
            overflow-y: auto;
            border: 1px solid #d6e0ee;
            border-radius: 16px;
            background: #fff;
            box-shadow: 0 16px 36px rgba(15, 23, 42, 0.14);
        }

        .home-favorite-menu-head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            margin-bottom: 12px;
        }

        .home-favorite-menu-head strong {
            color: #172033;
            font-size: 14px;
            font-weight: 700;
        }

        .home-favorite-menu-close,
        .core-feature-favorite-clear {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border: 0;
            border-radius: 50%;
            background: transparent;
            color: #71809a;
            cursor: pointer;
        }

        .home-favorite-menu-close {
            width: 28px;
            height: 28px;
            flex: 0 0 28px;
            font-size: 20px;
            line-height: 1;
        }

        .home-favorite-menu-close:hover,
        .core-feature-favorite-clear:hover {
            background: #eef4fc;
            color: #1748c7;
        }

        .home-favorite-group + .home-favorite-group {
            margin-top: 14px;
        }

        .home-favorite-group-title {
            display: block;
            margin: 0 0 7px;
            color: #71809a;
            font-size: 11px;
            font-weight: 600;
            letter-spacing: .02em;
        }

        .home-favorite-option-grid {
            display: grid;
            grid-template-columns: repeat(3, minmax(0, 1fr));
            gap: 7px;
        }

        .home-favorite-option {
            min-width: 0;
            min-height: 58px;
            padding: 8px 9px;
            display: flex;
            align-items: center;
            gap: 8px;
            border: 1px solid #e1e8f2;
            border-radius: 11px;
            background: #fff;
            color: #18345d;
            font: inherit;
            font-size: 12px;
            line-height: 1.25;
            text-align: left;
            cursor: pointer;
            transition: border-color .18s ease, background .18s ease, color .18s ease, transform .18s ease;
        }

        .home-favorite-option:hover,
        .home-favorite-option:focus-visible {
            border-color: rgba(37, 99, 255, .4);
            background: #f4f8ff;
            color: #1748c7;
            outline: none;
            transform: translateY(-1px);
        }

        .home-favorite-option-icon {
            width: 30px;
            height: 30px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            flex: 0 0 30px;
        }

        .home-favorite-option-icon img,
        .home-favorite-option-icon svg,
        .home-favorite-option-icon .fuuvo-icon {
            width: 30px;
            height: 30px;
            display: block;
            object-fit: contain;
        }

        .core-feature-favorite-btn {
            padding-right: 30px !important;
        }

        .core-feature-favorite-clear {
            position: absolute;
            top: 4px;
            right: 4px;
            z-index: 2;
            width: 22px;
            height: 22px;
            font-size: 16px;
            line-height: 1;
        }

        html[lang="en-US"] .composer-capability-btn[data-home-search-capability] {
            display: none !important;
        }

        .core-feature-btn-icon {
            width: 28px;
            height: 28px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            color: #2563ff;
            flex: 0 0 22px;
        }

        .core-feature-btn-icon svg {
            width: 28px;
            height: 28px;
            display: block;
        }

        .core-feature-btn-icon .home-core-feature-icon {
            width: 28px;
            height: 28px;
            display: block;
            border-radius: 6px;
            object-fit: cover;
        }

        .core-feature-btn-icon .home-capability-icon {
            width: 28px;
            height: 28px;
            display: block;
            object-fit: contain;
        }

        body[data-ui-theme="dark"] .core-feature-add-menu {
            border-color: rgba(148, 163, 184, .2);
            background: #111a2b;
            box-shadow: 0 18px 44px rgba(2, 6, 23, .42);
        }

        body[data-ui-theme="dark"] .home-favorite-menu-head strong {
            color: #f1f5ff;
        }

        body[data-ui-theme="dark"] .home-favorite-option {
            border-color: rgba(148, 163, 184, .18);
            background: rgba(15, 23, 42, .72);
            color: #e4ecfb;
        }

        body[data-ui-theme="dark"] .home-favorite-option:hover,
        body[data-ui-theme="dark"] .home-favorite-option:focus-visible {
            border-color: rgba(96, 165, 250, .42);
            background: rgba(30, 41, 59, .94);
            color: #dce8ff;
        }

        .fuuvo-icon {
            width: 1em;
            height: 1em;
            display: inline-block;
            flex: 0 0 auto;
            background: currentColor;
            -webkit-mask: var(--fuuvo-icon-url) center / contain no-repeat;
            mask: var(--fuuvo-icon-url) center / contain no-repeat;
        }

        .fuuvo-icon-ask { --fuuvo-icon-url: url('/static/icons/fuuvo-shell/fuuvo-understand.svg'); }
        .fuuvo-icon-live-search { --fuuvo-icon-url: url('/static/icons/fuuvo-pages/012_FUUVO_Research_Icons_Only/fuuvo-search-compare.svg'); }
        .fuuvo-icon-writing { --fuuvo-icon-url: url('/static/icons/fuuvo-home-capabilities/fuuvo-writing.png'); }
        .fuuvo-icon-translate { --fuuvo-icon-url: url('/static/icons/fuuvo-home-capabilities/fuuvo-translate.png'); }
        .fuuvo-icon-office-tasks { --fuuvo-icon-url: url('/static/icons/fuuvo-shell/fuuvo-office-efficiency.svg'); }
        .fuuvo-icon-creation-center { --fuuvo-icon-url: url('/static/icons/fuuvo-pages/001_FUUVO_Creation_Center_Page_Icons_Only/fuuvo-create-image.svg'); }
        .fuuvo-icon-deep-research { --fuuvo-icon-url: url('/static/icons/fuuvo-home-capabilities/fuuvo-deep-research.png'); }
        .fuuvo-icon-image-generation { --fuuvo-icon-url: url('/static/icons/fuuvo-home-capabilities/fuuvo-generate-image.png'); }
        .fuuvo-icon-video-generate { --fuuvo-icon-url: url('/static/icons/fuuvo-home-capabilities/fuuvo-generate-video.png'); }
        .fuuvo-icon-image-question { --fuuvo-icon-url: url('/static/icons/fuuvo-home-capabilities/fuuvo-image-question.png'); }
        .fuuvo-icon-upload-file { --fuuvo-icon-url: url('/static/icons/fuuvo-shell/fuuvo-generate-file.svg'); }
        .fuuvo-icon-upload-data-analysis { --fuuvo-icon-url: url('/static/icons/fuuvo-shell/fuuvo-upload-material-analysis.svg'); }
        .fuuvo-icon-local-food-explore { --fuuvo-icon-url: url('/static/icons/fuuvo-shell/fuuvo-local-food-explore.svg'); }
        .fuuvo-icon-fortune-zodiac { --fuuvo-icon-url: url('/static/icons/fuuvo-shell/fuuvo-fortune-zodiac.svg'); }
        .fuuvo-icon-core-upload-analysis { --fuuvo-icon-url: url('/static/icons/fuuvo-home-capabilities/fuuvo-core-upload-analysis.png'); }
        .fuuvo-icon-core-office-efficiency { --fuuvo-icon-url: url('/static/icons/fuuvo-home-capabilities/fuuvo-core-office-efficiency.png'); }
        .fuuvo-icon-core-local-food { --fuuvo-icon-url: url('/static/icons/fuuvo-home-capabilities/fuuvo-core-local-food.png'); }
        .fuuvo-icon-core-fortune-zodiac { --fuuvo-icon-url: url('/static/icons/fuuvo-home-capabilities/fuuvo-core-fortune-zodiac.png'); }
        @media (max-width: 920px) {
            .fuuvo-icon-writing { --fuuvo-icon-url: url('/static/icons/fuuvo-home-capabilities/fuuvo-writing.png'); }
            .fuuvo-icon-image-generation { --fuuvo-icon-url: url('/static/icons/fuuvo-home-capabilities/fuuvo-generate-image.png'); }
            .fuuvo-icon-translate { --fuuvo-icon-url: url('/static/icons/fuuvo-home-capabilities/fuuvo-translate.png'); }
            .fuuvo-icon-core-upload-analysis { --fuuvo-icon-url: url('/static/icons/fuuvo-home-capabilities/fuuvo-core-upload-analysis.png'); }
            .fuuvo-icon-core-office-efficiency { --fuuvo-icon-url: url('/static/icons/fuuvo-home-capabilities/fuuvo-core-office-efficiency.png'); }
            .fuuvo-icon-core-local-food { --fuuvo-icon-url: url('/static/icons/fuuvo-home-capabilities/fuuvo-core-local-food.png'); }
            .fuuvo-icon-core-fortune-zodiac { --fuuvo-icon-url: url('/static/icons/fuuvo-home-capabilities/fuuvo-core-fortune-zodiac.png'); }
        }

        .core-feature-btn-icon .fuuvo-icon {
            width: 28px;
            height: 28px;
        }

        html[lang="en-US"] .core-feature-btn {
            justify-content: center;
            padding: 6px 10px;
            line-height: 1.18;
            text-align: center;
        }

        html[lang="en-US"] .core-feature-btn > span:last-child {
            min-width: 0;
            white-space: normal;
        }

        @media (max-width: 720px) {
            .core-feature-actions {
                width: 100%;
                gap: 8px;
                margin-top: 2px;
                flex-wrap: wrap;
            }

            .core-feature-btn {
                min-height: 48px;
                padding: 0 10px;
                flex: 1 1 calc(50% - 4px);
                border-radius: 12px;
                font-size: 12px;
            }

            .core-feature-add-wrap {
                flex: 1 1 calc(50% - 4px);
            }

            .core-feature-add-menu {
                position: fixed;
                top: 50%;
                right: auto;
                left: 50%;
                width: min(360px, calc(100vw - 24px));
                max-width: none !important;
                max-height: calc(100vh - 32px);
                padding: 12px;
                transform: translate(-50%, -50%);
            }

            .home-favorite-option-grid {
                grid-template-columns: repeat(2, minmax(0, 1fr));
            }

            .core-feature-btn-icon,
            .core-feature-btn-icon svg,
            .core-feature-btn-icon .home-core-feature-icon {
                width: 24px;
                height: 24px;
            }

            .core-feature-btn-icon .fuuvo-icon {
                width: 24px;
                height: 24px;
            }
        }

        .chat-empty-grid {
            width: min(980px, 100%);
            display: block;
            overflow-x: auto;
            overscroll-behavior-inline: contain;
            scroll-snap-type: x proximity;
            scrollbar-width: none;
            touch-action: pan-x pan-y;
            padding: 2px 2px 8px;
        }

        .chat-empty-grid::-webkit-scrollbar {
            display: none;
        }

        .chat-empty-track {
            width: max-content;
            min-width: 100%;
            display: grid;
            gap: 10px;
        }

        .chat-empty-row {
            min-width: max-content;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
        }

        .chat-empty-chip {
            min-width: 0;
            width: max-content;
            max-width: 320px;
            flex: 0 0 auto;
            min-height: 48px;
            padding: 10px 16px;
            border-radius: 18px;
            border: 1px solid rgba(15, 23, 42, 0.04);
            background: rgba(246, 247, 249, 0.92);
            color: #1d2433;
            font-size: 13px;
            line-height: 1.45;
            cursor: pointer;
            box-shadow: none;
            transition: transform .18s ease, background .18s ease, color .18s ease, border-color .18s ease;
            display: inline-flex;
            align-items: center;
            justify-content: flex-start;
            text-align: left;
            scroll-snap-align: start;
            white-space: normal;
        }

        .chat-empty-chip-text {
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 2;
            overflow: hidden;
        }

        .chat-empty-grid-loading {
            pointer-events: none;
        }

        .chat-empty-chip-skeleton {
            position: relative;
            width: 210px;
            min-height: 44px;
            flex: 0 0 auto;
            border-radius: 16px;
            overflow: hidden;
            background: rgba(241, 243, 246, 0.9);
        }

        .chat-empty-chip-skeleton::after {
            content: '';
            position: absolute;
            inset: 0;
            transform: translateX(-100%);
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.72), transparent);
            animation: quick-prompt-shimmer 1.25s ease-in-out infinite;
        }

        .chat-empty-row:nth-child(1) .chat-empty-chip-skeleton:nth-child(2),
        .chat-empty-row:nth-child(3) .chat-empty-chip-skeleton:nth-child(1) {
            width: 164px;
        }

        .chat-empty-row:nth-child(2) .chat-empty-chip-skeleton:nth-child(1),
        .chat-empty-row:nth-child(3) .chat-empty-chip-skeleton:nth-child(3) {
            width: 248px;
        }

        @keyframes quick-prompt-shimmer {
            100% {
                transform: translateX(100%);
            }
        }

        .chat-empty-chip:hover {
            transform: translateY(-1px);
            background: #ffffff;
            color: #0f172a;
            border-color: rgba(37, 99, 255, 0.12);
        }

        .office-task-grid {
            width: min(980px, 100%);
            display: grid;
            grid-template-columns: repeat(3, minmax(0, 1fr));
            gap: 14px;
        }

        .office-task-card {
            min-width: 0;
            width: 100%;
            display: grid;
            gap: 14px;
            padding: 18px 18px 16px;
            border: 1px solid rgba(15, 23, 42, 0.06);
            border-radius: 24px;
            background: linear-gradient(180deg, rgba(255,255,255,0.96) 0%, rgba(247,249,252,0.96) 100%);
            color: #162033;
            text-align: left;
            cursor: pointer;
            transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
        }

        .office-task-card:hover {
            transform: translateY(-2px);
            border-color: rgba(37, 99, 255, 0.16);
            box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
        }

        .office-task-card-head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
        }

        body[data-inline-media-mode="image"] #core-feature-slot,
        body[data-inline-media-mode="video"] #core-feature-slot {
            display: none !important;
        }

        /* Home scenario cards are landing-only. Keep them out of conversation
           detail pages on both desktop and mobile, including during loading. */
        body:not(.chat-landing)[data-mode="chat"] #core-feature-slot {
            display: none !important;
        }

        .office-task-card-format {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            min-width: 56px;
            min-height: 30px;
            padding: 0 12px;
            border-radius: 999px;
            background: rgba(37, 99, 255, 0.1);
            color: #1d4ed8;
            font-size: 12px;
            font-weight: 800;
            letter-spacing: .04em;
        }

        .office-task-card-arrow {
            color: #8fa0bc;
            font-size: 18px;
            line-height: 1;
        }

        .office-task-card-copy {
            display: grid;
            gap: 8px;
        }

        .office-task-card-title {
            margin: 0;
            font-size: 16px;
            line-height: 1.4;
            font-weight: 800;
            color: #172135;
        }

        .office-task-card-desc {
            margin: 0;
            font-size: 13px;
            line-height: 1.7;
            color: #6b7280;
        }

        .office-task-card-foot {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            font-size: 12px;
            color: #2563eb;
            font-weight: 700;
        }

        .asset-grid {
            flex: 1 1 auto;
            min-height: 0;
            overflow: auto;
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 16px;
        }

        .result-content {
            flex: 1 1 auto;
            min-height: 0;
            overflow: hidden;
            display: flex;
            flex-direction: column;
        }

        body[data-mode="chat"] .result-content {
            height: calc(100vh - 228px);
            max-height: calc(100vh - 228px);
            overflow-y: auto;
            overflow-x: hidden;
            box-sizing: border-box;
            padding: 0 8px 18px 0;
            scroll-padding-bottom: 180px;
            scrollbar-gutter: stable both-edges;
        }

        .result-content > .empty-state {
            flex: 1 1 auto;
        }

        .asset-card,
        .chat-thread-card {
            border: 1px solid var(--line);
            border-radius: 24px;
            overflow: hidden;
            background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(247,250,253,0.98) 100%);
        }

        .asset-preview {
            position: relative;
            overflow: hidden;
            background: #edf2f8;
        }

        .asset-preview.is-file {
            padding: 20px;
            background: linear-gradient(180deg, rgba(241, 245, 249, 0.96) 0%, rgba(255,255,255,0.98) 100%);
        }

        .asset-preview img,
        .asset-preview video {
            width: 100%;
            height: auto;
            object-fit: contain;
            background: #edf2f8;
        }

        .asset-body {
            padding: 14px;
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .asset-meta-line {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            flex-wrap: wrap;
        }

        .chat-area {
            flex: 1 1 auto;
            min-height: 0;
            overflow-x: hidden;
            overflow-y: scroll;
            display: flex;
            flex-direction: column;
            gap: 16px;
            padding-right: 4px;
            padding-bottom: 22px;
            scroll-behavior: smooth;
            overscroll-behavior: contain;
            scrollbar-gutter: stable both-edges;
        }

        .chat-area::-webkit-scrollbar {
            width: 8px;
        }

        .chat-area::-webkit-scrollbar-thumb {
            background: rgba(120, 130, 149, 0.42);
            border-radius: 999px;
        }

        .chat-area::-webkit-scrollbar-track {
            background: transparent;
        }

        body[data-mode="chat"] .chat-area {
            flex: 0 0 auto;
            min-height: auto;
            height: auto;
            max-height: none;
            width: min(900px, calc(100vw - var(--chat-sidebar-width) - 108px));
            margin: 0 auto;
            overflow: visible;
        }

        body.sidebar-collapsed[data-mode="chat"] .chat-area {
            width: min(920px, calc(100vw - 120px));
        }

        .chat-thread-card {
            padding: 0;
            border: none;
            border-radius: 0;
            background: transparent;
        }

        .chat-thread {
            display: flex;
            flex-direction: column;
            gap: 18px;
        }

        .chat-bubble {
            max-width: min(760px, 86%);
            padding: 16px 18px;
            border-radius: 24px;
            line-height: 1.92;
            font-size: 15px;
            word-break: break-word;
            scroll-margin-top: 24px;
            scroll-margin-bottom: 168px;
        }

        .chat-bubble.user {
            align-self: flex-end;
            background: linear-gradient(135deg, #2d6bff 0%, #1f59ef 100%);
            border: 1px solid rgba(25, 86, 234, 0.34);
            color: #fff;
            box-shadow: 0 14px 32px rgba(25, 86, 234, 0.16);
        }

        .chat-bubble.user.clarification-origin {
            box-shadow: 0 14px 32px rgba(25, 86, 234, 0.14);
        }

        .chat-bubble.assistant,
        .chat-bubble.system {
            background: rgba(255,255,255,0.98);
            border: 1px solid rgba(15, 23, 42, 0.06);
            box-shadow: 0 8px 18px rgba(15, 23, 42, 0.03);
        }

        .chat-bubble.assistant.is-pending,
        .chat-bubble.system.is-pending {
            min-width: 168px;
            background: linear-gradient(180deg, rgba(248, 250, 255, 0.98) 0%, rgba(255,255,255,0.98) 100%);
            border-color: rgba(37, 99, 255, 0.14);
        }

        .chat-bubble.assistant.clarification-reply,
        .chat-bubble.system.clarification-reply {
            border-color: rgba(245, 158, 11, 0.26);
            background: linear-gradient(180deg, rgba(255, 251, 235, 0.98) 0%, rgba(255, 255, 255, 0.98) 100%);
        }

        .bubble-actions {
            display: flex;
            align-items: center;
            justify-content: flex-end;
            gap: 6px;
            margin-top: 12px;
            min-height: 28px;
        }

        .bubble-actions:empty {
            display: none;
        }

        .copy-btn {
            width: 28px;
            height: 28px;
            border-radius: 999px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border: none;
            background: rgba(37, 99, 255, 0.08);
            color: #315fd6;
            cursor: pointer;
            padding: 0;
            transition: background .18s ease, transform .18s ease;
        }

        .copy-btn:hover {
            background: rgba(37, 99, 255, 0.14);
            transform: translateY(-1px);
        }

        .copy-btn svg {
            width: 15px;
            height: 15px;
        }

        .quote-btn {
            min-height: 28px;
            padding: 0 12px;
            border-radius: 999px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border: none;
            background: rgba(15, 23, 42, 0.06);
            color: #334155;
            cursor: pointer;
            font-size: 12px;
            font-weight: 700;
            transition: background .18s ease, transform .18s ease, color .18s ease;
        }

        .quote-btn:hover {
            background: rgba(37, 99, 255, 0.1);
            color: #1d4ed8;
            transform: translateY(-1px);
        }

        .edit-btn {
            min-height: 28px;
            padding: 0 10px;
            border: none;
            border-radius: 999px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 5px;
            background: rgba(15, 23, 42, 0.06);
            color: #334155;
            cursor: pointer;
            font-size: 12px;
            font-weight: 700;
            transition: background .18s ease, color .18s ease, transform .18s ease;
        }

        .edit-btn:hover {
            background: rgba(37, 99, 255, 0.1);
            color: #1d4ed8;
            transform: translateY(-1px);
        }

        .edit-btn svg {
            width: 14px;
            height: 14px;
        }

        .chat-bubble.user .copy-btn,
        .chat-bubble.user .edit-btn {
            background: rgba(255, 255, 255, 0.16);
            color: rgba(255, 255, 255, 0.96);
        }

        .chat-bubble.user .copy-btn:hover,
        .chat-bubble.user .edit-btn:hover {
            background: rgba(255, 255, 255, 0.28);
            color: #fff;
        }

        .clarification-banner {
            position: relative;
            display: none;
            align-items: flex-start;
            gap: 10px;
            margin-top: 10px;
            padding: 12px 44px 12px 14px;
            border-radius: 16px;
            border: 1px solid rgba(245, 158, 11, 0.24);
            background: linear-gradient(180deg, rgba(255, 251, 235, 0.98) 0%, rgba(255, 255, 255, 0.98) 100%);
            color: #8a5a10;
        }

        .clarification-banner.is-active {
            display: flex;
        }

        .clarification-banner svg {
            width: 18px;
            height: 18px;
            flex: 0 0 18px;
            margin-top: 2px;
        }

        .clarification-banner strong {
            display: block;
            margin-bottom: 2px;
            color: #7a4d0e;
        }

        .clarification-banner-close {
            position: absolute;
            top: 10px;
            right: 10px;
            width: 24px;
            height: 24px;
            border: 0;
            border-radius: 999px;
            background: rgba(245, 158, 11, 0.08);
            color: #9a670f;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: background .18s ease, color .18s ease, transform .18s ease;
        }

        .clarification-banner-close:hover {
            background: rgba(245, 158, 11, 0.16);
            color: #7a4d0e;
            transform: translateY(-1px);
        }

        .clarification-banner-close svg {
            width: 14px;
            height: 14px;
            margin-top: 0;
            flex: 0 0 14px;
        }

        .chat-input-wrap.is-clarification {
            box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.12);
        }

        .chat-upload-entry {
            position: relative;
            display: inline-flex;
        }

        .chat-upload-popover {
            position: fixed;
            left: 12px;
            top: 12px;
            width: min(312px, calc(100vw - 24px));
            max-height: min(430px, calc(100vh - 24px));
            padding: 10px;
            border-radius: 18px;
            border: 1px solid rgba(15, 23, 42, 0.08);
            background: rgba(255, 255, 255, 0.98);
            box-shadow: 0 20px 38px rgba(15, 23, 42, 0.12);
            backdrop-filter: blur(18px);
            display: grid;
            gap: 6px;
            overflow-x: hidden;
            overflow-y: auto;
            overscroll-behavior: contain;
            z-index: 120;
        }

        .chat-upload-popover::after {
            display: none;
        }

        .chat-upload-popover-head {
            padding: 2px 6px 6px;
        }

        .chat-upload-popover-head strong {
            display: block;
            color: #13233a;
            font-size: 13px;
            line-height: 1.35;
        }

        .chat-upload-popover-head span {
            display: block;
            margin-top: 2px;
            color: #7a8598;
            font-size: 11px;
            line-height: 1.45;
        }

        .chat-upload-option {
            width: 100%;
            border: 1px solid transparent;
            background: transparent;
            border-radius: 14px;
            min-height: 48px;
            padding: 0 12px;
            display: flex;
            align-items: center;
            gap: 10px;
            color: #1f2937;
            cursor: pointer;
            transition: background .18s ease, border-color .18s ease, transform .18s ease;
            text-align: left;
        }

        .chat-upload-option:hover {
            background: rgba(37, 99, 255, 0.06);
            border-color: rgba(37, 99, 255, 0.1);
            transform: translateY(-1px);
        }

        .chat-upload-option-icon {
            width: 28px;
            height: 28px;
            border-radius: 10px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            background: rgba(37, 99, 255, 0.1);
            color: #1d4ed8;
            flex: 0 0 22px;
        }

        .chat-upload-option-icon svg {
            width: 15px;
            height: 15px;
            display: block;
        }

        .chat-upload-option-copy {
            min-width: 0;
            display: grid;
            gap: 1px;
        }

        .chat-upload-option-copy strong {
            color: #13233a;
            font-size: 13px;
            line-height: 1.2;
        }

        .chat-upload-option-copy span {
            color: #7a8598;
            font-size: 11px;
            line-height: 1.35;
        }

        .chat-markdown h1,
        .chat-markdown h2,
        .chat-markdown h3,
        .chat-markdown h4,
        .chat-markdown h5,
        .chat-markdown h6 {
            margin: 0 0 10px;
            line-height: 1.45;
            color: #13233a;
        }

        .chat-markdown h1 {
            font-size: 20px;
        }

        .chat-markdown h2 {
            font-size: 18px;
        }

        .chat-markdown h3 {
            font-size: 16px;
        }

        .chat-markdown h4 {
            font-size: 15px;
        }

        .chat-markdown h5,
        .chat-markdown h6 {
            font-size: 14px;
        }

        .chat-markdown p {
            margin: 0 0 12px;
        }

        .chat-markdown p:last-child,
        .chat-markdown ul:last-child,
        .chat-markdown ol:last-child {
            margin-bottom: 0;
        }

        .chat-markdown ul,
        .chat-markdown ol {
            margin: 0 0 12px;
            padding-left: 20px;
        }

        .chat-markdown li + li {
            margin-top: 6px;
        }

        .chat-markdown hr {
            border: none;
            border-top: 1px solid rgba(148, 163, 184, 0.28);
            margin: 14px 0;
        }

        .chat-markdown strong {
            font-weight: 700;
            color: #10213a;
        }

        .chat-markdown code {
            padding: 2px 6px;
            border-radius: 8px;
            background: rgba(15, 23, 42, 0.06);
            font-size: 12px;
            font-family: "Consolas", "SFMono-Regular", monospace;
        }

        .chat-markdown .fuuvo-math {
            font-family: "Cambria Math", "STIX Two Math", "Times New Roman", serif;
            font-size: 1.08em;
            letter-spacing: 0.01em;
        }

        .chat-markdown sup,
        .chat-markdown sub {
            position: relative;
            font-size: 0.72em;
            line-height: 0;
            vertical-align: baseline;
        }

        .chat-markdown sup { top: -0.48em; }
        .chat-markdown sub { bottom: -0.18em; }

        .chat-markdown .fuuvo-math-frac {
            min-width: 1.3em;
            margin: 0 0.12em;
            display: inline-grid;
            grid-template-rows: auto auto;
            align-items: center;
            vertical-align: -0.48em;
            text-align: center;
            line-height: 1.05;
        }

        .chat-markdown .fuuvo-math-frac > span:first-child {
            padding: 0 0.16em 0.1em;
            border-bottom: 1px solid currentColor;
        }

        .chat-markdown .fuuvo-math-frac > span:last-child { padding: 0.1em 0.16em 0; }
        .chat-markdown .fuuvo-math-radicand { padding-left: 0.08em; border-top: 1px solid currentColor; }

        .chat-markdown .table-scroll {
            width: 100%;
            max-width: 100%;
            overflow-x: auto;
            margin: 12px 0;
            border: 1px solid rgba(148, 163, 184, 0.26);
            border-radius: 14px;
            background: #fff;
        }

        .chat-markdown table {
            width: 100%;
            min-width: 520px;
            border-collapse: collapse;
            font-size: 13px;
        }

        .chat-markdown th,
        .chat-markdown td {
            padding: 10px 12px;
            border-bottom: 1px solid rgba(148, 163, 184, 0.22);
            border-right: 1px solid rgba(148, 163, 184, 0.18);
            vertical-align: top;
            text-align: left;
            word-break: break-word;
        }

        .chat-markdown th:last-child,
        .chat-markdown td:last-child {
            border-right: none;
        }

        .chat-markdown tr:last-child td {
            border-bottom: none;
        }

        .chat-markdown th {
            background: #f6f8fc;
            color: #10213a;
            font-weight: 700;
        }

        .chat-bubble.user .chat-markdown h1,
        .chat-bubble.user .chat-markdown h2,
        .chat-bubble.user .chat-markdown h3,
        .chat-bubble.user .chat-markdown h4,
        .chat-bubble.user .chat-markdown h5,
        .chat-bubble.user .chat-markdown h6,
        .chat-bubble.user .chat-markdown strong {
            color: #fff;
        }

        .chat-bubble.user .chat-markdown code {
            background: rgba(255, 255, 255, 0.18);
            color: #fff;
        }

        .chat-plain {
            white-space: pre-wrap;
        }

        .chat-bubble.assistant .chat-plain,
        .chat-bubble.system .chat-plain,
        .chat-bubble.assistant .chat-markdown,
        .chat-bubble.system .chat-markdown {
            color: #223248;
        }

        .chat-bubble.user .chat-plain,
        .chat-bubble.user .chat-markdown {
            color: #fff;
        }

        .copy-btn:focus-visible {
            outline: 2px solid rgba(37, 99, 255, 0.28);
            outline-offset: 2px;
        }

        .copy-btn:active {
            transform: scale(0.96);
        }

        .copy-btn[disabled] {
            opacity: .55;
            cursor: pointer;
        }

        .typing {
            display: inline-flex;
            align-items: center;
            gap: 5px;
            min-height: 18px;
        }

        .chat-thinking {
            display: inline-flex;
            align-items: center;
            gap: 10px;
            min-height: 28px;
            color: #4b5c78;
            font-weight: 600;
        }

        .chat-thinking-text {
            font-size: 13px;
            line-height: 1.5;
            color: #516073;
            white-space: nowrap;
        }

        .typing span {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: rgba(37, 99, 255, 0.65);
            display: inline-block;
            animation: pulse 1.15s infinite ease-in-out;
        }

        .typing span:nth-child(2) {
            animation-delay: .15s;
        }

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

        @keyframes pulse {
            0%, 80%, 100% { transform: scale(.72); opacity: .35; }
            40% { transform: scale(1); opacity: 1; }
        }

        .chat-bubble.is-streaming .chat-markdown > p:last-child::after,
        .chat-bubble.is-streaming .chat-markdown > h1:last-child::after,
        .chat-bubble.is-streaming .chat-markdown > h2:last-child::after,
        .chat-bubble.is-streaming .chat-markdown > h3:last-child::after,
        .chat-bubble.is-streaming .chat-markdown > ul:last-child > li:last-child::after,
        .chat-bubble.is-streaming .chat-markdown > ol:last-child > li:last-child::after,
        .chat-bubble.is-streaming .chat-markdown > pre:last-child::after,
        .chat-bubble.is-streaming .chat-markdown:empty::after {
            content: '';
            display: inline-block;
            width: 2px;
            height: 1em;
            margin-left: 3px;
            border-radius: 2px;
            vertical-align: -0.12em;
            background: #4774f6;
            animation: chat-stream-caret .82s steps(1, end) infinite;
        }

        @keyframes chat-stream-caret {
            0%, 48% { opacity: 1; }
            49%, 100% { opacity: 0; }
        }

        @media (prefers-reduced-motion: reduce) {
            .chat-bubble.is-streaming .chat-markdown > p:last-child::after,
            .chat-bubble.is-streaming .chat-markdown > h1:last-child::after,
            .chat-bubble.is-streaming .chat-markdown > h2:last-child::after,
            .chat-bubble.is-streaming .chat-markdown > h3:last-child::after,
            .chat-bubble.is-streaming .chat-markdown > ul:last-child > li:last-child::after,
            .chat-bubble.is-streaming .chat-markdown > ol:last-child > li:last-child::after,
            .chat-bubble.is-streaming .chat-markdown > pre:last-child::after,
            .chat-bubble.is-streaming .chat-markdown:empty::after {
                animation: none;
            }
        }

        .composer {
            padding: 12px 0 20px;
            display: flex;
            flex-direction: column;
            gap: 14px;
            background: transparent;
            border: none;
            box-shadow: none;
        }

        .workspace-disclaimer {
            display: flex;
            align-items: center;
            justify-content: center;
            flex-wrap: wrap;
            gap: 8px;
            padding: 2px 0 18px;
            text-align: center;
            font-size: 11px;
            line-height: 1.5;
            color: #94a3b8;
        }

        .workspace-disclaimer a {
            color: #71809a;
            text-decoration: none;
            white-space: nowrap;
        }

        .workspace-disclaimer a:hover {
            color: var(--brand-strong);
            text-decoration: underline;
        }

        .workspace-composer-anchor {
            display: none;
        }

        .workspace-records {
            display: none;
            padding: 18px;
            gap: 14px;
        }

        .workspace-records-slot {
            display: grid;
            gap: 14px;
            min-height: 0;
            align-content: start;
        }

        body[data-mode="image"] .workspace-records .task-list,
        body[data-mode="video"] .workspace-records .task-list {
            display: grid;
            grid-template-columns: repeat(6, minmax(0, 1fr));
            gap: 12px;
            overflow: visible;
            padding-right: 0;
        }

        body[data-mode="image"] .workspace-records .task-item,
        body[data-mode="video"] .workspace-records .task-item {
            grid-template-columns: 1fr;
            gap: 10px;
        }

        body[data-mode="image"] .workspace-records .task-thumb,
        body[data-mode="video"] .workspace-records .task-thumb {
            min-height: 136px;
            aspect-ratio: 4 / 3;
            background: #f3f6fb;
        }

        body[data-mode="image"] .workspace-records .task-thumb img,
        body[data-mode="image"] .workspace-records .task-thumb video,
        body[data-mode="video"] .workspace-records .task-thumb img,
        body[data-mode="video"] .workspace-records .task-thumb video,
        body.show-record-history .task-thumb img,
        body.show-record-history .task-thumb video {
            object-fit: contain;
            background: #f3f6fb;
        }

        body[data-mode="image"] .workspace-records .task-title,
        body[data-mode="video"] .workspace-records .task-title {
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        body[data-mode="image"] .workspace-records,
        body[data-mode="video"] .workspace-records {
            display: grid;
        }

        body[data-mode="image"] .history .composer,
        body[data-mode="video"] .history .composer {
            padding: 0;
            border: none;
            box-shadow: none;
            background: transparent;
            backdrop-filter: none;
        }

        .composer-top {
            display: none;
        }

        .composer-title {
            font-size: 18px;
            font-weight: 700;
            line-height: 1.2;
        }

        .composer-desc {
            margin-top: 4px;
            color: var(--muted);
            font-size: 12px;
            line-height: 1.7;
            white-space: pre-line;
        }

        .composer-desc[hidden] {
            display: none !important;
            margin: 0 !important;
        }

        .btn {
            border: none;
            border-radius: 14px;
            padding: 12px 16px;
            font-size: 14px;
            font-weight: 700;
            cursor: pointer;
            transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
        }

        .btn:hover {
            transform: translateY(-1px);
            box-shadow: var(--shadow-soft);
        }

        .btn:disabled {
            opacity: .56;
            cursor: not-allowed;
            transform: none;
            box-shadow: none;
        }

        .btn.primary {
            color: #fff;
            background: linear-gradient(135deg, #2563ff 0%, #173da6 100%);
        }

        .btn.secondary {
            color: #36465f;
            border: 1px solid var(--line);
            background: #f5f8fc;
        }

        .chip-btn {
            border: 1px solid var(--line);
            background: #f5f8fc;
            color: #576274;
            border-radius: 999px;
            padding: 9px 14px;
            font-size: 13px;
            font-weight: 700;
            cursor: pointer;
        }

        .chip-btn.active {
            color: var(--brand-strong);
            background: var(--brand-soft);
            border-color: rgba(37, 99, 255, 0.14);
        }

        .composer-actions {
            display: flex;
            align-items: center;
            gap: 10px;
            flex-wrap: wrap;
        }

        #submit-btn,
        #refresh-btn {
            display: none;
        }

        .advanced-controls {
            display: grid;
            gap: 12px;
        }

        #media-compose {
            display: grid;
            gap: 14px;
            margin-top: 2px;
            padding: 14px 16px 0;
            border-top: 1px solid rgba(15, 23, 42, 0.06);
        }

        .media-drawer-shell {
            display: grid;
            gap: 12px;
        }

        .media-drawer-section {
            border-radius: 22px;
            border: 1px solid rgba(15, 23, 42, 0.05);
            background: linear-gradient(180deg, rgba(250, 252, 255, 0.98) 0%, rgba(246, 249, 253, 0.98) 100%);
            overflow: hidden;
        }

        .media-section-head {
            display: flex;
            flex-direction: column;
            gap: 4px;
            padding: 16px 18px 0;
        }

        .media-section-head-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
        }

        .media-section-toggle {
            min-height: 30px;
            padding: 0 12px;
            border-radius: 999px;
            border: 1px solid rgba(15, 23, 42, 0.06);
            background: rgba(255,255,255,0.92);
            color: #4b5563;
            font-size: 12px;
            font-weight: 700;
            cursor: pointer;
        }

        .media-section-head strong {
            font-size: 14px;
            color: #162134;
            line-height: 1.3;
        }

        .media-section-head span {
            color: #7b8798;
            font-size: 12px;
            line-height: 1.6;
        }

        .media-options-card.is-collapsed {
            background: linear-gradient(180deg, rgba(252, 253, 255, 0.98) 0%, rgba(248, 250, 253, 0.98) 100%);
        }

        .field-grid {
            display: grid;
            grid-template-columns: repeat(3, minmax(0, 1fr));
            gap: 10px;
        }

        .field {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .field label {
            color: #516073;
            font-size: 13px;
            font-weight: 700;
        }

        .field input,
        .field select,
        .field textarea {
            width: 100%;
            border: 1px solid var(--line-strong);
            border-radius: 16px;
            padding: 12px 14px;
            background: #fff;
            color: var(--text);
            font-size: 14px;
            line-height: 1.7;
        }

        .field input:focus,
        .field select:focus,
        .field textarea:focus {
            outline: none;
            border-color: rgba(37, 99, 255, 0.34);
            box-shadow: 0 0 0 5px rgba(37, 99, 255, 0.08);
        }

        .prompt-box {
            min-height: 124px;
            resize: vertical;
        }

        .chat-input-wrap {
            position: relative;
            border-radius: 24px;
            overflow: hidden;
            background: var(--panel-strong);
            isolation: isolate;
        }

        .chat-input-hint {
            position: absolute;
            top: 16px;
            left: 16px;
            right: 136px;
            z-index: 4;
            font-size: 15px;
            line-height: 1.7;
            color: #8b95a7;
            pointer-events: none;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .chat-input-wrap.is-hint-hidden .chat-input-hint {
            display: none;
        }

        .chat-input-wrap.is-skill-mention-open {
            overflow: visible;
            z-index: 24;
        }

        .chat-skill-mention-menu {
            position: absolute;
            left: 12px;
            bottom: calc(100% + 10px);
            z-index: 60;
            width: min(420px, calc(100% - 24px));
            max-height: min(390px, 52dvh);
            padding: 8px;
            overflow-x: hidden;
            overflow-y: auto;
            overscroll-behavior: contain;
            border: 1px solid rgba(15, 23, 42, 0.1);
            border-radius: 18px;
            background: rgba(255, 255, 255, 0.98);
            box-shadow: 0 22px 58px rgba(15, 23, 42, 0.18);
            backdrop-filter: blur(18px);
        }

        .chat-skill-mention-menu.hidden {
            display: none;
        }

        .chat-skill-mention-head {
            padding: 7px 10px 8px;
            color: #7a8495;
            font-size: 12px;
            font-weight: 500;
            line-height: 1.4;
        }

        .chat-skill-mention-option {
            width: 100%;
            min-height: 56px;
            padding: 8px 10px;
            display: grid;
            grid-template-columns: 38px minmax(0, 1fr);
            align-items: center;
            gap: 10px;
            border: 0;
            border-radius: 13px;
            background: transparent;
            color: #253044;
            text-align: left;
            cursor: pointer;
        }

        .chat-skill-mention-option:hover,
        .chat-skill-mention-option.is-active {
            background: #f1f4f8;
            color: #10284c;
        }

        .chat-skill-mention-icon {
            width: 36px;
            height: 36px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border-radius: 11px;
            background: #f5f7fa;
        }

        .chat-skill-mention-icon img {
            width: 23px;
            height: 23px;
            object-fit: contain;
        }

        .chat-skill-mention-copy {
            min-width: 0;
            display: grid;
            gap: 2px;
        }

        .chat-skill-mention-copy strong {
            color: inherit;
            font-size: 14px;
            font-weight: 500;
            line-height: 1.35;
        }

        .chat-skill-mention-copy span {
            color: #7a8495;
            font-size: 12px;
            font-weight: 400;
            line-height: 1.45;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .chat-skill-mention-empty {
            padding: 18px 12px;
            color: #7a8495;
            font-size: 13px;
            text-align: center;
        }

        .chat-input-wrap textarea {
            display: block;
            min-height: 120px;
            resize: vertical;
            padding: 16px 136px 18px 16px;
            border-radius: inherit;
            background: transparent;
            color: #141826;
            caret-color: var(--brand);
            -webkit-text-fill-color: #141826;
            position: relative;
            z-index: 1;
        }


        .chat-input-tools {
            position: absolute;
            left: 12px;
            right: 12px;
            bottom: 12px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            z-index: 3;
            pointer-events: auto;
        }

        .chat-input-action-group {
            display: inline-flex;
            align-items: center;
            gap: 6px;
        }

        .chat-tool-btn,
        .send-btn,
        .chat-voice-btn {
            width: 42px;
            height: 42px;
            padding: 0;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border-radius: 14px;
        }

        .chat-tool-btn:disabled,
        .send-btn:disabled,
        .chat-voice-btn:disabled {
            cursor: not-allowed;
            opacity: 0.68;
            transform: none;
        }

        .chat-tool-btn {
            border: 1px solid rgba(15, 23, 42, 0.06);
            background: #f8fafc;
            color: #475569;
            cursor: pointer;
            transition: background .18s ease, transform .18s ease, color .18s ease;
        }

        .chat-tool-btn:hover {
            background: #eef3fb;
            color: #1d4ed8;
            transform: translateY(-1px);
        }

        .chat-voice-btn.is-listening {
            background: #eef3fb;
            color: #1d4ed8;
            box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
        }

        .chat-voice-btn.is-listening svg,
        .image-studio-voice-btn.is-listening svg {
            animation: chat-voice-pulse 1.1s ease-in-out infinite;
        }

        .chat-voice-btn.is-unavailable:not(:disabled) {
            opacity: 0.78;
        }

        .chat-voice-status {
            width: fit-content;
            max-width: calc(100% - 8px);
            min-height: 28px;
            margin: 8px 4px 0;
            padding: 5px 10px;
            display: inline-flex;
            align-items: center;
            gap: 8px;
            border-radius: 999px;
            background: rgba(37, 99, 235, 0.08);
            color: #475569;
            font-size: 12px;
            line-height: 1.45;
        }

        .chat-voice-status::before {
            content: '';
            width: 8px;
            height: 8px;
            flex: 0 0 auto;
            border-radius: 999px;
            background: #64748b;
        }

        .chat-voice-status.is-loading {
            color: #1d4ed8;
            background: rgba(37, 99, 235, 0.1);
        }

        .chat-voice-status.is-loading::before {
            width: 11px;
            height: 11px;
            border: 2px solid rgba(37, 99, 235, 0.2);
            border-top-color: #2563eb;
            background: transparent;
            animation: status-spin .8s linear infinite;
        }

        .chat-voice-status.is-success {
            color: #0f7b43;
            background: rgba(46, 184, 114, 0.1);
        }

        .chat-voice-status.is-success::before { background: #2eb872; }

        .chat-voice-status.is-warning,
        .chat-voice-status.is-error {
            color: #9a5d08;
            background: rgba(240, 171, 0, 0.12);
        }

        .chat-voice-status.is-warning::before,
        .chat-voice-status.is-error::before { background: #f0ab00; }

        body[data-ui-theme="dark"] .chat-voice-status {
            color: #cbd5e1;
            background: rgba(148, 163, 184, 0.12);
        }

        body[data-ui-theme="dark"] .chat-voice-status.is-loading {
            color: #bfdbfe;
            background: rgba(59, 130, 246, 0.14);
        }

        body[data-ui-theme="dark"] .chat-voice-status.is-success {
            color: #86efac;
            background: rgba(34, 197, 94, 0.12);
        }

        body[data-ui-theme="dark"] .chat-voice-status.is-warning,
        body[data-ui-theme="dark"] .chat-voice-status.is-error {
            color: #fde68a;
            background: rgba(245, 158, 11, 0.14);
        }

        .chat-tool-btn svg,
        .chat-voice-btn svg,
        .send-btn svg {
            width: 22px;
            height: 22px;
        }

        .send-btn {
            position: relative;
            overflow: visible;
            transition: background .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease;
        }

        .send-btn::before {
            content: attr(data-tooltip);
            position: absolute;
            right: 2px;
            bottom: calc(100% + 10px);
            padding: 6px 10px;
            border-radius: 10px;
            background: rgba(15, 23, 42, 0.96);
            color: #fff;
            font-size: 12px;
            font-weight: 600;
            line-height: 1;
            white-space: nowrap;
            opacity: 0;
            transform: translateY(4px);
            pointer-events: none;
            transition: opacity .16s ease, transform .16s ease;
            box-shadow: 0 12px 28px rgba(15, 23, 42, 0.22);
        }

        .send-btn::after {
            content: '';
            position: absolute;
            right: 14px;
            bottom: calc(100% + 4px);
            width: 10px;
            height: 10px;
            background: rgba(15, 23, 42, 0.96);
            transform: rotate(45deg) translateY(4px);
            opacity: 0;
            pointer-events: none;
            transition: opacity .16s ease, transform .16s ease;
        }

        .send-btn:not([data-tooltip])::before,
        .send-btn:not([data-tooltip])::after,
        .send-btn[data-tooltip=""]::before,
        .send-btn[data-tooltip=""]::after {
            display: none;
        }

        .send-btn:hover::before,
        .send-btn:focus-visible::before {
            opacity: 1;
            transform: translateY(0);
        }

        .send-btn:hover::after,
        .send-btn:focus-visible::after {
            opacity: 1;
            transform: rotate(45deg) translateY(0);
        }

        .send-btn.is-busy svg {
            animation: chat-send-spin .9s linear infinite;
        }

        .send-btn.has-text {
            background: linear-gradient(135deg, #2563eb 0%, #4f7cff 100%);
            color: #fff;
            box-shadow: 0 14px 28px rgba(37, 99, 235, 0.22);
        }

        .send-btn.is-voice {
            background: #eef3fb;
            color: #1d4ed8;
            box-shadow: 0 0 0 1.5px rgba(37, 99, 235, 0.18);
        }

        .send-btn.is-listening {
            background: #eef3fb;
            color: #1d4ed8;
            box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
        }

        .send-btn.is-listening svg {
            animation: chat-voice-pulse 1.1s ease-in-out infinite;
        }

        @keyframes chat-send-spin {
            from {
                transform: rotate(0deg);
            }
            to {
                transform: rotate(360deg);
            }
        }

        @keyframes chat-voice-pulse {
            0%, 100% {
                transform: scale(1);
            }
            50% {
                transform: scale(0.88);
            }
        }

        .chat-attachment-bar {
            display: grid;
            gap: 7px;
            margin: 0;
            padding: 10px 12px 6px;
            width: 100%;
            min-width: 0;
            box-sizing: border-box;
            position: relative;
            z-index: 3;
            background: rgba(248, 250, 252, 0.82);
            border-bottom: 1px solid rgba(15, 23, 42, 0.06);
        }

        .chat-input-wrap.has-attachments .chat-input-hint,
        .chat-input-wrap.has-attachments textarea::placeholder {
            display: none !important;
            color: transparent !important;
        }

        .chat-input-wrap.is-file-drop-target {
            border-color: rgba(37, 99, 235, 0.48);
            box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1), 0 18px 42px rgba(37, 99, 235, 0.1);
        }

        .chat-quote-bar {
            display: grid;
            gap: 12px;
            margin-bottom: 12px;
            padding: 12px 14px;
            border-radius: 20px;
            border: 1px solid rgba(15, 23, 42, 0.08);
            background: linear-gradient(180deg, rgba(248, 250, 252, 0.98) 0%, rgba(255,255,255,0.98) 100%);
        }

        .chat-quote-summary {
            display: flex;
            align-items: center;
            gap: 10px;
            min-width: 0;
        }

        .chat-quote-marker {
            width: 4px;
            align-self: stretch;
            border-radius: 999px;
            background: linear-gradient(180deg, #3b82f6 0%, #60a5fa 100%);
            flex: 0 0 4px;
        }

        .chat-quote-text {
            flex: 1 1 auto;
            min-width: 0;
            color: #475569;
            font-size: 13px;
            line-height: 1.6;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .chat-quote-clear {
            width: 24px;
            height: 24px;
            border: none;
            border-radius: 999px;
            background: rgba(15, 23, 42, 0.06);
            color: #64748b;
            cursor: pointer;
            font-size: 15px;
            line-height: 1;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            flex: 0 0 24px;
        }

        .chat-followup-actions {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
        }

        .chat-followup-chip {
            min-height: 32px;
            padding: 0 14px;
            border-radius: 999px;
            border: 1px solid rgba(15, 23, 42, 0.08);
            background: #fff;
            color: #1f2937;
            font-size: 13px;
            font-weight: 700;
            cursor: pointer;
            transition: border-color .18s ease, color .18s ease, transform .18s ease, background .18s ease;
        }

        .chat-followup-chip:hover {
            color: #1d4ed8;
            border-color: rgba(37, 99, 255, 0.24);
            background: rgba(239, 246, 255, 0.9);
            transform: translateY(-1px);
        }

        .chat-capability-active {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 10px;
            flex-wrap: wrap;
        }

        .chat-capability-pill {
            border: none;
            min-height: 34px;
            padding: 0 12px;
            border-radius: 999px;
            background: rgba(37, 99, 255, 0.1);
            color: #1748c7;
            font-size: 13px;
            font-weight: 700;
            display: inline-flex;
            align-items: center;
            gap: 8px;
            cursor: pointer;
            transition: background .18s ease, transform .18s ease;
        }

        .chat-capability-pill:hover {
            background: rgba(37, 99, 255, 0.14);
            transform: translateY(-1px);
        }

        .chat-capability-pill span[aria-hidden="true"] {
            font-size: 14px;
            line-height: 1;
        }

        .chat-capability-target {
            position: relative;
        }

        .chat-capability-target-btn {
            border: none;
            min-height: 34px;
            padding: 0 14px;
            border-radius: 999px;
            background: rgba(15, 23, 42, 0.04);
            color: #1f2937;
            font-size: 13px;
            font-weight: 600;
            display: inline-flex;
            align-items: center;
            gap: 8px;
            cursor: pointer;
            transition: background .18s ease, color .18s ease, transform .18s ease;
        }

        .chat-capability-target-btn:hover {
            background: rgba(37, 99, 255, 0.08);
            color: #1d4ed8;
            transform: translateY(-1px);
        }

        .chat-capability-target-btn[aria-expanded="true"] {
            background: rgba(37, 99, 255, 0.1);
            color: #1d4ed8;
        }

        .chat-capability-target-btn .caret {
            font-size: 12px;
            line-height: 1;
        }

        .chat-capability-target-menu {
            position: absolute;
            left: 0;
            top: calc(100% + 8px);
            z-index: 18;
            min-width: 196px;
            padding: 8px;
            border-radius: 18px;
            border: 1px solid rgba(15, 23, 42, 0.08);
            background: rgba(255, 255, 255, 0.98);
            box-shadow: 0 18px 42px rgba(15, 23, 42, 0.12);
            backdrop-filter: blur(14px);
            display: grid;
            gap: 4px;
        }

        .chat-capability-target-option {
            border: none;
            min-height: 38px;
            padding: 0 12px;
            border-radius: 12px;
            background: transparent;
            color: #334155;
            font-size: 13px;
            font-weight: 500;
            display: flex;
            align-items: center;
            justify-content: space-between;
            cursor: pointer;
            transition: background .18s ease, color .18s ease;
        }

        .chat-capability-target-option:hover,
        .chat-capability-target-option.active {
            background: rgba(37, 99, 255, 0.08);
            color: #1d4ed8;
        }

        .chat-capability-target-option-mark {
            font-size: 14px;
            font-weight: 700;
        }

        .chat-attachment-meta {
            color: #6d788a;
            font-size: 12px;
            line-height: 1.5;
        }

        .chat-attachment-list {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            width: 100%;
            min-width: 0;
        }

        .chat-attachment-chip {
            position: relative;
            display: flex;
            align-items: center;
            gap: 9px;
            width: min(320px, 100%);
            max-width: 100%;
            min-width: 0;
            min-height: 62px;
            box-sizing: border-box;
            padding: 6px 30px 6px 7px;
            border-radius: 15px;
            border: 1px solid var(--line);
            background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
            overflow: hidden;
            flex: 0 1 320px;
        }

        .chat-attachment-chip img,
        .chat-attachment-chip video {
            width: 50px;
            height: 50px;
            border-radius: 11px;
            object-fit: cover;
            display: block;
            flex: 0 0 50px;
        }

        .chat-attachment-thumb {
            width: 50px;
            height: 50px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            flex: 0 0 50px;
            overflow: hidden;
            border-radius: 11px;
            background: #e9eef7;
        }

        .chat-attachment-copy {
            min-width: 0;
            display: flex;
            flex: 1 1 auto;
            flex-direction: column;
            gap: 3px;
        }

        .chat-attachment-copy .chat-file-name,
        .chat-attachment-copy .chat-file-desc {
            display: block;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .chat-attachment-chip.is-uploading img,
        .chat-attachment-chip.is-uploading video {
            filter: saturate(.72) brightness(.82);
        }

        .chat-attachment-chip.is-error {
            border-color: rgba(220, 38, 38, 0.24);
            background: #fff7f7;
        }

        .chat-attachment-state {
            position: absolute;
            inset: 0;
            display: grid;
            place-content: center;
            justify-items: center;
            gap: 5px;
            padding: 8px;
            color: #fff;
            background: rgba(15, 23, 42, 0.44);
            font-size: 10px;
            font-weight: 700;
            line-height: 1.2;
            text-align: center;
            pointer-events: none;
        }

        .chat-attachment-state.error {
            color: #b42318;
            background: rgba(255, 247, 247, 0.94);
        }

        .chat-attachment-spinner {
            width: 16px;
            height: 16px;
            border-radius: 50%;
            border: 2px solid rgba(255, 255, 255, 0.38);
            border-top-color: #fff;
            animation: chat-send-spin .72s linear infinite;
        }

        .chat-attachment-chip.audio {
            background: linear-gradient(180deg, rgba(37, 99, 255, 0.08) 0%, rgba(255,255,255,0.95) 100%);
        }

        .chat-attachment-chip.document {
            background: linear-gradient(180deg, rgba(15, 23, 42, 0.06) 0%, rgba(255,255,255,0.98) 100%);
        }

        .chat-attachment-label {
            padding: 8px 10px;
            color: #516073;
            font-size: 11px;
            line-height: 1.5;
            word-break: break-word;
        }

        .chat-file-chip,
        .chat-file-card {
            display: flex;
            gap: 10px;
            align-items: center;
        }

        .chat-file-chip {
            flex-direction: column;
            justify-content: center;
            width: 100%;
            text-align: center;
            gap: 6px;
        }

        .chat-attachment-chip > .chat-file-icon {
            width: 42px;
            height: 42px;
            border-radius: 12px;
            flex: 0 0 42px;
        }

        .chat-file-icon {
            width: 34px;
            height: 34px;
            border-radius: 12px;
            background: linear-gradient(135deg, #1f2937 0%, #475569 100%);
            color: #fff;
            font-size: 10px;
            font-weight: 800;
            letter-spacing: 0.08em;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            flex: 0 0 auto;
        }

        .chat-file-meta {
            min-width: 0;
            display: flex;
            flex-direction: column;
            gap: 3px;
        }

        .chat-file-chip .chat-file-meta {
            align-items: center;
        }

        .chat-file-name {
            color: #1f2937;
            font-size: 12px;
            font-weight: 700;
            line-height: 1.45;
            word-break: break-word;
        }

        .chat-file-chip .chat-file-name {
            font-size: 10px;
            line-height: 1.35;
        }

        .chat-file-desc {
            color: #6b7280;
            font-size: 11px;
            line-height: 1.4;
        }

        .chat-file-chip .chat-file-desc {
            font-size: 10px;
        }

        .asset-preview .chat-file-card {
            width: 100%;
            min-height: 112px;
            padding: 18px;
            border-radius: 20px;
            background: rgba(255, 255, 255, 0.82);
            border: 1px solid rgba(15, 23, 42, 0.06);
        }

        .asset-preview .chat-file-icon {
            width: 48px;
            height: 48px;
            border-radius: 16px;
            font-size: 12px;
        }

        .asset-preview .chat-file-name {
            font-size: 14px;
        }

        .asset-preview .chat-file-desc {
            font-size: 12px;
            line-height: 1.6;
        }

        .chat-attachment-remove {
            position: absolute;
            top: 50%;
            right: 6px;
            transform: translateY(-50%);
            width: 20px;
            height: 20px;
            border: none;
            border-radius: 999px;
            background: rgba(15, 23, 42, 0.72);
            color: #fff;
            font-size: 12px;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            z-index: 4;
        }

        .chat-attachment-chip {
            min-height: 42px;
            padding: 4px 26px 4px 5px;
            gap: 6px;
            width: min(220px, 100%);
            flex: 0 1 220px;
            border-radius: 12px;
        }
        .chat-attachment-chip img,
        .chat-attachment-chip video {
            width: 32px;
            height: 32px;
            border-radius: 8px;
            flex: 0 0 32px;
        }
        .chat-attachment-thumb {
            width: 32px;
            height: 32px;
            flex: 0 0 32px;
            border-radius: 8px;
        }
        .chat-attachment-chip > .chat-file-icon {
            width: 32px;
            height: 32px;
            border-radius: 8px;
            flex: 0 0 32px;
            font-size: 9px;
        }
        .chat-attachment-copy {
            gap: 1px;
        }
        .chat-attachment-copy .chat-file-name {
            font-size: 12px;
            line-height: 1.3;
        }
        .chat-attachment-copy .chat-file-desc {
            font-size: 10px;
            line-height: 1.3;
        }
        .chat-attachment-remove {
            width: 18px;
            height: 18px;
            font-size: 14px;
            line-height: 18px;
            right: 4px;
        }
                .chat-attachment-remove:hover {
            background: rgba(15, 23, 42, 0.12);
            color: #0f172a;
        }

        body[data-mode="chat"] .composer {
            position: relative;
            z-index: 8;
            flex: 0 0 auto;
            width: min(804px, calc(100% - 88px));
            margin: auto auto 18px;
            padding: 10px 12px 10px;
            border-radius: 30px;
            border: 1px solid rgba(62, 92, 147, 0.16);
            box-shadow: 0 10px 28px rgba(52, 77, 118, 0.1);
            background: rgba(255, 255, 255, 0.98);
            backdrop-filter: blur(18px);
        }

        body[data-mode="chat"] .composer-top,
        body[data-mode="chat"] .composer-actions {
            display: none;
        }

        body[data-mode="chat"] #chat-compose-field {
            display: block !important;
            margin: 0;
        }

        body[data-mode="chat"] #chat-compose-field label {
            display: none;
        }

        body[data-mode="chat"] .chat-input-wrap {
            border-radius: 24px;
            overflow: hidden;
            background: var(--panel-strong);
        }

        body[data-mode="chat"] .chat-capability-active {
            margin-bottom: 8px;
        }

        body[data-mode="chat"] .chat-input-wrap textarea {
            min-height: 88px;
            border: none;
            border-radius: inherit;
            background: transparent;
            box-shadow: none;
            padding: 14px 136px 8px 18px;
            font-size: 15px;
            line-height: 1.7;
            color: #141826;
            caret-color: var(--brand);
            -webkit-text-fill-color: #141826;
        }

        body[data-mode="chat"] .chat-attachment-bar:not(.hidden) + .chat-input-hint {
            top: 94px;
        }

        body[data-mode="chat"] .chat-input-hint {
            top: 14px;
            left: 18px;
            right: 136px;
            color: #8b95a7;
        }

        body[data-mode="chat"] .chat-input-wrap textarea::placeholder {
            color: #b4bcc9;
            opacity: 1;
        }

        body[data-mode="chat"] .chat-input-tools {
            left: 14px;
            right: 14px;
            bottom: 14px;
            gap: 0;
        }

        body[data-mode="chat"] .chat-tool-btn {
            width: 40px;
            height: 40px;
            border-radius: 14px;
            border: 1px solid rgba(15, 23, 42, 0.06);
            background: #f8fafc;
            color: #64748b;
        }

        body[data-mode="chat"] .send-btn {
            width: 44px;
            height: 44px;
            border-radius: 16px;
            background: linear-gradient(135deg, #2f6bff 0%, #2150d8 100%);
            box-shadow: 0 8px 18px rgba(47, 107, 255, 0.22);
        }

        .chat-quick-actions {
            display: flex;
            align-items: center;
            gap: 8px;
            flex-wrap: wrap;
            margin-top: 6px;
            color: #68758a;
            font-size: 12px;
        }

        .chat-quick-actions-label {
            color: #9aa3b2;
            font-size: 11px;
            min-width: 28px;
        }

        .chat-quick-action {
            border: none;
            min-height: 28px;
            padding: 0 10px;
            border-radius: 999px;
            background: rgba(246, 248, 252, 0.96);
            color: #425168;
            font-size: 11px;
            font-weight: 600;
            cursor: pointer;
            transition: background .18s ease, transform .18s ease, color .18s ease;
        }

        .chat-quick-action:hover {
            background: rgba(37, 99, 255, 0.1);
            color: #2050c5;
            transform: translateY(-1px);
        }

        body[data-mode="chat"] .chat-quick-actions {
            margin-top: 4px;
            padding-bottom: 0;
            flex-wrap: nowrap;
            overflow-x: auto;
            scrollbar-width: none;
        }

        body[data-mode="chat"] .chat-quick-actions::-webkit-scrollbar {
            display: none;
        }

        body[data-mode="chat"] .chat-quick-actions-label {
            min-width: auto;
            margin-right: 2px;
            color: #94a3b8;
            flex: 0 0 auto;
        }

        body[data-mode="chat"] .chat-quick-action {
            min-height: 26px;
            padding: 0 8px;
            background: transparent;
            color: #334155;
            white-space: nowrap;
            flex: 0 0 auto;
        }

        body[data-mode="chat"] .chat-quick-action:hover {
            background: #f1f5f9;
            color: #1d4ed8;
        }

        body[data-mode="chat"] .site-topbar {
            display: none;
        }

        body[data-mode="chat"] .app,
        body[data-mode="image"] .app,
        body[data-mode="video"] .app {
            width: 100%;
            grid-template-columns: var(--chat-sidebar-width) var(--chat-sidebar-resizer-width) minmax(0, 1fr);
            gap: 0;
            padding: 0;
        }

        body[data-mode="chat"] .rail {
            display: none;
        }

        body[data-mode="chat"] .history {
            padding: 12px 8px 10px 10px;
            gap: 8px;
            border-radius: 0;
            background: #f8f8f8;
            border-right: 1px solid rgba(15, 23, 42, 0.06);
            border-color: rgba(15, 23, 42, 0.04);
            box-shadow: none;
            border-left: none;
            border-top: none;
            border-bottom: none;
        }

        body[data-mode="chat"] .desktop-sidebar-resizer,
        body[data-mode="image"] .desktop-sidebar-resizer,
        body[data-mode="video"] .desktop-sidebar-resizer {
            display: flex;
            align-items: stretch;
            justify-content: center;
            position: relative;
            cursor: col-resize;
            user-select: none;
            touch-action: none;
            background: transparent;
        }

        body[data-mode="chat"] .desktop-sidebar-resizer::before,
        body[data-mode="image"] .desktop-sidebar-resizer::before,
        body[data-mode="video"] .desktop-sidebar-resizer::before {
            content: "";
            width: 1px;
            margin: 0 auto;
            background: rgba(15, 23, 42, 0.08);
            transition: background .18s ease, box-shadow .18s ease;
        }

        body[data-mode="chat"] .desktop-sidebar-resizer::after,
        body[data-mode="image"] .desktop-sidebar-resizer::after,
        body[data-mode="video"] .desktop-sidebar-resizer::after {
            content: "";
            position: absolute;
            left: 50%;
            top: 50%;
            width: 4px;
            height: 48px;
            border-radius: 999px;
            transform: translate(-50%, -50%);
            background: rgba(148, 163, 184, 0.24);
            transition: background .18s ease, box-shadow .18s ease;
        }

        body[data-mode="chat"] .desktop-sidebar-resizer:hover::before,
        body[data-mode="chat"] .desktop-sidebar-resizer:hover::after,
        body[data-mode="image"] .desktop-sidebar-resizer:hover::before,
        body[data-mode="image"] .desktop-sidebar-resizer:hover::after,
        body[data-mode="video"] .desktop-sidebar-resizer:hover::before,
        body[data-mode="video"] .desktop-sidebar-resizer:hover::after,
        body.sidebar-resizing[data-mode="chat"] .desktop-sidebar-resizer::before,
        body.sidebar-resizing[data-mode="chat"] .desktop-sidebar-resizer::after,
        body.sidebar-resizing[data-mode="image"] .desktop-sidebar-resizer::before,
        body.sidebar-resizing[data-mode="image"] .desktop-sidebar-resizer::after,
        body.sidebar-resizing[data-mode="video"] .desktop-sidebar-resizer::before,
        body.sidebar-resizing[data-mode="video"] .desktop-sidebar-resizer::after {
            background: rgba(37, 99, 255, 0.34);
            box-shadow: 0 0 0 1px rgba(37, 99, 255, 0.06);
        }

        body[data-mode="chat"] .sidebar-shell {
            display: grid;
            gap: 8px;
            padding-bottom: 0;
        }

        body[data-mode="chat"] .sidebar-brand {
            gap: 8px;
            padding: 2px 4px 8px;
            align-items: center;
        }

        body[data-mode="chat"] .sidebar-brand-mark,
        body[data-mode="chat"] .sidebar-brand img {
            width: 28px;
            height: 28px;
            border-radius: 10px;
            flex: 0 0 22px;
        }

        body[data-mode="chat"] .sidebar-brand-copy strong {
            font-size: 14px;
            font-weight: 700;
            color: #0872e6;
        }

        body[data-mode="chat"] .sidebar-brand-copy span {
            font-size: 10px;
            color: #0d72f5;
            letter-spacing: .01em;
        }

        body[data-mode="chat"] .sidebar-nav-btn {
            min-height: 28px;
            padding: 0 8px;
            border-radius: 8px;
            font-size: 12px;
            gap: 6px;
        }

        body[data-mode="chat"] .sidebar-nav-btn .rail-glyph {
            width: 12px;
            height: 12px;
        }

        body[data-mode="chat"] .history-head,
        body[data-mode="chat"] .history-chat-summary {
            display: none;
        }

        body[data-mode="chat"] .history-actions {
            display: none !important;
        }

        body[data-mode="chat"] #new-conversation-btn {
            display: none;
            min-height: 38px;
            border-radius: 14px;
            background: #ffffff;
            border: 1px solid rgba(15, 23, 42, 0.08);
            box-shadow: none;
            font-size: 13px;
            display: flex;
            align-items: center;
            justify-content: flex-start;
            padding: 0 14px;
            position: relative;
        }

        body[data-mode="chat"] #new-conversation-btn::before {
            content: "";
            width: 16px;
            height: 16px;
            margin-right: 8px;
            border-radius: 999px;
            background:
                linear-gradient(#111827, #111827) center/10px 1.6px no-repeat,
                linear-gradient(#111827, #111827) center/1.6px 10px no-repeat;
            flex: 0 0 auto;
        }

        body[data-mode="chat"] #new-conversation-btn::after {
            content: "Ctrl K";
            position: absolute;
            right: 14px;
            top: 50%;
            transform: translateY(-50%);
            color: #9aa3b2;
            font-size: 11px;
            font-weight: 500;
        }

        body[data-mode="chat"] .history-search {
            display: none;
        }

        body[data-mode="chat"] .history-search button,
        body[data-mode="chat"] #history-subtitle,
        body[data-mode="chat"] .pagination,
        body[data-mode="chat"] .task-list {
            display: none !important;
        }

        body[data-mode="chat"] .history-search input {
            min-height: 34px;
            border-radius: 12px;
            background: rgba(255,255,255,0.96);
            border-color: rgba(15, 23, 42, 0.05);
            box-shadow: none;
            padding-left: 14px;
            font-size: 12px;
        }

        body[data-mode="chat"] .sidebar-footer {
            gap: 8px;
            padding-top: 10px;
        }

        body[data-mode="chat"] .sidebar-account strong {
            font-size: 12px;
        }

        body[data-mode="chat"] .sidebar-account span {
            font-size: 10px;
        }

        body[data-mode="chat"] .sidebar-footer-actions .btn {
            min-height: 30px;
            font-size: 11px;
            border-radius: 12px;
            justify-content: flex-start;
            padding: 0 10px;
            background: transparent;
            border-color: transparent;
            box-shadow: none;
        }

        body[data-mode="chat"] .conversation-meta {
            display: none;
        }

        body[data-mode="chat"] .conversation-item {
            border-radius: 12px;
            padding: 8px 10px 8px;
            background: transparent;
            border-color: transparent;
            box-shadow: none;
        }

        body[data-mode="chat"] .conversation-item.active,
        body[data-mode="chat"] .conversation-item:hover {
            background: rgba(255, 255, 255, 0.98);
            border-color: rgba(15, 23, 42, 0.03);
            box-shadow: 0 3px 10px rgba(15, 23, 42, 0.03);
        }

        .composer-capability-bar {
            display: flex;
            align-items: center;
            gap: 10px;
            flex-wrap: wrap;
            margin-top: 8px;
            padding-top: 8px;
            border-top: 1px solid rgba(15, 23, 42, 0.05);
        }

        .composer-capability-btn {
            border: none;
            min-height: 30px;
            padding: 0 12px;
            border-radius: 999px;
            background: transparent;
            color: #2f3a4f;
            font-size: 13px;
            font-weight: 500;
            cursor: pointer;
            transition: background .18s ease, color .18s ease, transform .18s ease;
            box-shadow: none;
            display: inline-flex;
            align-items: center;
            gap: 6px;
        }

        .composer-capability-btn:hover {
            background: rgba(37, 99, 255, 0.1);
            color: #2050c5;
            transform: translateY(-1px);
        }

        .composer-capability-btn.active {
            background: rgba(37, 99, 255, 0.12);
            color: #1748c7;
            font-weight: 700;
            box-shadow: inset 0 0 0 1px rgba(37, 99, 255, 0.14);
        }

        body[data-mode="chat"] .composer-capability-btn[data-mode="chat"] {
            display: none;
        }

        body[data-mode="chat"] .composer-capability-bar {
            gap: 14px;
            flex-wrap: nowrap;
            overflow-x: auto;
            scrollbar-width: none;
        }

        body[data-mode="chat"] .composer-capability-bar::-webkit-scrollbar {
            display: none;
        }

        body[data-mode="chat"] .composer-capability-btn {
            min-height: 28px;
            padding: 0 4px 0 0;
            border-radius: 0;
            white-space: nowrap;
            flex: 0 0 auto;
        }

        body[data-mode="chat"] .composer-capability-btn.active {
            background: transparent;
            color: #1748c7;
            box-shadow: none;
        }

        body[data-mode="chat"] .composer-capability-bar::before {
            content: "+";
            width: 28px;
            height: 28px;
            border-radius: 999px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            color: #1e293b;
            background: rgba(15, 23, 42, 0.04);
            font-size: 18px;
            line-height: 1;
            flex: 0 0 auto;
        }

        .composer-capability-btn .capability-icon {
            width: 18px;
            height: 18px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            color: #111827;
            flex: 0 0 auto;
        }

        .composer-capability-btn.active .capability-icon {
            color: #1748c7;
        }

        .composer-capability-btn .capability-icon svg {
            width: 18px;
            height: 18px;
            display: block;
        }

        .composer-capability-btn .capability-icon .home-capability-icon {
            width: 20px;
            height: 20px;
            display: block;
            border-radius: 0;
            background: transparent;
            object-fit: contain;
        }

        .work-skill-bar {
            position: relative;
            display: none;
            align-items: center;
            gap: 10px;
            margin-top: 8px;
            padding-top: 8px;
            border-top: 1px solid rgba(15, 23, 42, 0.05);
            overflow: visible;
            z-index: 36;
        }

        .work-skill-btn {
            min-height: 30px;
            padding: 0 12px;
            border: none;
            border-radius: 999px;
            background: rgba(15, 23, 42, 0.04);
            color: #1f2937;
            display: inline-flex;
            align-items: center;
            gap: 8px;
            font-size: 13px;
            font-weight: 600;
            cursor: pointer;
            transition: background .18s ease, color .18s ease;
        }

        .work-skill-btn:hover {
            background: rgba(37, 99, 255, 0.1);
            color: #2050c5;
        }

        .work-skill-btn.is-open {
            background: rgba(37, 99, 255, 0.12);
            color: #1748c7;
        }

        .work-skill-btn-label {
            white-space: nowrap;
        }

        .work-skill-btn-value {
            color: #64748b;
            font-weight: 500;
            white-space: nowrap;
        }

        .work-skill-btn.is-open .work-skill-btn-value {
            color: rgba(23, 72, 199, 0.78);
        }

        .work-skill-btn-caret {
            width: 14px;
            height: 14px;
            flex: 0 0 auto;
            transition: transform .18s ease;
        }

        .work-skill-btn.is-open .work-skill-btn-caret {
            transform: rotate(180deg);
        }

        .work-skill-menu {
            position: absolute;
            left: 0;
            top: auto;
            bottom: calc(100% + 8px);
            min-width: 164px;
            padding: 6px;
            border-radius: 14px;
            background: rgba(255, 255, 255, 0.98);
            border: 1px solid rgba(15, 23, 42, 0.08);
            box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
            display: flex;
            flex-direction: column;
            gap: 4px;
            z-index: 160;
        }

        .work-skill-menu.hidden {
            display: none;
        }

        .work-skill-option {
            width: 100%;
            border: none;
            background: transparent;
            min-height: 36px;
            padding: 0 10px;
            border-radius: 10px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            color: #1f2937;
            font-size: 13px;
            font-weight: 500;
            cursor: pointer;
            text-align: left;
        }

        .work-skill-option:hover {
            background: rgba(37, 99, 255, 0.08);
            color: #2050c5;
        }

        .work-skill-option.active {
            background: rgba(37, 99, 255, 0.1);
            color: #1748c7;
        }

        .work-skill-option-mark {
            color: inherit;
            font-size: 11px;
            font-weight: 700;
        }

        body[data-mode="chat"][data-chat-entry-mode="work"] .chat-quick-actions,
        body[data-mode="chat"][data-chat-entry-mode="work"] .composer-capability-bar,
        body[data-mode="chat"][data-chat-entry-mode="work"] .mobile-chat-toolbar {
            display: none !important;
        }

        body[data-mode="chat"][data-chat-entry-mode="work"] .work-skill-bar {
            display: flex;
        }

        body[data-mode="chat"][data-chat-entry-mode="work"] .composer,
        body[data-mode="chat"][data-chat-entry-mode="work"] #chat-compose-field,
        body[data-mode="chat"][data-chat-entry-mode="work"] .composer-actions {
            overflow: visible;
        }

        .chat-media-toolbar-host {
            display: none;
            margin-top: 10px;
            position: relative;
        }

        .chat-media-toolbar-host .studio-reference-bar {
            margin-bottom: 10px;
        }

        .image-studio-inline-close {
            display: none;
            width: 18px;
            height: 18px;
            border-radius: 999px;
            align-items: center;
            justify-content: center;
            background: rgba(37, 99, 255, 0.12);
            color: inherit;
            font-size: 12px;
            line-height: 1;
            flex: 0 0 auto;
        }

        .media-prompt-field {
            display: none;
        }

        body[data-mode="image"] .chat-quick-actions,
        body[data-mode="video"] .chat-quick-actions,
        body[data-mode="image"] .clarification-banner,
        body[data-mode="video"] .clarification-banner {
            display: none;
        }

        #chat-compose-field.is-media-mode .chat-attachment-bar,
        #chat-compose-field.is-media-mode .composer-capability-bar,
        #chat-compose-field.is-media-mode .chat-quick-actions {
            display: none !important;
        }

        #chat-compose-field.is-media-mode .chat-media-toolbar-host {
            display: block;
        }

        #chat-compose-field.is-media-mode .chat-input-wrap {
            border-radius: 24px;
            overflow: hidden;
            background: var(--panel-strong);
        }

        #chat-compose-field.is-media-mode .chat-input-wrap textarea {
            min-height: 92px;
            border: none;
            border-radius: inherit;
            background: transparent;
            box-shadow: none;
            padding: 16px 136px 12px 18px;
            font-size: 15px;
            line-height: 1.7;
            color: #141826;
            caret-color: var(--brand);
            -webkit-text-fill-color: #141826;
        }

        #chat-compose-field.is-media-mode .chat-input-hint {
            top: 16px;
            left: 18px;
            right: 136px;
            color: #8b95a7;
        }

        #chat-compose-field.is-media-mode .chat-input-tools {
            display: inline-flex !important;
            left: 12px;
            right: 12px;
            bottom: 12px;
            gap: 0;
        }

        #chat-compose-field.is-media-mode .chat-input-wrap textarea::placeholder {
            color: #b4bcc9;
            opacity: 1;
        }

        #chat-compose-field.is-media-mode .image-studio-toolbar {
            border-radius: 24px;
            padding: 12px 14px;
        }

        #chat-compose-field.is-media-mode .image-studio-toolbar-left {
            gap: 10px;
        }

        #chat-compose-field.is-media-mode .image-studio-toolbar-divider {
            order: 2;
        }

        #chat-compose-field.is-media-mode .image-studio-inline-btn {
            order: 3;
        }

        #chat-compose-field.is-media-mode .image-studio-tool-link {
            min-height: 36px;
        }

        #chat-compose-field.is-media-mode .image-studio-tool-link.compact-upload-icon {
            order: 1;
            width: 36px;
            min-width: 36px;
            padding: 0;
            border-radius: 999px;
        }

        #chat-compose-field.is-media-mode .image-studio-tool-link.compact-upload-icon .image-studio-tool-icon {
            background: transparent;
            width: 18px;
            height: 18px;
            font-size: 20px;
        }

        #chat-compose-field.is-media-mode .image-studio-tool-link.compact-upload-icon span:not(.image-studio-tool-icon) {
            display: none;
        }

        #chat-compose-field.is-media-mode .image-studio-inline-btn.compact-media-pill {
            padding: 0 12px;
            min-height: 36px;
            gap: 8px;
        }

        #chat-compose-field.is-media-mode .image-studio-inline-close {
            display: inline-flex;
        }

        #chat-compose-field.is-media-mode .image-studio-inline-btn.compact-media-pill .image-studio-inline-close {
            width: 16px;
            height: 16px;
            background: rgba(37, 99, 255, 0.14);
            font-size: 11px;
        }

        #chat-compose-field.is-media-mode .image-studio-tool-meta {
            display: none;
        }

        #chat-compose-field.is-media-mode .image-studio-popover {
            left: 0;
            top: auto;
            bottom: calc(100% + 12px);
        }

        #chat-compose-field.is-media-mode .image-studio-template-panel {
            position: static;
            left: auto;
            right: auto;
            bottom: auto;
            margin: 0 0 12px;
            z-index: 24;
            max-height: none;
            overflow: hidden;
        }

        #chat-compose-field.is-media-mode #image-studio-style-menu {
            min-width: 184px;
        }

        #chat-compose-field.is-media-mode #image-studio-style-menu .image-studio-popover-item-desc {
            display: none;
        }

        #chat-compose-field.is-media-mode #image-studio-style-menu .image-studio-popover-item {
            min-height: 40px;
            padding: 8px 10px;
        }

        body[data-mode="chat"] .conversation-list {
            display: grid !important;
            flex: 1 1 auto;
            max-height: none;
            gap: 2px;
            padding-right: 1px;
            align-content: start;
        }

        body[data-mode="chat"] .sidebar-section-label {
            margin-top: 12px;
            padding-top: 14px;
            border-top: 1px solid rgba(15, 23, 42, 0.08);
        }

        body[data-mode="chat"] .conversation-head {
            align-items: center;
            gap: 8px;
        }

        body[data-mode="chat"] .conversation-item-icon {
            color: #223b63;
        }

        body[data-mode="chat"] .conversation-time {
            color: #7d899e;
        }

        body[data-mode="chat"] .conversation-item {
            min-height: 32px;
            padding: 6px 8px 6px 10px;
            border-radius: 9px;
        }

        body[data-mode="chat"] .conversation-title {
            font-size: 11px;
            font-weight: 600;
            color: #273447;
            letter-spacing: -0.01em;
        }

        body[data-mode="chat"] .conversation-preview {
            display: none;
        }

        body[data-mode="chat"] .conversation-actions {
            align-self: center;
            padding-right: 8px;
        }

        body[data-mode="chat"] .conversation-more-btn {
            width: 24px;
            height: 24px;
            background: transparent;
            border-radius: 8px;
        }

        @media (max-width: 920px) {
            body[data-mode="chat"] .conversation-more-btn {
                opacity: 1 !important;
                pointer-events: auto !important;
            }
            .conversation-menu.conversation-menu-floating {
                z-index: 4600 !important;
            }
        }

        body[data-mode="chat"] .conversation-menu {
            min-width: 144px;
            padding: 6px;
            border-radius: 14px;
            top: 50%;
            right: auto;
            left: calc(100% + 10px);
            transform: translateY(-50%);
        }

        body[data-mode="chat"] .conversation-item:hover,
        body[data-mode="chat"] .conversation-item.active {
            background: rgba(255, 255, 255, 0.96);
            border-color: rgba(15, 23, 42, 0.03);
            box-shadow: 0 1px 6px rgba(15, 23, 42, 0.025);
        }

        body[data-mode="chat"] .conversation-item.active::before {
            left: 4px;
            top: 7px;
            bottom: 7px;
            width: 2px;
        }

        body[data-mode="chat"] .sidebar-section-label {
            padding: 6px 6px 2px;
            font-size: 11px;
            color: #a0a9b8;
            letter-spacing: .02em;
        }

        body[data-mode="chat"] .conversation-title-wrap {
            padding-right: 0;
        }

        body[data-mode="chat"] .sidebar-footer {
            border-top: 1px solid rgba(15, 23, 42, 0.035);
            padding-top: 8px;
            padding-bottom: 4px;
        }

        body[data-mode="chat"] .sidebar-account {
            gap: 2px;
        }

        body[data-mode="chat"] .sidebar-account strong {
            font-weight: 600;
            font-size: 12px;
        }

        body[data-mode="chat"] .sidebar-account span {
            color: #94a3b8;
            font-size: 10px;
        }

        body[data-mode="chat"] .sidebar-footer-actions {
            gap: 2px;
            grid-template-columns: 1fr;
        }

        body[data-mode="chat"] .sidebar-footer-actions .btn {
            min-height: 28px;
            padding: 0 8px;
            background: transparent;
            border-color: transparent;
            color: #64748b;
            box-shadow: none;
        }

        body[data-mode="chat"] .sidebar-footer-actions .btn:hover {
            background: #f8fafc;
            border-color: rgba(15, 23, 42, 0.04);
            box-shadow: none;
        }

        body[data-mode="chat"] .sidebar-account-row {
            gap: 8px;
        }

        body[data-mode="chat"] .sidebar-account-avatar {
            width: 28px;
            height: 28px;
            border-radius: 9px;
            flex-basis: 28px;
        }

        body[data-mode="chat"] .workspace {
            min-height: 100vh;
            height: 100vh;
            max-height: 100vh;
            padding: 0 0 0 0;
        }

        body[data-mode="chat"] .stage {
            flex: 1 1 auto;
            min-height: 0;
            padding-top: 0;
        }

        body[data-mode="chat"] .result-card {
            padding: 0;
            background: transparent;
            border: none;
            box-shadow: none;
        }

        body[data-mode="chat"] .result-card .section-head {
            display: none;
        }

        body[data-mode="chat"] .result-content {
            height: calc(100vh - 178px);
            max-height: calc(100vh - 178px);
            padding: 0 42px 0;
            overflow-y: auto;
            overflow-x: hidden;
        }

        body[data-mode="chat"] .empty-state {
            min-height: 100%;
            height: 100%;
            border: none;
            background: transparent;
            box-shadow: none;
            padding: 24px 34px 18px;
        }

        body[data-mode="chat"] .chat-empty-badge {
            min-height: 38px;
            padding: 0 18px;
            border-radius: 999px;
            background: rgba(77, 115, 255, 0.08);
            color: #3154c8;
            font-size: 14px;
            font-weight: 700;
        }

        body[data-mode="chat"] .chat-empty-copy {
            align-items: center;
            text-align: center;
            margin-bottom: 12px;
        }

        body[data-mode="chat"] .chat-empty-title {
            font-size: clamp(40px, 5.2vw, 68px);
            line-height: 1.08;
            letter-spacing: -0.05em;
            color: #0f172a;
        }

        body[data-mode="chat"] .chat-empty-desc {
            max-width: 420px;
            font-size: 12px;
            line-height: 1.7;
            color: #98a1ae;
        }

        body[data-mode="chat"] .chat-empty-grid {
            width: min(980px, 100%);
            margin-top: 8px;
        }

        body[data-mode="chat"] .chat-empty-chip {
            min-height: 44px;
            padding: 0 18px;
            border-radius: 16px;
            border: 1px solid rgba(15, 23, 42, 0.04);
            background: rgba(246, 247, 249, 0.92);
            color: #101828;
            box-shadow: none;
        }

        body[data-mode="chat"] .guest-preview {
            display: none;
        }

        .route-mode-wrap,
        .manual-model-wrap {
            display: grid;
            gap: 10px;
        }

        .route-mode-wrap {
            margin-top: 10px;
        }

        #negative-field {
            margin-top: 8px;
        }

        .route-mode-switch {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            padding: 3px;
            border-radius: 999px;
            border: 1px solid var(--line);
            background: #f6f8fb;
            width: fit-content;
        }

        #media-compose {
            margin-top: 6px;
            padding: 14px 14px 0;
            border-top: 1px solid rgba(15, 23, 42, 0.05);
        }

        body[data-mode="chat"] #media-compose {
            margin-top: 8px;
            padding: 12px 4px 0;
            border-top: 1px solid rgba(15, 23, 42, 0.05);
            gap: 12px;
        }

        body.compact-media-mode[data-mode="chat"] #media-compose {
            margin-top: 0;
            padding: 0;
            border-top: none;
        }

        body[data-mode="chat"] .media-drawer-shell {
            gap: 12px;
        }

        body[data-mode="chat"] .media-drawer-section {
            border-radius: 22px;
            border: 1px solid rgba(15, 23, 42, 0.05);
            background: linear-gradient(180deg, rgba(250, 252, 255, 0.98) 0%, rgba(246, 249, 253, 0.98) 100%);
        }

        body[data-mode="chat"] .media-section-head {
            padding: 14px 16px 0;
        }

        body.compact-media-mode[data-mode="chat"] .media-options-card {
            position: fixed;
            top: 84px;
            right: 18px;
            width: min(408px, calc(100vw - 308px));
            max-height: calc(100vh - 104px);
            overflow-y: auto;
            z-index: 42;
            box-shadow: 0 26px 60px rgba(15, 23, 42, 0.16);
            transform: translateX(calc(100% + 28px));
            opacity: 0;
            pointer-events: none;
            transition: transform .24s ease, opacity .24s ease;
            background: linear-gradient(180deg, rgba(255,255,255,0.99) 0%, rgba(248,250,253,0.99) 100%);
        }

        body.compact-media-mode.desktop-media-drawer-open[data-mode="chat"] .media-options-card {
            transform: translateX(0);
            opacity: 1;
            pointer-events: auto;
        }

        body.compact-media-mode.desktop-media-drawer-open[data-mode="chat"] .desktop-media-drawer-backdrop {
            display: block;
            opacity: 1;
            pointer-events: auto;
        }

        body.compact-media-mode[data-mode="chat"] .workspace-chat-header-right #desktop-media-drawer-toggle {
            display: inline-flex !important;
        }

        body.compact-media-mode.desktop-media-drawer-open[data-mode="chat"] .workspace-chat-header-right #desktop-media-drawer-toggle {
            background: #20242c;
            border-color: #20242c;
            color: #fff;
        }

        #media-compose .field > label,
        #media-compose .upload-panel h3,
        #media-compose .tiny {
            font-size: 12px;
        }

        #media-compose .field > label {
            color: #5f6e84;
        }

        #media-compose .field input,
        #media-compose .field select,
        #media-compose .field textarea {
            border-radius: 14px;
            padding: 11px 13px;
            font-size: 13px;
        }

        #media-compose .advanced-controls {
            gap: 10px;
            padding: 12px 14px 14px;
            border-radius: 18px;
            background: rgba(248, 250, 253, 0.82);
            border: 1px solid rgba(15, 23, 42, 0.04);
        }

        #media-compose .upload-panel {
            padding: 0;
            border: none;
            background: transparent;
            box-shadow: none;
        }

        body[data-mode="chat"] .route-mode-wrap {
            display: grid;
            gap: 10px;
        }

        body[data-mode="chat"] .route-mode-wrap > .field,
        body[data-mode="chat"] .manual-model-wrap .field,
        body[data-mode="chat"] .advanced-controls > .field,
        body[data-mode="chat"] .field-grid,
        body[data-mode="chat"] .upload-panel {
            padding: 12px 14px;
            border-radius: 18px;
            background: #fbfcfe;
            border: 1px solid rgba(15, 23, 42, 0.05);
        }

        body[data-mode="chat"] .route-mode-wrap > .field {
            background: transparent;
            border: none;
            padding-top: 8px;
            padding-left: 16px;
            padding-right: 16px;
            padding-bottom: 14px;
        }

        body[data-mode="chat"] .manual-model-wrap .field,
        body[data-mode="chat"] .advanced-controls > .field,
        body[data-mode="chat"] .field-grid,
        body[data-mode="chat"] .upload-panel {
            background: #fbfcfe;
        }

        body[data-mode="chat"] .media-routing-card .manual-model-wrap .field {
            background: rgba(255, 255, 255, 0.9);
        }

        body[data-mode="chat"] .media-options-card .advanced-controls {
            padding: 10px 12px 12px;
            background: transparent;
            border: none;
        }

        body[data-mode="chat"] .media-routing-card .field > label:first-child {
            display: none;
        }

        body[data-mode="chat"] .media-routing-card #auto-route-hint {
            margin-top: 6px;
            color: #7b8798;
        }

        body[data-mode="chat"] .media-options-card .advanced-controls > .field,
        body[data-mode="chat"] .media-options-card .field-grid {
            background: transparent;
            border: none;
            padding: 8px 10px;
        }

        body[data-mode="chat"] .media-options-card .field-grid {
            padding-top: 0;
            gap: 12px 10px;
        }

        body[data-mode="chat"] .media-options-card #negative-field {
            padding-bottom: 0;
        }

        body[data-mode="chat"] .media-options-card #negative-input {
            min-height: 76px;
        }

        body[data-mode="chat"] .media-options-card .upload-panel {
            background: rgba(255, 255, 255, 0.72);
        }

        body[data-mode="chat"] .field-grid {
            grid-template-columns: repeat(3, minmax(0, 1fr));
            gap: 10px;
        }

        body[data-mode="chat"] .field input,
        body[data-mode="chat"] .field select,
        body[data-mode="chat"] .field textarea {
            border-radius: 14px;
            border-color: rgba(15, 23, 42, 0.06);
            background: #fff;
        }

        body[data-mode="chat"] .route-mode-switch {
            background: #eef3fb;
            border-radius: 999px;
            padding: 4px;
            width: fit-content;
        }

        body[data-mode="chat"] .route-mode-switch .switch-btn {
            min-height: 34px;
            padding: 0 14px;
        }

        .manual-model-wrap,
        .manual-model-wrap .field {
            min-height: 0;
        }

        .manual-model-list {
            display: grid;
            grid-template-columns: 1fr;
            gap: 10px;
            max-height: 320px;
            overflow-y: auto;
            padding-right: 4px;
            overscroll-behavior: contain;
            -webkit-overflow-scrolling: touch;
        }

        .manual-model-card {
            border: 1px solid var(--line);
            border-radius: 18px;
            background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(246,248,252,0.98) 100%);
            transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
        }

        .manual-model-card:hover {
            border-color: rgba(37, 99, 255, 0.16);
            box-shadow: var(--shadow-soft);
            transform: translateY(-1px);
        }

        .manual-model-card label {
            display: flex;
            gap: 10px;
            align-items: center;
            padding: 10px 12px;
            cursor: pointer;
        }

        .manual-model-card label > div {
            min-width: 0;
            flex: 1 1 auto;
        }

        .manual-model-card input {
            width: auto;
            min-width: 16px;
            height: 16px;
            padding: 0;
            border: none;
            box-shadow: none;
            background: transparent;
            margin-top: 0;
            flex: 0 0 auto;
        }

        .manual-model-name {
            font-size: 13px;
            font-weight: 700;
            line-height: 1.45;
            color: var(--text);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .message-task-chip {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 4px 10px;
            border-radius: 999px;
            background: rgba(37, 99, 255, 0.08);
            color: #315fd6;
            font-size: 11px;
            font-weight: 700;
            margin-bottom: 10px;
        }

        .chat-bubble.user .message-task-chip {
            background: rgba(255, 255, 255, 0.2);
            color: #fff;
        }

        .chat-message-media,
        .chat-message-attachments {
            margin-top: 12px;
            display: grid;
            gap: 12px;
        }

        .chat-media-grid,
        .chat-attach-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(180px, 240px));
            gap: 12px;
        }

        .chat-media-grid.is-image-gallery {
            grid-template-columns: repeat(4, minmax(0, 1fr));
            gap: 10px;
        }

        .chat-media-gallery-item {
            position: relative;
            display: block;
            overflow: hidden;
            border-radius: 14px;
            background: #edf2f8;
            border: 1px solid rgba(15, 23, 42, 0.06);
            box-shadow: 0 6px 16px rgba(15, 23, 42, 0.04);
            transition: transform .18s ease, box-shadow .18s ease;
        }

        .chat-media-gallery-item::before,
        .chat-media-thumb::before,
        .task-thumb::before,
        .asset-preview::before {
            content: '';
            position: absolute;
            inset: 0;
            transform: translateX(-100%);
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.62), transparent);
            animation: quick-prompt-shimmer 1.25s ease-in-out infinite;
            pointer-events: none;
        }

        .chat-media-gallery-item.is-media-loaded::before,
        .chat-media-thumb.is-media-loaded::before,
        .task-thumb.is-media-loaded::before,
        .asset-preview.is-media-loaded::before {
            opacity: 0;
            animation: none;
        }

        .chat-media-gallery-item:hover {
            transform: translateY(-1px);
            box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
        }

        .chat-media-gallery-item img {
            position: relative;
            z-index: 1;
            display: block;
            width: 100%;
            aspect-ratio: 1 / 1;
            object-fit: cover;
            background: #edf2f8;
        }

        .chat-result-thumbnail-pending {
            position: relative;
            z-index: 0;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 8px;
            width: 100%;
            min-height: 96px;
            aspect-ratio: 1 / 1;
            overflow: hidden;
            background:
                radial-gradient(circle at 24% 18%, rgba(255, 255, 255, 0.9), transparent 24%),
                linear-gradient(145deg, #eef4ff 0%, #f5f1ff 52%, #edf8ff 100%);
            color: #7483a3;
        }

        .chat-result-thumbnail-pending::before,
        .chat-result-thumbnail-pending::after {
            content: '';
            position: absolute;
            border-radius: 999px;
            pointer-events: none;
        }

        .chat-result-thumbnail-pending::before {
            width: 88px;
            height: 88px;
            top: -42px;
            right: -24px;
            background: rgba(113, 143, 255, 0.13);
        }

        .chat-result-thumbnail-pending::after {
            width: 64px;
            height: 64px;
            left: -30px;
            bottom: -28px;
            background: rgba(168, 125, 255, 0.11);
        }

        .chat-result-thumbnail-icon,
        .chat-result-thumbnail-label {
            position: relative;
            z-index: 1;
        }

        .chat-result-thumbnail-icon {
            width: 42px;
            height: 42px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border-radius: 15px;
            color: #6680e8;
            background: rgba(255, 255, 255, 0.78);
            box-shadow: 0 10px 24px rgba(78, 99, 170, 0.13);
        }

        .chat-result-thumbnail-icon svg {
            width: 24px;
            height: 24px;
        }

        .chat-result-thumbnail-label {
            padding: 0 12px;
            font-size: 12px;
            line-height: 1.4;
            text-align: center;
        }

        .deferred-result-image {
            position: absolute !important;
            inset: 0;
            z-index: 2 !important;
            width: 100% !important;
            height: 100% !important;
            opacity: 0;
            object-fit: cover;
            transition: opacity .28s ease;
        }

        .is-media-loaded > .deferred-result-image,
        .deferred-result-image[src^="data:image/"] {
            opacity: 1;
        }

        .is-media-loaded > .chat-result-thumbnail-pending {
            opacity: 0;
        }

        .chat-media-thumb .chat-result-thumbnail-pending,
        .asset-preview .chat-result-thumbnail-pending {
            min-height: 180px;
            aspect-ratio: 4 / 3;
        }

        .task-thumb .chat-result-thumbnail-pending {
            height: 100%;
            min-height: inherit;
            aspect-ratio: auto;
        }

        .task-thumb .chat-result-thumbnail-icon {
            width: 34px;
            height: 34px;
            border-radius: 12px;
        }

        .task-thumb .chat-result-thumbnail-icon svg {
            width: 20px;
            height: 20px;
        }

        .task-thumb .chat-result-thumbnail-label {
            display: none;
        }

        .chat-media-card,
        .chat-attach-card {
            overflow: hidden;
            border: 1px solid var(--line);
            border-radius: 18px;
            background: rgba(255,255,255,0.95);
        }

        .chat-media-thumb,
        .chat-attach-thumb {
            position: relative;
            background: #edf2f8;
        }

        .chat-media-thumb img,
        .chat-media-thumb video,
        .asset-preview img,
        .asset-preview video {
            position: relative;
            z-index: 1;
        }

        .chat-media-thumb.is-file,
        .chat-attach-thumb.is-file {
            padding: 14px;
        }

        .chat-media-thumb img,
        .chat-media-thumb video,
        .chat-attach-thumb img,
        .chat-attach-thumb video {
            display: block;
            width: 100%;
            height: auto;
            max-height: 220px;
            object-fit: cover;
        }

        .chat-media-body,
        .chat-attach-body {
            padding: 10px 12px;
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .chat-media-actions,
        .asset-result-actions {
            display: flex;
            flex-wrap: nowrap;
            align-items: center;
            gap: 8px;
            overflow-x: auto;
            scrollbar-width: none;
        }

        .chat-media-actions::-webkit-scrollbar,
        .asset-result-actions::-webkit-scrollbar {
            display: none;
        }

        .chat-media-actions a,
        .chat-media-actions button,
        .asset-result-actions a,
        .asset-result-actions button {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 32px;
            min-width: 32px;
            height: 32px;
            border-radius: 999px;
            border: 1px solid rgba(148, 163, 184, 0.22);
            padding: 0;
            background: rgba(248, 250, 252, 0.98);
            color: #4b5563;
            text-decoration: none;
            cursor: pointer;
            flex: 0 0 auto;
            transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
        }

        .chat-media-actions a:hover,
        .chat-media-actions button:hover,
        .asset-result-actions a:hover,
        .asset-result-actions button:hover {
            background: rgba(37, 99, 235, 0.08);
            border-color: rgba(37, 99, 235, 0.18);
            color: #2563eb;
            transform: translateY(-1px);
        }

        .chat-media-actions a:focus-visible,
        .chat-media-actions button:focus-visible,
        .asset-result-actions a:focus-visible,
        .asset-result-actions button:focus-visible {
            outline: none;
            box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
        }

        .chat-media-actions svg,
        .asset-result-actions svg {
            width: 15px;
            height: 15px;
        }

        .chat-media-actions .is-primary,
        .asset-result-actions .is-primary {
            background: #1f2937;
            border-color: #1f2937;
            color: #fff;
        }

        .chat-media-actions .is-primary:hover,
        .asset-result-actions .is-primary:hover {
            background: #111827;
            border-color: #111827;
            color: #fff;
        }

        .asset-result-actions {
            margin-top: 10px;
        }

        .asset-result-actions a,
        .asset-result-actions button {
            width: 34px;
            min-width: 34px;
            height: 34px;
        }

        .chat-media-actions a,
        .chat-media-actions button {
            text-decoration: none;
        }

        .chat-media-note {
            color: #6d788a;
            font-size: 12px;
            line-height: 1.6;
        }

        .chat-bubble.has-media {
            max-width: min(96%, 920px);
        }

        .chat-bubble.user .chat-media-card,
        .chat-bubble.user .chat-attach-card {
            background: rgba(255,255,255,0.12);
            border-color: rgba(255,255,255,0.2);
        }

        .chat-bubble.user .chat-media-note,
        .chat-bubble.user .chat-attachment-meta,
        .chat-bubble.user .chat-attachment-label {
            color: rgba(255,255,255,0.92);
        }

        .chat-bubble.user .chat-file-name {
            color: #fff;
        }

        .chat-bubble.user .chat-file-desc {
            color: rgba(255,255,255,0.82);
        }

        .toolbar-group {
            display: flex;
            align-items: center;
            gap: 10px;
            flex-wrap: wrap;
        }

        .mode-switch {
            display: none;
        }

        .panel-toggle {
            display: none;
        }

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

        .mobile-nav-trigger {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border: none;
            background: transparent;
            padding: 0;
            cursor: pointer;
        }

        .mobile-nav-pill {
            display: inline-flex;
            align-items: center;
            gap: 12px;
            min-height: 38px;
            padding: 0 12px 0 11px;
            border-radius: 999px;
            border: 1px solid rgba(15, 23, 42, 0.08);
            background: rgba(255, 255, 255, 0.96);
            box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
        }

        .mobile-nav-bars {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 18px;
            height: 18px;
            color: #121826;
            flex: 0 0 18px;
        }

        .mobile-nav-title {
            color: #121826;
            font-size: 14px;
            font-weight: 700;
            line-height: 1;
        }

        .upload-panel {
            display: grid;
            gap: 10px;
        }

        .upload-panel.is-emphasized {
            padding: 14px;
            border-radius: 22px;
            border: 1px solid rgba(59, 130, 246, 0.24);
            background: linear-gradient(135deg, rgba(239, 246, 255, 0.92) 0%, rgba(248, 250, 252, 0.98) 100%);
            box-shadow: 0 16px 34px rgba(59, 130, 246, 0.12);
        }

        .upload-preview-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
            gap: 10px;
        }

        .upload-preview {
            overflow: hidden;
            border-radius: 14px;
            border: 1px solid var(--line);
            background: #fff;
        }

        .upload-preview img,
        .upload-preview video {
            height: 88px;
        }

        .upload-file-name {
            padding: 8px 9px;
            color: #697486;
            font-size: 11px;
            line-height: 1.6;
            word-break: break-all;
        }

        .file-input {
            display: none;
        }

        .file-drop-overlay {
            position: fixed;
            inset: 14px;
            z-index: 300;
            display: grid;
            place-items: center;
            border: 2px dashed rgba(37, 99, 235, 0.5);
            border-radius: 28px;
            background: rgba(239, 246, 255, 0.9);
            backdrop-filter: blur(12px);
            pointer-events: none;
            opacity: 0;
            visibility: hidden;
            transform: scale(0.985);
            transition: opacity .16s ease, visibility .16s ease, transform .16s ease;
        }

        body.is-file-dragging .file-drop-overlay {
            opacity: 1;
            visibility: visible;
            transform: scale(1);
        }

        .file-drop-card {
            width: min(420px, calc(100vw - 56px));
            padding: 28px 24px;
            border: 1px solid rgba(37, 99, 235, 0.16);
            border-radius: 24px;
            background: rgba(255, 255, 255, 0.96);
            box-shadow: 0 24px 60px rgba(37, 99, 235, 0.18);
            text-align: center;
        }

        .file-drop-icon {
            width: 54px;
            height: 54px;
            margin: 0 auto 14px;
            border-radius: 18px;
            display: grid;
            place-items: center;
            background: linear-gradient(135deg, #2f6bff 0%, #2150d8 100%);
            color: #fff;
            box-shadow: 0 14px 28px rgba(37, 99, 235, 0.22);
        }

        .file-drop-icon svg {
            width: 26px;
            height: 26px;
        }

        .file-drop-card strong {
            display: block;
            color: #152238;
            font-size: 18px;
            line-height: 1.4;
        }

        .file-drop-card span {
            display: block;
            margin-top: 6px;
            color: #718096;
            font-size: 13px;
            line-height: 1.6;
        }

        body[data-ui-theme="dark"] .file-drop-overlay {
            background: rgba(9, 16, 30, 0.88);
        }

        body[data-ui-theme="dark"] .file-drop-card {
            border-color: rgba(96, 165, 250, 0.24);
            background: rgba(20, 29, 46, 0.96);
        }

        body[data-ui-theme="dark"] .file-drop-card strong {
            color: #eef4ff;
        }

        body[data-ui-theme="dark"] .file-drop-card span {
            color: #9aa9bf;
        }

        .image-studio-popover-backdrop {
            display: none;
        }

        .iteration-banner {
            padding: 14px;
            border-radius: 18px;
            border: 1px solid rgba(37, 99, 255, 0.16);
            background: linear-gradient(135deg, rgba(37, 99, 255, 0.08) 0%, rgba(21, 185, 172, 0.08) 100%);
        }

        .iteration-banner strong {
            display: block;
            margin-bottom: 4px;
        }

        .mobile-sheet,
        .backdrop {
            display: none;
        }

        .mobile-account-sheet {
            position: fixed;
            top: 14px;
            right: 14px;
            width: min(360px, calc(100vw - 28px));
            padding: 18px;
            z-index: 60;
            background: rgba(255, 255, 255, 0.98);
            backdrop-filter: blur(18px);
            border: 1px solid var(--line);
            border-radius: 24px;
            box-shadow: var(--shadow);
            transform: translateX(calc(100% + 24px));
            transition: transform .24s ease;
            display: block;
        }

        .backdrop {
            position: fixed;
            inset: 0;
            z-index: 50;
            background: rgba(15, 23, 42, 0.16);
            backdrop-filter: blur(4px);
        }

        body.mobile-account-open .backdrop {
            display: block;
        }

        body.mobile-account-open .mobile-account-sheet {
            transform: translateX(0);
        }

        body.mobile-nav-open {
            overflow: hidden;
        }

        body.mobile-record-history {
            overflow: hidden;
        }

        body.show-record-history[data-mode="image"] .app,
        body.show-record-history[data-mode="video"] .app {
            grid-template-columns: 112px 320px minmax(0, 1fr);
        }

        body.show-record-history[data-mode="image"] .history,
        body.show-record-history[data-mode="video"] .history {
            display: grid;
        }

        body.show-record-history .task-list {
            grid-template-columns: 1fr;
            align-content: start;
        }

        body.show-record-history .history-main {
            gap: 12px;
            padding-right: 2px;
        }

        body.show-record-history[data-tool-mode="image"] .history .task-list,
        body.show-record-history[data-tool-mode="video"] .history .task-list {
            display: grid !important;
        }

        body.show-record-history[data-tool-mode="image"] .history .pagination,
        body.show-record-history[data-tool-mode="video"] .history .pagination {
            display: flex !important;
        }

        body.show-record-history .task-item {
            grid-template-columns: 84px minmax(0, 1fr);
            gap: 10px;
            align-items: start;
            min-height: 0;
            padding: 10px;
            border-radius: 16px;
        }

        body.show-record-history .task-thumb {
            height: 84px;
            min-height: 84px;
            background: #f3f6fb;
            border-radius: 14px;
        }

        body.show-record-history .task-thumb img,
        body.show-record-history .task-thumb video {
            width: 100%;
            height: 100%;
            object-fit: contain;
            object-position: center;
            display: block;
            background: #f3f6fb;
        }

        body.show-record-history .task-headline {
            gap: 4px;
            margin-bottom: 0;
        }

        body.show-record-history .task-title {
            font-size: 13px;
            line-height: 1.45;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }

        body.show-record-history .pagination {
            margin-top: 4px;
            padding-top: 10px;
            flex-direction: column;
            align-items: stretch;
            gap: 8px;
        }

        body.show-record-history .pagination-actions {
            justify-content: space-between;
        }

        body[data-mode="image"] .task-thumb,
        body[data-mode="video"] .task-thumb {
            min-height: 72px;
        }

        @media (max-width: 1420px) {
            .app {
                grid-template-columns: 104px 296px minmax(0, 1fr);
            }

            body[data-mode="image"] .app,
            body[data-mode="video"] .app {
                grid-template-columns: 104px 296px minmax(0, 1fr);
            }

            body.show-record-history[data-mode="image"] .app,
            body.show-record-history[data-mode="video"] .app {
                grid-template-columns: 104px 296px minmax(0, 1fr);
            }

            body[data-mode="image"] .workspace-records .task-list,
            body[data-mode="video"] .workspace-records .task-list {
                grid-template-columns: repeat(4, minmax(0, 1fr));
            }

            .field-grid {
                grid-template-columns: repeat(2, minmax(0, 1fr));
            }
        }

        @media (max-width: 1360px) {
            .app {
                width: min(100vw - 18px, 100%);
                grid-template-columns: 92px 276px minmax(0, 1fr);
                gap: 12px;
                padding: 9px 0;
            }

            body[data-mode="image"] .app,
            body[data-mode="video"] .app,
            body.show-record-history[data-mode="image"] .app,
            body.show-record-history[data-mode="video"] .app {
                grid-template-columns: 92px 276px minmax(0, 1fr);
            }

            body[data-tool-mode="image"] .app,
            body[data-tool-mode="video"] .app {
                grid-template-columns: var(--chat-sidebar-width) var(--chat-sidebar-resizer-width) minmax(0, 1fr);
            }

            .rail {
                top: 9px;
                min-height: calc(100vh - 18px);
                padding: 12px 8px;
            }

            .history {
                top: 9px;
                min-height: calc(100vh - 18px);
                max-height: calc(100vh - 18px);
                padding: 14px;
                gap: 12px;
            }

            .workspace,
            body[data-mode="chat"] .workspace {
                min-height: calc(100vh - 18px);
                height: calc(100vh - 18px);
                max-height: calc(100vh - 18px);
            }

            .rail-icon {
                padding: 0 6px;
                gap: 6px;
                font-size: 12px;
            }

            .composer,
            .result-card {
                border-radius: 22px;
            }
        }

        @media (max-width: 1160px) {
            .hero {
                flex-direction: column;
                align-items: stretch;
            }

            .hero-user {
                min-width: 0;
            }

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

        @media (max-width: 920px) {
            html,
            body {
                width: 100%;
                max-width: 100vw;
                overflow-x: hidden;
            }

            .site-topbar {
                display: none;
            }

            .app {
                width: 100%;
                max-width: 100vw;
                grid-template-columns: 1fr;
                gap: 10px;
                padding: 0;
                overflow-x: hidden;
            }

            body[data-mode="chat"] .app {
                width: 100%;
                grid-template-columns: 1fr;
                gap: 0;
                padding: 0;
            }

            body[data-tool-mode="image"] .app,
            body[data-tool-mode="video"] .app {
                width: 100%;
                grid-template-columns: 1fr;
                gap: 10px;
                padding: 0;
            }

            .rail {
                display: none !important;
            }

            .workspace {
                order: 1;
                min-height: 100vh;
                grid-template-rows: auto minmax(0, 1fr) auto;
                width: 100%;
                max-width: 100vw;
                padding: 0;
                gap: 0;
                overflow-x: hidden;
            }

            body[data-tool-mode="image"] .workspace,
            body[data-tool-mode="video"] .workspace {
                display: grid;
            }

            body[data-mode="chat"] .workspace {
                width: 100%;
                min-width: 0;
                height: 100vh;
                max-height: 100vh;
                padding: 0;
            }

            body[data-mode="chat"] .result-content,
            body[data-mode="chat"] .chat-area,
            body[data-mode="chat"] #chat-compose-field,
            body[data-mode="chat"] .chat-thread-card,
            body[data-mode="chat"] .chat-thread {
                width: 100% !important;
                max-width: 100% !important;
                min-width: 0 !important;
                margin-left: 0 !important;
                margin-right: 0 !important;
                box-sizing: border-box;
            }

            body[data-mode="chat"] .chat-area {
                padding-right: 0;
            }

            body[data-mode="chat"] .chat-bubble {
                max-width: min(100%, 100%) !important;
                min-width: 0;
                width: fit-content;
            }

            body[data-mode="chat"] .chat-bubble.user {
                margin-left: auto;
            }

            body[data-mode="chat"] .bubble-actions,
            body[data-mode="chat"] .chat-message-media,
            body[data-mode="chat"] .chat-message-attachments {
                width: 100%;
                max-width: 100%;
                min-width: 0;
            }

            .workspace-records {
                display: none !important;
            }

            body.workspace-creations-open[data-tool-mode="image"] .workspace-records,
            body.workspace-creations-open[data-tool-mode="video"] .workspace-records {
                display: grid !important;
                position: fixed;
                inset: 0;
                z-index: 70;
                grid-template-rows: auto minmax(0, 1fr) auto;
                width: 100vw;
                max-width: 100vw;
                height: 100vh;
                padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px calc(env(safe-area-inset-bottom, 0px) + 12px);
                box-sizing: border-box;
                gap: 12px;
                margin: 0;
                border-radius: 0;
                background: rgba(248, 250, 252, 0.98);
                overflow: hidden;
            }

            body.workspace-creations-open[data-tool-mode="image"] .workspace-disclaimer,
            body.workspace-creations-open[data-tool-mode="video"] .workspace-disclaimer {
                display: none;
            }

            body.workspace-creations-open[data-tool-mode="image"] .workspace-records .section-head,
            body.workspace-creations-open[data-tool-mode="video"] .workspace-records .section-head {
                display: flex;
                align-items: center;
                justify-content: flex-start;
                gap: 10px;
                padding: 2px 2px 0;
                flex: 0 0 auto;
            }

            body.workspace-creations-open[data-tool-mode="image"] .workspace-records .section-head > div,
            body.workspace-creations-open[data-tool-mode="video"] .workspace-records .section-head > div {
                min-width: 0;
            }

            body.workspace-creations-open[data-tool-mode="image"] #mobile-workspace-creations-back,
            body.workspace-creations-open[data-tool-mode="video"] #mobile-workspace-creations-back {
                display: inline-flex;
                min-height: 34px;
                padding: 0 12px;
                border-radius: 999px;
                flex: 0 0 auto;
            }

            body.workspace-creations-open[data-tool-mode="image"] .workspace-records .task-list,
            body.workspace-creations-open[data-tool-mode="video"] .workspace-records .task-list {
                display: grid !important;
                grid-template-columns: repeat(2, minmax(0, 1fr));
                gap: 10px;
            }

            body.workspace-creations-open[data-tool-mode="image"] .workspace-records-slot,
            body.workspace-creations-open[data-tool-mode="video"] .workspace-records-slot {
                min-height: 0;
                overflow-y: auto;
                overflow-x: hidden;
                padding: 0 0 6px;
                align-content: start;
            }

            body.workspace-creations-open[data-tool-mode="image"] .workspace-records .task-date-group,
            body.workspace-creations-open[data-tool-mode="video"] .workspace-records .task-date-group {
                gap: 10px;
            }

            body.workspace-creations-open[data-tool-mode="image"] .workspace-records .task-date-group-list,
            body.workspace-creations-open[data-tool-mode="video"] .workspace-records .task-date-group-list {
                display: grid;
                grid-template-columns: repeat(2, minmax(0, 1fr));
                gap: 10px;
            }

            body.workspace-creations-open[data-tool-mode="image"] .workspace-records .task-item,
            body.workspace-creations-open[data-tool-mode="video"] .workspace-records .task-item {
                grid-template-columns: 1fr;
                gap: 8px;
                min-height: 196px;
                padding: 10px;
            }

            body.workspace-creations-open[data-tool-mode="image"] .workspace-records .task-thumb,
            body.workspace-creations-open[data-tool-mode="video"] .workspace-records .task-thumb {
                height: 106px;
                min-height: 106px;
            }

            body.workspace-creations-open[data-tool-mode="image"] .workspace-records .task-thumb img,
            body.workspace-creations-open[data-tool-mode="image"] .workspace-records .task-thumb video,
            body.workspace-creations-open[data-tool-mode="video"] .workspace-records .task-thumb img,
            body.workspace-creations-open[data-tool-mode="video"] .workspace-records .task-thumb video {
                width: 100%;
                height: 100%;
                object-fit: contain;
                background: #f3f6fb;
            }

            body.workspace-creations-open[data-tool-mode="image"] .workspace-records .task-main,
            body.workspace-creations-open[data-tool-mode="video"] .workspace-records .task-main {
                display: grid;
                grid-template-rows: minmax(2.9em, auto) auto;
                align-content: start;
                gap: 6px;
            }

            body.workspace-creations-open[data-tool-mode="image"] .workspace-records .task-headline,
            body.workspace-creations-open[data-tool-mode="video"] .workspace-records .task-headline {
                gap: 6px;
                margin-bottom: 0;
            }

            body.workspace-creations-open[data-tool-mode="image"] .workspace-records .task-title,
            body.workspace-creations-open[data-tool-mode="video"] .workspace-records .task-title {
                display: block;
                color: #182235;
                line-height: 1.45;
                min-height: 2.9em;
                white-space: normal;
                display: -webkit-box;
                -webkit-line-clamp: 2;
                -webkit-box-orient: vertical;
                overflow: hidden;
                text-overflow: ellipsis;
                font-size: 13px;
            }

            body.workspace-creations-open[data-tool-mode="image"] .workspace-records .task-main .task-meta,
            body.workspace-creations-open[data-tool-mode="video"] .workspace-records .task-main .task-meta {
                display: none;
            }

            body.workspace-creations-open[data-tool-mode="image"] .workspace-records .task-status-line,
            body.workspace-creations-open[data-tool-mode="video"] .workspace-records .task-status-line {
                margin-top: 2px;
            }

            body.workspace-creations-open[data-tool-mode="image"] .workspace-records .pagination,
            body.workspace-creations-open[data-tool-mode="video"] .workspace-records .pagination {
                display: grid !important;
                grid-template-columns: 1fr;
                gap: 10px;
                margin-top: 0;
                padding: 10px 2px 0;
                align-items: stretch;
                justify-items: stretch;
                flex: 0 0 auto;
                border-top: 1px solid rgba(15, 23, 42, 0.08);
                background: rgba(248, 250, 252, 0.98);
            }

            body.workspace-creations-open[data-tool-mode="image"] .workspace-records #task-pagination-text,
            body.workspace-creations-open[data-tool-mode="video"] .workspace-records #task-pagination-text {
                text-align: center;
                line-height: 1.6;
                font-size: 11px;
                white-space: normal;
                word-break: keep-all;
            }

            body.workspace-creations-open[data-tool-mode="image"] .workspace-records .pagination-actions,
            body.workspace-creations-open[data-tool-mode="video"] .workspace-records .pagination-actions {
                display: grid;
                grid-template-columns: repeat(2, minmax(0, 1fr));
                gap: 8px;
                width: 100%;
            }

            body.workspace-creations-open[data-tool-mode="image"] .workspace-records .pagination-actions .btn,
            body.workspace-creations-open[data-tool-mode="video"] .workspace-records .pagination-actions .btn {
                width: 100%;
                min-width: 0;
                justify-content: center;
            }

            .mobile-chat-topbar {
                display: grid;
                grid-template-columns: auto 1fr auto;
                align-items: center;
                gap: 10px;
                width: 100vw;
                max-width: 100vw;
                box-sizing: border-box;
                padding: 10px 12px 16px;
                position: sticky;
                top: 0;
                z-index: 20;
                background: linear-gradient(180deg, rgba(251,252,254,0.98) 0%, rgba(251,252,254,0.92) 100%);
                backdrop-filter: blur(12px);
                border-bottom: 1px solid rgba(15, 23, 42, 0.06);
                overflow: hidden;
            }

            body[data-ui-theme="dark"] .mobile-chat-topbar {
                background: linear-gradient(180deg, rgba(8, 15, 28, 0.98) 0%, rgba(8, 15, 28, 0.84) 100%);
                border-bottom: 1px solid rgba(148, 163, 184, 0.12);
            }

            .mobile-chat-topbar .mobile-topbar-spacer {
                display: none;
            }

            .mobile-chat-bar {
                display: flex;
                align-items: center;
                justify-content: flex-start;
                min-width: 0;
                width: 100%;
                overflow: hidden;
            }

            .mobile-chat-brand {
                display: none;
            }

            .mobile-chat-brand strong {
                display: block;
                font-size: 14px;
                line-height: 1.2;
                color: #121826;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
            }

            .mobile-chat-brand span {
                display: none;
                margin-top: 2px;
                color: #9aa3b2;
                font-size: 10px;
                line-height: 1.2;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
            }

            .mobile-chat-actions {
                display: inline-flex;
                align-items: center;
                gap: 8px;
                flex: 0 0 auto;
                justify-self: end;
                position: fixed;
                top: 10px;
                right: 12px;
                z-index: 32;
            }

            .mobile-chat-link,
            .mobile-chat-btn {
                min-height: 34px;
                padding: 0 14px;
                border-radius: 999px;
                font-size: 12px;
                font-weight: 700;
            }

            .mobile-chat-link {
                color: #121826;
                background: rgba(255, 255, 255, 0.94);
                border: 1px solid rgba(15, 23, 42, 0.08);
            }

            .mobile-chat-link[data-safety-center-link] {
                min-height: 30px;
                padding: 0;
                border: 0;
                border-radius: 0;
                background: transparent;
                color: #71809a;
                font-size: 13px;
                font-weight: 600;
            }

            .mobile-chat-link.active {
                color: #1d4ed8;
                background: rgba(219, 234, 254, 0.96);
                border-color: rgba(59, 130, 246, 0.22);
            }

            .mobile-chat-btn {
                border: none;
                color: #fff;
                background: linear-gradient(135deg, #1c2430 0%, #111827 100%);
            }

            .mobile-nav-trigger,
            .mobile-chat-btn {
                flex: 0 0 auto;
            }

            .hero {
                padding: 16px;
            }

            .hero-brand-text strong {
                font-size: 14px;
            }

            .hero-brand-text span,
            .hero-desc {
                display: none;
            }

            .hero-title {
                margin-top: 10px;
                font-size: 16px;
            }

            .history {
                position: fixed;
                left: 0;
                top: 0;
                bottom: 0;
                width: min(84vw, 340px);
                min-height: 100vh;
                max-height: 100vh;
                padding: 18px 14px 20px;
                border-radius: 0 28px 28px 0;
                z-index: 80;
                background: #f5f6f8;
                transform: translateX(calc(-100% - 12px));
                transition: transform .26s ease;
                overflow: hidden;
                box-shadow: 0 24px 54px rgba(15, 23, 42, 0.16);
            }

            .hero-user {
                display: none;
            }

            body.mobile-nav-open .history {
                transform: translateX(0);
            }

            body.mobile-nav-open .backdrop {
                display: block;
            }

            .history-switch {
                align-self: flex-start;
            }

            .history-head {
                margin-bottom: 4px;
                align-items: flex-start;
            }

            .history-title {
                font-size: 15px;
            }

            .history-subtitle,
            #history-subtitle {
                display: none;
            }

            .history-actions {
                display: grid !important;
                gap: 10px;
                margin-bottom: 8px;
            }

            .history-actions .btn {
                width: 100%;
                justify-content: flex-start;
                border-radius: 20px;
                padding: 14px 16px;
                background: #fff;
            }

            .mobile-history-inline {
                display: flex;
                align-items: center;
                justify-content: flex-end;
                gap: 8px;
                flex: 0 0 auto;
                max-width: 52%;
                min-width: 0;
            }

            .mobile-history-inline-name {
                display: inline-flex;
                align-items: center;
                gap: 4px;
                font-size: 10px;
                line-height: 1.2;
                color: #8a94a6;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
                max-width: 100%;
                min-width: 0;
            }

            .mobile-history-inline-label {
                color: #a2acbb;
                flex: 0 0 auto;
            }

            .mobile-history-inline-value {
                overflow: hidden;
                text-overflow: ellipsis;
            }

            .mobile-history-inline .btn {
                min-height: 0;
                padding: 0;
                border: none;
                background: transparent;
                box-shadow: none;
                border-radius: 999px;
                font-size: 10px;
                font-weight: 600;
                line-height: 1.2;
                color: #5f6f86;
            }

            .mobile-history-inline .btn:active,
            .mobile-history-inline .btn:hover {
                color: #1f4fd6;
                background: transparent;
            }

            .mobile-history-account {
                display: none;
            }

            body.mobile-record-history #new-conversation-btn,
            body.mobile-record-history .conversation-list {
                display: none !important;
            }

            body.mobile-record-history .task-list,
            body.mobile-record-history .pagination {
                display: grid !important;
            }

            body.mobile-record-history .pagination {
                display: flex !important;
            }

            body.mobile-record-history .task-list {
                grid-template-columns: repeat(2, minmax(0, 1fr));
                gap: 10px;
            }

            body.mobile-record-history.mobile-creations-history .task-list {
                grid-template-columns: 1fr;
                gap: 16px;
            }

            body.mobile-record-history.mobile-creations-history .task-date-group {
                gap: 10px;
            }

            body.mobile-record-history.mobile-creations-history .task-date-group-list {
                display: grid;
                grid-template-columns: repeat(2, minmax(0, 1fr));
                gap: 10px;
            }

            body.mobile-record-history .task-item {
                grid-template-columns: 1fr;
                gap: 10px;
                min-height: 210px;
            }

            body.mobile-record-history .task-thumb {
                height: 124px;
                min-height: 124px;
            }

            body.mobile-record-history .task-thumb img,
            body.mobile-record-history .task-thumb video {
                width: 100%;
                height: 100%;
                object-fit: contain;
                background: #f3f6fb;
            }

            body.mobile-record-history .task-title {
                display: block;
                line-height: 1.45;
                height: 1.45em;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
            }

            .conversation-list,
            .task-list {
                max-height: none;
                overflow: visible;
                padding-right: 0;
            }

            .conversation-list {
                gap: 10px;
            }

            .pagination {
                margin-top: 0;
            }

            .mobile-account-sheet {
                top: 10px;
                left: 10px;
                right: 10px;
                padding: 16px;
                transform: translateY(calc(-100% - 16px));
                transition: transform .24s ease;
            }

            body.mobile-account-open .mobile-account-sheet {
                transform: translateY(0);
            }

            .panel-toggle {
                display: inline-flex;
                align-items: center;
                justify-content: center;
                border: none;
                background: transparent;
                color: #788295;
                font-size: 12px;
                font-weight: 700;
                cursor: pointer;
                padding: 0;
            }

            .composer {
                padding: 14px;
            }

            .composer-top {
                flex-direction: column;
                align-items: stretch;
            }

            .toolbar-group {
                width: 100%;
                justify-content: space-between;
                gap: 8px;
            }

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

            .mode-switch {
                display: none;
            }

            .composer-actions {
                justify-content: space-between;
            }

            .status-text {
                width: 100%;
            }

            .toast-stack {
                right: 12px;
                left: 12px;
                bottom: 14px;
            }

            .toast {
                min-width: 0;
                max-width: none;
            }

            .result-card {
                padding: 0;
                border-radius: 0;
                border: none;
                background: transparent;
                box-shadow: none;
            }

            body[data-mode="chat"] .result-card {
                min-height: calc(100vh - 142px);
            }

            body[data-mode="chat"] .section-head {
                display: none;
            }

            body[data-mode="chat"] .result-content {
                height: calc(100vh - 174px);
                max-height: calc(100vh - 174px);
                padding: 16px 12px 0;
                scroll-padding-top: 18px;
            }

            body[data-mode="chat"] .chat-area,
            body[data-mode="chat"] .chat-thread-card,
            body[data-mode="chat"] .chat-thread {
                padding-top: 0;
                box-sizing: border-box;
            }

            body[data-mode="chat"] .chat-area:not(.hidden) {
                padding-top: calc(env(safe-area-inset-top, 0px) + 56px);
                scroll-padding-top: calc(env(safe-area-inset-top, 0px) + 72px);
            }

            body.mobile-record-history[data-mode="chat"] .section-head {
                display: flex;
            }

            .chat-bubble {
                max-width: 100%;
                font-size: 13px;
                line-height: 1.8;
            }

            .chat-empty {
                width: 100%;
                gap: 16px;
            }

            body[data-mode="chat"] .chat-empty {
                min-height: auto;
                align-content: start;
                padding-top: 20px;
            }

            .chat-empty-title {
                font-size: 18px;
            }

            .chat-empty-desc {
                font-size: 13px;
            }

            .chat-empty-actions {
                width: 100%;
            }

            .chat-empty-grid {
                grid-template-columns: repeat(2, minmax(0, 1fr));
                justify-content: stretch;
                gap: 10px;
            }

            .office-task-grid {
                width: 100%;
                grid-template-columns: repeat(2, minmax(0, 1fr));
                gap: 10px;
            }

            .office-task-card {
                gap: 10px;
                padding: 13px 12px 12px;
                border-radius: 18px;
            }

            .office-task-card-head {
                gap: 8px;
            }

            .office-task-card-format {
                min-width: 46px;
                min-height: 24px;
                padding: 0 9px;
                font-size: 11px;
            }

            .office-task-card-arrow {
                font-size: 15px;
            }

            .office-task-card-copy {
                gap: 5px;
            }

            .office-task-card-title {
                font-size: 14px;
                line-height: 1.35;
            }

            .office-task-card-desc {
                font-size: 12px;
                line-height: 1.5;
                display: -webkit-box;
                -webkit-line-clamp: 2;
                -webkit-box-orient: vertical;
                overflow: hidden;
            }

            .office-task-card-foot {
                font-size: 11px;
            }

            body[data-mode="chat"] .office-task-grid .office-task-card:nth-child(n+5) {
                display: none;
            }

            .chat-empty-chip {
                width: 100%;
                min-width: 0;
                min-height: 42px;
                padding: 10px 14px;
                border-radius: 16px;
            }

            .chat-input-wrap textarea {
                min-height: 92px;
                border-radius: 24px;
                padding: 14px 112px 12px 16px;
                font-size: 14px;
            }

            .chat-input-hint {
                top: 14px;
                left: 16px;
                right: 92px;
                font-size: 14px;
            }

            .chat-quick-actions,
            .composer-capability-bar {
                display: none !important;
            }

            body[data-mode="chat"][data-chat-entry-mode="work"] .work-skill-bar {
                display: flex !important;
                margin-top: 8px;
                padding: 0 4px;
                border-top: none;
            }

            .work-skill-menu {
                left: 4px;
                min-width: 152px;
            }

            .mobile-chat-toolbar {
                position: relative;
                display: inline-flex;
                align-items: center;
                gap: 8px;
                margin-top: 8px;
                padding: 0 4px;
            }

            .mobile-chat-toolbar-btn {
                min-height: 34px;
                padding: 0 14px;
                border-radius: 999px;
                background: rgba(255, 255, 255, 0.92);
                border: 1px solid rgba(15, 23, 42, 0.06);
                box-shadow: 0 4px 10px rgba(15, 23, 42, 0.04);
            }

            .manual-model-list {
                grid-template-columns: 1fr;
            }

            .auth-dialog {
                width: min(680px, calc(100vw - 20px));
                padding: 22px;
            }

            .auth-layout {
                grid-template-columns: 1fr;
                gap: 18px;
            }

            .auth-dialog-head h3 {
                font-size: 20px;
            }

            .auth-aside {
                padding: 0;
                border-left: none;
            }

            .auth-preview-card {
                min-height: 0;
            }

            .send-btn {
                width: 38px;
                height: 38px;
            }

            #mobile-history-sheet,
            #mobile-composer-sheet {
                display: none !important;
            }

            #mobile-history-shortcut,
            #mobile-composer-shortcut,
            #mobile-account-open,
            #mobile-history-open,
            #mobile-composer-open {
                display: none !important;
            }

            body[data-mode="chat"] .composer {
                width: 100%;
                margin: auto auto 0;
                padding: 8px 8px 10px;
                border-radius: 0;
            }
        }

        @media (max-width: 560px) {
            .hero {
                padding: 16px;
            }

            .hero-brand-text strong {
                font-size: 14px;
            }

            .hero-title {
                font-size: 22px;
            }

            .chat-empty-title {
                font-size: 24px;
            }

            body[data-mode="chat"] .chat-empty {
                gap: 14px;
                padding-top: 12px;
            }

            body[data-mode="chat"] .chat-empty-copy {
                gap: 8px;
                margin-bottom: 16px;
            }

            body[data-mode="chat"] .chat-empty-desc {
                max-width: 300px;
                font-size: 12px;
            }

            body[data-mode="chat"] .chat-empty-grid {
                width: min(320px, 100%);
                gap: 8px;
            }

            body[data-mode="chat"] .chat-empty-chip {
                min-height: 36px;
                padding: 9px 11px;
                border-radius: 12px;
                font-size: 11px;
            }

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

            .result-card,
            .composer {
                padding: 14px;
            }

            .workspace-disclaimer {
                padding: 0 6px 16px;
                font-size: 11px;
                line-height: 1.45;
            }

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

            .task-list {
                grid-template-columns: 1fr;
            }

            .task-item {
                grid-template-columns: 1fr;
            }

            .task-thumb {
                min-height: 156px;
            }
        }

        .workspace-chat-header {
            position: sticky;
            top: 0;
            z-index: 18;
            display: grid;
            grid-template-columns: 52px minmax(0, 1fr) auto;
            align-items: center;
            gap: 12px;
            min-height: 86px;
            padding: 0;
            background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(255,255,255,0.92) 82%, rgba(255,255,255,0) 100%);
            backdrop-filter: blur(14px);
        }

        body[data-ui-theme="dark"] .workspace-chat-header {
            background: linear-gradient(180deg, rgba(8, 15, 28, 0.96) 0%, rgba(8, 15, 28, 0.84) 82%, rgba(8, 15, 28, 0) 100%);
        }

        .image-create-studio {
            display: none;
            padding: 18px 0 8px;
        }

        .image-studio-mobile-hero {
            display: none;
        }

        .image-studio-shell {
            display: grid;
            gap: 18px;
            width: min(1260px, 100%);
            margin: 0 auto;
        }

        .image-studio-hero {
            display: grid;
            grid-template-columns: minmax(0, 1fr) 300px;
            gap: 18px;
            align-items: stretch;
        }

        .image-studio-prompt-card,
        .image-studio-sidecard {
            border-radius: 28px;
            background: #fff;
            border: 1px solid rgba(15, 23, 42, 0.05);
            box-shadow: 0 18px 42px rgba(15, 23, 42, 0.06);
        }

        .image-studio-prompt-card {
            display: grid;
            gap: 16px;
            padding: 24px 24px 24px;
        }

        .image-studio-prompt-card > .image-studio-template-panel {
            margin: -4px 0 0;
        }

        .image-studio-input-shell {
            position: relative;
            margin: 10px 12px 0;
            border-radius: 24px;
            background: rgba(248, 250, 252, 0.92);
            border: 1px solid rgba(96, 135, 255, 0.18);
            box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
            overflow: hidden;
        }

        .image-studio-input {
            width: 100%;
            min-height: 172px;
            resize: vertical;
            border: none;
            background: transparent;
            color: #111827;
            font-size: 17px;
            line-height: 1.9;
            outline: none;
            display: block;
            padding: 18px 136px 20px 18px;
        }

        .image-studio-input::placeholder {
            color: #b4bcc9;
            opacity: 1;
        }

        .image-studio-input-tools {
            position: absolute;
            left: 14px;
            right: 14px;
            bottom: 14px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            z-index: 3;
            pointer-events: auto;
        }

        .image-studio-input-action-group {
            display: inline-flex;
            align-items: center;
            gap: 6px;
        }

        .image-studio-toolbar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 14px;
            padding: 4px 0 4px;
        }

        .image-studio-toolbar-left {
            display: flex;
            align-items: center;
            gap: 10px;
            flex-wrap: wrap;
            min-width: 0;
        }

        .image-studio-toolbar-right {
            display: flex;
            align-items: center;
            gap: 8px;
            flex-wrap: wrap;
            justify-content: flex-end;
        }

        .image-studio-pill {
            min-height: 34px;
            padding: 0 14px;
            border-radius: 999px;
            background: #f3f5f9;
            color: #111827;
            font-size: 14px;
            font-weight: 700;
            display: inline-flex;
            align-items: center;
        }

        .image-studio-tool-link {
            min-height: 34px;
            padding: 0 4px;
            border: none;
            background: transparent;
            color: #111827;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
        }

        .image-studio-tool-meta {
            color: #6b7280;
            font-size: 13px;
            line-height: 1.7;
        }

        .image-studio-inline-btn {
            min-height: 34px;
            padding: 0 14px;
            border-radius: 999px;
            border: 1px solid rgba(15, 23, 42, 0.08);
            background: #fff;
            color: #1f2937;
            font-size: 13px;
            font-weight: 600;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            cursor: pointer;
            transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
            white-space: nowrap;
        }

        .image-studio-inline-btn:hover {
            background: #f8fbff;
            border-color: rgba(37, 99, 255, 0.16);
            color: #1748c7;
            transform: translateY(-1px);
        }

        .image-studio-inline-btn.active {
            background: rgba(37, 99, 255, 0.1);
            border-color: rgba(37, 99, 255, 0.18);
            color: #1748c7;
        }

        .image-studio-send-btn {
            width: 40px;
            height: 40px;
            border: none;
            border-radius: 50%;
            background: linear-gradient(135deg, #2f6bff 0%, #2150d8 100%);
            color: #fff;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            box-shadow: 0 12px 28px rgba(37, 99, 255, 0.24);
            flex: 0 0 40px;
        }

        .image-studio-voice-btn {
            width: 36px;
            height: 36px;
            padding: 0;
            border: 0;
            border-radius: 50%;
            background: transparent;
            color: #334155;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
        }

        .image-studio-voice-btn:hover {
            background: #f1f5f9;
            color: #1d4ed8;
        }

        .image-studio-voice-btn.is-listening {
            background: #eef3fb;
            color: #1d4ed8;
            box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
        }

        .image-studio-voice-btn:disabled {
            cursor: not-allowed;
            opacity: 0.55;
        }

        .image-studio-voice-btn svg {
            width: 18px;
            height: 18px;
            display: block;
        }

        .image-studio-send-btn.is-voice {
            background: linear-gradient(135deg, #2563eb 0%, #4f7cff 100%);
            color: #ffffff;
            box-shadow: 0 14px 28px rgba(37, 99, 235, 0.22);
        }

        .image-studio-send-btn svg {
            width: 18px;
            height: 18px;
            display: block;
        }

        .image-studio-sidecard {
            padding: 20px 18px;
            display: grid;
            gap: 12px;
            align-content: start;
            background:
                radial-gradient(circle at top right, rgba(37, 99, 255, 0.08), transparent 38%),
                linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
        }

        .image-studio-sidecard-badge {
            width: fit-content;
            min-height: 28px;
            padding: 0 12px;
            border-radius: 999px;
            background: rgba(37, 99, 255, 0.09);
            color: #2150d8;
            font-size: 12px;
            font-weight: 700;
            display: inline-flex;
            align-items: center;
        }

        .image-studio-sidecard h3 {
            margin: 0;
            font-size: 20px;
            line-height: 1.4;
            color: #0f172a;
        }

        .image-studio-sidecard p,
        .image-studio-sidecard-tip {
            margin: 0;
            color: #64748b;
            font-size: 13px;
            line-height: 1.8;
        }

        .image-studio-sidecard-list {
            display: grid;
            gap: 10px;
            margin-top: 2px;
        }

        .image-studio-sidecard-item {
            padding: 10px 12px;
            border-radius: 16px;
            background: rgba(255, 255, 255, 0.88);
            border: 1px solid rgba(15, 23, 42, 0.04);
        }

        .image-studio-sidecard-item strong {
            display: block;
            margin-bottom: 4px;
            color: #111827;
            font-size: 13px;
            line-height: 1.4;
        }

        .image-studio-sidecard-item span {
            display: block;
            color: #64748b;
            font-size: 12px;
            line-height: 1.7;
        }

        .image-studio-tools {
            display: grid;
            grid-template-columns: repeat(6, minmax(0, 1fr));
            gap: 12px;
        }

        .image-studio-tool-card {
            min-height: 88px;
            border-radius: 18px;
            border: 1px solid rgba(15, 23, 42, 0.08);
            background: #fff;
            padding: 10px 12px;
            display: grid;
            grid-template-columns: minmax(0, 1fr) 52px;
            align-items: center;
            column-gap: 10px;
            row-gap: 2px;
            cursor: pointer;
            transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
        }

        .image-studio-tool-card:hover {
            transform: translateY(-1px);
            border-color: rgba(37, 99, 255, 0.22);
            box-shadow: 0 14px 30px rgba(15, 23, 42, 0.06);
        }

        .image-studio-tool-card.active {
            border-color: rgba(37, 99, 255, 0.3);
            box-shadow: 0 14px 32px rgba(37, 99, 255, 0.12);
            background: linear-gradient(180deg, #ffffff 0%, #f5f9ff 100%);
        }

        .image-studio-tool-thumb {
            grid-column: 2;
            grid-row: 1 / span 2;
            width: 52px;
            height: 52px;
            border-radius: 12px;
            background: linear-gradient(135deg, #e7eefc 0%, #fef6e8 100%);
            position: relative;
            overflow: hidden;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 10px;
            display: inline-flex !important;
        }

        .image-studio-tool-thumb::before,
        .image-studio-tool-thumb::after {
            content: none;
            display: none;
        }

        .image-studio-tool-thumb svg {
            width: 100%;
            height: 100%;
            display: block;
            position: relative;
            z-index: 1;
        }

        .image-studio-tool-card[data-tool-code="generate"] .image-studio-tool-thumb {
            background: linear-gradient(135deg, #dbeafe 0%, #eff6ff 55%, #fff1d6 100%);
        }

        .image-studio-tool-card[data-tool-code="generate"] .image-studio-tool-thumb::after {
            inset: 10px;
            border-radius: 999px;
            background:
                radial-gradient(circle at 36% 48%, rgba(37,99,255,0.18) 0 26%, transparent 27%),
                radial-gradient(circle at 64% 48%, rgba(37,99,255,0.18) 0 26%, transparent 27%),
                rgba(255,255,255,0.82);
        }

        .image-studio-tool-card[data-tool-code="cutout"] .image-studio-tool-thumb {
            background: linear-gradient(135deg, #fdf2f8 0%, #fff7ed 100%);
        }

        .image-studio-tool-card[data-tool-code="cutout"] .image-studio-tool-thumb::after {
            inset: 10px 12px;
            border-radius: 10px;
            background:
                linear-gradient(90deg, rgba(255,255,255,0.95) 0 46%, rgba(255, 196, 147, 0.86) 46% 54%, rgba(255,255,255,0.95) 54% 100%);
        }

        .image-studio-tool-card[data-tool-code="erase"] .image-studio-tool-thumb {
            background: linear-gradient(135deg, #e9f7ef 0%, #fef9c3 100%);
        }

        .image-studio-tool-card[data-tool-code="erase"] .image-studio-tool-thumb::after {
            inset: 10px;
            border-radius: 8px;
            background:
                linear-gradient(135deg, rgba(255,255,255,0.95) 0 48%, rgba(34,197,94,0.18) 48% 58%, rgba(255,255,255,0.95) 58% 100%);
        }

        .image-studio-tool-card[data-tool-code="mark_edit"] .image-studio-tool-thumb {
            background: linear-gradient(135deg, #ede9fe 0%, #e0f2fe 100%);
        }

        .image-studio-tool-card[data-tool-code="mark_edit"] .image-studio-tool-thumb::after {
            inset: 10px;
            border-radius: 8px;
            background:
                linear-gradient(180deg, rgba(255,255,255,0.95) 0 100%);
            box-shadow: inset 0 0 0 2px rgba(124, 58, 237, 0.14);
        }

        .image-studio-tool-card[data-tool-code="mark_edit"] .image-studio-tool-thumb::before {
            content: "";
            position: absolute;
            width: 18px;
            height: 3px;
            border-radius: 999px;
            background: rgba(124, 58, 237, 0.7);
            left: 17px;
            top: 24px;
            transform: rotate(-20deg);
            z-index: 1;
        }

        .image-studio-tool-card[data-tool-code="outpaint"] .image-studio-tool-thumb {
            background: linear-gradient(135deg, #ecfeff 0%, #dbeafe 100%);
        }

        .image-studio-tool-card[data-tool-code="outpaint"] .image-studio-tool-thumb::after {
            inset: 14px;
            border-radius: 6px;
            background: rgba(255,255,255,0.92);
            box-shadow:
                0 0 0 2px rgba(56, 189, 248, 0.12),
                -10px 0 0 -7px rgba(255,255,255,0.72),
                10px 0 0 -7px rgba(255,255,255,0.72);
        }

        .image-studio-tool-card[data-tool-code="enhance"] .image-studio-tool-thumb {
            background: linear-gradient(135deg, #eff6ff 0%, #fef2f2 100%);
        }

        .image-studio-tool-card[data-tool-code="enhance"] .image-studio-tool-thumb::after {
            inset: 10px;
            border-radius: 8px;
            background:
                radial-gradient(circle at 50% 50%, rgba(255,255,255,0.98) 0 34%, rgba(255, 208, 80, 0.58) 35% 42%, rgba(255,255,255,0.82) 43% 100%);
        }

        .image-studio-tool-card strong {
            grid-column: 1;
            font-size: 15px;
            color: #111827;
            line-height: 1.3;
        }

        .image-studio-tool-card span {
            grid-column: 1;
            color: #64748b;
            font-size: 12px;
            line-height: 1.6;
        }

        .image-studio-gallery-head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 14px;
            padding-top: 4px;
        }

        .image-studio-gallery-head strong {
            display: block;
            font-size: 18px;
            color: #0f172a;
            margin-bottom: 4px;
        }

        .image-studio-gallery-head span {
            color: #64748b;
            font-size: 13px;
            line-height: 1.7;
        }

        .image-studio-gallery-refresh {
            min-height: 34px;
            padding: 0 14px;
            border-radius: 999px;
            border: 1px solid rgba(15, 23, 42, 0.08);
            background: #fff;
            color: #111827;
            font-size: 13px;
            font-weight: 600;
            cursor: pointer;
        }

        .image-studio-gallery-filters {
            display: flex;
            align-items: center;
            gap: 10px;
            flex-wrap: wrap;
            margin-top: 8px;
        }

        .image-studio-gallery-filter {
            min-height: 32px;
            padding: 0 12px;
            border-radius: 999px;
            border: 1px solid rgba(15, 23, 42, 0.08);
            background: #fff;
            color: #526074;
            font-size: 12px;
            font-weight: 700;
            cursor: pointer;
            transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
        }

        .image-studio-gallery-filter:hover {
            transform: translateY(-1px);
            border-color: rgba(37, 99, 255, 0.16);
            color: #1748c7;
        }

        .image-studio-gallery-filter.active {
            background: linear-gradient(135deg, #eff6ff 0%, #eef2ff 100%);
            border-color: rgba(37, 99, 255, 0.24);
            color: #1748c7;
            box-shadow: 0 10px 24px rgba(37, 99, 255, 0.1);
        }

        .image-studio-gallery {
            display: grid;
            grid-template-columns: repeat(3, minmax(0, 1fr));
            gap: 12px;
            grid-auto-flow: dense;
        }

        .image-studio-preset-card {
            position: relative;
            min-height: 0;
            aspect-ratio: auto;
            border-radius: 24px;
            overflow: hidden;
            background: #ffffff;
            box-shadow: 0 18px 38px rgba(15, 23, 42, 0.06);
            border: 1px solid rgba(15, 23, 42, 0.06);
            cursor: pointer;
            transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
            display: grid;
            grid-template-rows: minmax(0, auto) auto;
        }

        .image-studio-preset-card:hover {
            transform: translateY(-3px);
            box-shadow: 0 22px 52px rgba(15, 23, 42, 0.1);
            border-color: rgba(37, 99, 255, 0.2);
        }

        .image-studio-preset-card.large {
            grid-column: span 2;
        }

        .image-studio-preset-card.portrait {
        }

        .image-studio-preset-stage {
            position: relative;
            min-height: 272px;
            overflow: hidden;
            background: #edf2ff;
        }

        .image-studio-preset-card.large .image-studio-preset-stage {
            min-height: 256px;
        }

        .image-studio-preset-card.portrait .image-studio-preset-stage {
            min-height: 336px;
        }

        .image-studio-preset-card.square .image-studio-preset-stage {
            min-height: 286px;
        }

        .image-studio-preset-preview {
            position: absolute;
            inset: 0;
        }

        .image-studio-preset-card.pixel .image-studio-preset-preview {
            background:
                radial-gradient(circle at 22% 12%, #ffd84d 0 10%, transparent 10.5%),
                linear-gradient(180deg, #ff8b1f 0%, #ffb02a 58%, #ffcf4a 100%);
        }

        .image-studio-preset-card.pixel .image-studio-preset-preview::after {
            content: "城市\A漫游";
            white-space: pre;
            position: absolute;
            left: 24px;
            top: 58px;
            font-size: 74px;
            line-height: .94;
            font-weight: 900;
            color: #141414;
            text-shadow:
                4px 0 0 #141414,
                -4px 0 0 #141414,
                0 4px 0 #141414,
                0 -4px 0 #141414,
                3px 3px 0 #ffd84d;
        }

        .image-studio-preset-card.toy .image-studio-preset-preview {
            background:
                radial-gradient(circle at 50% 38%, #f7fbff 0 24%, transparent 25%),
                linear-gradient(180deg, #f4f7fb 0%, #eff7ff 100%);
        }

        .image-studio-preset-card.toy .image-studio-preset-preview::after {
            content: "";
            position: absolute;
            width: 118px;
            height: 118px;
            border-radius: 50%;
            left: calc(50% - 59px);
            top: 64px;
            background:
                radial-gradient(circle at 42% 42%, #8fd2ff 0 16%, #fefefe 17% 28%, transparent 29%),
                radial-gradient(circle at 60% 42%, #8fd2ff 0 16%, #fefefe 17% 28%, transparent 29%),
                radial-gradient(circle at 50% 80%, #ffdfde 0 16%, transparent 17%),
                linear-gradient(180deg, #d4f1ff 0%, #84c7ff 100%);
            box-shadow: inset 0 -12px 0 rgba(255,255,255,0.42);
        }

        .image-studio-preset-card.figurine .image-studio-preset-preview {
            background:
                radial-gradient(circle at 20% 18%, rgba(255, 208, 80, 0.44), transparent 24%),
                linear-gradient(180deg, #ffffff 0%, #fffaf0 100%);
        }

        .image-studio-preset-card.figurine .image-studio-preset-preview::after {
            content: "";
            position: absolute;
            inset: 56px 24px 24px;
            background:
                radial-gradient(circle at 26% 32%, #f6c25f 0 10%, transparent 11%),
                radial-gradient(circle at 66% 34%, #edb24f 0 10%, transparent 11%),
                radial-gradient(circle at 48% 66%, #f1c55f 0 10%, transparent 11%),
                linear-gradient(180deg, transparent 0%, transparent 28%, rgba(255,255,255,0.56) 29%, rgba(255,255,255,0.56) 100%);
        }

        .image-studio-preset-card.poster .image-studio-preset-preview {
            background:
                linear-gradient(180deg, #143899 0%, #0e2f80 100%);
        }

        .image-studio-preset-card.poster .image-studio-preset-preview::after {
            content: "";
            position: absolute;
            inset: 0;
            background:
                radial-gradient(circle at 28% 28%, #ffd98a 0 8%, transparent 8.5%),
                radial-gradient(circle at 62% 22%, #ffc66a 0 7%, transparent 7.5%),
                radial-gradient(circle at 54% 48%, #ffe4aa 0 8%, transparent 8.5%),
                linear-gradient(135deg, transparent 0 42%, rgba(255, 209, 92, 0.92) 43% 52%, transparent 53%),
                linear-gradient(45deg, transparent 0 40%, rgba(255, 235, 189, 0.94) 41% 56%, transparent 57%);
            opacity: .9;
        }

        .image-studio-preset-card.sunset .image-studio-preset-preview {
            background:
                linear-gradient(180deg, #65a6ff 0%, #86b9ff 20%, #ffcf9a 76%, #f6e6d4 100%);
        }

        .image-studio-preset-card.sunset .image-studio-preset-preview::after {
            content: "";
            position: absolute;
            inset: 0;
            background:
                radial-gradient(circle at 74% 22%, rgba(255,255,255,0.88) 0 2.8%, transparent 3.2%),
                radial-gradient(circle at 66% 28%, rgba(255,244,215,0.68) 0 5.2%, transparent 5.6%),
                linear-gradient(75deg, transparent 0 72%, rgba(44, 84, 62, 0.9) 73% 75%, transparent 76%),
                linear-gradient(108deg, transparent 0 78%, rgba(37, 88, 61, 0.88) 79% 81%, transparent 82%);
        }

        .image-studio-preset-overlay {
            position: relative;
            padding: 14px 15px 16px;
            background: #ffffff;
            color: #111827;
            display: grid;
            gap: 8px;
            z-index: 1;
        }

        .image-studio-preset-topline {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
        }

        .image-studio-preset-badge {
            min-height: 24px;
            padding: 0 10px;
            border-radius: 999px;
            background: #eef4ff;
            color: #2450d6;
            font-size: 11px;
            font-weight: 700;
            display: inline-flex;
            align-items: center;
        }

        .image-studio-preset-ratio {
            font-size: 11px;
            color: #8a94a6;
        }

        .image-studio-preset-overlay strong {
            font-size: 16px;
            line-height: 1.3;
        }

        .image-studio-preset-overlay p {
            margin: 0;
            font-size: 12px;
            line-height: 1.68;
            color: #6b778b;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 2;
            overflow: hidden;
        }

        .image-studio-preset-meta {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            color: #7c8798;
            font-size: 11px;
            font-weight: 600;
        }

        .image-studio-preset-tool {
            display: inline-flex;
            align-items: center;
            min-height: 24px;
            padding: 0 10px;
            border-radius: 999px;
            background: #f3f6fb;
            color: #34435d;
        }

        .image-studio-preset-meta span:last-child {
            opacity: 0.92;
        }

        .image-studio-preset-action {
            position: absolute;
            top: 14px;
            right: 14px;
            display: flex;
            align-items: flex-start;
            justify-content: flex-end;
            opacity: 0;
            transition: opacity .18s ease;
            z-index: 3;
        }

        .image-studio-preset-card:hover .image-studio-preset-action {
            opacity: 1;
        }

        .image-studio-preset-action button {
            min-height: 34px;
            padding: 0 14px;
            border: none;
            border-radius: 999px;
            background: rgba(255,255,255,0.96);
            color: #111827;
            font-size: 12px;
            font-weight: 700;
            cursor: pointer;
            box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
        }

        .image-studio-preset-index {
            position: absolute;
            left: 14px;
            top: 14px;
            z-index: 2;
            min-width: 34px;
            height: 28px;
            padding: 0 10px;
            border-radius: 999px;
            background: rgba(255, 255, 255, 0.78);
            backdrop-filter: blur(8px);
            color: #111827;
            font-size: 11px;
            font-weight: 800;
            display: inline-flex;
            align-items: center;
            justify-content: center;
        }

        .workspace-chat-header-left,
        .workspace-chat-header-center,
        .workspace-chat-header-right {
            display: flex;
            align-items: center;
        }

        .chat-detail-back {
            min-height: 36px;
            padding: 0 11px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 5px;
            border: 0;
            border-radius: 9px;
            background: transparent;
            color: #53627c;
            font-size: 13px;
            font-weight: 500;
            line-height: 1;
            cursor: pointer;
            transition: background-color .18s ease, color .18s ease;
        }

        .chat-detail-back:hover {
            background: #f2f5f9;
            color: #10284c;
        }

        .chat-detail-back svg {
            width: 21px;
            height: 21px;
            flex: 0 0 21px;
        }

        .chat-detail-back-mobile {
            display: none;
        }

        .desktop-history-toggle {
            width: 36px;
            height: 36px;
            padding: 0;
            border: 0;
            border-radius: 8px;
            background: transparent;
            color: #182b4c;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            box-shadow: none;
            transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
        }

        .desktop-action-icon {
            width: 36px;
            height: 36px;
            border: 1px solid rgba(15, 23, 42, 0.08);
            border-radius: 12px;
            background: #fff;
            color: #111827;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
            transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
        }

        .desktop-history-toggle:hover,
        .desktop-action-icon:hover {
            border-color: transparent;
            background: #f8fbff;
            color: #2563eb;
        }

        .desktop-history-toggle.active {
            border-color: transparent;
            background: #f4f8ff;
            color: #2563eb;
            box-shadow: none;
        }

        .desktop-history-toggle svg {
            width: 22px;
            height: 22px;
            display: block;
        }

        .desktop-action-icon svg {
            width: 18px;
            height: 18px;
            display: block;
        }

        .workspace-chat-header-center {
            flex-direction: column;
            justify-content: center;
            gap: 3px;
            min-width: 0;
            text-align: center;
        }

        .workspace-chat-header-center strong {
            font-size: 15px;
            font-weight: 700;
            color: #111827;
            line-height: 1.2;
        }

        .workspace-chat-header-center span {
            font-size: 11px;
            color: #b2b8c3;
            line-height: 1.2;
            white-space: nowrap;
        }

        .workspace-chat-header-right {
            gap: 10px;
            justify-content: flex-end;
        }

        body[data-tool-mode="image"] .workspace-chat-header-center,
        body[data-tool-mode="video"] .workspace-chat-header-center {
            opacity: 0;
            pointer-events: none;
        }

        .desktop-media-drawer-backdrop {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(15, 23, 42, 0.18);
            backdrop-filter: blur(4px);
            opacity: 0;
            pointer-events: none;
            transition: opacity .22s ease;
            z-index: 28;
        }

        .workspace-header-link {
            min-height: 36px;
            padding: 0;
            border: 0;
            border-radius: 0;
            background: transparent;
            color: #71809a;
            font-size: 15px;
            font-weight: 600;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            white-space: nowrap;
        }

        .workspace-header-login {
            min-width: 96px;
            min-height: 44px;
            padding: 0 22px;
            border-radius: 999px;
            border: 0;
            background: #102746;
            color: #fff;
            font-size: 15px;
            font-weight: 700;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            white-space: nowrap;
        }

        .workspace-header-link.active {
            color: #111827;
        }

        .workspace-header-link:hover {
            color: #111827;
        }

        body[data-ui-theme="dark"] .workspace-chat-header {
            background: linear-gradient(180deg, rgba(8, 15, 28, 0.98) 0%, rgba(8, 15, 28, 0.9) 74%, rgba(8, 15, 28, 0) 100%) !important;
        }

        body[data-ui-theme="dark"] .desktop-history-toggle,
        body[data-ui-theme="dark"] .desktop-action-icon,
        body[data-ui-theme="dark"] .workspace-header-login {
            border-color: rgba(148, 163, 184, 0.14);
            background: rgba(15, 23, 42, 0.82);
            color: #edf2ff;
            box-shadow: 0 10px 24px rgba(2, 6, 23, 0.24);
        }

        body[data-ui-theme="dark"] .workspace-header-link {
            border-color: transparent;
            background: transparent;
            color: #dbeafe;
            box-shadow: none;
        }

        body[data-ui-theme="dark"] .workspace-header-link.active {
            color: #dbeafe;
        }

        body[data-ui-theme="dark"] .desktop-history-toggle:hover,
        body[data-ui-theme="dark"] .desktop-action-icon:hover {
            background: rgba(30, 41, 59, 0.96);
            border-color: rgba(96, 165, 250, 0.32);
            color: #93c5fd;
        }

        body[data-ui-theme="dark"] .desktop-history-toggle.active {
            background: rgba(30, 64, 175, 0.18);
            border-color: rgba(96, 165, 250, 0.4);
            color: #93c5fd;
        }

        body[data-ui-theme="dark"] .legal-doc-head h3 {
            color: #edf2ff;
        }

        body[data-ui-theme="dark"] .legal-doc-head span {
            color: #8fa0bc;
        }

        body[data-ui-theme="dark"] .legal-doc-content {
            color: #c7d2e5;
        }

        .workspace-header-user {
            min-height: 36px;
            padding: 0 10px 0 8px;
            border-radius: 16px;
            background: #f8fafc;
            color: #111827;
            display: inline-flex;
            align-items: center;
            gap: 8px;
            font-size: 13px;
            font-weight: 600;
            border: 1px solid rgba(15, 23, 42, 0.06);
            cursor: pointer;
        }

        .workspace-header-user img,
        .workspace-header-user-fallback {
            width: 24px;
            height: 24px;
            border-radius: 50%;
            flex: 0 0 24px;
        }

        .workspace-header-user-fallback {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            background: linear-gradient(135deg, #2f6bff 0%, #5c89ff 100%);
            color: #fff;
            font-size: 12px;
        }

        .workspace-account-menu {
            position: relative;
            display: inline-flex;
            align-items: center;
        }

        .workspace-account-toggle {
            border: 1px solid rgba(15, 23, 42, 0.06);
        }

        .workspace-account-toggle::after {
            content: "";
            width: 8px;
            height: 8px;
            margin-left: 2px;
            border-right: 1.8px solid currentColor;
            border-bottom: 1.8px solid currentColor;
            transform: rotate(45deg) translateY(-1px);
            opacity: .6;
            flex: 0 0 auto;
        }

        .workspace-account-dropdown {
            position: absolute;
            right: 0;
            top: calc(100% + 10px);
            min-width: 180px;
            padding: 10px;
            border-radius: 18px;
            border: 1px solid rgba(15, 23, 42, 0.08);
            background: rgba(255, 255, 255, 0.98);
            box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
            display: grid;
            gap: 8px;
            z-index: 40;
        }

        .workspace-account-action {
            min-height: 38px;
            width: 100%;
            padding: 0 12px;
            border: none;
            border-radius: 12px;
            display: inline-flex;
            align-items: center;
            justify-content: flex-start;
            color: #172135;
            font-size: 13px;
            font-weight: 600;
            background: #f8fafc;
            cursor: pointer;
            text-align: left;
            font-family: inherit;
        }

        .workspace-account-action:hover {
            background: #eef3ff;
            color: #2150d8;
        }

        .settings-overlay {
            position: fixed;
            inset: 0;
            z-index: 125;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 18px;
        }

        .settings-dialog {
            position: relative;
            width: min(920px, 100%);
            max-height: calc(100vh - 36px);
            border-radius: 30px;
            border: 1px solid rgba(255, 255, 255, 0.18);
            background:
                radial-gradient(circle at top left, rgba(37, 99, 255, 0.08), transparent 24%),
                radial-gradient(circle at bottom right, rgba(21, 185, 172, 0.08), transparent 30%),
                linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(247, 249, 252, 0.98) 100%);
            box-shadow: 0 36px 90px rgba(15, 23, 42, 0.24);
            overflow: hidden;
            z-index: 2;
            pointer-events: auto;
        }

        .settings-overlay .auth-mask {
            z-index: 1;
        }

        .settings-shell {
            display: grid;
            grid-template-columns: 248px minmax(0, 1fr);
            min-height: 560px;
            max-height: calc(100vh - 36px);
        }

        .settings-sidebar {
            padding: 28px 22px;
            border-right: 1px solid rgba(15, 23, 42, 0.06);
            background: rgba(247, 249, 252, 0.88);
            display: grid;
            align-content: start;
            gap: 18px;
            min-height: 0;
            overflow: auto;
        }

        .settings-sidebar h3 {
            margin: 0;
            font-size: 24px;
        }

        .settings-nav {
            display: grid;
            gap: 8px;
        }

        .settings-nav-btn {
            min-height: 48px;
            padding: 0 14px;
            border: 1px solid transparent;
            border-radius: 16px;
            background: transparent;
            color: var(--text);
            display: flex;
            align-items: center;
            justify-content: flex-start;
            font-size: 14px;
            font-weight: 700;
            cursor: pointer;
            transition: all .18s ease;
        }

        .settings-nav-btn.active {
            border-color: rgba(37, 99, 255, 0.14);
            background: rgba(37, 99, 255, 0.08);
            color: var(--brand-strong);
        }

        .settings-content {
            padding: 28px;
            display: grid;
            align-content: start;
            gap: 20px;
            min-height: 0;
            overflow: auto;
        }

        .settings-panel {
            display: none;
            gap: 18px;
        }

        .settings-panel.active {
            display: grid;
        }

        .settings-panel-head h4 {
            margin: 0;
            font-size: 22px;
        }

        .settings-grid {
            display: grid;
            gap: 16px;
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }

        .settings-card,
        .settings-password-form,
        .settings-profile-form {
            padding: 18px;
            border-radius: 20px;
            border: 1px solid rgba(15, 23, 42, 0.06);
            background: rgba(255, 255, 255, 0.82);
            box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
        }

        .settings-password-form,
        .settings-profile-form {
            display: grid;
            gap: 14px;
        }

        .settings-profile-head {
            display: flex;
            align-items: center;
            gap: 16px;
        }

        .settings-account-name-field input[readonly] {
            border-color: rgba(15, 23, 42, 0.08);
            background: #f4f6f9;
            color: #667085;
            cursor: default;
            box-shadow: none;
        }

        .settings-account-name-field input[readonly]:focus {
            border-color: rgba(15, 23, 42, 0.08);
            background: #f4f6f9;
            box-shadow: none;
        }

        .settings-account-name-help {
            color: #7b8798;
            font-size: 12px;
            line-height: 1.5;
        }

        .settings-profile-avatar-wrap {
            flex: 0 0 76px;
        }

        .settings-profile-avatar {
            width: 76px;
            height: 76px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 24px;
            object-fit: cover;
            background: linear-gradient(135deg, #2563ff 0%, #15b9ac 100%);
            color: #fff;
            font-size: 28px;
            font-weight: 800;
        }

        .settings-profile-copy {
            display: grid;
            gap: 5px;
            min-width: 0;
        }

        .settings-profile-copy strong {
            color: #1f2a3d;
            font-size: 15px;
        }

        .settings-profile-copy span {
            color: var(--muted);
            font-size: 12px;
            line-height: 1.6;
        }

        .settings-profile-actions {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin-top: 3px;
        }

        .settings-profile-actions .btn {
            min-height: 34px;
            padding: 0 12px;
            font-size: 12px;
        }

        .settings-legal-card {
            display: grid;
            gap: 14px;
        }

        .settings-about-brand {
            display: flex;
            align-items: center;
            gap: 14px;
            padding-bottom: 2px;
        }

        .settings-about-mark,
        .settings-about-brand img {
            width: 42px;
            height: 42px;
            border-radius: 14px;
            flex: 0 0 42px;
        }

        .settings-about-mark {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            background: linear-gradient(135deg, #2563ff 0%, #15b9ac 100%);
            color: #fff;
            font-size: 15px;
            font-weight: 800;
            letter-spacing: 0.04em;
            box-shadow: 0 12px 24px rgba(37, 99, 255, 0.16);
        }

        .settings-about-copy {
            display: grid;
            gap: 4px;
            min-width: 0;
        }

        .settings-about-copy strong {
            font-size: 15px;
            color: #1f2a3d;
        }

        .settings-about-copy span {
            font-size: 12px;
            line-height: 1.6;
            color: var(--muted);
        }

        .settings-legal-head {
            display: grid;
            gap: 6px;
        }

        .settings-legal-head h5 {
            margin: 0;
            font-size: 16px;
            color: #1f2a3d;
        }

        .settings-legal-list {
            display: grid;
            gap: 10px;
        }

        .settings-legal-item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 16px;
            padding: 14px 16px;
            border-radius: 16px;
            border: 1px solid rgba(15, 23, 42, 0.06);
            background: rgba(247, 249, 252, 0.9);
        }

        .settings-legal-copy {
            display: grid;
            gap: 4px;
            min-width: 0;
        }

        .settings-legal-copy strong {
            font-size: 14px;
            color: #1f2a3d;
        }

        .settings-legal-copy span {
            font-size: 12px;
            line-height: 1.6;
            color: var(--muted);
        }

        .settings-legal-btn {
            min-width: 72px;
            padding: 0 16px;
            border-radius: 999px;
            white-space: nowrap;
        }

        .settings-field {
            display: grid;
            gap: 10px;
        }

        .settings-field label {
            font-size: 13px;
            font-weight: 700;
            color: #243144;
        }

        .settings-select {
            min-height: 46px;
            width: 100%;
            padding: 0 14px;
            border-radius: 14px;
            border: 1px solid rgba(15, 23, 42, 0.08);
            background: #fff;
            color: var(--text);
            font-size: 14px;
            outline: none;
        }

        .settings-select:focus {
            border-color: rgba(37, 99, 255, 0.34);
            box-shadow: 0 0 0 4px rgba(37, 99, 255, 0.08);
        }

        .settings-inline-help {
            color: var(--muted);
            font-size: 12px;
            line-height: 1.8;
        }

        .settings-dialog input,
        .settings-dialog select,
        .settings-dialog button,
        .settings-dialog textarea {
            pointer-events: auto;
        }

        .settings-form-actions {
            display: flex;
            justify-content: flex-start;
            gap: 12px;
        }

        .settings-status {
            min-height: 22px;
            color: var(--muted);
            font-size: 12px;
            line-height: 1.8;
        }

        .settings-status.success {
            color: #0f7b43;
        }

        .settings-status.error {
            color: #bb2d3b;
        }

        body[data-ui-theme="dark"] .workspace-account-dropdown,
        body[data-ui-theme="dark"] .workspace-account-action,
        body[data-ui-theme="dark"] .settings-dialog,
        body[data-ui-theme="dark"] .settings-sidebar,
        body[data-ui-theme="dark"] .settings-card,
        body[data-ui-theme="dark"] .settings-password-form,
        body[data-ui-theme="dark"] .settings-profile-form,
        body[data-ui-theme="dark"] .settings-select,
        body[data-ui-theme="dark"] .toast,
        body[data-ui-theme="dark"] .auth-dialog {
            border-color: rgba(148, 163, 184, 0.14);
            background: rgba(10, 18, 32, 0.96);
            color: var(--text);
            box-shadow: 0 18px 42px rgba(2, 6, 23, 0.34);
        }

        body[data-ui-theme="dark"] .app {
            background: #0a1220;
        }

        body[data-ui-theme="dark"] .history {
            background: #0b1322;
            border-right-color: rgba(148, 163, 184, 0.12);
        }

        body[data-ui-theme="dark"] .history-account .workspace-account-toggle,
        body[data-ui-theme="dark"] .workspace-account-card,
        body[data-ui-theme="dark"] .sidebar-search-trigger,
        body[data-ui-theme="dark"] .sidebar-nav-btn,
        body[data-ui-theme="dark"] .chat-empty-chip {
            background: rgba(15, 23, 42, 0.46);
            border-color: rgba(148, 163, 184, 0.12);
            color: #dbe7ff;
        }

        body[data-ui-theme="dark"] .sidebar-safety-link,
        body[data-ui-theme="dark"] .workspace-account-settings {
            color: #9aabc5;
        }

        body[data-ui-theme="dark"] .sidebar-safety-link:hover,
        body[data-ui-theme="dark"] .workspace-account-settings:hover {
            background: rgba(30, 41, 59, 0.88);
            color: #93c5fd;
        }

        body[data-ui-theme="dark"] .office-task-card {
            background: linear-gradient(180deg, rgba(15, 23, 42, 0.76) 0%, rgba(15, 23, 42, 0.92) 100%);
            border-color: rgba(148, 163, 184, 0.16);
            color: #dbe7ff;
        }

        body[data-ui-theme="dark"] .office-task-card:hover {
            border-color: rgba(96, 165, 250, 0.24);
            box-shadow: 0 18px 40px rgba(2, 6, 23, 0.26);
        }

        body[data-ui-theme="dark"] .office-task-card-title {
            color: #eef4ff;
        }

        body[data-ui-theme="dark"] .office-task-card-desc {
            color: #93a4c0;
        }

        body[data-ui-theme="dark"] .office-task-card-format {
            background: rgba(59, 130, 246, 0.16);
            color: #bfdbfe;
        }

        body[data-ui-theme="dark"] .office-task-card-arrow {
            color: #7f90ad;
        }

        body[data-ui-theme="dark"] .sidebar-search-trigger:hover,
        body[data-ui-theme="dark"] .sidebar-nav-btn:hover,
        body[data-ui-theme="dark"] .workspace-account-card:hover,
        body[data-ui-theme="dark"] .chat-empty-chip:hover {
            background: rgba(30, 41, 59, 0.88);
            border-color: rgba(96, 165, 250, 0.18);
            color: #edf2ff;
            box-shadow: 0 10px 22px rgba(2, 6, 23, 0.26);
        }

        body[data-ui-theme="dark"] .sidebar-nav-btn.active {
            background: rgba(30, 41, 59, 0.96);
            border-color: rgba(96, 165, 250, 0.18);
            color: #edf2ff;
            box-shadow: 0 10px 22px rgba(2, 6, 23, 0.26);
        }

        body[data-ui-theme="dark"] .sidebar-brand-copy strong,
        body[data-ui-theme="dark"] .hero-brand-text strong,
        body[data-ui-theme="dark"] .hero-title,
        body[data-ui-theme="dark"] .section-head h3,
        body[data-ui-theme="dark"] .chat-empty-title,
        body[data-ui-theme="dark"] .composer-title,
        body[data-ui-theme="dark"] .viewer-name {
            color: #edf2ff;
        }

        body[data-ui-theme="dark"] .sidebar-brand-copy span,
        body[data-ui-theme="dark"] .sidebar-search-trigger-label,
        body[data-ui-theme="dark"] .sidebar-section-label,
        body[data-ui-theme="dark"] .hero-brand-text span,
        body[data-ui-theme="dark"] .hero-desc,
        body[data-ui-theme="dark"] .viewer-meta,
        body[data-ui-theme="dark"] .section-head .tiny,
        body[data-ui-theme="dark"] .chat-empty-desc,
        body[data-ui-theme="dark"] .composer-desc,
        body[data-ui-theme="dark"] .status-text {
            color: #8fa0bc;
        }

        body[data-ui-theme="dark"] .auth-legal-check,
        body[data-ui-theme="dark"] .auth-legal-note {
            color: #8fa0bc;
        }

        body[data-ui-theme="dark"] .auth-legal-link {
            color: #edf2ff;
        }

        body[data-ui-theme="dark"] .auth-legal-link:hover {
            color: #93c5fd;
        }

        body[data-ui-theme="dark"] .workspace-disclaimer {
            color: #6f829f;
        }

        body[data-ui-theme="dark"] .ui-language-switch {
            border-color: rgba(96, 165, 250, 0.14);
            background: rgba(15, 23, 42, 0.82);
            box-shadow: 0 10px 24px rgba(2, 6, 23, 0.24);
        }

        body[data-ui-theme="dark"] .ui-language-switch-btn {
            color: #9fb0cb;
        }

        body[data-ui-theme="dark"] .ui-language-switch-btn:hover {
            color: #edf2ff;
        }

        body[data-ui-theme="dark"] .ui-language-switch-btn.active {
            background: linear-gradient(135deg, #2a62f4 0%, #0ea5a2 100%);
            color: #fff;
        }

        body[data-ui-theme="dark"] .conversation-empty-state {
            color: #8fa0bc;
        }

        body[data-ui-theme="dark"] .workspace,
        body[data-ui-theme="dark"] .result-card,
        body[data-ui-theme="dark"] .composer,
        body[data-ui-theme="dark"] .guest-hero-main,
        body[data-ui-theme="dark"] .guest-preview-shell,
        body[data-ui-theme="dark"] .guest-preview-sidebar,
        body[data-ui-theme="dark"] .guest-preview-main,
        body[data-ui-theme="dark"] .chat-empty,
        body[data-ui-theme="dark"] .chat-area {
            color: var(--text);
        }

        body[data-ui-theme="dark"] .workspace {
            background:
                radial-gradient(circle at 100% 0%, rgba(54, 102, 255, 0.12), transparent 34%),
                linear-gradient(180deg, #0a1220 0%, #0d1626 100%);
        }

        body[data-ui-theme="dark"] .settings-sidebar {
            background: rgba(7, 13, 24, 0.94);
        }

        body[data-ui-theme="dark"] .settings-about-copy strong,
        body[data-ui-theme="dark"] .settings-field label,
        body[data-ui-theme="dark"] .settings-legal-head h5,
        body[data-ui-theme="dark"] .settings-legal-copy strong,
        body[data-ui-theme="dark"] .workspace-account-action,
        body[data-ui-theme="dark"] .auth-close {
            color: var(--text);
        }

        body[data-ui-theme="dark"] .workspace-account-action:hover,
        body[data-ui-theme="dark"] .settings-nav-btn.active {
            background: rgba(92, 140, 255, 0.16);
            color: #dce7ff;
        }

        body[data-ui-theme="dark"] .settings-account-name-field input[readonly],
        body[data-ui-theme="dark"] .settings-account-name-field input[readonly]:focus {
            border-color: rgba(148, 163, 184, 0.14);
            background: rgba(15, 23, 42, 0.7);
            color: #aab8cc;
        }

        body[data-ui-theme="dark"] .settings-account-name-help {
            color: #8494ad;
        }

        body[data-ui-theme="dark"] .auth-close,
        body[data-ui-theme="dark"] .settings-select {
            background: rgba(15, 23, 42, 0.7);
        }

        body[data-ui-theme="dark"] .settings-select option {
            background: #0f172a;
            color: #edf2ff;
        }

        body[data-ui-theme="dark"] .settings-legal-item {
            border-color: rgba(148, 163, 184, 0.14);
            background: rgba(15, 23, 42, 0.62);
        }

        body[data-ui-theme="dark"] .settings-legal-copy span {
            color: #8fa0bc;
        }

        body[data-ui-theme="dark"] .settings-about-copy span {
            color: #8fa0bc;
        }

        body[data-ui-theme="dark"] .chat-input-wrap {
            background: rgba(10, 18, 32, 0.96);
            border-color: rgba(148, 163, 184, 0.14);
            box-shadow: 0 18px 42px rgba(2, 6, 23, 0.34);
        }

        body[data-ui-theme="dark"] .chat-input-wrap textarea {
            color: #edf2ff;
            caret-color: #6aa1ff;
            -webkit-text-fill-color: #edf2ff;
        }

        body[data-ui-theme="dark"] .chat-input-wrap textarea::placeholder {
            color: #8f9bb0;
            opacity: 1;
        }

        body[data-ui-theme="dark"] .chat-input-hint {
            color: #8f9bb0;
        }

        body[data-ui-theme="dark"] .chat-skill-mention-menu {
            border-color: rgba(148, 163, 184, 0.18);
            background: rgba(20, 27, 39, 0.98);
            box-shadow: 0 24px 62px rgba(0, 0, 0, 0.42);
        }

        body[data-ui-theme="dark"] .chat-skill-mention-head,
        body[data-ui-theme="dark"] .chat-skill-mention-copy span,
        body[data-ui-theme="dark"] .chat-skill-mention-empty {
            color: #98a5b8;
        }

        body[data-ui-theme="dark"] .chat-skill-mention-option {
            color: #dce5f2;
        }

        body[data-ui-theme="dark"] .chat-skill-mention-option:hover,
        body[data-ui-theme="dark"] .chat-skill-mention-option.is-active {
            background: rgba(96, 165, 250, 0.12);
            color: #f4f8ff;
        }

        body[data-ui-theme="dark"] .chat-skill-mention-icon {
            background: rgba(148, 163, 184, 0.1);
        }

        @media (max-width: 600px) {
            .chat-skill-mention-menu {
                left: 0;
                bottom: calc(100% + 8px);
                width: 100%;
                max-height: min(330px, 44dvh);
                border-radius: 17px;
            }

            .chat-skill-mention-option {
                min-height: 54px;
            }
        }


        body[data-ui-theme="dark"] .sidebar-search-trigger-shortcut {
            background: rgba(148, 163, 184, 0.12);
            color: #9fb1cb;
        }

       body[data-ui-theme="dark"] .image-create-studio,
        body[data-ui-theme="dark"] .image-studio-template-panel,
        body[data-ui-theme="dark"] .image-studio-prompt-card,
        body[data-ui-theme="dark"] .image-studio-summary,
        body[data-ui-theme="dark"] .image-studio-tool-card,
        body[data-ui-theme="dark"] .image-studio-preset-card,
        body[data-ui-theme="dark"] .workspace-records,
        body[data-ui-theme="dark"] .image-studio-popover {
            border-color: rgba(148, 163, 184, 0.14);
            background: rgba(10, 18, 32, 0.96);
            color: var(--text);
            box-shadow: 0 18px 42px rgba(2, 6, 23, 0.34);
        }

        body[data-ui-theme="dark"] .image-studio-template-panel.is-compact {
            background: rgba(8, 15, 28, 0.97);
            box-shadow: 0 28px 64px rgba(2, 6, 23, 0.5);
        }

        body[data-ui-theme="dark"] .image-studio-template-compact {
            background: rgba(148, 163, 184, 0.08);
        }

        body[data-ui-theme="dark"] .image-studio-template-compact-head strong {
            color: #edf2ff;
        }

        body[data-ui-theme="dark"] .image-studio-template-compact-head span {
            color: #94a3b8;
        }

        body[data-ui-theme="dark"] .image-studio-template-refresh {
            background: rgba(15, 23, 42, 0.72);
            border-color: rgba(148, 163, 184, 0.16);
            color: #dbe6ff;
        }

        body[data-ui-theme="dark"] .image-studio-template-refresh-icon {
            background: rgba(59, 130, 246, 0.14);
            color: #a5c8ff;
        }

        body[data-ui-theme="dark"] .image-studio-template-refresh:hover {
            background: rgba(37, 99, 255, 0.18);
            color: #9fc0ff;
        }

        body[data-ui-theme="dark"] .image-studio-template-refresh:hover .image-studio-template-refresh-icon {
            background: rgba(96, 165, 250, 0.18);
            color: #cfe2ff;
        }

        body[data-ui-theme="dark"] .image-studio-template-mini-copy {
            background: rgba(8, 15, 28, 0.72);
            color: #e5edf9;
        }

        body[data-ui-theme="dark"] .image-studio-template-spotlight-badge {
            background: rgba(8, 15, 28, 0.58);
            color: rgba(255,255,255,0.9);
        }

        body[data-ui-theme="dark"] .image-create-studio {
            background: transparent;
            border-color: transparent;
            box-shadow: none;
        }

        body[data-ui-theme="dark"] .image-studio-shell,
        body[data-ui-theme="dark"] .image-studio-content,
        body[data-ui-theme="dark"] .image-studio-main,
        body[data-ui-theme="dark"] .image-studio-gallery-shell {
            background: transparent;
            border-color: transparent;
            box-shadow: none;
        }

        body[data-ui-theme="dark"] .image-studio-input,
        body[data-ui-theme="dark"] .image-studio-tool-meta,
        body[data-ui-theme="dark"] .image-studio-tool-title,
        body[data-ui-theme="dark"] .image-studio-tool-desc,
        body[data-ui-theme="dark"] .image-studio-gallery-head strong,
        body[data-ui-theme="dark"] .image-studio-summary strong,
        body[data-ui-theme="dark"] .image-studio-preset-overlay strong,
        body[data-ui-theme="dark"] .image-studio-template-head strong,
        body[data-ui-theme="dark"] .workspace-records h3,
        body[data-ui-theme="dark"] .task-date-group-title {
            color: #edf2ff;
        }

        body[data-ui-theme="dark"] .image-studio-input::placeholder,
        body[data-ui-theme="dark"] .image-studio-gallery-head span,
        body[data-ui-theme="dark"] .image-studio-summary p,
        body[data-ui-theme="dark"] .image-studio-sidecard-tip,
        body[data-ui-theme="dark"] .image-studio-preset-overlay p,
        body[data-ui-theme="dark"] .image-studio-preset-meta,
        body[data-ui-theme="dark"] .image-studio-template-head span,
        body[data-ui-theme="dark"] .workspace-records .tiny {
            color: #8fa0bc;
        }

        body[data-ui-theme="dark"] .image-studio-toolbar {
            border-top-color: rgba(148, 163, 184, 0.12);
            background: rgba(7, 13, 24, 0.76);
        }

        body[data-ui-theme="dark"] .image-studio-inline-btn,
        body[data-ui-theme="dark"] .image-studio-gallery-filter,
        body[data-ui-theme="dark"] .image-studio-template-filter,
        body[data-ui-theme="dark"] .composer-capability-btn,
        body[data-ui-theme="dark"] .work-skill-btn,
        body[data-ui-theme="dark"] .chat-followup-chip,
        body[data-ui-theme="dark"] .chat-quick-action {
            background: rgba(15, 23, 42, 0.7);
            border-color: rgba(148, 163, 184, 0.16);
            color: #dbe7ff;
        }

        body[data-ui-theme="dark"] .image-studio-inline-btn.active,
        body[data-ui-theme="dark"] .image-studio-gallery-filter.active,
        body[data-ui-theme="dark"] .image-studio-template-filter.active,
        body[data-ui-theme="dark"] .composer-capability-btn.active,
        body[data-ui-theme="dark"] .work-skill-btn.is-open,
        body[data-ui-theme="dark"] .chat-followup-chip:hover,
        body[data-ui-theme="dark"] .chat-quick-action:hover {
            background: rgba(37, 99, 255, 0.18);
            border-color: rgba(96, 165, 250, 0.28);
            color: #dce7ff;
        }

        body[data-ui-theme="dark"] .work-skill-btn-value {
            color: rgba(191, 219, 254, 0.78);
        }

        body[data-ui-theme="dark"] .work-skill-menu {
            background: rgba(9, 15, 27, 0.98);
            border-color: rgba(148, 163, 184, 0.16);
            box-shadow: 0 18px 42px rgba(2, 6, 23, 0.45);
        }

        body[data-ui-theme="dark"] .work-skill-option {
            color: #dbe7ff;
        }

        body[data-ui-theme="dark"] .work-skill-option:hover,
        body[data-ui-theme="dark"] .work-skill-option.active {
            background: rgba(37, 99, 255, 0.18);
            color: #dce7ff;
        }

        body[data-ui-theme="dark"] .image-studio-template-filter:hover {
            background: rgba(22, 32, 52, 0.92);
            border-color: rgba(96, 165, 250, 0.24);
        }

        body[data-ui-theme="dark"] .image-studio-template-filter.active {
            box-shadow: none;
        }

        body[data-ui-theme="dark"] .image-studio-tool-link {
            background: rgba(15, 23, 42, 0.78);
            border-color: rgba(148, 163, 184, 0.16);
            color: #e2e8f0;
        }

        body[data-ui-theme="dark"] .image-studio-tool-link-label {
            color: #8fa0bc;
        }

        body[data-ui-theme="dark"] .image-studio-tool-link-value {
            color: #edf2ff;
        }

        body[data-ui-theme="dark"] .image-studio-tool-icon {
            color: #93a4bf;
        }

        body[data-ui-theme="dark"] .image-studio-tool-link.active .image-studio-tool-link-label,
        body[data-ui-theme="dark"] .image-studio-tool-link.active .image-studio-tool-link-value {
            color: #bfd3ff;
        }

        body[data-ui-theme="dark"] .image-studio-more-panel {
            border-color: rgba(148, 163, 184, 0.14);
            background: rgba(12, 20, 34, 0.96);
            box-shadow: 0 22px 48px rgba(2, 6, 23, 0.42);
        }

        body[data-ui-theme="dark"] .mobile-chat-more-menu {
            border-color: rgba(148, 163, 184, 0.14);
            background: rgba(12, 20, 34, 0.96);
            box-shadow: 0 22px 48px rgba(2, 6, 23, 0.42);
        }

        body[data-ui-theme="dark"] .mobile-chat-more-item,
        body[data-ui-theme="dark"] .mobile-chat-toolbar-btn {
            color: #dbe7ff;
        }

        body[data-ui-theme="dark"] .mobile-chat-more-item:hover,
        body[data-ui-theme="dark"] .mobile-chat-toolbar-btn:hover {
            background: rgba(30, 41, 59, 0.92);
        }

        body[data-ui-theme="dark"] .image-studio-toolbar-divider {
            background: rgba(148, 163, 184, 0.18);
        }

        body[data-ui-theme="dark"] .studio-reference-bar {
            border-color: rgba(148, 163, 184, 0.14);
            background: rgba(15, 23, 42, 0.72);
        }

        body[data-ui-theme="dark"] .studio-reference-meta,
        body[data-ui-theme="dark"] .studio-reference-chip-label,
        body[data-ui-theme="dark"] .studio-reference-chip-kind {
            color: #dbe7ff;
        }

        body[data-ui-theme="dark"] .image-studio-popover-item {
            border-color: rgba(148, 163, 184, 0.12);
            background: rgba(15, 23, 42, 0.82);
            color: #e2e8f0;
        }

        body[data-ui-theme="dark"] .image-studio-popover-item:hover {
            border-color: rgba(96, 165, 250, 0.28);
            background: rgba(30, 41, 59, 0.92);
            color: #dbeafe;
        }

        body[data-ui-theme="dark"] .image-studio-popover-item.active {
            border-color: rgba(96, 165, 250, 0.42);
            background: linear-gradient(135deg, rgba(30, 41, 59, 0.98) 0%, rgba(23, 37, 84, 0.94) 100%);
            color: #dbeafe;
        }

        body[data-ui-theme="dark"] .image-studio-popover-item-desc {
            color: #8fa0bc;
        }

        body[data-ui-theme="dark"] .image-studio-popover-thumb {
            box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
        }

        body[data-ui-theme="dark"] .image-studio-send-btn {
            box-shadow: 0 10px 20px rgba(30, 64, 175, 0.16);
        }

        body[data-ui-theme="dark"] .image-studio-preset-card {
            background: rgba(15, 23, 42, 0.76);
            border-color: rgba(148, 163, 184, 0.12);
        }

        body[data-ui-theme="dark"] .image-studio-preset-stage {
            background: #0f172a;
        }

        body[data-ui-theme="dark"] .image-studio-template-card {
            background: #172036;
            box-shadow: 0 16px 32px rgba(2, 6, 23, 0.3);
        }

        body[data-ui-theme="dark"] .image-studio-template-overlay p {
            color: rgba(226, 232, 240, 0.82);
        }

        body[data-ui-theme="dark"] .image-studio-template-action,
        body[data-ui-theme="dark"] .image-studio-preset-action button {
            background: rgba(15, 23, 42, 0.42);
            border-color: rgba(148, 163, 184, 0.22);
            color: #f8fbff;
        }

        body[data-ui-theme="dark"] .image-studio-template-action:hover,
        body[data-ui-theme="dark"] .image-studio-template-action:focus-visible,
        body[data-ui-theme="dark"] .image-studio-preset-action button:hover,
        body[data-ui-theme="dark"] .image-studio-preset-action button:focus-visible {
            background: rgba(30, 41, 59, 0.62);
            border-color: rgba(148, 163, 184, 0.3);
        }

        body[data-ui-theme="dark"] .image-studio-template-panel,
        body[data-ui-theme="dark"] .image-studio-quickcard,
        body[data-ui-theme="dark"] .image-studio-tool-card,
        body[data-ui-theme="dark"] .image-studio-sidecard,
        body[data-ui-theme="dark"] .image-studio-sidecard-item,
        body[data-ui-theme="dark"] .image-studio-template-card,
        body[data-ui-theme="dark"] .image-studio-preset-card,
        body[data-ui-theme="dark"] .image-studio-prompt-card {
            border-color: rgba(71, 85, 105, 0.34);
        }

        body[data-ui-theme="dark"] .image-studio-tool-thumb {
            box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.34);
        }

        @media (max-width: 860px) {
            .settings-overlay {
                align-items: stretch;
                padding: 8px;
                padding-top: max(8px, env(safe-area-inset-top));
                padding-bottom: max(8px, env(safe-area-inset-bottom));
            }

            .settings-dialog {
                width: 100%;
                height: 100%;
                max-height: 100%;
                border-radius: 24px;
            }

            .settings-shell {
                grid-template-columns: minmax(0, 1fr);
                grid-template-rows: auto minmax(0, 1fr);
                width: 100%;
                height: 100%;
                min-height: 0;
                max-height: none;
            }

            .settings-sidebar {
                border-right: none;
                border-bottom: 1px solid rgba(15, 23, 42, 0.06);
                padding: 20px 52px 14px 20px;
                gap: 12px;
                overflow: hidden;
            }

            .settings-sidebar h3 {
                font-size: 22px;
            }

            .settings-nav {
                display: flex;
                gap: 8px;
                overflow-x: auto;
                overflow-y: hidden;
                scrollbar-width: none;
                overscroll-behavior-inline: contain;
                -webkit-overflow-scrolling: touch;
            }

            .settings-nav::-webkit-scrollbar {
                display: none;
            }

            .settings-nav-btn {
                min-height: 42px;
                padding: 0 15px;
                border-radius: 14px;
                flex: 0 0 auto;
                white-space: nowrap;
            }

            .settings-content {
                padding: 22px 18px calc(28px + env(safe-area-inset-bottom));
                overflow-y: auto;
                overflow-x: hidden;
                overscroll-behavior-y: contain;
                -webkit-overflow-scrolling: touch;
            }

            .settings-grid {
                grid-template-columns: minmax(0, 1fr);
            }

            .settings-profile-head {
                align-items: flex-start;
            }

            .settings-profile-avatar-wrap,
            .settings-profile-avatar {
                width: 64px;
                height: 64px;
                flex-basis: 64px;
            }

            .settings-profile-avatar {
                border-radius: 20px;
                font-size: 24px;
            }

            .settings-form-actions .btn,
            .settings-form-actions .auth-submit-btn {
                max-width: 100%;
            }
        }

        @media (max-height: 760px) and (min-width: 861px) {
            .settings-overlay {
                align-items: flex-start;
                padding-top: 12px;
                padding-bottom: 12px;
            }

            .settings-dialog {
                max-height: calc(100vh - 24px);
            }

            .settings-shell {
                min-height: 0;
                max-height: calc(100vh - 24px);
            }

            .settings-sidebar,
            .settings-content {
                padding-top: 22px;
                padding-bottom: 22px;
            }
        }

        .auth-layout {
            display: grid;
            grid-template-columns: minmax(0, 1fr) 228px;
            gap: 20px;
            align-items: start;
        }

        .auth-dialog {
            width: min(700px, calc(100vw - 28px));
            padding: 26px;
            border-radius: 28px;
        }

        .auth-main {
            display: grid;
            gap: 14px;
        }

        .auth-mode-tabs {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            padding: 4px;
            border-radius: 16px;
            background: #f5f6f8;
            width: fit-content;
        }

        .auth-mode-tab {
            min-width: 82px;
            min-height: 36px;
            padding: 0 16px;
            border: none;
            border-radius: 12px;
            background: transparent;
            color: #6b7280;
            font-size: 13px;
            font-weight: 700;
            cursor: pointer;
        }

        .auth-mode-tab.active {
            background: #fff;
            color: #111827;
            box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
        }

        .auth-form {
            display: none;
            gap: 14px;
        }

        .auth-form.active {
            display: grid;
        }

        .auth-field {
            display: grid;
            gap: 8px;
        }

        .auth-field label {
            font-size: 13px;
            font-weight: 600;
            color: #334155;
        }

        .auth-field input {
            width: 100%;
            min-height: 48px;
            border-radius: 14px;
            border: 1px solid rgba(15, 23, 42, 0.1);
            background: #fff;
            padding: 0 16px;
            font-size: 14px;
            color: #111827;
            outline: none;
        }

        .auth-field.password-field { position: relative; }
        .auth-field.password-field input { padding-right: 52px; }
        .password-toggle {
            position: absolute;
            top: 50%;
            right: 10px;
            width: 34px;
            height: 34px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            transform: translateY(-50%);
            border: 0;
            border-radius: 10px;
            background: transparent;
            color: #64748b;
            cursor: pointer;
        }
        .password-toggle:hover,
        .password-toggle:focus-visible {
            color: #1f2430;
            background: rgba(37, 99, 255, 0.08);
            outline: none;
        }
        .password-toggle svg { width: 18px; height: 18px; pointer-events: none; }

        .auth-field input:focus {
            border-color: rgba(37, 99, 255, 0.32);
            background: #fff;
            box-shadow: 0 0 0 4px rgba(37, 99, 255, 0.06);
        }

        .auth-submit-btn {
            min-height: 48px;
            border: none;
            border-radius: 14px;
            background: #1f2430;
            color: #fff;
            font-size: 15px;
            font-weight: 700;
            cursor: pointer;
            box-shadow: 0 16px 28px rgba(15, 23, 42, 0.16);
        }

        .auth-submit-btn:disabled {
            opacity: 0.72;
            cursor: wait;
        }

        .auth-message {
            min-height: 20px;
            font-size: 13px;
            color: #e11d48;
        }

        .auth-message.success {
            color: #0f7a50;
        }

        .auth-legal {
            display: grid;
            gap: 10px;
            margin-top: -2px;
        }

        .auth-legal-check {
            display: flex;
            align-items: flex-start;
            gap: 10px;
            color: #64748b;
            font-size: 12px;
            line-height: 1.7;
        }

        .auth-legal-check input {
            width: 16px;
            height: 16px;
            margin: 2px 0 0;
            accent-color: #2563ff;
            flex: 0 0 16px;
        }

        .auth-legal-copy {
            min-width: 0;
        }

        .auth-legal-link {
            border: none;
            background: transparent;
            padding: 0;
            color: #111827;
            font-weight: 600;
            cursor: pointer;
        }

        .auth-legal-link:hover {
            color: #2563eb;
        }

        .auth-legal-note {
            color: #94a3b8;
            font-size: 11px;
            line-height: 1.5;
            padding-left: 26px;
        }

        .auth-aside {
            display: grid;
            gap: 10px;
            padding: 2px 0 0 4px;
            align-content: start;
        }

        .auth-aside-card {
            display: grid;
            gap: 6px;
            padding: 14px 14px 13px;
            border-radius: 16px;
            background: rgba(248,250,252,0.92);
            border: 1px solid rgba(15, 23, 42, 0.05);
            box-shadow: none;
        }

        .auth-aside-card strong {
            font-size: 13px;
            color: #111827;
        }

        .auth-aside-card span {
            font-size: 12px;
            line-height: 1.7;
            color: #64748b;
        }

        .auth-preview-card {
            position: relative;
            min-height: 188px;
            overflow: hidden;
            border-radius: 20px;
            padding: 16px;
            background:
                radial-gradient(circle at 18% 20%, rgba(255,255,255,0.18), transparent 18%),
                linear-gradient(135deg, #1f2430 0%, #34435d 100%);
            color: #fff;
        }

        .auth-preview-card::after {
            content: "";
            position: absolute;
            right: -40px;
            bottom: -46px;
            width: 180px;
            height: 180px;
            border-radius: 50%;
            background: rgba(255,255,255,0.14);
        }

        .auth-preview-card strong,
        .auth-preview-card span,
        .auth-preview-card p {
            position: relative;
            z-index: 1;
        }

        .auth-preview-card strong {
            display: block;
            font-size: 20px;
            line-height: 1.2;
        }

        .auth-preview-card span {
            display: block;
            margin-top: 8px;
            font-size: 12px;
            line-height: 1.7;
            color: rgba(255,255,255,0.88);
        }

        .auth-preview-messages {
            position: relative;
            z-index: 1;
            margin-top: 14px;
            display: grid;
            gap: 8px;
        }

        .auth-preview-bubble {
            max-width: 88%;
            padding: 8px 11px;
            border-radius: 14px;
            font-size: 11px;
            line-height: 1.65;
        }

        .auth-preview-bubble.user {
            justify-self: end;
            background: rgba(255,255,255,0.18);
            color: #fff;
        }

        .auth-preview-bubble.assistant {
            background: rgba(255,255,255,0.92);
            color: #172135;
        }

        body[data-mode="chat"] .workspace {
            position: relative;
            overflow: hidden;
            background:
                radial-gradient(circle at top, rgba(73, 110, 255, 0.08), transparent 26%),
                linear-gradient(180deg, #ffffff 0%, #fbfbfd 100%);
        }

        body[data-mode="chat"] .workspace-chat-header {
            display: grid;
            grid-template-columns: 52px minmax(0, 1fr) auto;
            align-items: center;
            gap: 10px;
            padding: 12px 22px 8px;
            border-bottom: none;
            background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(255,255,255,0.92) 82%, rgba(255,255,255,0) 100%);
            backdrop-filter: blur(14px);
        }

        body[data-mode="chat"] .hero,
        body[data-mode="chat"] .guest-hero,
        body[data-mode="chat"] .workspace-records,
        body[data-mode="chat"] .composer-top,
        body[data-mode="chat"] .composer-actions,
        body[data-mode="chat"] .chat-quick-actions {
            display: none;
        }

        body[data-mode="chat"] .history,
        body[data-mode="image"] .history,
        body[data-mode="video"] .history {
            width: var(--chat-sidebar-width);
            min-width: var(--chat-sidebar-width);
            transition: opacity .22s ease, transform .22s ease, width .22s ease, padding .22s ease, box-shadow .22s ease;
        }

        body.sidebar-collapsed[data-mode="image"] .app,
        body.sidebar-collapsed[data-mode="video"] .app {
            grid-template-columns: 0 0 minmax(0, 1fr);
        }

        body.sidebar-collapsed[data-mode="image"] .history,
        body.sidebar-collapsed[data-mode="video"] .history {
            width: 0;
            min-width: 0;
            padding-left: 0;
            padding-right: 0;
            opacity: 0;
            transform: translateX(-18px);
            pointer-events: none;
            overflow: hidden;
            border-right-color: transparent;
        }

        body.sidebar-collapsed[data-mode="chat"] .app {
            grid-template-columns: 0 0 minmax(0, 1fr);
        }

        body.sidebar-collapsed[data-mode="chat"] .history {
            width: 0;
            min-width: 0;
            padding-left: 0;
            padding-right: 0;
            opacity: 0;
            transform: translateX(-18px);
            pointer-events: none;
            overflow: hidden;
            border-right-color: transparent;
        }

        body.sidebar-collapsed[data-mode="chat"] .desktop-sidebar-resizer {
            pointer-events: none;
        }

        body.sidebar-collapsed[data-mode="image"] .desktop-sidebar-resizer,
        body.sidebar-collapsed[data-mode="video"] .desktop-sidebar-resizer {
            pointer-events: none;
        }

        body.sidebar-collapsed[data-mode="chat"] .desktop-sidebar-resizer::before,
        body.sidebar-collapsed[data-mode="chat"] .desktop-sidebar-resizer::after {
            opacity: 0;
        }

        body.sidebar-collapsed[data-mode="image"] .desktop-sidebar-resizer::before,
        body.sidebar-collapsed[data-mode="image"] .desktop-sidebar-resizer::after,
        body.sidebar-collapsed[data-mode="video"] .desktop-sidebar-resizer::before,
        body.sidebar-collapsed[data-mode="video"] .desktop-sidebar-resizer::after {
            opacity: 0;
        }

        body.sidebar-peek-open[data-mode="chat"] .history {
            position: fixed;
            left: 14px;
            top: 58px;
            width: var(--chat-sidebar-width);
            min-width: var(--chat-sidebar-width);
            height: calc(100vh - 74px);
            opacity: 1;
            transform: none;
            pointer-events: auto;
            padding: 14px 10px 10px 12px;
            border: 1px solid rgba(15, 23, 42, 0.06);
            border-radius: 24px;
            background: #f8f8f8;
            box-shadow: 0 18px 46px rgba(15, 23, 42, 0.14);
            z-index: 42;
        }

        body.sidebar-peek-open[data-mode="chat"] .history .conversation-list {
            overflow-y: auto;
        }

        body[data-mode="chat"] .result-content {
            height: calc(100vh - 196px);
            max-height: calc(100vh - 196px);
            padding: 0 42px;
        }

        body[data-mode="chat"] .empty-state {
            min-height: 100%;
            height: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 22px 18px 8px;
        }

        body[data-mode="chat"] .chat-empty {
            width: min(860px, 100%);
            min-height: 0;
            gap: 14px;
        }

        body[data-mode="chat"] .chat-empty-badge {
            display: none;
        }

        body[data-mode="chat"] .chat-empty-copy {
            text-align: center;
            margin-bottom: 12px;
        }

        body[data-mode="chat"] .chat-empty-title {
            font-size: clamp(28px, 3.8vw, 44px);
            line-height: 1.12;
            letter-spacing: -0.05em;
            color: #0f172a;
        }

        body[data-mode="chat"] .chat-empty-desc {
            max-width: 420px;
            margin: 0 auto;
            font-size: 12px;
            line-height: 1.7;
            color: #98a1ae;
        }

        body[data-mode="chat"] .chat-empty-grid {
            width: min(980px, 100%);
        }

        body[data-mode="chat"] .chat-empty-chip {
            min-height: 44px;
            padding: 0 18px;
            border-radius: 16px;
            border: 1px solid rgba(15, 23, 42, 0.04);
            background: rgba(246, 247, 249, 0.92);
            color: #101828;
            font-size: 13px;
            box-shadow: none;
        }

        body[data-mode="chat"] .composer {
            position: sticky;
            bottom: 0;
            z-index: 12;
            width: 100%;
            max-width: none;
            margin: 0;
            padding: 0 22px 14px;
            background: transparent;
            border: none;
            box-shadow: none;
            background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(252,253,255,0.84) 12%, rgba(252,253,255,0.98) 34%, #fbfbfd 100%);
        }

        body[data-mode="chat"] #chat-compose-field {
            width: min(900px, calc(100vw - var(--chat-sidebar-width) - 108px));
            margin: 0 auto;
        }

        body.sidebar-collapsed[data-mode="chat"] #chat-compose-field {
            width: min(920px, calc(100vw - 120px));
        }

        body[data-mode="chat"] .chat-input-wrap {
            border-radius: 24px;
            border: 1px solid rgba(15, 23, 42, 0.08);
            overflow: hidden;
            background: var(--panel-strong);
            box-shadow: 0 18px 42px rgba(15, 23, 42, 0.06);
            padding-bottom: 8px;
        }

        body[data-mode="chat"] .chat-capability-pill {
            min-height: 32px;
            padding: 0 12px;
            background: rgba(37, 99, 255, 0.1);
            color: #1d4ed8;
            box-shadow: inset 0 0 0 1px rgba(37, 99, 255, 0.08);
        }

        body[data-mode="chat"] .chat-capability-target-btn {
            min-height: 32px;
            padding: 0 12px;
            background: rgba(15, 23, 42, 0.045);
        }

        body[data-mode="chat"] .chat-input-wrap textarea {
            min-height: 74px;
            padding: 16px 124px 10px 20px;
            color: #141826;
            -webkit-text-fill-color: #141826;
        }

        body[data-ui-theme="dark"][data-mode="chat"] .chat-input-wrap textarea {
            color: #edf2ff;
            caret-color: #6aa1ff;
            -webkit-text-fill-color: #edf2ff;
        }

        body[data-ui-theme="dark"][data-mode="chat"] .chat-input-wrap textarea::placeholder {
            color: #8f9bb0;
            opacity: 1;
        }

        body[data-ui-theme="dark"][data-mode="chat"] .chat-input-hint {
            color: #8f9bb0;
        }

        body[data-mode="chat"] .chat-input-tools {
            left: 12px;
            right: 12px;
            bottom: 10px;
            gap: 0;
        }

        body[data-mode="chat"] .chat-tool-btn {
            width: 34px;
            height: 34px;
            border: none;
            border-radius: 50%;
            background: transparent;
            color: #111827;
            box-shadow: none;
        }

        body[data-mode="chat"] .chat-input-action-group {
            gap: 6px;
        }

        body[data-mode="chat"] .chat-voice-btn {
            width: 34px;
            height: 34px;
            border: none;
            border-radius: 50%;
            background: transparent;
            color: #111827;
            box-shadow: none;
        }

        body[data-mode="chat"] .send-btn {
            width: 38px;
            height: 38px;
            border-radius: 50%;
            background: #f3f4f6;
            color: #111827;
            box-shadow: none;
        }

        body[data-mode="chat"] .send-btn.is-busy {
            background: #111827;
            color: #fff;
        }

        body[data-mode="chat"] .send-btn.has-text {
            background: linear-gradient(135deg, #2563eb 0%, #4f7cff 100%);
            color: #fff;
            box-shadow: 0 12px 24px rgba(37, 99, 235, 0.2);
        }

        body[data-mode="chat"] .send-btn.is-listening {
            background: #eef3fb;
            color: #1d4ed8;
            box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
        }

        body[data-mode="chat"] .composer-capability-bar {
            margin-top: 10px;
            padding: 4px 2px 0;
            border-top: none;
            gap: 8px;
            overflow-x: auto;
            flex-wrap: nowrap;
            scrollbar-width: none;
            justify-content: flex-start;
        }

        body[data-mode="chat"] .composer-capability-bar::-webkit-scrollbar {
            display: none;
        }

        body[data-mode="chat"] .composer-capability-bar::before {
            display: none;
        }

        body[data-mode="chat"] .composer-capability-btn {
            min-height: 36px;
            padding: 0 13px;
            border-radius: 999px;
            background: rgba(255, 255, 255, 0.9);
            border: 1px solid rgba(15, 23, 42, 0.06);
            color: #2f3a4f;
            font-size: 12px;
            font-weight: 600;
            box-shadow: 0 4px 10px rgba(15, 23, 42, 0.03);
            flex: 0 0 auto;
            text-decoration: none;
        }

        body[data-mode="chat"] .composer-capability-btn:hover,
        body[data-mode="chat"] .composer-capability-btn.active {
            background: #fff;
            color: #2050c5;
            border-color: rgba(37, 99, 255, 0.12);
            box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
        }

        body[data-mode="chat"] .composer-capability-btn[data-chat-tool-action="create"] {
            background: linear-gradient(135deg, rgba(37, 99, 255, 0.1) 0%, rgba(21, 185, 172, 0.1) 100%);
            border-color: rgba(37, 99, 255, 0.14);
            color: #1748c7;
        }

        body[data-mode="chat"] .composer-capability-btn[data-chat-tool-action="create"]:hover {
            background: linear-gradient(135deg, rgba(37, 99, 255, 0.14) 0%, rgba(21, 185, 172, 0.14) 100%);
        }

        body[data-mode="chat"] .composer-capability-btn[data-chat-tool-action="work"] {
            background: rgba(245, 247, 251, 0.95);
        }

        body[data-mode="chat"] .composer-capability-btn .capability-icon {
            width: 18px;
            height: 18px;
        }

        body[data-mode="chat"] .composer-capability-btn .capability-icon svg {
            width: 18px;
            height: 18px;
        }

        body[data-mode="chat"] .workspace-chat-header-center span {
            display: none;
        }

        body[data-ui-theme="dark"][data-mode="chat"] .workspace {
            background: linear-gradient(180deg, rgba(10, 18, 32, 0.94) 0%, rgba(13, 22, 38, 0.98) 100%);
        }

        body[data-ui-theme="dark"][data-mode="chat"] .chat-empty-title {
            color: #edf2ff;
        }

        body[data-ui-theme="dark"][data-mode="chat"] .chat-empty-desc {
            color: #8fa0bc;
        }

        body[data-ui-theme="dark"][data-mode="chat"] .chat-empty-chip {
            background: rgba(15, 23, 42, 0.72);
            border-color: rgba(148, 163, 184, 0.16);
            color: #dbe7ff;
        }

        body[data-ui-theme="dark"][data-mode="chat"] .chat-empty-chip:hover {
            background: rgba(30, 41, 59, 0.92);
            color: #edf2ff;
            border-color: rgba(96, 165, 250, 0.2);
            box-shadow: 0 10px 22px rgba(2, 6, 23, 0.26);
        }

        body[data-ui-theme="dark"][data-mode="chat"] .office-task-card {
            background: linear-gradient(180deg, rgba(15, 23, 42, 0.82) 0%, rgba(15, 23, 42, 0.96) 100%);
        }

        body[data-ui-theme="dark"][data-mode="chat"] .composer {
            background: rgba(10, 18, 32, 0.94);
            border-color: rgba(148, 163, 184, 0.16);
            box-shadow: 0 20px 42px rgba(2, 6, 23, 0.34);
        }

        body[data-ui-theme="dark"] .conversation-more-btn {
            background: rgba(71, 85, 105, 0.18);
            color: #94a3b8;
        }

        body[data-ui-theme="dark"] .conversation-more-btn:hover,
        body[data-ui-theme="dark"] .conversation-item.menu-open .conversation-more-btn {
            background: rgba(100, 116, 139, 0.22);
            color: #e2e8f0;
        }

        body[data-ui-theme="dark"] .conversation-menu {
            border-color: rgba(148, 163, 184, 0.12);
            background: rgba(12, 20, 34, 0.96);
            box-shadow: 0 24px 50px rgba(2, 6, 23, 0.44);
        }

        body[data-ui-theme="dark"] .conversation-menu-item {
            color: #dbe7ff;
        }

        body[data-ui-theme="dark"] .conversation-menu-item:hover {
            background: rgba(30, 41, 59, 0.9);
        }

        body[data-ui-theme="dark"] .conversation-menu-item.is-divider {
            border-top-color: rgba(148, 163, 184, 0.12);
        }

        body[data-ui-theme="dark"] .conversation-menu-item.is-danger {
            color: #fca5a5;
        }

        body[data-ui-theme="dark"] .conversation-menu-item.is-danger:hover {
            background: rgba(127, 29, 29, 0.32);
        }

        body[data-ui-theme="dark"] .conversation-pinned-chip {
            background: rgba(59, 130, 246, 0.16);
            color: #bfdbfe;
        }

        body[data-ui-theme="dark"] #chat-compose-field.is-media-mode .chat-input-wrap textarea {
            color: #edf2ff;
            -webkit-text-fill-color: #edf2ff;
        }

        body[data-ui-theme="dark"] #chat-compose-field.is-media-mode .chat-input-wrap textarea::placeholder {
            color: #8f9bb0;
            opacity: 1;
        }

        body[data-ui-theme="dark"] #chat-compose-field.is-media-mode .chat-input-hint {
            color: #8f9bb0;
        }

        body[data-ui-theme="dark"][data-mode="chat"] .composer-capability-btn {
            background: rgba(15, 23, 42, 0.76);
            border-color: rgba(148, 163, 184, 0.14);
            color: #dbe7ff;
        }

        body[data-ui-theme="dark"][data-mode="chat"] .composer-capability-btn:hover,
        body[data-ui-theme="dark"][data-mode="chat"] .composer-capability-btn.active {
            background: rgba(30, 41, 59, 0.94);
            color: #bfd3ff;
            border-color: rgba(96, 165, 250, 0.2);
            box-shadow: 0 8px 18px rgba(2, 6, 23, 0.24);
        }

        body[data-ui-theme="dark"][data-mode="chat"] .composer-capability-btn[data-chat-tool-action="work"] {
            background: rgba(15, 23, 42, 0.76);
        }

        body[data-ui-theme="dark"] .composer-capability-btn .capability-icon {
            color: #dbe7ff;
        }

        body[data-ui-theme="dark"] .composer-capability-btn.active .capability-icon {
            color: #bfd3ff;
        }

        body[data-ui-theme="dark"][data-mode="chat"] .workspace-chat-header {
            background: rgba(8, 15, 28, 0.82);
            border-bottom-color: rgba(148, 163, 184, 0.1);
            box-shadow: 0 10px 26px rgba(2, 6, 23, 0.18);
        }

        body[data-ui-theme="dark"][data-mode="chat"] .workspace-chat-header-center strong,
        body[data-ui-theme="dark"][data-mode="chat"] .conversation-title,
        body[data-ui-theme="dark"][data-mode="chat"] .chat-tool-btn,
        body[data-ui-theme="dark"][data-mode="chat"] .send-btn,
        body[data-ui-theme="dark"][data-mode="chat"] .sidebar-account strong {
            color: #edf2ff;
        }

        body[data-ui-theme="dark"] .sidebar-brand-copy strong {
            color: #67a8ff;
        }

        body[data-ui-theme="dark"][data-mode="chat"] .workspace-chat-header-center span,
        body[data-ui-theme="dark"][data-mode="chat"] .sidebar-section-label,
        body[data-ui-theme="dark"][data-mode="chat"] .sidebar-account span,
        body[data-ui-theme="dark"][data-mode="chat"] .chat-quick-actions-label {
            color: #8fa0bc;
        }

        body[data-ui-theme="dark"][data-mode="chat"] .sidebar-brand-copy span {
            color: #67a8ff;
        }

        body[data-ui-theme="dark"] .conversation-item-icon {
            color: #d7e4ff;
        }

        body[data-ui-theme="dark"] .conversation-time {
            color: #91a1bc;
        }

        body[data-ui-theme="dark"][data-mode="chat"] .composer {
            background: linear-gradient(180deg, rgba(8, 15, 28, 0) 0%, rgba(8, 15, 28, 0.78) 16%, rgba(8, 15, 28, 0.94) 38%, rgba(8, 15, 28, 0.98) 100%);
        }

        body[data-ui-theme="dark"][data-mode="chat"] .chat-input-wrap {
            background: rgba(10, 18, 32, 0.96);
            border-color: rgba(148, 163, 184, 0.14);
            box-shadow: 0 18px 42px rgba(2, 6, 23, 0.34);
        }

        body[data-ui-theme="dark"][data-mode="chat"] .chat-capability-pill {
            background: rgba(37, 99, 255, 0.18);
            color: #dbeafe;
            box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.16);
        }

        body[data-ui-theme="dark"][data-mode="chat"] .chat-capability-target-btn {
            background: rgba(15, 23, 42, 0.7);
            color: #dbe7ff;
            border-color: rgba(148, 163, 184, 0.16);
        }

        body[data-ui-theme="dark"][data-mode="chat"] .chat-tool-btn {
            background: rgba(15, 23, 42, 0.76);
            color: #dbe7ff;
            border: 1px solid rgba(148, 163, 184, 0.12);
        }

        body[data-ui-theme="dark"][data-mode="chat"] .chat-tool-btn:hover,
        body[data-ui-theme="dark"][data-mode="chat"] .chat-capability-target-btn:hover {
            background: rgba(30, 41, 59, 0.94);
            color: #edf2ff;
            border-color: rgba(96, 165, 250, 0.18);
        }

        body[data-ui-theme="dark"][data-mode="chat"] .send-btn {
            background: rgba(226, 232, 240, 0.1);
            color: #edf2ff;
        }

        body[data-ui-theme="dark"][data-mode="chat"] .send-btn.is-busy {
            background: #edf2ff;
            color: #0f172a;
        }

        body[data-ui-theme="dark"][data-mode="chat"] .send-btn.has-text,
        body[data-ui-theme="dark"][data-mode="chat"] .send-btn.is-listening {
            background: #1e293b;
            color: #93c5fd;
        }

        body[data-ui-theme="dark"][data-mode="chat"] .send-btn::before,
        body[data-ui-theme="dark"][data-mode="chat"] .send-btn::after {
            background: rgba(2, 6, 23, 0.96);
        }

        @media (max-width: 768px) {
            .send-btn::before,
            .send-btn::after {
                display: none;
            }
        }

        body[data-ui-theme="dark"][data-mode="chat"] .chat-quick-action {
            background: transparent;
            color: #c7d2e5;
        }

        body[data-ui-theme="dark"][data-mode="chat"] .chat-quick-action:hover {
            background: rgba(30, 41, 59, 0.92);
            color: #edf2ff;
        }

        body[data-ui-theme="dark"][data-mode="chat"] .history {
            background: #0b1322;
            border-right-color: rgba(148, 163, 184, 0.12);
        }

        body[data-ui-theme="dark"][data-mode="chat"] .desktop-sidebar-resizer::before,
        body[data-ui-theme="dark"][data-mode="image"] .desktop-sidebar-resizer::before,
        body[data-ui-theme="dark"][data-mode="video"] .desktop-sidebar-resizer::before {
            background: rgba(148, 163, 184, 0.14);
        }

        body[data-ui-theme="dark"][data-mode="chat"] .desktop-sidebar-resizer::after,
        body[data-ui-theme="dark"][data-mode="image"] .desktop-sidebar-resizer::after,
        body[data-ui-theme="dark"][data-mode="video"] .desktop-sidebar-resizer::after {
            background: rgba(148, 163, 184, 0.2);
        }

        body[data-ui-theme="dark"][data-mode="chat"] .conversation-item {
            color: #dbe7ff;
        }

        body[data-ui-theme="dark"][data-mode="chat"] .conversation-item:hover,
        body[data-ui-theme="dark"][data-mode="chat"] .conversation-item.active {
            background: rgba(15, 23, 42, 0.82);
            border-color: rgba(148, 163, 184, 0.1);
            box-shadow: 0 8px 18px rgba(2, 6, 23, 0.22);
        }

        body[data-ui-theme="dark"] .history.is-conversation-view .sidebar-section-label {
            color: #8ea0bb;
        }

        body[data-ui-theme="dark"] .history.is-conversation-view .conversation-item {
            color: #dbe7ff;
        }

        body[data-ui-theme="dark"] .history.is-conversation-view .conversation-item:hover,
        body[data-ui-theme="dark"] .history.is-conversation-view .conversation-item.active {
            background: rgba(15, 23, 42, 0.82);
            border-color: rgba(148, 163, 184, 0.1);
            box-shadow: 0 8px 18px rgba(2, 6, 23, 0.22) !important;
        }

        body[data-ui-theme="dark"] .history.is-conversation-view .conversation-title,
        body[data-ui-theme="dark"] .history.is-conversation-view .conversation-item.active .conversation-title,
        body[data-ui-theme="dark"] .history.is-conversation-view .conversation-item:hover .conversation-title {
            color: #edf2ff;
        }

        body[data-ui-theme="dark"][data-mode="chat"] .sidebar-footer {
            border-top-color: rgba(148, 163, 184, 0.08);
        }

        body[data-ui-theme="dark"][data-mode="chat"] .media-drawer-section {
            border-color: rgba(148, 163, 184, 0.12);
            background: linear-gradient(180deg, rgba(10, 18, 32, 0.98) 0%, rgba(12, 22, 36, 0.98) 100%);
            box-shadow: 0 16px 32px rgba(2, 6, 23, 0.18);
        }

        body[data-ui-theme="dark"][data-mode="chat"] .media-options-card {
            background: linear-gradient(180deg, rgba(10, 18, 32, 0.99) 0%, rgba(12, 22, 36, 0.99) 100%);
            border-color: rgba(148, 163, 184, 0.12);
            box-shadow: 0 26px 60px rgba(2, 6, 23, 0.42);
        }

        body[data-ui-theme="dark"][data-mode="chat"] #media-compose .field > label,
        body[data-ui-theme="dark"][data-mode="chat"] #media-compose .tiny,
        body[data-ui-theme="dark"][data-mode="chat"] .media-section-head p {
            color: #8fa0bc;
        }

        body[data-ui-theme="dark"][data-mode="chat"] .field input,
        body[data-ui-theme="dark"][data-mode="chat"] .field select,
        body[data-ui-theme="dark"][data-mode="chat"] .field textarea {
            background: rgba(15, 23, 42, 0.82);
            border-color: rgba(148, 163, 184, 0.12);
            color: #edf2ff;
        }

        body[data-ui-theme="dark"][data-mode="chat"] #media-compose .advanced-controls {
            background: rgba(15, 23, 42, 0.72);
            border-color: rgba(148, 163, 184, 0.12);
        }

        body[data-mode="chat"] .workspace-chat-header-center strong {
            font-size: 14px;
            letter-spacing: -0.02em;
        }

        @media (max-width: 920px) {
            body[data-mode="chat"] .app {
                grid-template-columns: minmax(0, 1fr);
            }

            body[data-mode="chat"] .desktop-sidebar-resizer {
                display: none !important;
            }

            .auth-layout {
                grid-template-columns: 1fr;
            }

            .auth-aside {
                padding-left: 0;
                border-left: none;
                border-top: 1px solid rgba(148, 163, 184, 0.18);
                padding-top: 16px;
            }

            body[data-mode="chat"] .workspace-chat-header {
                display: none;
            }

            body.compact-media-mode[data-mode="chat"] .media-options-card {
                position: static;
                width: auto;
                max-height: none;
                overflow: visible;
                transform: none;
                opacity: 1;
                pointer-events: auto;
                box-shadow: none;
            }

            body.compact-media-mode[data-mode="chat"] .desktop-media-drawer-backdrop {
                display: none;
            }

            body[data-mode="chat"] .chat-empty-suggestions {
                width: 100%;
                grid-template-columns: 1fr;
            }

            body[data-mode="chat"] .chat-empty-grid {
                width: min(100%, calc(100vw - 28px));
                margin: 8px auto 0;
                padding-right: 0;
                overflow-x: hidden;
                touch-action: pan-y;
            }

            body[data-mode="chat"] .chat-empty-track {
                width: 100%;
                min-width: 0;
                gap: 9px;
            }

            body[data-mode="chat"] .chat-empty-row {
                width: 100%;
                min-width: 0;
                flex-wrap: wrap;
                justify-content: center;
                gap: 8px;
            }

            body[data-mode="chat"] .chat-empty-chip {
                width: calc((100% - 16px) / 3);
                max-width: 100%;
                min-width: 0;
                min-height: 38px;
                padding: 10px 12px;
                border-radius: 12px;
                font-size: 11.5px;
                line-height: 1.4;
                justify-content: flex-start;
                align-items: flex-start;
                text-align: left;
                background: rgba(246, 247, 249, 0.9);
                border-color: rgba(15, 23, 42, 0.035);
            }

            body[data-mode="chat"] #chat-compose-field,
            body.sidebar-collapsed[data-mode="chat"] #chat-compose-field {
                width: 100%;
            }

            body[data-mode="chat"] .workspace {
                height: 100dvh;
                min-height: 100dvh;
                max-height: 100dvh;
            }

            body[data-mode="chat"] .stage,
            body[data-mode="chat"] .result-card {
                min-height: 0;
                height: 100%;
            }

            body[data-mode="chat"] .result-card {
                display: flex;
                flex-direction: column;
            }

            body[data-mode="chat"] .result-content {
                flex: 1 1 auto;
                min-height: 0;
                height: auto;
                max-height: none;
                padding: 6px 14px 18px;
                overflow-y: auto;
                overflow-x: hidden;
                scroll-padding-top: 16px;
                scroll-padding-bottom: 24px;
            }

            body[data-mode="chat"] .empty-state {
                min-height: 100%;
                height: 100%;
                align-items: center;
                justify-content: center;
                padding: 0 10px clamp(20px, 6vh, 52px);
            }

            body[data-mode="chat"] .chat-empty {
                min-height: 0;
                padding-top: 0;
                gap: 12px;
            }

            body[data-mode="chat"] .chat-empty-copy {
                margin-bottom: 10px;
            }

            body[data-mode="chat"] .chat-empty-title {
                font-size: clamp(26px, 7.2vw, 30px);
            }

            body[data-mode="chat"] .chat-area,
            body[data-mode="chat"] .chat-thread-card,
            body[data-mode="chat"] .chat-thread {
                min-height: 0;
            }

            body[data-mode="chat"] .chat-area:not(.hidden) {
                padding-top: 4px;
                padding-bottom: 28px;
                scroll-padding-top: 16px;
            }

            body[data-mode="chat"] .composer {
                padding: 8px 10px calc(env(safe-area-inset-bottom, 0px) + 12px);
            }
        }

        .image-studio-heading {
            display: none;
        }

        .image-studio-heading h1 {
            margin: 0;
            font-size: clamp(28px, 3.6vw, 40px);
            line-height: 1.12;
            color: #172135;
            letter-spacing: -0.04em;
        }

        .image-studio-heading p {
            margin: 0;
            color: #a9b3c3;
            font-size: 13px;
            line-height: 1.5;
        }

        .image-create-studio {
            display: flex;
            align-items: flex-end;
            min-height: calc(100vh - 122px);
            width: 100%;
            max-width: 100%;
            min-width: 0;
            box-sizing: border-box;
            padding: 0 0 16px;
        }

        .image-studio-shell {
            width: 100%;
            max-width: 1008px;
            margin: 0 auto;
            min-height: 100%;
            display: flex;
            flex-direction: column;
            justify-content: flex-end;
            gap: 16px;
        }

        .image-studio-hero {
            display: block;
        }

        .image-studio-prompt-card {
            padding: 0;
            border-radius: 34px;
            border: 1px solid rgba(96, 165, 250, 0.3);
            background: rgba(255, 255, 255, 0.98);
            box-shadow: 0 24px 60px rgba(15, 23, 42, 0.08);
            overflow: visible;
        }

        .studio-reference-bar {
            display: grid;
            gap: 10px;
            padding: 18px 22px 0;
        }

        .studio-reference-meta {
            color: #6c7688;
            font-size: 12px;
            line-height: 1.5;
        }

        .studio-reference-list {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
        }

        .studio-reference-chip {
            position: relative;
            min-width: 88px;
            max-width: 148px;
            min-height: 88px;
            padding: 8px;
            border-radius: 20px;
            border: 1px solid rgba(15, 23, 42, 0.08);
            background: linear-gradient(180deg, rgba(249, 251, 255, 0.98) 0%, rgba(242, 246, 252, 0.98) 100%);
            box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
            overflow: hidden;
        }

        .studio-reference-chip.is-file {
            display: flex;
            flex-direction: column;
            justify-content: center;
            gap: 8px;
        }

        .studio-reference-chip img,
        .studio-reference-chip video {
            display: block;
            width: 100%;
            height: 72px;
            object-fit: cover;
            border-radius: 14px;
            background: #edf2f8;
        }

        .studio-reference-chip-label {
            display: block;
            color: #445063;
            font-size: 11px;
            line-height: 1.5;
            word-break: break-word;
        }

        .studio-reference-chip-kind {
            display: inline-flex;
            align-items: center;
            align-self: flex-start;
            min-height: 22px;
            padding: 0 8px;
            border-radius: 999px;
            background: rgba(37, 99, 255, 0.08);
            color: #315fd6;
            font-size: 11px;
            font-weight: 700;
        }

        .studio-reference-remove {
            position: absolute;
            top: 8px;
            right: 8px;
            width: 24px;
            height: 24px;
            border: none;
            border-radius: 999px;
            background: rgba(15, 23, 42, 0.72);
            color: #fff;
            font-size: 14px;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 10px 20px rgba(15, 23, 42, 0.16);
        }

        .image-studio-input-shell {
            position: relative;
            border-radius: 24px;
            background: rgba(248, 250, 252, 0.92);
            border: 1px solid rgba(96, 135, 255, 0.2);
            box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
            overflow: hidden;
        }

        .image-studio-input {
            min-height: 148px;
            padding: 18px 112px 20px 18px;
            border: none;
            background: transparent;
            font-size: 18px;
            line-height: 1.7;
            color: #172135;
        }

        .image-studio-input::placeholder {
            color: #b8c0cc;
            opacity: 1;
        }

        .image-studio-input-tools {
            position: absolute;
            right: 14px;
            bottom: 14px;
            display: inline-flex;
            align-items: center;
            gap: 8px;
            z-index: 3;
            pointer-events: auto;
        }

        .image-studio-toolbar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            padding: 12px 16px 8px 16px;
            border-top: none;
        }

        .image-studio-toolbar-left,
        .image-studio-toolbar-right {
            display: flex;
            align-items: center;
            gap: 8px;
            flex-wrap: wrap;
        }

        .image-studio-toolbar-left {
            flex: 1 1 auto;
            min-width: 0;
            flex-wrap: wrap;
            overflow: visible;
            padding-left: 2px;
            padding-bottom: 0;
            scrollbar-width: none;
        }

        .image-studio-toolbar-left::-webkit-scrollbar {
            display: none;
        }

        .image-studio-toolbar-right {
            flex: 0 0 auto;
            justify-content: flex-end;
        }

        body[data-ui-theme="dark"] .image-studio-prompt-card {
            border-color: rgba(148, 163, 184, 0.14);
            background: rgba(10, 18, 32, 0.98) !important;
            box-shadow: 0 24px 60px rgba(2, 6, 23, 0.32);
        }

        body[data-ui-theme="dark"] .image-studio-input-shell {
            background: rgba(15, 23, 42, 0.38);
            border-color: rgba(96, 165, 250, 0.24);
            box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.12);
        }

        body[data-ui-theme="dark"] .image-studio-input,
        body[data-ui-theme="dark"] #image-studio-input {
            background: transparent !important;
            background-color: transparent !important;
            color: #edf2ff !important;
            -webkit-text-fill-color: #edf2ff !important;
            caret-color: #6aa1ff;
            box-shadow: none;
        }

        body[data-ui-theme="dark"] .image-studio-input::placeholder {
            color: #8f9bb0;
            opacity: 1;
        }

        body[data-ui-theme="dark"] .image-studio-toolbar {
            background: transparent;
        }

        .image-studio-toolbar-control {
            position: relative;
            z-index: 80;
        }

        .image-studio-more-panel {
            display: contents;
        }

        .image-studio-mobile-more-btn {
            display: none;
        }

        .image-studio-toolbar-divider {
            width: 1px;
            height: 22px;
            border-radius: 999px;
            background: rgba(15, 23, 42, 0.08);
        }

        .image-studio-inline-btn,
        .image-studio-tool-link {
            min-height: 40px;
            padding: 0 14px;
            border-radius: 999px;
            border: 1px solid rgba(15, 23, 42, 0.06);
            background: #fff;
            color: #1a2233;
            font-size: 14px;
            font-weight: 600;
            box-shadow: none;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            white-space: nowrap;
        }

        .image-studio-tool-link {
            max-width: 240px;
        }

        .image-studio-tool-link-copy {
            min-width: 0;
            display: inline-flex;
            align-items: baseline;
            gap: 6px;
        }

        .image-studio-tool-link-label {
            color: #6a7386;
            font-size: 12px;
            font-weight: 600;
        }

        .image-studio-tool-link-value {
            min-width: 0;
            max-width: 112px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            color: #111827;
            font-size: 14px;
            font-weight: 700;
        }

        .image-studio-inline-label {
            white-space: nowrap;
        }

        .image-studio-inline-btn.active {
            background: linear-gradient(180deg, #eff6ff 0%, #e8f1ff 100%);
            border-color: rgba(59, 130, 246, 0.18);
            color: #2563ff;
            box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.72);
        }

        .image-studio-inline-icon,
        .image-studio-inline-close {
            display: none;
        }

        .image-studio-tool-icon {
            width: 16px;
            height: 16px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            background: transparent;
            color: #64748b;
            line-height: 1;
            flex: 0 0 16px;
        }

        .image-studio-tool-icon svg {
            width: 16px;
            height: 16px;
            display: block;
        }

        .image-studio-inline-btn.active .image-studio-inline-icon {
            background: rgba(37, 99, 255, 0.12);
            color: #2563ff;
        }

        .image-studio-tool-link.has-popover::after {
            content: "";
            width: 8px;
            height: 8px;
            margin-left: 8px;
            border-right: 1.8px solid currentColor;
            border-bottom: 1.8px solid currentColor;
            transform: translateY(-2px) rotate(45deg);
            opacity: 0.72;
        }

        .image-studio-tool-link {
            background: rgba(248, 250, 252, 0.92);
        }

        .image-studio-tool-link-icononly {
            width: 40px;
            height: 40px;
            min-height: 40px;
            padding: 0;
            flex: 0 0 40px;
            align-items: center;
            justify-content: center;
            border-radius: 14px;
            border: 1px solid rgba(15, 23, 42, 0.06);
            background: #f8fafc;
            color: #475569;
            transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
        }

        .image-studio-tool-link-icononly:hover,
        .image-studio-tool-link-icononly:focus-visible {
            background: #eef3fb;
            border-color: rgba(37, 99, 255, 0.14);
            color: #1d4ed8;
            transform: translateY(-1px);
        }

        .image-studio-tool-link-icononly .image-studio-tool-icon {
            width: 18px;
            height: 18px;
            margin: 0;
            flex: 0 0 18px;
        }

        .image-studio-tool-link-icononly .image-studio-tool-icon svg {
            width: 18px;
            height: 18px;
        }

        .image-studio-tool-link:hover,
        .image-studio-inline-btn:hover {
            border-color: rgba(37, 99, 255, 0.16);
        }

        .image-studio-tool-link-muted {
            display: none;
        }

        .image-studio-tool-link.active {
            color: #0f172a;
            border-color: rgba(37, 99, 255, 0.18);
            background: linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%);
            box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
        }

        body[data-ui-theme="dark"] .image-studio-tool-link.active {
            color: #dce7ff;
            border-color: rgba(96, 165, 250, 0.28);
            background: linear-gradient(180deg, rgba(22, 32, 52, 0.98) 0%, rgba(15, 23, 42, 0.96) 100%);
            box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.12);
        }

        .image-studio-tool-link.active .image-studio-tool-link-label,
        .image-studio-tool-link.active .image-studio-tool-link-value {
            color: #1d4ed8;
        }

        .image-studio-tool-link.active .image-studio-tool-icon {
            color: #2563eb;
        }

        body[data-ui-theme="dark"] .image-studio-tool-link.active .image-studio-tool-link-label,
        body[data-ui-theme="dark"] .image-studio-tool-link.active .image-studio-tool-link-value {
            color: #bfd3ff;
        }

        body[data-ui-theme="dark"] .image-studio-tool-link.active .image-studio-tool-icon {
            color: #9fc0ff;
        }

        .image-studio-tool-link.has-popover[aria-expanded="true"]::after {
            transform: translateY(2px) rotate(225deg);
            opacity: 1;
        }

        .mobile-chat-toolbar {
            display: none;
        }

        .mobile-chat-more-menu {
            position: absolute;
            left: 0;
            bottom: calc(100% + 10px);
            min-width: 168px;
            padding: 8px;
            border-radius: 18px;
            border: 1px solid rgba(15, 23, 42, 0.08);
            background: rgba(255, 255, 255, 0.98);
            box-shadow: 0 18px 44px rgba(15, 23, 42, 0.14);
            backdrop-filter: blur(14px);
            z-index: 88;
        }

        .mobile-chat-more-item,
        .mobile-chat-toolbar-btn {
            border: none;
            background: transparent;
            color: #111827;
            font-size: 13px;
            font-weight: 600;
            border-radius: 14px;
        }

        .mobile-chat-more-item {
            width: 100%;
            min-height: 40px;
            padding: 0 12px;
            text-align: left;
            display: inline-flex;
            align-items: center;
            gap: 10px;
        }

        .mobile-chat-more-item:hover,
        .mobile-chat-toolbar-btn:hover {
            background: rgba(241, 245, 249, 0.92);
        }

        .mobile-chat-toolbar-btn {
            min-height: 34px;
            padding: 0 12px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
        }

        .mobile-chat-toolbar-icon,
        .mobile-chat-more-icon {
            width: 16px;
            height: 16px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            flex: 0 0 16px;
            color: currentColor;
        }

        .mobile-chat-toolbar-icon svg,
        .mobile-chat-more-icon svg {
            width: 16px;
            height: 16px;
            display: block;
        }

        .image-studio-popover {
            position: absolute;
            left: 0;
            top: calc(100% + 12px);
            bottom: auto;
            z-index: 64;
            min-width: 252px;
            max-height: min(54vh, 420px);
            overflow: auto;
            padding: 10px;
            border-radius: 20px;
            border: 1px solid rgba(15, 23, 42, 0.08);
            background: rgba(255, 255, 255, 0.98);
            box-shadow: 0 22px 48px rgba(15, 23, 42, 0.14);
            backdrop-filter: blur(16px);
        }

        #image-studio-style-menu {
            min-width: 348px;
        }

        #image-studio-style-menu .image-studio-popover-grid {
            grid-template-columns: 1fr;
        }

        .image-studio-popover-grid {
            display: grid;
            grid-template-columns: 1fr;
            gap: 6px;
        }

        .image-studio-popover-item {
            min-height: 36px;
            padding: 0 13px;
            border-radius: 13px;
            border: 1px solid rgba(15, 23, 42, 0.06);
            background: #f8fafc;
            color: #1f2937;
            font-size: 13px;
            font-weight: 600;
            text-align: left;
            transition: all 0.2s ease;
        }

        .image-studio-popover-item:hover {
            border-color: rgba(59, 130, 246, 0.28);
            background: #eef4ff;
            color: #1d4ed8;
        }

        .image-studio-popover-item.active {
            border-color: rgba(59, 130, 246, 0.42);
            background: linear-gradient(135deg, #eff6ff 0%, #eef2ff 100%);
            color: #1d4ed8;
        }

        .image-studio-popover-item.has-detail {
            min-height: 54px;
            padding: 9px 11px;
            align-items: center;
            justify-content: flex-start;
            text-align: left;
            display: flex;
            gap: 10px;
        }

        .image-studio-popover-item.no-thumb {
            padding: 10px 12px;
            gap: 0;
        }

        .image-studio-popover-item-title {
            font-size: 13px;
            font-weight: 700;
            line-height: 1.3;
            color: inherit;
        }

        .image-studio-popover-item-desc {
            font-size: 11px;
            line-height: 1.35;
            color: #8b97aa;
        }

        .image-studio-popover-copy {
            display: grid;
            gap: 2px;
            min-width: 0;
        }

        .image-studio-popover-thumb {
            width: 32px;
            height: 32px;
            border-radius: 11px;
            flex: 0 0 32px;
            background: linear-gradient(135deg, #dbeafe 0%, #eff6ff 100%);
            box-shadow: inset 0 0 0 1px rgba(255,255,255,0.82);
            background-size: cover;
            background-position: center;
            position: relative;
            overflow: hidden;
        }

        .image-studio-popover-thumb[data-style-thumb="portrait_photo"] {
            background:
                radial-gradient(circle at 55% 34%, rgba(255, 232, 214, 0.98) 0 22%, transparent 23%),
                radial-gradient(circle at 56% 29%, rgba(88, 62, 47, 0.98) 0 19%, transparent 20%),
                radial-gradient(circle at 52% 78%, rgba(244, 200, 174, 0.96) 0 24%, transparent 25%),
                linear-gradient(180deg, #fbe7da 0%, #f4c4b0 100%);
        }

        .image-studio-popover-thumb[data-style-thumb="cinematic_photo"] {
            background:
                radial-gradient(circle at 72% 18%, rgba(255, 211, 142, 0.9) 0 11%, transparent 12%),
                linear-gradient(180deg, rgba(245, 183, 104, 0.3) 0%, rgba(13, 29, 67, 0) 34%),
                linear-gradient(135deg, #274f93 0%, #0f1b3f 62%, #090f24 100%);
        }

        .image-studio-popover-thumb[data-style-thumb="chinese_style"] {
            background:
                radial-gradient(circle at 76% 23%, rgba(255, 221, 166, 0.92) 0 13%, transparent 14%),
                linear-gradient(180deg, rgba(254, 245, 223, 0.96) 0 43%, rgba(240, 186, 116, 0.44) 44%, rgba(203, 139, 70, 0.22) 100%),
                linear-gradient(160deg, transparent 42%, rgba(60, 95, 72, 0.72) 43% 61%, transparent 62%),
                linear-gradient(150deg, transparent 48%, rgba(39, 64, 49, 0.78) 49% 73%, transparent 74%);
        }

        .image-studio-popover-thumb[data-style-thumb="anime"] {
            background:
                radial-gradient(circle at 54% 34%, rgba(255, 237, 214, 0.98) 0 22%, transparent 23%),
                radial-gradient(circle at 42% 33%, rgba(255, 171, 202, 0.95) 0 15%, transparent 16%),
                radial-gradient(circle at 66% 33%, rgba(166, 209, 255, 0.95) 0 15%, transparent 16%),
                linear-gradient(180deg, #ffeaf4 0%, #ffd5e5 52%, #ffdba7 100%);
        }

        .image-studio-popover-thumb[data-style-thumb="render_3d"] {
            background:
                radial-gradient(circle at 34% 30%, rgba(255,255,255,0.92) 0 8%, transparent 9%),
                radial-gradient(circle at 44% 42%, rgba(255, 226, 242, 0.98) 0 22%, rgba(173, 198, 255, 0.9) 23% 38%, transparent 39%),
                linear-gradient(135deg, #edf3ff 0%, #c7d8ff 60%, #e9ecff 100%);
        }

        .image-studio-popover-thumb[data-style-thumb="cyberpunk"] {
            background:
                linear-gradient(180deg, rgba(26, 12, 61, 0.12) 0 50%, rgba(6, 4, 20, 0.72) 50% 100%),
                linear-gradient(90deg, transparent 0 14%, rgba(255, 73, 233, 0.82) 15% 18%, transparent 19% 34%, rgba(85, 199, 255, 0.85) 35% 38%, transparent 39% 56%, rgba(255, 152, 92, 0.72) 57% 60%, transparent 61% 100%),
                linear-gradient(135deg, #150d38 0%, #5f1aa2 54%, #ff54d0 100%);
        }

        .image-studio-popover-thumb[data-style-thumb="cg_animation"] {
            background:
                radial-gradient(circle at 62% 36%, rgba(255, 239, 196, 0.92) 0 16%, transparent 17%),
                radial-gradient(circle at 42% 58%, rgba(255,255,255,0.82) 0 20%, transparent 21%),
                linear-gradient(135deg, #d6f4ff 0%, #83b4ff 58%, #5e78ff 100%);
        }

        .image-studio-popover-thumb[data-style-thumb="ink_painting"] {
            background:
                radial-gradient(circle at 68% 24%, rgba(255,255,255,0.74) 0 10%, transparent 11%),
                linear-gradient(135deg, rgba(32, 38, 47, 0.78) 0 16%, transparent 17% 100%),
                linear-gradient(155deg, transparent 22%, rgba(85, 92, 108, 0.72) 23% 41%, transparent 42% 100%),
                linear-gradient(180deg, #f4f5f7 0%, #d0d5dd 100%);
        }

        .image-studio-popover-thumb[data-style-thumb="oil_painting"] {
            background:
                linear-gradient(35deg, rgba(250, 197, 92, 0.92) 0 20%, rgba(211, 103, 56, 0.92) 20% 40%, rgba(56, 120, 170, 0.86) 40% 60%, rgba(246, 226, 178, 0.92) 60% 78%, rgba(156, 76, 44, 0.92) 78% 100%),
                linear-gradient(135deg, #ffd695 0%, #c96d2d 100%);
        }

        .image-studio-popover-thumb[data-style-thumb="classical"] {
            background:
                radial-gradient(circle at 58% 28%, rgba(244, 224, 176, 0.9) 0 12%, transparent 13%),
                linear-gradient(180deg, rgba(80, 53, 34, 0.08) 0 46%, rgba(65, 36, 22, 0.64) 47% 100%),
                linear-gradient(135deg, #dbcda8 0%, #9d7a57 54%, #5e4632 100%);
        }

        .image-studio-popover-thumb[data-style-thumb="watercolor"] {
            background:
                radial-gradient(circle at 30% 36%, rgba(255, 195, 224, 0.88) 0 18%, transparent 19%),
                radial-gradient(circle at 64% 48%, rgba(186, 226, 255, 0.86) 0 20%, transparent 21%),
                radial-gradient(circle at 52% 72%, rgba(194, 246, 217, 0.8) 0 18%, transparent 19%),
                linear-gradient(135deg, #fff0f8 0%, #dff3ff 100%);
        }

        .image-studio-popover-thumb[data-style-thumb="cartoon"] {
            background:
                radial-gradient(circle at 50% 34%, rgba(255, 243, 199, 0.95) 0 17%, transparent 18%),
                radial-gradient(circle at 38% 64%, rgba(255, 107, 129, 0.92) 0 10%, transparent 11%),
                radial-gradient(circle at 62% 64%, rgba(65, 182, 230, 0.92) 0 10%, transparent 11%),
                linear-gradient(135deg, #fff0a9 0%, #ffb703 100%);
        }

        .image-studio-popover-thumb[data-style-thumb="flat_illustration"] {
            background:
                linear-gradient(180deg, rgba(255,255,255,0.18) 0 48%, rgba(25, 118, 210, 0.12) 49% 100%),
                linear-gradient(135deg, #ffd6a5 0%, #ffb4a2 36%, #a0c4ff 100%);
        }

        .image-studio-popover-thumb[data-style-thumb="landscape"] {
            background:
                radial-gradient(circle at 76% 18%, rgba(255, 238, 175, 0.92) 0 12%, transparent 13%),
                linear-gradient(180deg, #89c2ff 0 42%, #d9f0ff 43% 58%, #78c091 59% 100%);
        }

        .image-studio-popover-thumb[data-style-thumb="hongkong_anime"] {
            background:
                linear-gradient(180deg, rgba(8, 10, 30, 0.08) 0 46%, rgba(8, 10, 30, 0.56) 47% 100%),
                linear-gradient(90deg, transparent 0 18%, rgba(255, 93, 162, 0.84) 19% 23%, transparent 24% 52%, rgba(74, 222, 255, 0.84) 53% 57%, transparent 58% 100%),
                linear-gradient(135deg, #1e1b4b 0%, #7c3aed 54%, #f472b6 100%);
        }

        .image-studio-popover-thumb[data-style-thumb="pixel"] {
            background:
                linear-gradient(90deg, rgba(0,0,0,0.08) 0 14%, transparent 14% 28%, rgba(0,0,0,0.08) 28% 42%, transparent 42% 56%, rgba(0,0,0,0.08) 56% 70%, transparent 70% 84%, rgba(0,0,0,0.08) 84% 100%),
                linear-gradient(180deg, #ff9f1c 0%, #ffbf69 50%, #ffd166 100%);
        }

        .image-studio-popover-thumb[data-style-thumb="neon_painting"] {
            background:
                radial-gradient(circle at 52% 38%, rgba(255,255,255,0.9) 0 10%, transparent 11%),
                linear-gradient(135deg, #0f172a 0%, #312e81 36%, #ec4899 72%, #22d3ee 100%);
        }

        .image-studio-popover-thumb[data-style-thumb="colored_pencil"] {
            background:
                linear-gradient(35deg, rgba(255, 94, 98, 0.88) 0 18%, rgba(255, 188, 66, 0.86) 18% 36%, rgba(138, 201, 38, 0.84) 36% 54%, rgba(25, 130, 196, 0.84) 54% 72%, rgba(106, 76, 147, 0.86) 72% 100%),
                linear-gradient(135deg, #fff3c4 0%, #f7cad0 100%);
        }

        .image-studio-popover-thumb[data-style-thumb="figure"] {
            background:
                radial-gradient(circle at 50% 34%, rgba(255, 243, 214, 0.94) 0 16%, transparent 17%),
                radial-gradient(circle at 38% 60%, rgba(254, 202, 202, 0.92) 0 10%, transparent 11%),
                radial-gradient(circle at 62% 60%, rgba(191, 219, 254, 0.92) 0 10%, transparent 11%),
                linear-gradient(135deg, #f8fafc 0%, #dbeafe 100%);
        }

        .image-studio-popover-thumb[data-style-thumb="children_drawing"] {
            background:
                radial-gradient(circle at 28% 26%, rgba(255, 221, 87, 0.94) 0 10%, transparent 11%),
                linear-gradient(180deg, #c7f9cc 0 54%, #80ed99 55% 100%);
        }

        .image-studio-popover-thumb[data-style-thumb="abstract"] {
            background:
                radial-gradient(circle at 24% 30%, rgba(255,255,255,0.38) 0 18%, transparent 19%),
                radial-gradient(circle at 74% 40%, rgba(255,255,255,0.28) 0 20%, transparent 21%),
                linear-gradient(135deg, #0ea5e9 0%, #8b5cf6 54%, #f43f5e 100%);
        }

        .image-studio-popover-thumb[data-style-thumb="pen_illustration"] {
            background:
                linear-gradient(135deg, rgba(15, 23, 42, 0.9) 0 8%, transparent 8% 100%),
                linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
        }

        .image-studio-popover-thumb[data-style-thumb="anime_2d"] {
            background:
                radial-gradient(circle at 48% 34%, rgba(255, 230, 242, 0.96) 0 18%, transparent 19%),
                radial-gradient(circle at 34% 62%, rgba(255, 170, 200, 0.92) 0 10%, transparent 11%),
                radial-gradient(circle at 66% 62%, rgba(96, 165, 250, 0.92) 0 10%, transparent 11%),
                linear-gradient(135deg, #fde68a 0%, #f9a8d4 52%, #93c5fd 100%);
        }

        .image-studio-popover-thumb[data-style-thumb="ink_print"] {
            background:
                linear-gradient(35deg, rgba(17, 24, 39, 0.88) 0 18%, rgba(75, 85, 99, 0.8) 18% 36%, rgba(209, 213, 219, 0.82) 36% 60%, rgba(17, 24, 39, 0.88) 60% 100%),
                linear-gradient(180deg, #f3f4f6 0%, #d1d5db 100%);
        }

        .image-studio-popover-thumb[data-style-thumb="printmaking"] {
            background:
                linear-gradient(90deg, rgba(15, 23, 42, 0.2) 0 10%, transparent 10% 20%, rgba(15, 23, 42, 0.2) 20% 30%, transparent 30% 40%, rgba(15, 23, 42, 0.2) 40% 50%, transparent 50% 60%, rgba(15, 23, 42, 0.2) 60% 70%, transparent 70% 80%, rgba(15, 23, 42, 0.2) 80% 90%, transparent 90% 100%),
                linear-gradient(135deg, #e9d5ff 0%, #c4b5fd 100%);
        }

        .image-studio-popover-thumb[data-style-thumb="monet"] {
            background:
                radial-gradient(circle at 34% 44%, rgba(255, 209, 220, 0.86) 0 16%, transparent 17%),
                radial-gradient(circle at 68% 56%, rgba(147, 197, 253, 0.8) 0 18%, transparent 19%),
                linear-gradient(135deg, #e9f5db 0%, #cfe1b9 46%, #dbeafe 100%);
        }

        .image-studio-popover-thumb[data-style-thumb="picasso"] {
            background:
                linear-gradient(45deg, rgba(17,24,39,0.72) 0 10%, transparent 10% 100%),
                linear-gradient(135deg, #fde68a 0%, #fca5a5 34%, #93c5fd 68%, #d8b4fe 100%);
        }

        .image-studio-popover-thumb[data-style-thumb="rembrandt"] {
            background:
                radial-gradient(circle at 62% 28%, rgba(255, 219, 153, 0.88) 0 12%, transparent 13%),
                linear-gradient(135deg, #3f2f1f 0%, #7c4a2d 46%, #d4a373 100%);
        }

        .image-studio-popover-thumb[data-style-thumb="matisse"] {
            background:
                radial-gradient(circle at 26% 34%, rgba(255,255,255,0.26) 0 12%, transparent 13%),
                linear-gradient(135deg, #f97316 0%, #60a5fa 50%, #34d399 100%);
        }

        .image-studio-popover-thumb[data-style-thumb="baroque"] {
            background:
                radial-gradient(circle at 66% 22%, rgba(255, 224, 163, 0.88) 0 12%, transparent 13%),
                linear-gradient(135deg, #2d1b0e 0%, #7c5c32 56%, #d4a017 100%);
        }

        .image-studio-popover-thumb[data-style-thumb="retro_anime"] {
            background:
                radial-gradient(circle at 50% 34%, rgba(255, 237, 214, 0.96) 0 16%, transparent 17%),
                linear-gradient(135deg, #fef3c7 0%, #fdba74 38%, #f472b6 100%);
        }

        .image-studio-popover-thumb[data-style-thumb="storybook"] {
            background:
                radial-gradient(circle at 28% 22%, rgba(255, 244, 163, 0.92) 0 10%, transparent 11%),
                linear-gradient(180deg, #bfdbfe 0 46%, #e9d5ff 47% 72%, #86efac 73% 100%);
        }

        .image-studio-tool-meta {
            display: none;
            align-items: center;
            min-height: 36px;
            padding: 0 12px;
            border-radius: 999px;
            background: rgba(37, 99, 255, 0.08);
            color: #4a5e83;
            font-size: 12px;
            white-space: nowrap;
            max-width: 320px;
        }

        #image-studio-advanced-btn {
            display: none !important;
        }

        .image-studio-template-panel {
            width: 100%;
            margin: 0;
            padding: 18px;
            border-radius: 32px;
            border: 1px solid rgba(15, 23, 42, 0.06);
            background: linear-gradient(180deg, rgba(255, 255, 255, 0.99) 0%, rgba(249, 251, 255, 0.99) 100%);
            box-shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
            max-height: min(48vh, 560px);
            overflow: auto;
        }

        .image-studio-template-panel.is-visible {
            animation: imageStudioTemplateReveal .22s cubic-bezier(.22, 1, .36, 1);
            transform-origin: center bottom;
        }

        .image-studio-template-panel.is-compact {
            padding: 14px;
            border-radius: 28px;
            box-shadow: 0 28px 64px rgba(15, 23, 42, 0.16);
            background: rgba(255, 255, 255, 0.98);
            backdrop-filter: blur(20px);
            max-height: none;
            overflow: visible;
        }

        @keyframes imageStudioTemplateReveal {
            0% {
                opacity: 0;
                transform: translateY(10px) scale(0.985);
            }
            100% {
                opacity: 1;
                transform: translateY(0) scale(1);
            }
        }

        .image-studio-template-head {
            display: flex;
            align-items: flex-end;
            justify-content: space-between;
            gap: 16px;
            margin-bottom: 12px;
        }

        .image-studio-template-head strong {
            display: block;
            font-size: 18px;
            line-height: 1.3;
            color: #111827;
        }

        .image-studio-template-head span {
            display: block;
            margin-top: 4px;
            font-size: 12px;
            line-height: 1.5;
            color: #6b7280;
        }

        .image-studio-template-filters {
            display: flex;
            align-items: center;
            gap: 8px;
            flex-wrap: wrap;
            margin-bottom: 14px;
        }

        .image-studio-template-filter {
            min-height: 34px;
            padding: 0 12px;
            border: 1px solid rgba(15, 23, 42, 0.08);
            border-radius: 999px;
            background: rgba(255, 255, 255, 0.88);
            color: #475569;
            font-size: 12px;
            font-weight: 600;
            cursor: pointer;
            transition: all .2s ease;
        }

        .image-studio-template-filter:hover {
            border-color: rgba(37, 99, 255, 0.2);
            color: #1d4ed8;
            background: #eff6ff;
        }

        .image-studio-template-filter.active {
            border-color: rgba(37, 99, 255, 0.3);
            color: #1d4ed8;
            background: linear-gradient(180deg, #f7fbff 0%, #edf4ff 100%);
            box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7);
        }

        .image-studio-template-masonry {
            display: grid;
            grid-template-columns: repeat(3, minmax(0, 1fr));
            gap: 12px;
            align-items: start;
        }

        .image-studio-template-compact {
            display: grid;
            gap: 2px;
            border-radius: 22px;
            overflow: hidden;
            background: #f2f5fa;
        }

        .image-studio-template-compact-head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            padding: 2px 2px 12px;
        }

        .image-studio-template-compact-copy {
            display: grid;
            gap: 3px;
            min-width: 0;
        }

        .image-studio-template-compact-copy strong {
            display: block;
            font-size: 15px;
            line-height: 1.35;
            color: #111827;
        }

        .image-studio-template-compact-copy span {
            display: block;
            font-size: 11px;
            line-height: 1.4;
            color: #7b8797;
        }

        .image-studio-template-compact-head strong {
            display: block;
            font-size: 15px;
            line-height: 1.35;
            color: #111827;
        }

        .image-studio-template-compact-head span {
            display: block;
            margin-top: 4px;
            font-size: 11px;
            line-height: 1.4;
            color: #7b8797;
        }

        .image-studio-template-refresh {
            flex: 0 0 auto;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            min-height: 32px;
            padding: 0 12px;
            border: 1px solid rgba(15, 23, 42, 0.08);
            border-radius: 999px;
            background: rgba(255, 255, 255, 0.92);
            color: #334155;
            font-size: 12px;
            font-weight: 700;
            cursor: pointer;
            transition: all .2s ease;
        }

        .image-studio-template-refresh-icon {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 16px;
            height: 16px;
            margin-right: 6px;
            border-radius: 999px;
            background: rgba(37, 99, 255, 0.1);
            color: #2563eb;
            font-size: 11px;
            line-height: 1;
            transition: transform .22s ease, background .2s ease, color .2s ease;
        }

        .image-studio-template-refresh:hover {
            color: #1d4ed8;
            border-color: rgba(37, 99, 255, 0.22);
            background: #eef4ff;
        }

        .image-studio-template-refresh:hover .image-studio-template-refresh-icon {
            transform: rotate(90deg);
            background: rgba(37, 99, 255, 0.14);
            color: #1d4ed8;
        }

        .image-studio-template-compact-grid {
            display: grid;
            grid-template-columns: repeat(4, minmax(0, 1fr));
            gap: 2px;
        }

        .image-studio-template-column {
            display: block;
            min-width: 0;
            overflow: hidden;
            background: #f3f4f6;
        }

        .image-studio-template-spotlight,
        .image-studio-template-mini {
            position: relative;
            display: block;
            width: 100%;
            margin: 0;
            padding: 0;
            border: none;
            background: #f3f4f6;
            overflow: hidden;
            cursor: pointer;
            transition: transform .22s ease, box-shadow .22s ease, filter .22s ease;
        }

        .image-studio-template-spotlight {
            aspect-ratio: 3 / 4;
            min-height: 262px;
        }

        .image-studio-template-spotlight.is-featured::after,
        .image-studio-template-spotlight.is-clean::after {
            content: "";
            position: absolute;
            inset: 0;
            pointer-events: none;
        }

        .image-studio-template-spotlight.is-featured::after {
            background: linear-gradient(180deg, rgba(15, 23, 42, 0.02) 0%, rgba(15, 23, 42, 0.14) 46%, rgba(15, 23, 42, 0.82) 100%);
        }

        .image-studio-template-spotlight.is-clean::after {
            background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(15, 23, 42, 0.04) 100%);
        }

        .image-studio-template-mini {
            display: none;
        }

        .image-studio-template-spotlight:hover,
        .image-studio-template-mini:hover {
            z-index: 1;
            transform: translateY(-2px);
            filter: saturate(1.04);
        }

        .image-studio-template-spotlight-visual,
        .image-studio-template-mini-visual {
            position: absolute;
            inset: 0;
            background-size: cover;
            background-position: center;
            background-repeat: no-repeat;
            background-color: #eef2f8;
        }

        .image-studio-template-spotlight-image,
        .image-studio-template-mini-image {
            width: 100%;
            height: 100%;
            display: block;
            object-fit: cover;
        }

        .image-studio-template-spotlight-copy {
            position: absolute;
            inset: auto 0 0 0;
            padding: 18px 16px 14px;
            color: #fff;
            text-align: left;
            z-index: 1;
        }

        .image-studio-template-spotlight-copy strong {
            display: block;
            font-size: 16px;
            line-height: 1.4;
            font-weight: 700;
        }

        .image-studio-template-spotlight-copy p {
            margin: 8px 0 0;
            font-size: 12px;
            line-height: 1.65;
            color: rgba(255, 255, 255, 0.88);
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }

        .image-studio-template-spotlight-action {
            display: flex;
            align-items: center;
            justify-content: center;
            height: 34px;
            min-height: 34px;
            padding: 1px 14px 0;
            margin-top: 12px;
            box-sizing: border-box;
            border-radius: 999px;
            border: 1px solid rgba(255, 255, 255, 0.2);
            background: rgba(17, 24, 39, 0.38);
            color: #fff;
            font-size: 12px;
            font-weight: 700;
            line-height: 30px !important;
            text-align: center;
            white-space: nowrap;
            backdrop-filter: blur(12px);
            box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
        }

        .image-studio-template-spotlight-badge {
            position: absolute;
            top: 10px;
            left: 10px;
            z-index: 1;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            min-height: 22px;
            padding: 0 8px;
            border-radius: 999px;
            background: rgba(17, 24, 39, 0.46);
            color: rgba(255,255,255,0.88);
            font-size: 10px;
            font-weight: 700;
            letter-spacing: .02em;
            backdrop-filter: blur(8px);
        }

        .image-studio-template-spotlight-hover {
            position: absolute;
            inset: auto 0 0 0;
            z-index: 1;
            padding: 28px 14px 14px;
            background: linear-gradient(180deg, rgba(15, 23, 42, 0) 0%, rgba(15, 23, 42, 0.62) 100%);
            color: #fff;
            opacity: 0;
            transition: opacity .2s ease;
            text-align: left;
        }

        .image-studio-template-spotlight-hover strong {
            display: block;
            font-size: 13px;
            line-height: 1.35;
            font-weight: 700;
        }

        .image-studio-template-spotlight-hover span {
            display: block;
            margin-top: 4px;
            font-size: 11px;
            line-height: 1.5;
            color: rgba(255,255,255,0.82);
        }

        .image-studio-template-spotlight-hover p {
            margin: 6px 0 0;
            font-size: 11px;
            line-height: 1.6;
            color: rgba(255,255,255,0.84);
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }

        .image-studio-template-spotlight:hover .image-studio-template-spotlight-hover,
        .image-studio-template-spotlight:focus-visible .image-studio-template-spotlight-hover {
            opacity: 1;
        }

        .image-studio-template-mini-copy {
            position: absolute;
            inset: auto 0 0 0;
            min-height: 26px;
            padding: 6px 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: rgba(255, 255, 255, 0.95);
            color: #4b5563;
            font-size: 11px;
            font-weight: 500;
            line-height: 1.4;
            text-align: center;
            backdrop-filter: blur(8px);
        }

        .image-studio-template-card {
            position: relative;
            overflow: hidden;
            display: block;
            width: 100%;
            margin: 0;
            border: none;
            border-radius: 22px;
            padding: 0;
            cursor: default;
            background: #eef2ff;
            box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
            transition: transform .22s ease, box-shadow .22s ease, filter .22s ease;
            aspect-ratio: 4 / 5;
            min-width: 0;
        }

        .image-studio-template-card:hover {
            transform: translateY(-3px);
            box-shadow: 0 18px 34px rgba(15, 23, 42, 0.14);
            filter: saturate(1.04);
        }

        .image-studio-template-card.wide {
            aspect-ratio: 4 / 3.2;
        }

        .image-studio-template-card.tall {
            aspect-ratio: 4 / 6.2;
        }

        .image-studio-template-card.hero {
            aspect-ratio: 4 / 6.8;
        }

        .image-studio-template-card.landscape {
            aspect-ratio: 16 / 10;
            grid-column: span 2;
        }

        .image-studio-template-card.square {
            aspect-ratio: 1 / 1;
        }

        .image-studio-template-card.poster {
            aspect-ratio: 3 / 4;
        }

        .image-studio-template-card.story {
            aspect-ratio: 9 / 16;
        }

        .image-studio-template-card.wide {
            grid-column: span 2;
        }

        .image-studio-template-card.hero {
            grid-row: span 2;
        }

        .image-studio-template-visual {
            position: absolute;
            inset: 0;
            background-size: cover;
            background-position: center;
            background-repeat: no-repeat;
            background-color: #eff3f8;
            transition: transform .28s ease;
        }

        .image-studio-template-image {
            width: 100%;
            height: 100%;
            display: block;
            object-fit: cover;
        }

        .image-studio-template-card:hover .image-studio-template-visual,
        .image-studio-template-card:focus-within .image-studio-template-visual {
            transform: scale(1.03);
        }

        .image-studio-template-overlay {
            position: absolute;
            inset: auto 0 0 0;
            display: grid;
            gap: 10px;
            padding: 96px 14px 14px;
            background: linear-gradient(180deg, rgba(12, 18, 30, 0) 0%, rgba(12, 18, 30, 0.18) 28%, rgba(12, 18, 30, 0.76) 64%, rgba(12, 18, 30, 0.94) 100%);
            color: #fff;
            text-align: left;
            opacity: 0;
            transform: translateY(12px);
            transition: opacity .2s ease, transform .2s ease;
            pointer-events: none;
        }

        .image-studio-template-overlay strong {
            display: block;
            font-size: 15px;
            line-height: 1.35;
            font-weight: 700;
        }

        .image-studio-template-overlay p {
            margin: 0;
            font-size: 12px;
            line-height: 1.7;
            color: rgba(255, 255, 255, 0.84);
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 3;
            overflow: hidden;
        }

        .image-studio-template-action,
        .image-studio-preset-action button {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: fit-content;
            min-width: 112px;
            min-height: 40px;
            padding: 0 18px;
            border: 1px solid rgba(255, 255, 255, 0.22);
            border-radius: 999px;
            background: rgba(255, 255, 255, 0.14);
            color: #fff;
            font-size: 12px;
            font-weight: 700;
            cursor: pointer;
            pointer-events: auto;
            backdrop-filter: blur(12px);
            box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18);
            transition: transform .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
        }

        .image-studio-template-action:hover,
        .image-studio-template-action:focus-visible,
        .image-studio-preset-action button:hover,
        .image-studio-preset-action button:focus-visible {
            background: rgba(255, 255, 255, 0.22);
            border-color: rgba(255, 255, 255, 0.32);
            transform: translateY(-1px);
            box-shadow: 0 18px 34px rgba(0, 0, 0, 0.22);
        }

        .image-studio-template-card:hover .image-studio-template-overlay,
        .image-studio-template-card:focus-within .image-studio-template-overlay {
            opacity: 1;
            transform: translateY(0);
        }

        .image-create-studio.template-open .image-studio-heading,
        .image-create-studio.template-open .image-studio-quickbar,
        .image-create-studio.template-open .image-studio-summary,
        .image-create-studio.template-open .image-studio-tools,
        .image-create-studio.template-open .image-studio-gallery-shell {
            display: none;
        }

        .image-studio-send-btn {
            width: 40px;
            height: 40px;
            min-width: 40px;
            min-height: 40px;
            padding: 0;
            border-radius: 999px;
            border: 1px solid rgba(59, 130, 246, 0.28);
            background: linear-gradient(180deg, #1e40af 0%, #1d4ed8 100%);
            color: #fff;
            box-shadow: 0 10px 20px rgba(37, 99, 235, 0.18);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 0;
            font-size: 14px;
            font-weight: 700;
            white-space: nowrap;
            flex: 0 0 40px;
        }

        .image-studio-send-btn:hover {
            border-color: rgba(96, 165, 250, 0.38);
            background: linear-gradient(180deg, #1d4ed8 0%, #2563eb 100%);
            box-shadow: 0 12px 24px rgba(37, 99, 235, 0.2);
        }

        .image-studio-send-btn svg {
            width: 18px;
            height: 18px;
        }

        .image-studio-content {
            display: grid;
            gap: 16px;
        }

        .image-studio-quickbar {
            display: none;
        }

        .image-studio-quickbar-head {
            display: flex;
            align-items: flex-end;
            justify-content: space-between;
            gap: 12px;
        }

        .image-studio-quickbar-head strong {
            display: block;
            font-size: 16px;
            color: #0f172a;
            margin-bottom: 4px;
        }

        .image-studio-quickbar-head span {
            color: #64748b;
            font-size: 12px;
            line-height: 1.7;
        }

        .image-studio-quicklist {
            display: grid;
            grid-template-columns: repeat(3, minmax(0, 1fr));
            gap: 12px;
        }

        .image-studio-quickcard {
            display: grid;
            gap: 10px;
            padding: 14px 14px 16px;
            border-radius: 22px;
            border: 1px solid rgba(15, 23, 42, 0.06);
            background: #fff;
            cursor: pointer;
            transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
        }

        .image-studio-quickcard:hover {
            transform: translateY(-2px);
            border-color: rgba(37, 99, 255, 0.18);
            box-shadow: 0 18px 36px rgba(15, 23, 42, 0.08);
        }

        .image-studio-quickcard-top {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
        }

        .image-studio-quickcard-tag {
            display: inline-flex;
            align-items: center;
            min-height: 24px;
            padding: 0 10px;
            border-radius: 999px;
            background: rgba(37, 99, 255, 0.1);
            color: #1d4ed8;
            font-size: 11px;
            font-weight: 700;
        }

        .image-studio-quickcard-meta {
            color: #94a3b8;
            font-size: 11px;
            font-weight: 700;
        }

        .image-studio-quickcard strong {
            font-size: 15px;
            color: #0f172a;
            line-height: 1.4;
        }

        .image-studio-quickcard p {
            margin: 0;
            color: #64748b;
            font-size: 12px;
            line-height: 1.7;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 2;
            overflow: hidden;
        }

        .image-studio-quickcard-action {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            color: #1d4ed8;
            font-size: 12px;
            font-weight: 700;
        }

        .image-studio-main {
            display: grid;
            gap: 18px;
            min-width: 0;
            padding: 0 8px 0 12px;
        }

        .image-studio-summary {
            display: none;
        }

        .image-studio-summary-copy {
            display: grid;
            gap: 6px;
            min-width: 0;
        }

        .image-studio-summary-copy strong {
            font-size: 16px;
            color: #111827;
        }

        .image-studio-summary-copy p,
        .image-studio-sidecard-tip {
            margin: 0;
            color: #6e7b90;
            font-size: 12px;
            line-height: 1.65;
        }

        .image-studio-sidecard-tip {
            display: none;
        }

        .image-studio-gallery-shell {
            display: grid;
            gap: 12px;
            padding: 4px 0 0;
            border-radius: 0;
            border: none;
            background: transparent;
        }

        .image-studio-tools {
            display: grid;
            grid-auto-flow: column;
            grid-auto-columns: 164px;
            gap: 12px;
            overflow-x: auto;
            padding: 4px 12px 8px 2px;
            scrollbar-width: none;
        }

        .image-studio-tools::-webkit-scrollbar {
            display: none;
        }

        .image-studio-tool-card {
            display: grid;
            grid-template-columns: 1fr;
            align-items: center;
            gap: 12px;
            justify-items: center;
            min-height: 116px;
            padding: 16px 14px 14px;
            border-radius: 18px;
            border: 1px solid rgba(15, 23, 42, 0.08);
            background: rgba(255, 255, 255, 0.98);
            box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
            text-align: center;
            transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease, background .18s ease;
        }

        .image-studio-tool-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 14px 28px rgba(15, 23, 42, 0.08);
        }

        .image-studio-tool-card.active {
            border-color: rgba(37, 99, 255, 0.24);
            background: linear-gradient(180deg, rgba(255, 255, 255, 0.99) 0%, rgba(239, 246, 255, 0.98) 100%);
            box-shadow: 0 16px 32px rgba(37, 99, 255, 0.14);
            transform: translateY(-2px);
        }

        .image-studio-tool-card.active .image-studio-tool-tag {
            background: rgba(37, 99, 255, 0.14);
            color: #1d4ed8;
        }

        .image-studio-tool-copy {
            display: block;
            min-width: 0;
            width: 100%;
        }

        .image-studio-tool-copy-top {
            display: block;
            min-width: 0;
        }

        .image-studio-tool-tag {
            display: none;
        }

        .image-studio-tool-card strong {
            display: block;
            font-size: 15px;
            font-weight: 700;
            color: #111827;
            line-height: 1.35;
            word-break: break-word;
        }

        .image-studio-tool-card span {
            font-size: 11px;
            color: #8a94a6;
            line-height: 1.45;
        }

        .image-studio-tool-card:not([data-tool-code="video-theme"]) .image-studio-tool-copy > span:last-child {
            display: none;
        }

        .image-studio-tool-thumb {
            width: 76px;
            height: 76px;
            border-radius: 20px;
            justify-self: center;
            background: linear-gradient(135deg, #dbe7ff 0%, #f4f7ff 100%);
            box-shadow: inset 0 0 0 1px rgba(255,255,255,0.72);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 12px;
        }

        .image-studio-tool-thumb svg {
            width: 100%;
            height: 100%;
            display: block;
        }

        .image-studio-tool-card[data-tool-code="generate"] .image-studio-tool-thumb {
            background: linear-gradient(135deg, #ffe1d6 0%, #fff1ec 100%);
        }

        .image-studio-tool-card[data-tool-code="cutout"] .image-studio-tool-thumb {
            background: linear-gradient(135deg, #e8efff 0%, #f7f9ff 100%);
        }

        .image-studio-tool-card[data-tool-code="erase"] .image-studio-tool-thumb {
            background: linear-gradient(135deg, #e7f5ff 0%, #f8fcff 100%);
        }

        .image-studio-tool-card[data-tool-code="mark_edit"] .image-studio-tool-thumb {
            background: linear-gradient(135deg, #e9ebff 0%, #fbfbff 100%);
        }

        .image-studio-tool-card[data-tool-code="outpaint"] .image-studio-tool-thumb {
            background: linear-gradient(135deg, #eaf6e9 0%, #f8fff7 100%);
        }

        .image-studio-tool-card[data-tool-code="enhance"] .image-studio-tool-thumb {
            background: linear-gradient(135deg, #dcecff 0%, #f7fbff 100%);
        }

        .image-studio-tool-card[data-tool-code="video-theme"] .image-studio-tool-thumb {
            background: linear-gradient(135deg, #e7ecff 0%, #f8faff 100%);
        }

        .image-studio-tool-card .image-studio-tool-thumb::before,
        .image-studio-tool-card .image-studio-tool-thumb::after {
            content: none !important;
            display: none !important;
            background: none !important;
            box-shadow: none !important;
            inset: auto !important;
        }

        .image-studio-gallery-head {
            margin-top: 0;
            align-items: flex-end;
        }

        .image-studio-gallery-head strong {
            font-size: 16px;
        }

        .image-studio-gallery-filters {
            display: none;
        }

        .image-studio-gallery {
            grid-template-columns: repeat(3, minmax(0, 1fr));
            gap: 14px;
        }

        .image-studio-preset-card {
            min-height: 0;
            position: relative;
            border-radius: 26px;
            border: 1px solid rgba(255, 255, 255, 0.52);
            background: #10141d;
            box-shadow: 0 22px 42px rgba(15, 23, 42, 0.12);
            overflow: hidden;
            content-visibility: auto;
            contain-intrinsic-size: 280px 240px;
        }

        .image-studio-preset-card.large {
            grid-column: span 1;
        }

        .image-studio-preset-stage {
            min-height: 280px;
            border-radius: inherit;
            isolation: isolate;
            background: #111827;
        }

        .image-studio-preset-card.large .image-studio-preset-stage {
            min-height: 264px;
        }

        .image-studio-preset-card.portrait .image-studio-preset-stage {
            min-height: 308px;
        }

        .image-studio-preset-card.square .image-studio-preset-stage {
            min-height: 256px;
        }

        .image-studio-preset-preview {
            transform: scale(1);
            transition: transform .45s ease, filter .45s ease;
            filter: saturate(1.04) contrast(1.02);
            background-color: #edf2f7;
            background-size: cover;
            background-position: center;
            background-repeat: no-repeat;
        }

        .image-studio-preset-image {
            width: 100%;
            height: 100%;
            display: block;
            object-fit: cover;
            image-rendering: auto;
            transform: translateZ(0);
            backface-visibility: hidden;
        }

        .image-studio-preset-card.has-cover-image .image-studio-preset-preview::before,
        .image-studio-preset-card.has-cover-image .image-studio-preset-preview::after {
            content: none !important;
            display: none !important;
        }

        .image-studio-preset-stage::after {
            content: "";
            position: absolute;
            inset: 0;
            background:
                linear-gradient(180deg, rgba(10, 14, 24, 0.02) 0%, rgba(10, 14, 24, 0.1) 34%, rgba(10, 14, 24, 0.72) 76%, rgba(8, 12, 20, 0.92) 100%);
            z-index: 1;
            pointer-events: none;
            opacity: 0;
            transition: opacity .2s ease;
        }

        .image-studio-preset-stage::before {
            content: "";
            position: absolute;
            inset: 0;
            z-index: 1;
            pointer-events: none;
            box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
        }

        .image-studio-preset-card:hover {
            transform: translateY(-4px);
            box-shadow: 0 28px 52px rgba(15, 23, 42, 0.18);
        }

        .image-studio-preset-card:hover .image-studio-preset-preview {
            transform: scale(1.045);
            filter: saturate(1.08);
        }

        .image-studio-preset-card:hover .image-studio-preset-stage::after {
            opacity: 1;
        }

        .image-studio-preset-overlay strong {
            font-size: 16px;
        }

        .image-studio-preset-overlay p {
            font-size: 12px;
        }

        .image-studio-preset-overlay {
            position: absolute;
            inset: auto 0 0 0;
            padding: 118px 16px 82px;
            background: linear-gradient(180deg, rgba(13, 18, 29, 0) 0%, rgba(11, 16, 27, 0.74) 42%, rgba(9, 14, 24, 0.94) 100%);
            color: #fff;
            z-index: 2;
            opacity: 0;
            transform: translateY(12px);
            transition: opacity .2s ease, transform .2s ease;
            pointer-events: none;
        }

        .image-studio-preset-topline {
            display: none;
        }

        .image-studio-preset-badge {
            display: none;
        }

        .image-studio-preset-ratio {
            display: none;
        }

        .image-studio-preset-overlay p {
            color: rgba(255, 255, 255, 0.82);
            -webkit-line-clamp: 3;
        }

        .image-studio-preset-meta {
            display: none;
        }

        .image-studio-preset-tool {
            display: none;
        }

        .image-studio-preset-card:hover .image-studio-preset-overlay,
        .image-studio-preset-card:focus-within .image-studio-preset-overlay {
            opacity: 1;
            transform: translateY(0);
        }

        .image-studio-preset-action {
            left: 16px;
            right: 16px;
            top: auto;
            bottom: 16px;
            justify-content: center;
            transform: translateY(10px);
            transition: opacity .2s ease, transform .2s ease;
            z-index: 4;
            pointer-events: auto;
        }

        .image-studio-preset-card:hover .image-studio-preset-action,
        .image-studio-preset-card:focus-within .image-studio-preset-action {
            transform: translateY(0);
        }

        .image-studio-preset-action button {
            width: auto;
        }

        .image-studio-preset-index {
            display: none;
        }

        body[data-ui-theme="dark"] .image-studio-quickcard,
        body[data-ui-theme="dark"] .image-studio-tool-card,
        body[data-ui-theme="dark"] .image-studio-sidecard,
        body[data-ui-theme="dark"] .image-studio-sidecard-item,
        body[data-ui-theme="dark"] .image-studio-template-card {
            border-color: rgba(148, 163, 184, 0.12) !important;
            background: rgba(10, 18, 32, 0.96) !important;
            box-shadow: 0 18px 36px rgba(2, 6, 23, 0.28);
        }

        body[data-ui-theme="dark"] .image-studio-quickcard strong,
        body[data-ui-theme="dark"] .image-studio-tool-card strong,
        body[data-ui-theme="dark"] .image-studio-sidecard h3,
        body[data-ui-theme="dark"] .image-studio-sidecard-item strong {
            color: #edf2ff;
        }

        body[data-ui-theme="dark"] .image-studio-quickcard p,
        body[data-ui-theme="dark"] .image-studio-quickcard-meta,
        body[data-ui-theme="dark"] .image-studio-sidecard p,
        body[data-ui-theme="dark"] .image-studio-sidecard-item span,
        body[data-ui-theme="dark"] .image-studio-tool-card span {
            color: #8fa0bc;
        }

        body[data-ui-theme="dark"] .image-studio-quickcard-tag,
        body[data-ui-theme="dark"] .image-studio-sidecard-badge,
        body[data-ui-theme="dark"] .image-studio-tool-card.active .image-studio-tool-tag {
            background: rgba(37, 99, 255, 0.18);
            color: #bfd3ff;
        }

        body[data-ui-theme="dark"] .image-studio-tool-card.active {
            border-color: rgba(96, 165, 250, 0.24) !important;
            background: linear-gradient(180deg, rgba(17, 24, 39, 0.98) 0%, rgba(12, 33, 67, 0.98) 100%);
            box-shadow: 0 18px 34px rgba(30, 64, 175, 0.18);
        }

        body[data-ui-theme="dark"] .upload-panel.is-emphasized {
            border-color: rgba(96, 165, 250, 0.28);
            background: linear-gradient(135deg, rgba(15, 23, 42, 0.96) 0%, rgba(15, 30, 54, 0.98) 100%);
            box-shadow: 0 20px 40px rgba(15, 23, 42, 0.34);
        }

        body[data-ui-theme="dark"] .image-studio-preset-card {
            border-color: rgba(148, 163, 184, 0.14) !important;
            background: #101722 !important;
            box-shadow: 0 24px 48px rgba(2, 6, 23, 0.34);
        }

        body[data-ui-theme="dark"] .image-studio-preset-stage {
            background: #0b1220;
        }

        body[data-ui-theme="dark"] .image-studio-preset-stage::before {
            box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.12);
        }

        body[data-ui-theme="dark"] .image-studio-preset-action button {
            border-color: rgba(148, 163, 184, 0.18);
            background: rgba(15, 23, 42, 0.74);
            color: #edf2ff;
            box-shadow: 0 14px 30px rgba(2, 6, 23, 0.24);
        }

        body[data-tool-mode="image"] .image-create-studio,
        body[data-tool-mode="video"] .image-create-studio {
            display: block;
        }

        body[data-tool-mode="image"] .hero,
        body[data-tool-mode="image"] .guest-hero,
        body[data-tool-mode="image"] .workspace-records,
        body[data-tool-mode="video"] .hero,
        body[data-tool-mode="video"] .guest-hero,
        body[data-tool-mode="video"] .workspace-records {
            display: none;
        }

        body[data-tool-mode="image"] .result-card,
        body[data-tool-mode="video"] .result-card {
            display: none;
        }

        body[data-tool-mode="image"]:not(.show-record-history) .task-list,
        body[data-tool-mode="video"]:not(.show-record-history) .task-list,
        body[data-tool-mode="image"]:not(.show-record-history) .pagination,
        body[data-tool-mode="video"]:not(.show-record-history) .pagination {
            display: none !important;
        }

        body.workspace-creations-open[data-tool-mode="image"] .image-create-studio,
        body.workspace-creations-open[data-tool-mode="video"] .image-create-studio {
            display: none;
        }

        body.workspace-creations-open[data-tool-mode="image"] .workspace-records,
        body.workspace-creations-open[data-tool-mode="video"] .workspace-records {
            display: grid;
            padding: 18px 0 20px;
            align-content: start;
            width: min(1260px, 100%);
            margin: 0 auto;
        }

        body.workspace-creations-open[data-tool-mode="image"] .workspace-records .task-list,
        body.workspace-creations-open[data-tool-mode="video"] .workspace-records .task-list {
            display: grid !important;
            grid-template-columns: 1fr;
            gap: 22px;
        }

        body.workspace-creations-open[data-tool-mode="image"] .workspace-records .pagination,
        body.workspace-creations-open[data-tool-mode="video"] .workspace-records .pagination {
            display: flex !important;
            margin-top: 0;
            padding-left: 10px;
            padding-right: 10px;
            box-sizing: border-box;
        }

        body.workspace-creations-open[data-tool-mode="image"] .workspace-records .task-date-group,
        body.workspace-creations-open[data-tool-mode="video"] .workspace-records .task-date-group {
            gap: 12px;
        }

        body.workspace-creations-open[data-tool-mode="image"] .workspace-records .task-date-group-list,
        body.workspace-creations-open[data-tool-mode="video"] .workspace-records .task-date-group-list {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(196px, 1fr));
            gap: 14px;
            align-content: start;
        }

        body.workspace-creations-open[data-tool-mode="image"] .workspace-records .task-date-group-title,
        body.workspace-creations-open[data-tool-mode="video"] .workspace-records .task-date-group-title {
            padding-left: 10px;
            padding-right: 10px;
            box-sizing: border-box;
        }

        body.workspace-creations-open[data-tool-mode="image"] .workspace-records .section-head,
        body.workspace-creations-open[data-tool-mode="video"] .workspace-records .section-head {
            padding-left: 10px;
            padding-right: 0;
        }

        @media (max-width: 920px) {
            body.workspace-creations-open[data-tool-mode="image"] .workspace-records,
            body.workspace-creations-open[data-tool-mode="video"] .workspace-records {
                padding-top: calc(env(safe-area-inset-top, 0px) + 10px);
                padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
            }

            body.workspace-creations-open[data-tool-mode="image"] .workspace-records .task-list,
            body.workspace-creations-open[data-tool-mode="video"] .workspace-records .task-list {
                grid-template-columns: repeat(2, minmax(0, 1fr));
                gap: 10px;
            }

            body.workspace-creations-open[data-tool-mode="image"] .workspace-records .pagination,
            body.workspace-creations-open[data-tool-mode="video"] .workspace-records .pagination {
                display: grid !important;
                grid-template-columns: 1fr;
                gap: 10px;
                padding-left: 2px;
                padding-right: 2px;
            }

            body.workspace-creations-open[data-tool-mode="image"] .workspace-records .pagination-actions,
            body.workspace-creations-open[data-tool-mode="video"] .workspace-records .pagination-actions {
                display: grid;
                grid-template-columns: repeat(2, minmax(0, 1fr));
                gap: 8px;
                width: 100%;
            }
        }

        body[data-tool-mode="image"] .composer-top,
        body[data-tool-mode="video"] .composer-top {
            display: none;
        }

        body[data-tool-mode="image"] #chat-compose-field,
        body[data-tool-mode="video"] #chat-compose-field {
            display: none;
        }

        body[data-tool-mode="image"] #media-compose,
        body[data-tool-mode="video"] #media-compose {
            display: none;
            margin-top: 0;
            padding: 0;
            border-top: none;
        }

        body.studio-advanced-open[data-tool-mode="image"] #media-compose,
        body.studio-advanced-open[data-tool-mode="video"] #media-compose {
            display: none;
        }

        body[data-tool-mode="image"] .media-prompt-field,
        body[data-tool-mode="video"] .media-prompt-field {
            display: none;
        }

        body[data-tool-mode="image"] .composer,
        body[data-tool-mode="video"] .composer {
            display: none;
        }

        body[data-tool-mode="image"] .workspace,
        body[data-tool-mode="video"] .workspace {
            overflow-y: auto;
            background:
                radial-gradient(circle at top right, rgba(54, 102, 255, 0.05), transparent 32%),
                linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
        }

        body[data-ui-theme="dark"][data-tool-mode="image"] .workspace,
        body[data-ui-theme="dark"][data-tool-mode="video"] .workspace {
            background:
                radial-gradient(circle at top right, rgba(54, 102, 255, 0.16), transparent 34%),
                linear-gradient(180deg, #0a1220 0%, #0d1626 100%);
        }

        body.studio-advanced-open[data-tool-mode="image"] .media-drawer-shell,
        body.studio-advanced-open[data-tool-mode="video"] .media-drawer-shell {
            width: min(1280px, calc(100vw - 96px));
            margin: 0 auto;
            display: grid;
            gap: 16px;
        }

        @media (min-width: 921px) {
            body.studio-advanced-open[data-tool-mode="image"] .media-drawer-shell,
            body.studio-advanced-open[data-tool-mode="video"] .media-drawer-shell {
                position: fixed;
                left: 50%;
                top: 256px;
                transform: translateX(-50%);
                grid-template-columns: minmax(320px, 360px) minmax(0, 1fr);
                z-index: 48;
            }
        }

        @media (max-width: 1200px) {
            .image-studio-gallery {
                grid-template-columns: repeat(3, minmax(0, 1fr));
            }
        }

        @media (max-width: 920px) {
            .image-create-studio {
                min-height: calc(100vh - 112px);
                width: 100%;
                max-width: 100%;
                min-width: 0;
                align-items: stretch;
                padding: 12px 12px 18px;
            }

            body[data-tool-mode="image"],
            body[data-tool-mode="video"] {
                overflow-x: hidden;
            }

            body[data-tool-mode="image"] .workspace,
            body[data-tool-mode="video"] .workspace {
                width: 100%;
                min-width: 0;
                padding: 0;
                gap: 12px;
                overflow-x: hidden;
            }

            body[data-tool-mode="image"] .workspace-chat-header,
            body[data-tool-mode="video"] .workspace-chat-header {
                display: none;
            }

            body[data-tool-mode="image"] .image-studio-shell,
            body[data-tool-mode="video"] .image-studio-shell,
            body[data-tool-mode="image"] .image-studio-content,
            body[data-tool-mode="video"] .image-studio-content,
            body[data-tool-mode="image"] .image-studio-main,
            body[data-tool-mode="video"] .image-studio-main,
            body[data-tool-mode="image"] .image-studio-prompt-card,
            body[data-tool-mode="video"] .image-studio-prompt-card {
                width: 100%;
                min-width: 0;
                max-width: 100%;
                overflow-x: hidden;
                -webkit-text-size-adjust: 100%;
            }

            .image-studio-shell {
                gap: 12px;
                width: 100%;
                max-width: 100%;
                min-width: 0;
            }

            .image-studio-mobile-hero {
                display: grid;
                gap: 8px;
                justify-items: center;
                text-align: center;
                padding: 42px 10px 6px;
                position: relative;
                z-index: 1;
            }

            .image-studio-mobile-hero strong {
                display: block;
                color: #0f172a;
                font-size: 16px;
                line-height: 1.2;
                letter-spacing: -0.03em;
            }

            .image-studio-mobile-hero span {
                display: block;
                color: #9aa6b8;
                font-size: 14px;
                line-height: 1.5;
            }

            body[data-ui-theme="dark"] .image-studio-mobile-hero strong {
                color: #eef2ff;
            }

            body[data-ui-theme="dark"] .image-studio-mobile-hero span {
                color: #8a9bb4;
            }

            .image-studio-prompt-card {
                border-radius: 28px;
                padding: 0;
                border: 1px solid rgba(96, 135, 255, 0.22);
                box-shadow: 0 18px 38px rgba(37, 99, 255, 0.1);
                overflow: hidden;
            }

            .studio-reference-bar {
                padding: 14px 16px 0;
            }

            .image-studio-input-shell {
                border-radius: 0;
                background: transparent;
                box-shadow: none;
            }

            .image-studio-input {
                min-height: 114px;
                padding: 16px 132px 18px 18px;
                font-size: 16px;
                line-height: 1.65;
            }

            .image-studio-input::placeholder {
                color: #b4bcc9;
                opacity: 1;
            }

            .image-studio-input-tools {
                left: 12px;
                right: 12px;
                bottom: 12px;
                gap: 0;
            }

            .image-studio-toolbar {
                align-items: center;
                justify-content: space-between;
                gap: 10px;
                padding: 8px 12px 12px;
                position: relative;
                background: rgba(255, 255, 255, 0.92);
                border-top: 1px solid rgba(15, 23, 42, 0.05);
            }

            .image-studio-toolbar-left {
                width: 100%;
                flex-wrap: nowrap;
                overflow-x: auto;
                overflow-y: visible;
                padding-bottom: 0;
                scrollbar-width: none;
            }

            .image-studio-toolbar-left::-webkit-scrollbar {
                display: none;
            }

            .image-studio-toolbar-right {
                width: auto;
                justify-content: flex-end;
                align-items: center;
                gap: 0;
            }

            .image-studio-toolbar-control,
            .image-studio-inline-btn,
            .image-studio-tool-link,
            .image-studio-toolbar-divider {
                flex: 0 0 auto;
            }

            .image-studio-toolbar-control {
                position: relative;
            }

            .image-studio-more-panel {
                display: contents;
            }

            .image-studio-toolbar-left > .image-studio-toolbar-control,
            .image-studio-toolbar-left > #image-studio-template-btn,
            .image-studio-toolbar-left > #image-studio-advanced-btn {
                display: inline-flex !important;
            }

            .image-studio-tool-meta {
                display: none;
            }

            .image-studio-toolbar-left > #image-studio-mode-image,
            .image-studio-toolbar-left > #image-studio-mode-video,
            .image-studio-toolbar-left > #image-studio-upload-btn {
                display: inline-flex;
            }

            .image-studio-toolbar-left > #image-studio-upload-btn {
                order: 4;
            }

            #chat-compose-field.is-media-mode .image-studio-toolbar-left > .image-studio-toolbar-control,
            #chat-compose-field.is-media-mode .image-studio-toolbar-left > #image-studio-template-btn,
            #chat-compose-field.is-media-mode .image-studio-toolbar-left > #image-studio-advanced-btn {
                display: inline-flex !important;
            }

            #chat-compose-field.is-media-mode .image-studio-toolbar-left > #image-studio-mode-image,
            #chat-compose-field.is-media-mode .image-studio-toolbar-left > #image-studio-mode-video,
            #chat-compose-field.is-media-mode .image-studio-toolbar-left > #image-studio-upload-btn {
                display: inline-flex;
            }

            .image-studio-toolbar-left > #image-studio-template-btn,
            .image-studio-toolbar-left > #image-studio-advanced-btn,
            #chat-compose-field.is-media-mode .image-studio-toolbar-left > #image-studio-template-btn,
            #chat-compose-field.is-media-mode .image-studio-toolbar-left > #image-studio-advanced-btn {
                display: none !important;
            }

            .image-studio-gallery-shell,
            .image-studio-template-panel,
            #image-studio-template-btn {
                display: none !important;
            }

            .image-studio-popover {
                position: fixed;
                left: 12px;
                right: 12px;
                top: auto;
                bottom: 12px;
                min-width: 0;
                max-width: none;
                max-height: min(52vh, 420px);
                padding: 12px;
                border-radius: 22px;
                z-index: 120;
            }

            .image-studio-popover-backdrop {
                position: fixed;
                inset: 0;
                z-index: 218;
                border: none;
                padding: 0;
                background: rgba(15, 23, 42, 0.42);
                backdrop-filter: blur(3px);
            }

            body.mobile-studio-popover-open .image-studio-popover-backdrop {
                display: block;
            }

            .image-studio-popover.is-mobile-sheet {
                position: fixed;
                left: 10px;
                right: 10px;
                top: auto;
                bottom: max(20px, env(safe-area-inset-bottom, 0px));
                z-index: 220;
                width: auto;
                min-width: 0;
                max-width: none;
                max-height: min(68vh, 560px);
                max-height: min(68dvh, 560px);
                padding: 12px;
                border-radius: 24px;
                overflow-x: hidden;
                overflow-y: auto;
                overscroll-behavior: contain;
                box-shadow: 0 26px 72px rgba(15, 23, 42, 0.28);
                animation: mobile-studio-sheet-in .2s ease-out;
            }

            .image-studio-popover.is-mobile-sheet::before {
                content: attr(data-mobile-title);
                display: block;
                position: sticky;
                top: -12px;
                z-index: 2;
                margin: -12px -12px 10px;
                padding: 16px 16px 12px;
                border-bottom: 1px solid rgba(15, 23, 42, 0.06);
                background: rgba(255, 255, 255, 0.98);
                color: #111827;
                font-size: 16px;
                font-weight: 750;
                line-height: 1.4;
            }

            .image-studio-popover.is-mobile-sheet[data-mobile-kind="duration"] .image-studio-popover-grid,
            .image-studio-popover.is-mobile-sheet[data-mobile-kind="ratio"] .image-studio-popover-grid {
                grid-template-columns: repeat(2, minmax(0, 1fr));
            }

            .image-studio-popover.is-mobile-sheet[data-mobile-kind="duration"] .image-studio-popover-item {
                min-height: 48px;
                text-align: center;
            }

            body[data-ui-theme="dark"] .image-studio-popover.is-mobile-sheet::before {
                border-bottom-color: rgba(148, 163, 184, 0.1);
                background: rgba(10, 18, 32, 0.98);
                color: #eef4ff;
            }

            @keyframes mobile-studio-sheet-in {
                from {
                    opacity: 0;
                    transform: translateY(18px);
                }
                to {
                    opacity: 1;
                    transform: translateY(0);
                }
            }

            #image-studio-style-menu {
                min-width: 0;
            }

            .image-studio-popover-grid {
                gap: 8px;
            }

            .image-studio-popover-item.has-detail {
                min-height: 58px;
            }

            .image-studio-template-panel {
                padding: 12px;
                border-radius: 24px;
                max-height: min(44vh, 460px);
            }

            .image-studio-template-panel.is-compact {
                padding: 10px;
            }

            .image-studio-template-compact-head {
                padding: 2px 0 10px;
            }

            .image-studio-template-masonry {
                grid-template-columns: repeat(3, minmax(0, 1fr));
                gap: 10px;
            }

            .image-studio-template-compact-grid {
                grid-template-columns: repeat(2, minmax(0, 1fr));
            }

            .image-studio-template-column {
                display: block;
            }

            .image-studio-template-spotlight {
                min-height: 184px;
            }

            .image-studio-template-mini {
                min-height: 60px;
                height: 60px;
            }

            .image-studio-template-card.hero,
            .image-studio-template-card.landscape,
            .image-studio-template-card.wide {
                grid-column: span 2;
            }

            .image-studio-template-card.hero {
                grid-row: span 1;
            }

            .image-studio-quickbar,
            .image-studio-summary {
                display: none;
            }

            .image-studio-send-btn {
                width: 44px;
                min-width: 44px;
                padding: 0;
                justify-content: center;
                min-height: 44px;
                border-radius: 999px;
            }

            .image-studio-send-btn span {
                display: none;
            }

            .image-studio-gallery {
                grid-template-columns: repeat(2, minmax(0, 1fr));
                gap: 12px;
            }

            .image-studio-tools {
                display: grid;
                grid-template-columns: repeat(3, minmax(0, 1fr));
                grid-auto-flow: initial;
                overflow: visible;
                gap: 10px;
                padding-bottom: 0;
                width: 100%;
            }

            .image-studio-tools::-webkit-scrollbar {
                display: none;
            }

            .image-studio-tool-card {
                min-width: 0;
                min-height: 96px;
                width: 100%;
                grid-template-columns: 1fr;
                justify-items: center;
                align-content: center;
                text-align: center;
                padding: 12px 8px;
                row-gap: 8px;
                border-radius: 20px;
            }

            .image-studio-tool-copy {
                width: 100%;
                display: grid;
                justify-items: center;
                gap: 2px;
            }

            .image-studio-tool-copy-top {
                display: block;
                width: 100%;
            }

            .image-studio-tool-card strong {
                display: block;
                font-size: 13px;
                line-height: 1.35;
                text-align: center;
            }

            .image-studio-tool-card .image-studio-tool-tag,
            .image-studio-tool-card .image-studio-tool-copy > span:last-child {
                display: none;
            }

            .image-studio-tool-thumb {
                width: 52px;
                height: 52px;
                margin: 0 auto;
            }

            .mobile-chat-toolbar {
                display: inline-flex;
            }
        }

        @media (max-width: 560px) {
            .image-studio-mobile-hero {
                padding-top: 48px;
            }

            .image-studio-mobile-hero strong {
                font-size: 22px;
            }

            .image-studio-gallery {
                grid-template-columns: repeat(2, minmax(0, 1fr));
                gap: 10px;
            }

            .image-studio-template-panel {
                padding: 10px;
                border-radius: 22px;
            }

            .image-studio-template-panel.is-compact {
                padding: 8px;
                border-radius: 20px;
            }

            .image-studio-template-compact-head {
                align-items: flex-start;
                gap: 10px;
            }

            .image-studio-template-refresh {
                min-height: 28px;
                padding: 0 10px;
                font-size: 11px;
            }

            .image-studio-template-head {
                flex-direction: column;
                align-items: flex-start;
                gap: 10px;
            }

            .image-studio-template-filters {
                gap: 6px;
                margin-bottom: 10px;
            }

            .image-studio-template-filter {
                min-height: 30px;
                padding: 0 10px;
                font-size: 11px;
            }

            .image-studio-template-masonry {
                grid-template-columns: repeat(2, minmax(0, 1fr));
                gap: 10px;
            }

            .image-studio-template-spotlight-copy {
                padding: 14px 12px 12px;
            }

            .image-studio-template-spotlight-copy strong {
                font-size: 14px;
            }

            .image-studio-template-spotlight-copy p {
                font-size: 11px;
            }

            .image-studio-template-mini-copy {
                padding: 5px 8px;
                font-size: 10px;
            }

            .image-studio-template-spotlight-hover {
                padding: 20px 10px 10px;
            }

            .image-studio-template-card.landscape,
            .image-studio-template-card.wide,
            .image-studio-template-card.hero {
                grid-column: span 2;
                grid-row: span 1;
            }
        }

        @media (max-width: 920px) {
            body[data-tool-mode="image"] .image-create-studio,
            body[data-tool-mode="video"] .image-create-studio {
                padding: 10px 12px 24px;
            }

            body[data-tool-mode="image"] .image-studio-shell,
            body[data-tool-mode="video"] .image-studio-shell {
                gap: 16px;
            }

            body[data-tool-mode="image"] .image-studio-mobile-hero,
            body[data-tool-mode="video"] .image-studio-mobile-hero {
                padding: 36px 8px 8px;
            }

            body[data-tool-mode="image"] .image-studio-prompt-card,
            body[data-tool-mode="video"] .image-studio-prompt-card {
                position: relative;
                border-radius: 26px;
                overflow: visible;
                box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
            }

            body[data-tool-mode="image"] .image-studio-input,
            body[data-tool-mode="video"] .image-studio-input {
                min-height: 124px;
                padding: 18px 18px 72px;
                font-size: 16px;
                line-height: 1.65;
            }

            body[data-tool-mode="image"] .image-studio-toolbar,
            body[data-tool-mode="video"] .image-studio-toolbar {
                position: absolute;
                left: 14px;
                right: 14px;
                bottom: 12px;
                padding: 0;
                gap: 0;
                background: transparent;
                border-top: none;
            }

            body[data-tool-mode="image"] .image-studio-toolbar-left,
            body[data-tool-mode="video"] .image-studio-toolbar-left {
                position: relative;
                width: 100%;
                gap: 8px;
                padding-right: 58px;
                overflow: visible;
                align-items: center;
            }

            body[data-tool-mode="image"] .image-studio-toolbar-right,
            body[data-tool-mode="video"] .image-studio-toolbar-right {
                position: absolute;
                right: 0;
                bottom: 0;
                width: auto;
            }

            body[data-tool-mode="image"] .image-studio-toolbar-divider,
            body[data-tool-mode="video"] .image-studio-toolbar-divider {
                display: none !important;
            }

            body[data-tool-mode="image"] .image-studio-inline-btn,
            body[data-tool-mode="video"] .image-studio-inline-btn,
            body[data-tool-mode="image"] .image-studio-tool-link,
            body[data-tool-mode="video"] .image-studio-tool-link {
                min-height: 34px;
                padding: 0 12px;
                border-radius: 12px;
                font-size: 14px;
                gap: 6px;
                box-shadow: none;
            }

            body[data-tool-mode="image"] .image-studio-inline-btn,
            body[data-tool-mode="video"] .image-studio-inline-btn {
                background: #f3f4f6;
                border-color: rgba(15, 23, 42, 0.04);
            }

            body[data-tool-mode="image"] .image-studio-inline-btn.active,
            body[data-tool-mode="video"] .image-studio-inline-btn.active {
                background: #ffffff;
                color: #111827;
                border-color: rgba(37, 99, 255, 0.14);
                box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
            }

            body[data-tool-mode="image"] .image-studio-inline-close,
            body[data-tool-mode="video"] .image-studio-inline-close {
                display: none !important;
            }

            body[data-tool-mode="image"] #image-studio-upload-btn,
            body[data-tool-mode="video"] #image-studio-upload-btn {
                background: rgba(255, 255, 255, 0.96);
                border-color: rgba(15, 23, 42, 0.06);
            }

            body[data-tool-mode="image"] #image-studio-upload-btn .image-studio-tool-icon,
            body[data-tool-mode="video"] #image-studio-upload-btn .image-studio-tool-icon {
                width: 14px;
                height: 14px;
                flex: 0 0 14px;
            }

            body[data-tool-mode="image"] #image-studio-upload-btn .image-studio-tool-icon svg,
            body[data-tool-mode="video"] #image-studio-upload-btn .image-studio-tool-icon svg {
                width: 14px;
                height: 14px;
            }

            body[data-tool-mode="image"] #image-studio-mobile-more-btn,
            body[data-tool-mode="video"] #image-studio-mobile-more-btn {
                display: inline-flex !important;
                width: 34px;
                min-width: 34px;
                padding: 0;
                justify-content: center;
                background: rgba(244, 244, 245, 0.96);
                border-color: rgba(15, 23, 42, 0.04);
            }

            #chat-compose-field.is-media-mode #image-studio-mobile-more-btn {
                display: none !important;
            }

            body[data-tool-mode="image"] #image-studio-mobile-more-btn.active,
            body[data-tool-mode="video"] #image-studio-mobile-more-btn.active {
                background: #ffffff;
                border-color: rgba(37, 99, 255, 0.14);
            }

            body[data-tool-mode="image"] .image-studio-toolbar-left > .image-studio-toolbar-control,
            body[data-tool-mode="video"] .image-studio-toolbar-left > .image-studio-toolbar-control {
                display: none !important;
            }

            body[data-tool-mode="image"] .image-studio-more-panel,
            body[data-tool-mode="video"] .image-studio-more-panel {
                display: none !important;
                position: absolute;
                left: 0;
                right: 0;
                bottom: calc(100% + 10px);
                width: auto;
                max-width: none;
                transform: none;
                max-height: min(42vh, 320px);
                overflow-y: auto;
                overflow-x: hidden;
                padding: 8px;
                border-radius: 18px;
                border: 1px solid rgba(15, 23, 42, 0.08);
                background: rgba(255, 255, 255, 0.98);
                box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
                z-index: 160;
                grid-template-columns: 1fr;
                gap: 8px;
                pointer-events: auto;
            }

            body[data-tool-mode="image"] .image-studio-more-panel.open,
            body[data-tool-mode="video"] .image-studio-more-panel.open {
                display: grid !important;
            }

            body[data-tool-mode="image"] .image-studio-more-panel .image-studio-toolbar-control,
            body[data-tool-mode="video"] .image-studio-more-panel .image-studio-toolbar-control {
                display: block !important;
                position: relative;
            }

            body[data-tool-mode="image"] .image-studio-more-panel .image-studio-tool-link,
            body[data-tool-mode="video"] .image-studio-more-panel .image-studio-tool-link {
                width: 100%;
                min-height: 42px;
                justify-content: space-between;
                padding: 0 12px;
                border: none;
                border-radius: 14px;
                background: #ffffff;
                box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
            }

            body[data-tool-mode="image"] .image-studio-more-panel .image-studio-tool-link-copy,
            body[data-tool-mode="video"] .image-studio-more-panel .image-studio-tool-link-copy {
                display: inline-flex;
                align-items: center;
                gap: 6px;
            }

            body[data-tool-mode="image"] .image-studio-more-panel .image-studio-tool-link-label,
            body[data-tool-mode="video"] .image-studio-more-panel .image-studio-tool-link-label {
                color: #111827;
                font-size: 14px;
            }

            body[data-tool-mode="image"] .image-studio-more-panel .image-studio-tool-link-value,
            body[data-tool-mode="video"] .image-studio-more-panel .image-studio-tool-link-value {
                max-width: 80px;
                color: #64748b;
                font-size: 14px;
                font-weight: 600;
            }

            body[data-tool-mode="image"] .image-studio-gallery-shell,
            body[data-tool-mode="video"] .image-studio-gallery-shell {
                display: block !important;
            }

            body[data-tool-mode="image"] .image-studio-gallery-head,
            body[data-tool-mode="video"] .image-studio-gallery-head,
            body[data-tool-mode="image"] .image-studio-gallery-filters,
            body[data-tool-mode="video"] .image-studio-gallery-filters {
                display: none !important;
            }

            body[data-tool-mode="image"] .image-studio-tools,
            body[data-tool-mode="video"] .image-studio-tools {
                display: flex;
                gap: 10px;
                overflow-x: auto;
                overflow-y: hidden;
                padding: 0 2px 2px;
                scroll-snap-type: x proximity;
            }

            body[data-tool-mode="image"] .image-studio-tools::-webkit-scrollbar,
            body[data-tool-mode="video"] .image-studio-tools::-webkit-scrollbar {
                display: none;
            }

            body[data-tool-mode="image"] .image-studio-tool-card,
            body[data-tool-mode="video"] .image-studio-tool-card {
                flex: 0 0 102px;
                min-width: 102px;
                min-height: 76px;
                padding: 10px 8px 12px;
                border-radius: 16px;
                display: grid;
                grid-template-columns: 1fr;
                justify-items: center;
                align-content: flex-start;
                gap: 8px;
                scroll-snap-align: start;
            }

            body[data-tool-mode="image"] .image-studio-tool-copy,
            body[data-tool-mode="video"] .image-studio-tool-copy {
                width: 100%;
                display: grid;
                justify-items: center;
                gap: 2px;
            }

            body[data-tool-mode="image"] .image-studio-tool-copy-top,
            body[data-tool-mode="video"] .image-studio-tool-copy-top {
                width: 100%;
            }

            body[data-tool-mode="image"] .image-studio-tool-card strong,
            body[data-tool-mode="video"] .image-studio-tool-card strong {
                font-size: 12px;
                line-height: 1.35;
                text-align: center;
            }

            body[data-tool-mode="image"] .image-studio-tool-card .image-studio-tool-tag,
            body[data-tool-mode="video"] .image-studio-tool-card .image-studio-tool-tag,
            body[data-tool-mode="image"] .image-studio-tool-card .image-studio-tool-copy > span:last-child,
            body[data-tool-mode="video"] .image-studio-tool-card .image-studio-tool-copy > span:last-child {
                display: none;
            }

            body[data-tool-mode="image"] .image-studio-tool-thumb,
            body[data-tool-mode="video"] .image-studio-tool-thumb {
                grid-column: auto;
                grid-row: auto;
                width: 38px;
                height: 38px;
                margin: 0 auto;
                border-radius: 10px;
                padding: 7px;
                display: inline-flex !important;
            }

            body[data-tool-mode="image"] .image-studio-send-btn,
            body[data-tool-mode="video"] .image-studio-send-btn {
                width: 44px;
                min-width: 44px;
                min-height: 44px;
                padding: 0;
                border-radius: 999px;
                justify-content: center;
                background: linear-gradient(135deg, #2563eb 0%, #4f7cff 100%);
                color: #ffffff;
                box-shadow: 0 14px 28px rgba(37, 99, 235, 0.22);
            }

            body[data-tool-mode="image"] .image-studio-send-btn svg,
            body[data-tool-mode="video"] .image-studio-send-btn svg {
                width: 22px;
                height: 22px;
            }

            body[data-tool-mode="image"] .image-studio-send-btn.is-busy svg,
            body[data-tool-mode="video"] .image-studio-send-btn.is-busy svg {
                animation: chat-send-spin .9s linear infinite;
            }

            body[data-tool-mode="image"] .image-studio-send-btn.has-text,
            body[data-tool-mode="video"] .image-studio-send-btn.has-text {
                background: linear-gradient(135deg, #2563eb 0%, #4f7cff 100%);
                color: #ffffff;
                box-shadow: 0 14px 28px rgba(37, 99, 235, 0.22);
            }

            body[data-tool-mode="image"] .image-studio-send-btn.is-voice,
            body[data-tool-mode="video"] .image-studio-send-btn.is-voice {
                background: #eef3fb;
                color: #1d4ed8;
                box-shadow: 0 0 0 1.5px rgba(37, 99, 235, 0.18);
            }

            body[data-tool-mode="image"] .image-studio-send-btn.is-listening,
            body[data-tool-mode="video"] .image-studio-send-btn.is-listening {
                background: #eef3fb;
                color: #1d4ed8;
                box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
            }

            body[data-tool-mode="image"] .image-studio-send-btn.is-listening svg,
            body[data-tool-mode="video"] .image-studio-send-btn.is-listening svg {
                animation: chat-voice-pulse 1.1s ease-in-out infinite;
            }

            body[data-tool-mode="image"] .image-studio-gallery,
            body[data-tool-mode="video"] .image-studio-gallery {
                grid-template-columns: repeat(2, minmax(0, 1fr));
                gap: 12px;
            }

            body[data-tool-mode="image"] .image-studio-preset-card,
            body[data-tool-mode="video"] .image-studio-preset-card {
                display: block;
                border-radius: 18px;
                overflow: hidden;
                position: relative;
            }

            body[data-tool-mode="image"] .image-studio-preset-card.large,
            body[data-tool-mode="video"] .image-studio-preset-card.large {
                grid-column: span 1;
            }

            body[data-tool-mode="image"] .image-studio-preset-stage,
            body[data-tool-mode="video"] .image-studio-preset-stage {
                min-height: 180px;
            }

            body[data-tool-mode="image"] .image-studio-preset-card.portrait .image-studio-preset-stage,
            body[data-tool-mode="video"] .image-studio-preset-card.portrait .image-studio-preset-stage {
                min-height: 214px;
            }

            body[data-tool-mode="image"] .image-studio-preset-card.square .image-studio-preset-stage,
            body[data-tool-mode="video"] .image-studio-preset-card.square .image-studio-preset-stage {
                min-height: 212px;
            }

            body[data-tool-mode="image"] .image-studio-preset-overlay,
            body[data-tool-mode="video"] .image-studio-preset-overlay {
                position: absolute;
                inset: auto 0 0 0;
                padding: 18px 12px 12px;
                background: linear-gradient(180deg, rgba(9, 14, 26, 0) 0%, rgba(9, 14, 26, 0.2) 18%, rgba(9, 14, 26, 0.9) 100%);
                color: #ffffff;
                gap: 6px;
                opacity: 0;
                transform: translateY(10px);
                transition: opacity .2s ease, transform .2s ease;
                pointer-events: none;
            }

            body[data-tool-mode="image"] .image-studio-preset-overlay strong,
            body[data-tool-mode="video"] .image-studio-preset-overlay strong {
                color: #ffffff;
                font-size: 14px;
            }

            body[data-tool-mode="image"] .image-studio-preset-overlay p,
            body[data-tool-mode="video"] .image-studio-preset-overlay p {
                color: rgba(255, 255, 255, 0.84);
                font-size: 11px;
                line-height: 1.5;
            }

            body[data-tool-mode="image"] .image-studio-preset-action,
            body[data-tool-mode="video"] .image-studio-preset-action {
                position: static;
                opacity: 1;
                transform: none;
                justify-content: flex-start;
                pointer-events: auto;
            }

            body[data-tool-mode="image"] .image-studio-preset-action button,
            body[data-tool-mode="video"] .image-studio-preset-action button {
                min-height: 30px;
                padding: 0 12px;
                background: rgba(255, 255, 255, 0.96);
                color: #111827;
                box-shadow: none;
            }

            body[data-tool-mode="image"] .image-studio-preset-card.is-revealed .image-studio-preset-overlay,
            body[data-tool-mode="video"] .image-studio-preset-card.is-revealed .image-studio-preset-overlay {
                opacity: 1;
                transform: translateY(0);
                pointer-events: auto;
            }

            body[data-tool-mode="image"] .image-studio-preset-card.is-revealed .image-studio-preset-action,
            body[data-tool-mode="video"] .image-studio-preset-card.is-revealed .image-studio-preset-action {
                pointer-events: auto;
            }

            body[data-ui-theme="dark"][data-tool-mode="image"] .image-studio-prompt-card,
            body[data-ui-theme="dark"][data-tool-mode="video"] .image-studio-prompt-card {
                box-shadow: 0 18px 40px rgba(2, 6, 23, 0.28);
            }

            body[data-ui-theme="dark"][data-tool-mode="image"] .image-studio-inline-btn,
            body[data-ui-theme="dark"][data-tool-mode="video"] .image-studio-inline-btn {
                background: rgba(15, 23, 42, 0.72);
                border-color: rgba(148, 163, 184, 0.08);
            }

            body[data-ui-theme="dark"][data-tool-mode="image"] .image-studio-inline-btn.active,
            body[data-ui-theme="dark"][data-tool-mode="video"] .image-studio-inline-btn.active {
                background: rgba(22, 32, 52, 0.98);
            }

            body[data-ui-theme="dark"][data-tool-mode="image"] #image-studio-upload-btn,
            body[data-ui-theme="dark"][data-tool-mode="video"] #image-studio-upload-btn,
            body[data-ui-theme="dark"][data-tool-mode="image"] #image-studio-mobile-more-btn,
            body[data-ui-theme="dark"][data-tool-mode="video"] #image-studio-mobile-more-btn {
                background: rgba(15, 23, 42, 0.82);
                border-color: rgba(148, 163, 184, 0.08);
            }

            body[data-ui-theme="dark"][data-tool-mode="image"] .image-studio-more-panel,
            body[data-ui-theme="dark"][data-tool-mode="video"] .image-studio-more-panel {
                background: rgba(10, 18, 32, 0.98);
                border-color: rgba(148, 163, 184, 0.12);
                box-shadow: 0 18px 40px rgba(2, 6, 23, 0.34);
            }

            body[data-ui-theme="dark"][data-tool-mode="image"] .image-studio-more-panel .image-studio-tool-link,
            body[data-ui-theme="dark"][data-tool-mode="video"] .image-studio-more-panel .image-studio-tool-link {
                background: rgba(15, 23, 42, 0.92);
                box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.08);
            }
        }

        @media (min-width: 921px) and (hover: hover) and (pointer: fine) {
            .mobile-chat-toolbar,
            .mobile-chat-more-menu {
                display: none !important;
            }

            body[data-tool-mode="image"] #image-studio-mobile-more-btn,
            body[data-tool-mode="video"] #image-studio-mobile-more-btn {
                display: none !important;
            }
        }

        @media (min-width: 921px) {
            #image-studio-mobile-more-btn {
                display: none !important;
            }
        }

        /* Mobile viewport is a fixed shell. Only dedicated content panes scroll. */
        @media (max-width: 920px) {
            html {
                width: 100%;
                height: 100%;
                min-height: 100%;
                max-width: 100%;
                overflow: hidden;
                overscroll-behavior: none;
            }

            body {
                position: fixed;
                inset: 0;
                width: 100%;
                height: 100vh;
                height: var(--mobile-viewport-height, 100dvh);
                min-height: 0;
                max-width: 100%;
                overflow: hidden;
                overscroll-behavior: none;
            }

            .app {
                width: 100%;
                height: 100%;
                min-height: 0;
                max-height: 100%;
                max-width: 100%;
                overflow: hidden;
                overscroll-behavior: none;
            }

            .workspace,
            body[data-mode="chat"] .workspace {
                width: 100%;
                height: 100%;
                min-height: 0;
                max-height: 100%;
                max-width: 100%;
                overflow: hidden;
                overscroll-behavior: none;
            }

            body[data-mode="chat"] .stage,
            body[data-mode="chat"] .result-card {
                min-height: 0;
                max-height: 100%;
                overflow: hidden;
            }

            body[data-mode="chat"] .result-content {
                min-height: 0;
                overflow-y: auto;
                overflow-x: hidden;
                overscroll-behavior-y: contain;
                -webkit-overflow-scrolling: touch;
            }

            body[data-tool-mode="image"] .workspace,
            body[data-tool-mode="video"] .workspace {
                overflow-y: auto;
                overflow-x: hidden;
                overscroll-behavior-y: contain;
                -webkit-overflow-scrolling: touch;
            }

            .history {
                height: 100vh;
                height: var(--mobile-viewport-height, 100dvh);
                min-height: 0;
                max-height: var(--mobile-viewport-height, 100dvh);
                overflow: hidden;
                overscroll-behavior: none;
            }

            .history-main,
            .workspace-records-slot,
            .legal-doc-content {
                min-height: 0;
                overflow-y: auto;
                overflow-x: hidden;
                overscroll-behavior-y: contain;
                -webkit-overflow-scrolling: touch;
            }

            .auth-overlay,
            .legal-doc-overlay,
            .user-settings-overlay {
                position: fixed;
                inset: 0;
                width: 100%;
                height: 100vh;
                height: var(--mobile-viewport-height, 100dvh);
                max-width: 100%;
                overflow: hidden;
                overscroll-behavior: none;
            }

            .auth-mask {
                touch-action: none;
                -webkit-text-size-adjust: 100%;
            }

            /* Prevent accidental pinch/double-tap zoom from putting the page
             * into a scaled visual viewport. Text fields opt back into text
             * selection below. */
            html {
                touch-action: none;
            }

            body input,
            body textarea,
            body [contenteditable="true"] {
                -webkit-user-select: text;
                user-select: text;
            }

            .auth-dialog {
                top: 50%;
                left: 50%;
                width: calc(100% - 16px);
                max-width: 520px;
                height: auto;
                max-height: calc(var(--mobile-viewport-height, 100dvh) - 16px);
                padding: 18px 16px 16px;
                border-radius: 24px;
                overflow: hidden;
            }

            .auth-layout {
                display: block;
                width: 100%;
                min-width: 0;
                min-height: 0;
                max-height: calc(var(--mobile-viewport-height, 100dvh) - 50px);
                overflow: hidden;
            }

            .auth-main {
                width: 100%;
                min-width: 0;
                min-height: 0;
                max-height: calc(var(--mobile-viewport-height, 100dvh) - 50px);
                padding: 2px 2px 4px;
                overflow-y: auto;
                overflow-x: hidden;
                overscroll-behavior-y: contain;
                -webkit-overflow-scrolling: touch;
            }

            .auth-aside {
                display: none;
            }

            .auth-dialog-head {
                gap: 6px;
                padding-right: 34px;
            }

            .auth-dialog-head h3 {
                font-size: 20px;
            }

            .auth-dialog-head p {
                font-size: 13px;
                line-height: 1.55;
            }

            .auth-dialog-badge {
                min-height: 26px;
                padding: 0 10px;
                font-size: 11px;
            }

            .auth-mode-tabs {
                margin-top: 12px;
            }

            .auth-form {
                gap: 12px;
            }

            .auth-field {
                gap: 6px;
            }

            .auth-field input {
                min-height: 44px;
                font-size: 16px;
            }

            .chat-input-wrap textarea {
                font-size: 16px;
            }

            .auth-legal-copy {
                line-height: 1.55;
            }

            .auth-submit-btn {
                min-height: 44px;
            }

            .legal-doc-dialog {
                width: calc(100% - 16px);
                max-height: calc(var(--mobile-viewport-height, 100dvh) - 16px);
            }
        }
        /* Mobile chat: keep the viewport stable on narrow phones and let the
         * conversation area own vertical scrolling. The header is intentionally
         * non-sticky so focusing the composer does not permanently consume the
         * top of the screen. */
        @media (max-width: 920px) {
            html,
            body {
                width: 100%;
                max-width: 100%;
                min-width: 0;
                overflow-x: clip;
            }

            .app,
            .workspace,
            .stage,
            .result-card,
            .result-content,
            .composer,
            #chat-compose-field,
            .field,
            .chat-input-wrap {
                min-width: 0;
                max-width: 100%;
                box-sizing: border-box;
            }

            .mobile-chat-topbar {
                position: relative;
                top: auto;
                width: 100%;
                max-width: 100%;
                backdrop-filter: none;
            }

            .mobile-chat-actions {
                position: absolute;
                top: 10px;
                right: 12px;
            }

            body[data-mode="chat"] .chat-bubble,
            body[data-mode="chat"] .chat-bubble * {
                max-width: 100%;
                min-width: 0;
                overflow-wrap: anywhere;
                word-break: break-word;
            }

            body[data-mode="chat"] .chat-input-wrap {
                width: 100%;
                overflow: visible;
            }

            body[data-mode="chat"] .chat-input-wrap textarea {
                width: 100%;
                max-width: 100%;
                box-sizing: border-box;
                padding-bottom: 58px;
            }

            body[data-mode="chat"] .chat-input-wrap + .mobile-chat-toolbar {
                position: relative;
                z-index: 4;
                width: max-content;
                max-width: calc(100% - 24px);
                height: 34px;
                margin: -44px 0 10px 12px;
                padding: 0;
                pointer-events: none;
            }

            body[data-mode="chat"] .chat-input-wrap + .mobile-chat-toolbar .mobile-chat-toolbar-btn {
                pointer-events: auto;
                min-height: 34px;
                padding: 0 12px;
            }

            body[data-mode="chat"] .chat-input-wrap + .mobile-chat-toolbar .mobile-chat-more-menu {
                max-width: calc(100vw - 24px);
                max-height: min(46vh, 360px);
                overflow-x: hidden;
                overflow-y: auto;
                pointer-events: auto;
            }
        }

        @media (max-width: 560px) {
            .mobile-chat-topbar {
                padding-left: 8px;
                padding-right: 8px;
            }

            .mobile-chat-actions {
                right: 8px;
            }

            body[data-mode="chat"] .composer {
                padding-left: 8px;
                padding-right: 8px;
            }

            body[data-mode="chat"] .chat-input-wrap + .mobile-chat-toolbar {
                margin-left: 10px;
            }
        }

        /* Narrow-phone stability: keep the viewport itself fixed and let only
         * the conversation content scroll. The previous 100vw/fixed-action
         * combination could create a one-to-several-pixel horizontal overflow
         * on iOS, which also pushed the left Chat control out of view. */
        @media (max-width: 920px) {
            html,
            body {
                width: 100%;
                height: 100%;
                min-width: 0;
                max-width: 100%;
                overflow-x: hidden;
            }

            body[data-mode="chat"] {
                height: 100%;
                overflow: hidden;
                overscroll-behavior: none;
                overscroll-behavior-x: none;
            }

            body[data-mode="chat"] .app,
            body[data-mode="chat"] .workspace {
                width: 100%;
                min-width: 0;
                max-width: 100%;
                height: 100vh;
                min-height: 100vh;
                max-height: 100vh;
                height: var(--mobile-viewport-height, 100dvh);
                min-height: var(--mobile-viewport-height, 100dvh);
                max-height: var(--mobile-viewport-height, 100dvh);
                overflow: hidden;
            }

            body[data-mode="chat"] .mobile-chat-topbar {
                display: grid !important;
                grid-template-columns: max-content minmax(0, 1fr) max-content;
                width: 100%;
                min-width: 0;
                max-width: 100%;
                flex: 0 0 auto;
                padding-top: calc(env(safe-area-inset-top, 0px) + 10px);
                padding-right: calc(env(safe-area-inset-right, 0px) + 12px);
                padding-bottom: 10px;
                padding-left: calc(env(safe-area-inset-left, 0px) + 12px);
                overflow: visible;
            }

            body[data-mode="chat"] .mobile-nav-trigger {
                display: inline-flex !important;
                visibility: visible !important;
                opacity: 1 !important;
                min-width: 66px;
                width: auto;
                flex: 0 0 auto;
                position: relative;
                z-index: 33;
            }

            body[data-mode="chat"] .mobile-nav-pill {
                max-width: 100%;
                white-space: nowrap;
            }

            body[data-mode="chat"] .mobile-chat-bar {
                min-width: 0;
                max-width: 100%;
                overflow: hidden;
            }

            body[data-mode="chat"] .mobile-chat-actions {
                position: absolute;
                top: calc(env(safe-area-inset-top, 0px) + 10px);
                right: calc(env(safe-area-inset-right, 0px) + 12px);
                max-width: calc(100% - 84px);
                overflow: hidden;
            }

            body[data-mode="chat"] .stage {
                flex: 1 1 auto;
                min-height: 0;
                height: auto;
                overflow: hidden;
            }

            body[data-mode="chat"] .result-card {
                min-width: 0;
                min-height: 0;
                width: 100%;
                max-width: 100%;
                height: 100%;
                overflow: hidden;
            }

            body[data-mode="chat"] .result-content {
                min-width: 0;
                min-height: 0;
                width: 100%;
                max-width: 100%;
                overflow-x: hidden;
                overflow-y: auto;
                overscroll-behavior: contain;
                -webkit-overflow-scrolling: touch;
            }

            body[data-mode="chat"] .composer {
                flex: 0 0 auto;
                width: 100%;
                min-width: 0;
                max-width: 100%;
                margin: 0;
                border-radius: 20px 20px 0 0;
                padding-right: calc(env(safe-area-inset-right, 0px) + 10px);
                padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
                padding-left: calc(env(safe-area-inset-left, 0px) + 10px);
            }

            body[data-mode="chat"] .workspace-disclaimer {
                flex: 0 0 auto;
                width: 100%;
                max-width: 100%;
                padding-right: calc(env(safe-area-inset-right, 0px) + 8px);
                padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 5px);
                padding-left: calc(env(safe-area-inset-left, 0px) + 8px);
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
            }
        }

        /* Mobile composer refinement: keep the message area compact while
         * placing the existing More control inside the rounded input surface.
         * This block is intentionally last so it wins over desktop/chat base
         * rules without changing the desktop layout. */
        @media (max-width: 920px) {
            /* The mobile image workspace keeps the inspiration gallery
             * visible, including its refresh action. Video layout remains
             * unchanged. */
            body[data-tool-mode="image"] .image-studio-gallery-shell,
            body[data-tool-mode="image"] .image-studio-gallery-head {
                display: grid !important;
            }

            body[data-tool-mode="image"] .image-studio-gallery-head {
                grid-template-columns: minmax(0, 1fr) auto;
                align-items: start;
                gap: 10px;
            }

            body[data-tool-mode="image"] .image-studio-gallery-refresh {
                display: inline-flex !important;
                align-items: center;
                justify-content: center;
                min-height: 32px;
                padding: 0 11px;
                white-space: nowrap;
                font-size: 12px;
            }

            body[data-tool-mode="image"] .image-studio-gallery {
                grid-template-columns: repeat(2, minmax(0, 1fr));
                gap: 10px;
            }

            body[data-mode="chat"] .workspace-disclaimer {
                min-height: 0;
                padding: 0 6px 5px;
                font-size: 10px;
                line-height: 1.2;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
            }

            body[data-mode="chat"] .chat-input-wrap {
                overflow: visible;
                border-radius: 20px;
                padding-bottom: 0;
                min-height: 64px !important;
                height: auto !important;
                box-sizing: border-box;
            }

            body[data-mode="chat"] .chat-input-wrap textarea {
                min-height: 64px !important;
                height: 64px !important;
                max-height: 64px !important;
                resize: none;
                padding: 10px 112px 38px 14px;
                line-height: 1.45;
                font-size: 14px;
                overflow-x: hidden;
                overflow-y: auto;
                white-space: pre-wrap;
                overflow-wrap: anywhere;
                box-sizing: border-box;
            }

            body[data-mode="chat"] .chat-input-hint {
                top: 12px;
                left: 14px;
                right: 88px;
                height: 22px;
                line-height: 22px;
                font-size: 14px;
                color: #94a3b8;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
            }

            body[data-mode="chat"] .chat-input-tools {
                right: 10px;
                bottom: 7px;
                gap: 6px;
                z-index: 5;
            }

            body[data-mode="chat"] .mobile-chat-toolbar {
                display: flex;
                width: auto;
                min-height: 32px;
                box-sizing: border-box;
                align-items: center;
                gap: 4px;
                margin: 0;
                padding: 0 88px 5px 10px;
                position: absolute;
                left: 0;
                right: 0;
                bottom: 0;
                z-index: 4;
            }

            body[data-mode="chat"] .mobile-chat-toolbar-btn {
                min-height: 28px;
                padding: 0 10px;
                border-radius: 999px;
                background: rgba(248, 250, 252, 0.92);
                border-color: rgba(15, 23, 42, 0.06);
                box-shadow: none;
                font-size: 12px;
            }

            body[data-mode="chat"] .mobile-chat-toolbar .mobile-chat-more-menu {
                max-width: calc(100vw - 24px);
                max-height: min(46vh, 360px);
                overflow-x: hidden;
                overflow-y: auto;
            }

            #chat-compose-field.is-media-mode .mobile-chat-toolbar,
            body[data-chat-entry-mode="work"] .mobile-chat-toolbar {
                display: none !important;
            }
        }

        /* Final narrow-phone containment rules.  Keep the page itself fixed;
         * only the conversation pane is scrollable.  In particular, avoid
         * 100vw + safe-area combinations, which create a tiny horizontal
         * overflow on iOS and expose the body's top/bottom as draggable. */
        @media (max-width: 920px) {
            html,
            body {
                position: fixed;
                inset: 0;
                width: 100%;
                max-width: 100%;
                min-width: 0;
                height: 100%;
                min-height: 0;
                max-height: 100%;
                overflow: hidden !important;
                overscroll-behavior: none;
                overscroll-behavior-x: none;
                touch-action: none;
            }

            body[data-mode="chat"] .app,
            body[data-mode="chat"] .workspace,
            body[data-mode="chat"] .stage,
            body[data-mode="chat"] .result-card {
                width: 100%;
                max-width: 100%;
                min-width: 0;
                box-sizing: border-box;
                overflow-x: hidden !important;
            }

            body[data-mode="chat"] .app,
            body[data-mode="chat"] .workspace,
            body[data-mode="chat"] .stage,
            body[data-mode="chat"] .result-card,
            body[data-mode="chat"] .result-content,
            body[data-mode="chat"] .composer,
            body[data-mode="chat"] .workspace-disclaimer,
            body[data-mode="chat"] .mobile-chat-topbar,
            body[data-mode="chat"] .mobile-chat-bar,
            body[data-mode="chat"] .mobile-chat-actions {
                min-width: 0;
                max-width: 100%;
                flex-shrink: 1;
            }

            body[data-mode="chat"] * {
                min-width: 0;
                overflow-wrap: anywhere;
            }

            body[data-mode="chat"] .app,
            body[data-mode="chat"] .workspace {
                height: var(--mobile-viewport-height, 100dvh);
                min-height: 0;
                max-height: var(--mobile-viewport-height, 100dvh);
                padding: 0 !important;
                margin: 0 !important;
                overflow-y: hidden !important;
            }

            body[data-mode="chat"] .mobile-chat-topbar {
                position: relative !important;
                inset: auto !important;
                display: grid !important;
                grid-template-columns: max-content minmax(0, 1fr) max-content;
                width: 100% !important;
                max-width: 100% !important;
                min-width: 0;
                box-sizing: border-box;
                overflow: hidden !important;
                background: transparent;
                border: 0;
                box-shadow: none;
                backdrop-filter: none;
            }

            body[data-mode="chat"] .mobile-nav-trigger,
            body[data-mode="chat"] .mobile-chat-actions {
                min-width: 0;
                max-width: 100%;
                box-sizing: border-box;
                overflow: hidden;
            }

            body[data-mode="chat"] .mobile-nav-trigger,
            body[data-mode="chat"] .mobile-nav-pill,
            body[data-mode="chat"] .ui-language-switch,
            body[data-mode="chat"] .ui-language-switch-btn {
                -webkit-appearance: none;
                appearance: none;
                -webkit-tap-highlight-color: transparent;
            }

            body[data-mode="chat"] .mobile-chat-actions {
                position: relative !important;
                top: auto !important;
                right: auto !important;
                justify-self: end;
                gap: 6px;
            }

            body[data-mode="chat"] .mobile-nav-pill,
            body[data-mode="chat"] .ui-language-switch {
                overflow: hidden;
                isolation: isolate;
                box-shadow: none;
                background-clip: padding-box;
            }

            body[data-mode="chat"] .mobile-nav-pill {
                max-width: 100%;
            }

            body[data-mode="chat"] .ui-language-switch {
                flex: 0 1 auto;
                max-width: 100%;
                border-color: rgba(15, 23, 42, 0.08);
            }

            body[data-mode="chat"] .result-content {
                width: 100%;
                max-width: 100%;
                min-width: 0;
                overflow-x: hidden !important;
                overflow-y: auto;
                overscroll-behavior: contain;
                touch-action: pan-y;
                -webkit-overflow-scrolling: touch;
            }

            body[data-mode="chat"] .workspace-disclaimer {
                width: 100%;
                max-width: 100%;
                min-width: 0;
                box-sizing: border-box;
                display: flex;
                align-items: center;
                justify-content: center;
                flex-wrap: nowrap;
                gap: 6px;
                overflow: hidden;
                white-space: nowrap;
                text-overflow: clip;
            }

            body[data-mode="chat"] .workspace-disclaimer > span {
                min-width: 0;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
            }

            body[data-mode="chat"] .workspace-disclaimer > a {
                flex: 0 0 auto;
            }

            body[data-mode="chat"] * {
                max-width: 100%;
                box-sizing: border-box;
            }

            body[data-mode="chat"] .mobile-chat-more-menu {
                max-width: calc(100% - 16px) !important;
                overflow-x: hidden;
            }

            /* The office landing grid is taller than the chat landing grid.
             * Centering that whole block on a short phone viewport can push
             * the heading above the scroll area, making it look clipped. */
            body[data-mode="chat"][data-chat-entry-mode="work"] .empty-state {
                align-items: flex-start;
                justify-content: flex-start;
                padding-top: max(30px, calc(env(safe-area-inset-top, 0px) + 24px));
                padding-bottom: 28px;
                overflow-y: auto;
            }

            body[data-mode="chat"][data-chat-entry-mode="work"] .chat-empty {
                width: 100%;
                min-height: 0;
                align-content: start;
                padding-top: 0;
                padding-bottom: 8px;
            }

            /* AI creation mobile composer: the text field and the tool row
             * are separate surfaces.  Previously the prompt-card border
             * wrapped both, and a growing textarea could paint underneath the
             * image/video controls. */
            body[data-tool-mode="image"] .image-studio-prompt-card {
                border: 0;
                border-radius: 0;
                background: transparent;
                box-shadow: none;
                overflow: visible;
            }

            body[data-tool-mode="image"] .image-studio-input-shell {
                margin: 0;
                border: 1px solid rgba(96, 135, 255, 0.24);
                border-radius: 24px;
                background: rgba(248, 250, 252, 0.96);
                box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.48);
                overflow: hidden;
            }

            body[data-tool-mode="image"] .image-studio-input {
                width: 100%;
                height: clamp(138px, 22vh, 182px);
                min-height: 0;
                max-height: 210px;
                resize: none;
                overflow-x: hidden;
                overflow-y: auto;
                box-sizing: border-box;
                padding: 16px 108px 68px 18px;
                line-height: 1.65;
            }

            body[data-tool-mode="image"] .image-studio-toolbar {
                margin-top: 10px;
                padding: 0 4px;
                border: 0;
                background: transparent;
            }

            body[data-ui-theme="dark"][data-tool-mode="image"] .image-studio-input-shell {
                background: rgba(15, 23, 42, 0.72);
                border-color: rgba(96, 165, 250, 0.28);
                box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.12);
            }
        }
        /* New conversation landing: keep the composer as the primary
         * centered entry point and remove the old nine-card prompt grid. */
        body.chat-landing[data-mode="chat"] .stage {
            display: none;
        }

        body.chat-landing[data-mode="chat"] .workspace-chat-header-center {
            visibility: hidden;
            pointer-events: none;
        }

        body.chat-landing[data-mode="chat"] .composer {
            position: absolute;
            top: 50%;
            left: 50%;
            z-index: 14;
            width: min(900px, calc(100% - 72px));
            max-width: 900px;
            margin: 0;
            padding: 0 0 18px;
            transform: translate(-50%, -40%);
            background: transparent;
            border: none;
            box-shadow: none;
        }

        body.chat-landing[data-mode="chat"] .composer-top {
            display: block;
            margin-bottom: 14px;
            text-align: center;
        }

        body.chat-landing[data-mode="chat"] .composer-title {
            color: #172033;
            font-size: clamp(22px, 3vw, 30px);
            font-weight: 700;
            line-height: 1.25;
        }

        body.chat-landing[data-mode="chat"] .composer-desc {
            display: none;
        }

        body.chat-landing[data-mode="chat"] #chat-compose-field {
            width: 100%;
            margin: 0;
        }

        body.chat-landing[data-mode="chat"] .workspace-disclaimer {
            position: absolute;
            right: 22px;
            bottom: 6px;
            left: 22px;
            z-index: 15;
        }

        body.chat-landing[data-mode="chat"] .chat-quick-actions {
            display: none;
        }

        @media (max-width: 920px) {
            body.chat-landing[data-mode="chat"] .composer {
                --landing-composer-head-space: 48px;
                --landing-input-center-offset: calc(var(--landing-composer-head-space) + 62px);
                top: calc(50% - var(--landing-input-center-offset));
                width: calc(100% - 20px);
                padding-bottom: 8px;
                transform: translateX(-50%);
            }

            body.chat-landing[data-mode="chat"] .composer-title {
                font-size: 17px;
            }

            body.chat-landing[data-mode="chat"] .workspace-disclaimer {
                right: 10px;
                bottom: 4px;
                left: 10px;
            }
        }

        .sidebar-brand-wordmark {
            display: none;
        }

        /* New conversation landing page: match the FuuVo reference layout. */
        @media (min-width: 921px) {
            body.chat-landing[data-mode="chat"] {
                --chat-sidebar-width: 370px;
                --chat-sidebar-resizer-width: 1px;
                background: #fff;
            }

            body.chat-landing[data-mode="chat"] .app {
                background: #fff;
            }

            body.chat-landing[data-mode="chat"] .history {
                padding: 30px 22px 18px;
                background: #fff;
                border-right: 1px solid #edf1f7;
            }

            body.chat-landing[data-mode="chat"] .desktop-sidebar-resizer {
                display: flex;
                opacity: 0;
                pointer-events: none;
            }

            body.chat-landing[data-mode="chat"] .sidebar-search-trigger {
                display: grid;
                min-height: 40px;
                padding: 0 10px;
                border-radius: 8px;
                box-shadow: none;
            }

            body.chat-landing[data-mode="chat"] .sidebar-shell {
                gap: 22px;
                padding: 0 2px;
            }

            body.chat-landing[data-mode="chat"] .sidebar-brand {
                display: grid;
                gap: 2px;
                align-items: start;
                padding: 0 10px;
            }

            body.chat-landing[data-mode="chat"] .sidebar-brand-mark {
                display: none;
            }

            body.chat-landing[data-mode="chat"] .sidebar-brand img {
                display: block;
                width: 160px;
                height: auto;
                max-height: 32px;
                border: 0;
                border-radius: 0;
                background: transparent;
                object-fit: contain;
                object-position: left center;
            }

            body.chat-landing[data-mode="chat"] .sidebar-brand-wordmark {
                display: block;
                color: #0b73e8;
                font-family: Arial, sans-serif;
                font-size: 43px;
                font-weight: 800;
                letter-spacing: -2px;
                line-height: .92;
            }

            body.chat-landing[data-mode="chat"] .sidebar-brand-wordmark span {
                display: inline-block;
                margin-left: 4px;
                color: #0688ea;
                font-size: 22px;
                font-weight: 700;
                letter-spacing: -4px;
                transform: translateY(-6px);
            }

            body.chat-landing[data-mode="chat"] .sidebar-brand-copy {
                display: flex;
                align-items: baseline;
                gap: 2px;
                padding-top: 3px;
            }

            body.chat-landing[data-mode="chat"] .sidebar-brand-copy strong,
            body.chat-landing[data-mode="chat"] .sidebar-brand-copy .sidebar-brand-suffix {
                display: inline;
                overflow: visible;
                font-size: 16px;
                font-weight: 700;
                line-height: 1.2;
                white-space: nowrap;
            }

            body.chat-landing[data-mode="chat"] .sidebar-brand-copy strong {
                color: #0a70e5;
            }

            body.chat-landing[data-mode="chat"] .sidebar-brand-copy .sidebar-brand-suffix {
                color: #0d72f5;
                font-size: 13px;
                font-weight: 600;
            }

            body.chat-landing[data-mode="chat"] .sidebar-nav {
                gap: 4px;
            }

            body.chat-landing[data-mode="chat"] .sidebar-nav-btn {
                min-height: 30px;
                padding: 0 10px;
                border-radius: 8px;
                color: #182b4c;
                font-size: 12px;
                font-weight: 600;
            }

            body.chat-landing[data-mode="chat"] #sidebar-new-chat {
                width: calc(100% + 8px);
                margin-left: -4px;
                min-height: 54px;
                justify-content: center;
                border: 1px solid #126fff;
                color: #0b6ff0;
                background: #fff;
                font-size: 18px;
            }

            body.chat-landing[data-mode="chat"] #sidebar-new-chat .rail-icon {
                display: inline-flex;
                align-items: center;
                gap: 12px;
            }

            body.chat-landing[data-mode="chat"] #sidebar-new-chat .rail-icon::before {
                content: "+";
                display: inline-flex;
                align-items: center;
                justify-content: center;
                width: 24px;
                height: 24px;
                font-size: 30px;
                font-weight: 300;
                line-height: 1;
            }

            body.chat-landing[data-mode="chat"] #sidebar-new-chat .rail-glyph {
                display: none;
            }

            body.chat-landing[data-mode="chat"] .sidebar-nav-btn:not(#sidebar-new-chat) {
                justify-content: flex-start;
            }

            body.chat-landing[data-mode="chat"] .sidebar-nav-btn:not(#sidebar-new-chat):hover,
            body.chat-landing[data-mode="chat"] .sidebar-nav-btn:not(#sidebar-new-chat).active {
                background: #f4f8ff;
                border-color: transparent;
                box-shadow: none;
                color: #0b6ff0;
            }

            body.chat-landing[data-mode="chat"] .sidebar-nav-btn .rail-icon {
                color: currentColor;
            }

            body.chat-landing[data-mode="chat"] .sidebar-nav-btn .rail-glyph {
                width: 14px;
                height: 14px;
            }

            body.chat-landing[data-mode="chat"] .history-main {
                padding-top: 22px;
            }

            body.chat-landing[data-mode="chat"] .sidebar-section-label {
                padding: 14px 10px 8px;
                color: #7b8ba5;
                font-size: 14px;
                font-weight: 600;
            }

            body.chat-landing[data-mode="chat"] .conversation-list {
                gap: 2px;
            }

            body.chat-landing[data-mode="chat"] .conversation-item {
                min-height: 30px;
                padding: 4px 10px;
                border-radius: 8px;
            }

            body[data-mode="chat"] .conversation-item {
                min-height: 30px !important;
                padding: 4px 10px !important;
            }

            body.chat-landing[data-mode="chat"] .conversation-title,
            body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .conversation-title {
                color: #273447;
            }

            body.chat-landing[data-mode="chat"] .conversation-item-icon {
                color: #223b63;
            }

            body.chat-landing[data-mode="chat"] .conversation-time {
                color: #7d899e;
            }

            body.chat-landing[data-mode="chat"] .conversation-item:hover,
            body.chat-landing[data-mode="chat"] .conversation-item.active {
                background: #f6f9ff;
                border-color: transparent;
                box-shadow: none;
            }

            body.chat-landing[data-mode="chat"] .conversation-item::before {
                display: none;
            }

            body.chat-landing[data-mode="chat"] .history-account {
                padding: 18px 0 0;
                border-top: 1px solid #edf1f7;
            }

            body.chat-landing[data-mode="chat"] .workspace-account-card {
                min-height: 68px;
            }

            body.chat-landing[data-mode="chat"] .workspace-account-card .workspace-account-toggle {
                min-height: 66px;
                padding: 0;
                border-radius: 0;
                background: transparent;
                font-size: 15px;
            }

            body.chat-landing[data-mode="chat"] .workspace-chat-header {
                min-height: 84px;
                padding: 0 32px;
                border-bottom: 1px solid #edf1f7;
                background: #fff;
                backdrop-filter: none;
            }

            body.chat-landing[data-mode="chat"] .desktop-history-toggle {
                width: 28px;
                height: 28px;
                border: 0;
                border-radius: 0;
                background: transparent;
                color: #182b4c;
                padding: 0;
            }

            body.chat-landing[data-mode="chat"] .desktop-history-toggle svg {
                display: block;
                width: 24px;
                height: 24px;
                margin: 0;
            }

            body.chat-landing[data-mode="chat"] .workspace-chat-header-center strong {
                color: #122746;
                font-size: 14px;
                font-weight: 600;
                line-height: 1.2;
                letter-spacing: 0;
            }

            body.chat-landing[data-mode="chat"] .workspace-chat-header-center span {
                display: none;
            }

            body.chat-landing[data-mode="chat"] .workspace-chat-header-right {
                gap: 18px;
            }

            body.chat-landing[data-mode="chat"] .workspace-header-link,
            body.chat-landing[data-mode="chat"] .ui-language-switch-btn {
                color: #8a95a6;
                font-size: 15px;
            }

            body.chat-landing[data-mode="chat"] .ui-language-switch {
                gap: 0;
                padding: 0;
                border: 0;
                border-radius: 0;
                background: transparent;
                box-shadow: none;
            }

            body.chat-landing[data-mode="chat"] .ui-language-switch-btn {
                min-width: auto;
                min-height: 30px;
                padding: 0 8px;
                border-radius: 0;
                background: transparent;
                color: #71809a;
                box-shadow: none;
            }

            body.chat-landing[data-mode="chat"] .ui-language-switch-btn + .ui-language-switch-btn {
                border-left: 1px solid #d8e1ee;
            }

            body.chat-landing[data-mode="chat"] .ui-language-switch-btn.active {
                background: transparent;
                color: #111827 !important;
                box-shadow: none;
            }

            body.chat-landing[data-mode="chat"] .ui-language-switch-btn:not(.active) {
                color: #71809a !important;
            }

            body.chat-landing[data-mode="chat"] .workspace-header-link {
                color: #71809a;
            }

            body.chat-landing[data-mode="chat"] .workspace-header-login {
                min-width: 96px;
                min-height: 44px;
                padding: 0 22px;
                border-radius: 999px;
                background: #102746;
                color: #fff;
                font-size: 15px;
            }

            body.chat-landing[data-mode="chat"] .workspace {
                position: relative;
                background: #fff;
            }

            body.chat-landing[data-mode="chat"] .composer {
                --landing-composer-head-space: 68px;
                --landing-input-center-offset: calc(var(--landing-composer-head-space) + 62px);
                top: calc(50% - var(--landing-input-center-offset));
                bottom: auto;
                left: 50%;
                width: min(880px, calc(100% - 96px));
                height: auto;
                margin: 0;
                padding: 0 0 18px;
                transform: translateX(-50%);
            }

            body.chat-landing[data-mode="chat"] .composer-top {
                width: 100%;
                display: block;
                margin: 0 auto 20px;
                text-align: center;
            }

            body.chat-landing[data-mode="chat"] .composer-title {
                color: #122746;
                font-size: 22px;
                font-weight: 700;
                line-height: 1.35;
            }

            body.chat-landing[data-mode="chat"] .composer-desc {
                display: block;
                max-width: 680px;
                margin: 8px auto 0;
                color: #71809a;
                font-size: 11px;
                line-height: 1.55;
                white-space: pre-line;
            }

            body.chat-landing[data-mode="chat"] #core-feature-slot,
            body.chat-landing[data-mode="chat"] #chat-compose-field,
            body.chat-landing[data-mode="chat"] .composer-capability-bar {
                margin-right: auto;
                margin-left: auto;
            }

            body.chat-landing[data-mode="chat"] #core-feature-slot {
                width: 100%;
                min-width: 0;
                max-width: 100%;
            }

            body.chat-landing[data-mode="chat"] .chat-input-wrap {
                min-height: 124px;
                border: 1px solid #dbe5f3;
                border-radius: 17px;
                background: #fff;
                box-shadow: 0 8px 24px rgba(36, 71, 118, .05);
            }

            body.chat-landing[data-mode="chat"] .chat-input-wrap textarea {
                min-height: 122px;
                padding: 16px 108px 50px 20px;
                font-size: 14px;
            }

            body.chat-landing[data-mode="chat"] .chat-input-hint {
                top: 18px;
                left: 20px;
                right: 108px;
                color: #8c9ab0;
                font-size: 14px;
            }

            body.chat-landing[data-mode="chat"] .chat-input-tools {
                right: 14px;
                bottom: 12px;
                gap: 8px;
            }

            body.chat-landing[data-mode="chat"] .chat-tool-btn,
            body.chat-landing[data-mode="chat"] .send-btn {
                width: 38px;
                height: 38px;
                border-radius: 50%;
            }

            body.chat-landing[data-mode="chat"] .chat-tool-btn {
                border: 1px solid #dbe5f3;
                background: #fff;
                color: #1d365d;
            }

            body.chat-landing[data-mode="chat"] .send-btn {
                background: #0d72f5;
                box-shadow: 0 8px 18px rgba(13, 114, 245, .2);
            }

            body.chat-landing[data-mode="chat"] .chat-quick-actions,
            body.chat-landing[data-mode="chat"] .work-skill-bar,
            body.chat-landing[data-mode="chat"] .clarification-banner,
            body.chat-landing[data-mode="chat"] .mobile-chat-toolbar {
                display: none !important;
            }

            body.chat-landing[data-mode="chat"] .composer-capability-bar {
                display: flex;
                justify-content: center;
                width: 100%;
                gap: 5px;
                margin-top: 24px;
                overflow: hidden;
                flex-wrap: nowrap;
            }

            body.chat-landing[data-mode="chat"] .composer-capability-btn {
                width: 0;
                min-width: 0;
                min-height: 34px;
                padding: 0 7px;
                border: 1px solid #bccde7;
                border-radius: 8px;
                background: #fff;
                color: #193257;
                font-size: 11px;
                font-weight: 600;
                line-height: 1;
                gap: 4px;
                flex: 1 1 0;
                justify-content: center;
                white-space: nowrap;
                box-shadow: none;
            }

            body.chat-landing[data-mode="chat"] .composer-capability-btn .capability-icon,
            body.chat-landing[data-mode="chat"] .composer-capability-btn .capability-icon svg,
            body.chat-landing[data-mode="chat"] .composer-capability-btn .capability-icon .fuuvo-icon,
            body.chat-landing[data-mode="chat"] .composer-capability-btn .capability-icon .home-capability-icon {
                width: 17px;
                height: 17px;
            }

            @media (max-width: 1100px) {
                body.chat-landing[data-mode="chat"] .composer-capability-bar {
                    gap: 3px;
                }

                body.chat-landing[data-mode="chat"] .composer-capability-btn {
                    min-height: 32px;
                    padding: 0 3px;
                    font-size: 10px;
                    gap: 3px;
                }

                body.chat-landing[data-mode="chat"] .composer-capability-btn .capability-icon,
                body.chat-landing[data-mode="chat"] .composer-capability-btn .capability-icon svg,
                body.chat-landing[data-mode="chat"] .composer-capability-btn .capability-icon .fuuvo-icon,
                body.chat-landing[data-mode="chat"] .composer-capability-btn .capability-icon .home-capability-icon {
                    width: 14px;
                    height: 14px;
                }
            }

            body.chat-landing[data-mode="chat"] .composer-capability-btn:hover,
            body.chat-landing[data-mode="chat"] .composer-capability-btn.active {
                border-color: #0d72f5;
                background: #f3f8ff;
                color: #0d72f5;
                box-shadow: none;
            }

            body.chat-landing[data-mode="chat"] .composer-capability-btn .capability-icon {
                color: #0d72f5;
            }

            @media (max-width: 720px) {
                body.chat-landing[data-mode="chat"] .composer-capability-btn .capability-icon,
                body.chat-landing[data-mode="chat"] .composer-capability-btn .capability-icon svg,
                body.chat-landing[data-mode="chat"] .composer-capability-btn .capability-icon .fuuvo-icon,
                body.chat-landing[data-mode="chat"] .composer-capability-btn .capability-icon .home-capability-icon {
                    width: 24px;
                    height: 24px;
                }
            }

            body.chat-landing[data-mode="chat"] .workspace-disclaimer {
                position: static;
                margin-top: 26px;
                padding: 0;
                color: #93a0b4;
                font-size: 13px;
            }

            body.chat-landing[data-mode="chat"] .workspace-disclaimer a {
                color: #0d72f5;
            }
        }

        @media (max-width: 920px) {
            body.chat-landing[data-mode="chat"] .sidebar-brand-wordmark {
                display: none;
            }

            body.chat-landing[data-mode="chat"] .sidebar-brand-suffix {
                display: inline !important;
            }

            body.chat-landing[data-mode="chat"] .composer-desc {
                display: block;
                margin-top: 10px;
                color: #71809a;
                font-size: 13px;
                line-height: 1.7;
                white-space: pre-line;
            }
        }

        body.chat-landing[data-mode="chat"] .workspace-disclaimer:not(.landing-workspace-disclaimer) {
            display: none !important;
        }

        body[data-mode="chat"] .workspace > .fuuvo-ai-disclaimer {
            flex: 0 0 auto;
            position: relative;
            z-index: 15;
            margin-top: auto;
            padding: 8px 10px max(6px, env(safe-area-inset-bottom));
        }

        body.chat-landing[data-mode="chat"] .workspace > .fuuvo-ai-disclaimer {
            position: absolute;
            right: 18px;
            bottom: 0;
            left: 18px;
            width: auto;
            margin: 0;
        }

        @media (max-width: 920px) {
            body.chat-landing[data-mode="chat"] .workspace > .fuuvo-ai-disclaimer {
                right: 8px;
                left: 8px;
                font-size: 9px;
            }
        }

        body.chat-landing[data-mode="chat"] .landing-workspace-disclaimer {
            position: static !important;
            right: auto;
            bottom: auto;
            left: auto;
            display: flex !important;
            align-items: center;
            justify-content: center;
            flex-wrap: wrap;
            gap: 8px;
            margin: 10px 0 0;
            padding: 0;
            color: #93a0b4;
            font-size: 11px;
            line-height: 1.5;
            text-align: center;
        }

        body.chat-landing[data-mode="chat"] .landing-workspace-disclaimer a {
            color: #0d72f5;
            white-space: nowrap;
        }

        @media (max-width: 920px) {
            body.chat-landing[data-mode="chat"] .landing-workspace-disclaimer {
                gap: 6px;
                margin-top: 8px;
                padding: 0 12px;
                font-size: 9px;
                line-height: 1.3;
                white-space: normal;
            }

            body.chat-landing[data-mode="chat"] .landing-workspace-disclaimer > span {
                overflow: visible;
                text-overflow: clip;
                white-space: normal;
            }
        }

        /* Keep the opened conversation aligned with the sidebar's selected state. */
        body[data-mode="chat"] .conversation-item.active {
            background: #e8f1ff !important;
            border-color: transparent !important;
            box-shadow: none !important;
        }

        body[data-mode="chat"] .conversation-item.active .conversation-title,
        body[data-mode="chat"] .conversation-item.active .conversation-item-icon {
            color: #0b6ff0 !important;
        }

        body[data-mode="chat"] .conversation-item.active .conversation-time {
            color: #6d84a6 !important;
        }

        @media (min-width: 921px) {
            body[data-mode="chat"] .history.is-conversation-view .conversation-list {
                gap: 0 !important;
                padding-bottom: 4px !important;
            }

            body[data-mode="chat"] .history.is-conversation-view .conversation-item {
                min-height: 24px !important;
                padding: 1px 6px 1px 10px !important;
                border-radius: 7px !important;
                margin: 0 !important;
                line-height: 1.35 !important;
            }

            body[data-mode="chat"] .history.is-conversation-view .conversation-head {
                display: grid !important;
                grid-template-columns: 16px minmax(0, 1fr) auto auto !important;
                align-items: center !important;
                gap: 6px !important;
            }

            body[data-mode="chat"] .history.is-conversation-view .conversation-item-icon,
            body[data-mode="chat"] .history.is-conversation-view .conversation-item-icon svg {
                width: 16px !important;
                height: 16px !important;
                flex-basis: 16px !important;
            }

            body[data-mode="chat"] .history.is-conversation-view .conversation-title {
                font-size: 12px !important;
                line-height: 1.35 !important;
            }

            body[data-mode="chat"] .history.is-conversation-view .conversation-time {
                min-width: 38px !important;
                font-size: 11px !important;
                line-height: 1.35 !important;
            }
        }

        body[data-ui-theme="dark"][data-mode="chat"] .conversation-item.active {
            background: rgba(37, 99, 255, 0.2) !important;
            border-color: rgba(96, 165, 250, 0.16) !important;
        }

        body[data-ui-theme="dark"][data-mode="chat"] .conversation-item.active .conversation-title,
        body[data-ui-theme="dark"][data-mode="chat"] .conversation-item.active .conversation-item-icon {
            color: #8fc1ff !important;
        }

        .work-task-back {
            width: 34px;
            height: 34px;
            justify-self: end;
            min-height: 34px;
            padding: 0;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border: 1px solid #dbe4ef;
            border-radius: 50%;
            background: #fff;
            color: #52657f;
            cursor: pointer;
            transition: color .18s ease, border-color .18s ease, background .18s ease;
        }

        .work-task-back:hover { border-color: #9fc4fa; background: #f3f8ff; color: #0b6ff0; }
        .work-task-back svg { width: 18px; height: 18px; flex: 0 0 18px; }
        body[data-ui-theme="dark"] .work-task-back { border-color: rgba(148, 163, 184, .22); background: rgba(15, 23, 42, .72); color: #a8b8cf; }
        body[data-ui-theme="dark"] .work-task-back:hover { border-color: rgba(96, 165, 250, .42); background: rgba(37, 99, 255, .14); color: #8fc1ff; }

        body[data-mode="chat"][data-chat-entry-mode="work"] .empty-state {
            align-items: flex-start;
            justify-content: flex-start;
            overflow-y: auto;
            padding-top: 24px;
            padding-bottom: 28px;
        }

        body[data-mode="chat"][data-chat-entry-mode="work"] .chat-empty {
            min-height: 0;
            align-content: start;
            padding-bottom: 8px;
        }

        @media (max-width: 920px) {
            .work-task-back { width: 30px; height: 30px; min-height: 30px; }
        }

        /* Files add a preview row above the prompt. Keep the upload and send
         * controls in their own row so the + button never covers editable text. */
        @media (min-width: 921px) {
            body[data-mode="chat"] .chat-input-wrap.has-attachments {
                padding-bottom: 0;
            }

            body[data-mode="chat"] .chat-input-wrap.has-attachments textarea {
                padding: 14px 18px 10px;
            }

            body[data-mode="chat"] .chat-input-wrap.has-attachments .chat-input-tools {
                position: relative;
                left: auto;
                right: auto;
                bottom: auto;
                min-height: 44px;
                padding: 0 12px 8px;
            }
        }

        body .landing-workspace-disclaimer { display: none !important; }

        @media (max-width: 720px) {
            body[data-mode="chat"] .core-feature-actions {
                gap: 5px;
                margin-top: 0;
            }

            body[data-mode="chat"] .core-feature-btn {
                min-height: 34px;
                padding: 3px 6px;
                gap: 4px;
                border-radius: 8px;
                font-size: 10.5px;
                line-height: 1.1;
            }

            body[data-mode="chat"] .core-feature-btn-icon,
            body[data-mode="chat"] .core-feature-btn-icon svg,
            body[data-mode="chat"] .core-feature-btn-icon .home-core-feature-icon,
            body[data-mode="chat"] .core-feature-btn-icon .fuuvo-icon {
                width: 17px;
                height: 17px;
                flex-basis: 17px;
            }
        }

        @media (max-width: 920px) {
            body[data-mode="chat"] .send-btn {
                width: 34px;
                height: 34px;
                min-width: 34px;
                min-height: 34px;
                flex: 0 0 34px;
            }
        }

        @media (max-width: 920px) {
            body.chat-landing[data-mode="chat"] .composer-title {
                font-size: 15px !important;
                line-height: 1.28;
            }

            body.chat-landing[data-mode="chat"] .composer-title.has-wenzhi-slogan {
                gap: 5px;
            }

            body.chat-landing[data-mode="chat"] .composer-title-logo {
                max-height: 20px;
                width: auto;
            }

            body.chat-landing[data-mode="chat"] #mobile-new-chat-trigger {
                display: none !important;
            }

            body[data-ui-theme="dark"].chat-landing[data-mode="chat"],
            body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .app,
            body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .workspace,
            body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .stage,
            body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .result-card {
                background: linear-gradient(180deg, #080f1c 0%, #0d1728 100%) !important;
                color: #edf2ff;
            }

            body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .mobile-chat-topbar {
                background: linear-gradient(180deg, rgba(8, 15, 28, 0.98) 0%, rgba(8, 15, 28, 0.9) 100%) !important;
                border-bottom-color: rgba(148, 163, 184, 0.12);
            }

            body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .mobile-nav-pill,
            body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .ui-language-switch {
                background: transparent;
                border-color: rgba(148, 163, 184, 0.16);
                color: #dbe7ff;
            }

            body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .mobile-nav-trigger,
            body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .mobile-chat-link,
            body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .ui-language-switch-btn {
                color: #dbe7ff;
            }

            body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .ui-language-switch-btn.active,
            body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .ui-language-switch-btn:hover {
                color: #ffffff;
            }

            body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .ui-language-switch-btn + .ui-language-switch-btn {
                border-left-color: rgba(148, 163, 184, 0.2);
            }

            body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .composer {
                background: transparent !important;
                box-shadow: none !important;
            }

            body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .composer-title,
            body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .composer-title.has-wenzhi-slogan span,
            body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .mobile-home-scenes-title {
                color: #edf2ff !important;
            }

            body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .chat-input-wrap {
                background: rgba(16, 24, 39, 0.98) !important;
                border-color: rgba(148, 163, 184, 0.24) !important;
                box-shadow: 0 18px 42px rgba(2, 6, 23, 0.38) !important;
            }

            body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .chat-input-wrap textarea {
                color: #edf2ff !important;
                caret-color: #7db5ff;
                -webkit-text-fill-color: #edf2ff !important;
            }

            body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .chat-input-wrap textarea::placeholder,
            body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .chat-input-hint {
                color: #a8b7cf !important;
                -webkit-text-fill-color: #a8b7cf !important;
            }

            body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .chat-tool-btn,
            body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .chat-voice-btn,
            body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .mobile-chat-toolbar-btn {
                background: rgba(15, 23, 42, 0.92) !important;
                border: 1px solid rgba(148, 163, 184, 0.22) !important;
                color: #edf2ff !important;
                box-shadow: none !important;
            }

            body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .chat-tool-btn:hover,
            body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .chat-voice-btn:hover,
            body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .mobile-chat-toolbar-btn:hover {
                background: rgba(30, 41, 59, 0.96) !important;
                color: #ffffff !important;
            }

            body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .send-btn.has-text {
                background: #0d72f5 !important;
                color: #ffffff !important;
            }

            body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .mobile-chat-more-menu,
            body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .chat-upload-popover {
                background: rgba(12, 20, 34, 0.98) !important;
                border-color: rgba(148, 163, 184, 0.22) !important;
                box-shadow: 0 22px 48px rgba(2, 6, 23, 0.46) !important;
            }

            body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .mobile-chat-more-item,
            body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .chat-upload-option,
            body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .chat-upload-option-copy strong {
                color: #edf2ff !important;
            }

            body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .chat-upload-option-copy span,
            body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .chat-upload-popover-head span {
                color: #a8b7cf !important;
            }

            body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .core-feature-btn {
                background: rgba(15, 23, 42, 0.88) !important;
                border-color: rgba(148, 163, 184, 0.2) !important;
                color: #edf2ff !important;
            }

            body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .core-feature-btn:hover,
            body[data-ui-theme="dark"].chat-landing[data-mode="chat"] .core-feature-btn:focus-visible {
                background: rgba(30, 41, 59, 0.98) !important;
                border-color: rgba(96, 165, 250, 0.34) !important;
                color: #ffffff !important;
            }
        }
