﻿:root {
    --primary-red: #E53935;
    --primary-red-hover: #C62828;
    --primary-red-light: #EF5350;
    --accent-blue: #3B82F6;
    --accent-purple: #7C3AED;
    --accent-teal: #0D9488;
    --dark-bg: #0A0B0F;
    --darker-bg: #06070A;
    --sidebar-bg: #0E0F14;
    --sidebar-border: rgba(255,255,255,0.055);
    --chat-bg: #0A0B0F;
    --surface-dark: rgba(255,255,255,0.038);
    --surface-lighter: rgba(255,255,255,0.072);
    --text-primary: #EAEAF2;
    --text-secondary: #8888A0;
    --text-muted: #4A4A5C;
    --border-dark: rgba(255,255,255,0.058);
    --border-bright: rgba(255,255,255,0.10);
    --success: #10B981;
    --warning: #F59E0B;
    --main-bg: #0A0B0F;
    --sidebar-width: 260px;
    --glass-blur: 20px;
    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --transition: 0.22s cubic-bezier(0.4,0,0.2,1);
    --input-bg: rgba(255,255,255,0.055);
    --hover-bg: rgba(255,255,255,0.07);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', 'Cairo', sans-serif;
    background: var(--darker-bg);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 20% -10%, rgba(220,38,38,0.06) 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 80% 110%, rgba(139,92,246,0.05) 0%, transparent 60%),
        radial-gradient(ellipse 100% 80% at 50% 50%, rgba(8,8,10,0.98) 0%, transparent 100%);
    pointer-events: none;
    z-index: 0;
}

.bg-particles {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.particle {
    position: absolute;
    width: 1.5px;
    height: 1.5px;
    background: var(--primary-red);
    border-radius: 50%;
    opacity: 0;
    animation: float 8s infinite linear;
}

@keyframes float {
    0% { transform: translateY(100vh) rotate(0deg); opacity: 0; }
    8% { opacity: 0.25; }
    92% { opacity: 0.15; }
    100% { transform: translateY(-10vh) rotate(360deg); opacity: 0; }
}

.chatgpt-app-container {
    display: flex;
    height: 100dvh;
    width: 100%;
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 10;
}

.chatgpt-sidebar {
    width: var(--sidebar-width);
    min-width: 60px;
    max-width: 480px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    transition: width var(--transition), min-width var(--transition);
    z-index: 100;
    position: relative;
    overflow: visible;
    box-shadow: 2px 0 24px rgba(28, 202, 236, 0.35);
}

.chatgpt-sidebar.closed {
    width: 0 !important;
    min-width: 0;
    overflow: hidden;
    border: none;
}

.chatgpt-sidebar.mini {
    width: 60px !important;
    min-width: 60px;
    overflow: hidden;
}

.sidebar-resize-handle {
    position: absolute;
    top: 0;
    right: -4px;
    width: 8px;
    height: 100%;
    cursor: col-resize;
    z-index: 200;
    background: transparent;
    transition: background 0.2s;
}

.sidebar-resize-handle:hover,
.sidebar-resize-handle.dragging {
    background: rgba(220,38,38,0.25);
}

.sidebar-resize-handle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 40px;
    background: rgba(220,38,38,0.4);
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.2s;
}

.sidebar-resize-handle:hover::after,
.sidebar-resize-handle.dragging::after {
    opacity: 1;
}

.chatgpt-sidebar-header {
    padding: 14px 12px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.chatgpt-new-chat-btn {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13.5px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all var(--transition);
    white-space: nowrap;
    overflow: hidden;
}

.chatgpt-new-chat-btn:hover {
    background: rgba(220,38,38,0.1);
    border-color: rgba(220,38,38,0.35);
    box-shadow: 0 0 16px rgba(220,38,38,0.08);
}

.chatgpt-new-chat-btn i {
    font-size: 14px;
    flex-shrink: 0;
    color: var(--primary-red);
}

.chatgpt-sidebar.mini .chatgpt-new-chat-btn span { display: none; }
.chatgpt-sidebar.mini .chatgpt-new-chat-btn { padding: 10px; justify-content: center; }

.chatgpt-sidebar-close-btn {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-dark);
    color: var(--text-secondary);
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    font-size: 14px;
}

.chatgpt-sidebar-close-btn:hover {
    background: rgba(220,38,38,0.1);
    border-color: rgba(220,38,38,0.35);
    color: var(--primary-red);
}

@media (min-width: 769px) {
    .chatgpt-sidebar-close-btn { display: flex; }
}

.chatgpt-sidebar-nav {
    padding: 6px 10px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex-shrink: 0;
}

.chatgpt-nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 500;
    transition: all var(--transition);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    border: 1px solid transparent;
}

.chatgpt-nav-item:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-primary);
    border-color: var(--border-dark);
}

.chatgpt-nav-item i {
    font-size: 15px;
    width: 18px;
    flex-shrink: 0;
    color: var(--primary-red);
}

.chatgpt-nav-item.nav-osint {
    border-color: rgba(14,165,233,0.2);
    background: rgba(14,165,233,0.05);
    color: #7dd3fc;
}
.chatgpt-nav-item.nav-osint i { color: #38bdf8; }
.chatgpt-nav-item.nav-osint:hover { background: rgba(14,165,233,0.1); border-color: rgba(14,165,233,0.4); }

.chatgpt-nav-item.nav-worm {
    border-color: rgba(0,255,65,0.15);
    background: rgba(0,255,65,0.04);
    color: #86efac;
}
.chatgpt-nav-item.nav-worm i { color: #4ade80; }
.chatgpt-nav-item.nav-worm span:not(.chatgpt-badge) { color: #86efac; }
.chatgpt-nav-item.nav-worm:hover { background: rgba(0,255,65,0.08); border-color: rgba(0,255,65,0.3); }

.chatgpt-sidebar.mini .chatgpt-nav-item span:not(.chatgpt-badge) { display: none; }
.chatgpt-sidebar.mini .chatgpt-badge { display: none; }
.chatgpt-sidebar.mini .chatgpt-nav-item { padding: 10px; justify-content: center; gap: 0; }
.chatgpt-sidebar.mini .chatgpt-nav-item i { width: auto; }

.chatgpt-badge {
    margin-left: auto;
    padding: 2px 7px;
    font-size: 9.5px;
    font-weight: 700;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.chatgpt-badge.badge-free { background: rgba(14,165,233,0.2); color: #38bdf8; border: 1px solid rgba(14,165,233,0.3); }
.chatgpt-badge.badge-pro { background: rgba(0,255,65,0.12); color: #4ade80; border: 1px solid rgba(0,255,65,0.25); }

.chatgpt-sidebar-divider {
    height: 1px;
    background: var(--border-dark);
    margin: 8px 10px;
    flex-shrink: 0;
}

.chatgpt-sidebar.mini .chatgpt-sidebar-divider { margin: 8px 8px; }

.chatgpt-sidebar-chats {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 8px;
    min-height: 0;
}

.chatgpt-sidebar.mini .chatgpt-sidebar-chats { display: none; }

.chats-list-container {
    padding: 2px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.08) transparent;
}

.chats-list-container::-webkit-scrollbar { width: 4px; }
.chats-list-container::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.08);
    border-radius: 4px;
}
.chats-list-container::-webkit-scrollbar-track { background: transparent; }

.chats-group { margin-bottom: 14px; }

.chats-group-title {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    padding: 6px 10px;
    margin-bottom: 2px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.chatgpt-chat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 400;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    overflow: hidden;
    border: 1px solid transparent;
}

.chatgpt-chat-item:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-primary);
    border-color: var(--border-dark);
}

.chatgpt-chat-item.active {
    background: rgba(220,38,38,0.08);
    color: var(--text-primary);
    border-color: rgba(220,38,38,0.2);
}

.chatgpt-chat-item i {
    font-size: 13px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.chatgpt-chat-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.chatgpt-sidebar-footer {
    padding: 10px;
    border-top: 1px solid var(--border-dark);
    position: relative;
    flex-shrink: 0;
}

.chatgpt-user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    border: 1px solid transparent;
    overflow: hidden;
}

.chatgpt-user-profile:hover {
    background: rgba(255,255,255,0.05);
    border-color: var(--border-dark);
}

.chatgpt-sidebar.mini .chatgpt-user-profile { justify-content: center; gap: 0; }
.chatgpt-sidebar.mini .chatgpt-user-info { display: none; }
.chatgpt-sidebar.mini .chatgpt-user-menu-icon { display: none; }

.chatgpt-user-avatar {
    width: 30px;
    height: 30px;
    min-width: 30px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent-purple), var(--primary-red));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 13px;
    box-shadow: 0 2px 8px rgba(220,38,38,0.25);
}

.chatgpt-user-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
    overflow: hidden;
    min-width: 0;
}

.chatgpt-user-name {
    color: var(--text-primary);
    font-size: 13.5px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chatgpt-user-plan {
    color: var(--text-muted);
    font-size: 11.5px;
}

.chatgpt-user-menu-icon {
    color: var(--text-muted);
    font-size: 14px;
    flex-shrink: 0;
}

.dropdown-menu {
    position: absolute;
    bottom: 68px;
    left: 10px;
    right: 10px;
    background: rgba(16,16,22,0.97);
    border: 1px solid var(--border-bright);
    border-radius: var(--radius-md);
    padding: 6px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.9), 0 0 0 1px rgba(255,255,255,0.04);
    display: none;
    z-index: 99999;
    flex-direction: column;
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
}

.dropdown-menu.show {
    display: flex;
    animation: slideUpFade 0.2s cubic-bezier(0.16,1,0.3,1);
}

@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(8px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13.5px;
    border-radius: 9px;
    transition: all var(--transition);
    cursor: pointer;
    border: 1px solid transparent;
}

.dropdown-item:hover {
    background: rgba(255,255,255,0.06);
    color: var(--text-primary);
    border-color: var(--border-dark);
}

.dropdown-item i {
    width: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.dropdown-item:hover i { color: var(--primary-red); }

.dropdown-item.logout-item { color: rgba(248,113,113,0.8); }
.dropdown-item.logout-item i { color: rgba(248,113,113,0.7); }
.dropdown-item.logout-item:hover {
    background: rgba(239,68,68,0.08);
    color: #f87171;
    border-color: rgba(239,68,68,0.15);
}
.dropdown-item.logout-item:hover i { color: #f87171; }

.dropdown-divider {
    height: 1px;
    background: var(--border-dark);
    margin: 4px;
}

.chatgpt-main {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--dark-bg);
    position: relative;
    overflow: hidden;
    min-width: 0;
}

.chatgpt-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: rgba(8,8,10,0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-dark);
    height: 54px;
    position: relative;
    z-index: 200;
    gap: 8px;
    flex-shrink: 0;
}

.chatgpt-menu-btn {
    width: 38px;
    height: 38px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    border-radius: 9px;
    transition: all var(--transition);
    display: none;
    align-items: center;
    justify-content: center;
}

.chatgpt-menu-btn:hover {
    background: rgba(255,255,255,0.06);
    color: var(--text-primary);
}

/* ═══════════════════════════════════════════════════════════
   TOPBAR / PREMIUM HEADER
   ═══════════════════════════════════════════════════════════ */

.chatgpt-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 54px;
    padding: 0 12px 0 14px;
    background: rgba(10,11,15,0.88);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border-bottom: 1px solid var(--sidebar-border);
    position: relative;
    z-index: 200;
    flex-shrink: 0;
    gap: 8px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}

.topbar-logo {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(220,38,38,0.22);
}

.topbar-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
    display: block;
}

.topbar-logo-fallback {
    color: white;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.topbar-brand-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.4px;
}

.topbar-brand-badge {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 5px;
    background: rgba(229,57,53,0.14);
    color: var(--primary-red-light);
    border: 1px solid rgba(229,57,53,0.22);
    line-height: 1.4;
}

.topbar-icon-btn {
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    flex-shrink: 0;
}

.topbar-icon-btn:hover {
    background: rgba(255,255,255,0.07);
    color: var(--text-primary);
}

.topbar-upgrade-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: rgba(220,38,38,0.1);
    border: 1px solid rgba(220,38,38,0.25);
    border-radius: 20px;
    color: #fca5a5;
    font-size: 12.5px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition);
}

.topbar-upgrade-btn:hover {
    background: rgba(220,38,38,0.18);
    border-color: rgba(220,38,38,0.45);
    color: #fecaca;
    box-shadow: 0 0 16px rgba(220,38,38,0.12);
}

.topbar-upgrade-btn i { color: #fbbf24; }

@media (max-width: 520px) {
    .topbar-upgrade-btn span { display: none; }
    .topbar-upgrade-btn { padding: 7px 9px; border-radius: 9px; gap: 0; }
    .topbar-brand-badge { display: none; }
}

@media (max-width: 380px) {
    .topbar-brand-name { display: none; }
}

.chatgpt-desktop-toggle {
    position: absolute;
    top: 12px;
    left: 14px;
    z-index: 250;
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-dark);
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    border-radius: 9px;
    transition: all var(--transition);
    display: none;
    align-items: center;
    justify-content: center;
}

.chatgpt-desktop-toggle:hover {
    background: rgba(220,38,38,0.1);
    border-color: rgba(220,38,38,0.35);
    color: var(--primary-red);
}

.chatgpt-app-container:has(.chatgpt-sidebar.closed) .chatgpt-desktop-toggle {
    display: flex;
}

@media (max-width: 768px) {
    .chatgpt-desktop-toggle { display: none !important; }
}

.chatgpt-header-title {
    flex: 1;
    text-align: center;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.2px;
}

.chatgpt-header-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.chatgpt-upgrade-btn {
    padding: 7px 14px;
    background: rgba(220,38,38,0.1);
    border: 1px solid rgba(220,38,38,0.25);
    border-radius: 20px;
    color: #fca5a5;
    font-size: 12.5px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition);
    white-space: nowrap;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
}

.chatgpt-upgrade-btn:hover {
    background: rgba(220,38,38,0.18);
    border-color: rgba(220,38,38,0.45);
    color: #fecaca;
    box-shadow: 0 0 16px rgba(220,38,38,0.12);
}

.chatgpt-upgrade-btn i { color: #fbbf24; }

.chatgpt-icon-btn {
    width: 34px;
    height: 34px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 15px;
    cursor: pointer;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.chatgpt-icon-btn:hover {
    background: rgba(255,255,255,0.06);
    color: var(--text-primary);
}

.chatgpt-chat-area {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 28px 24px;
    padding-bottom: 170px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.06) transparent;
    background: var(--dark-bg);
}

.chatgpt-chat-area::-webkit-scrollbar { width: 4px; }
.chatgpt-chat-area::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.07); border-radius: 4px; }
.chatgpt-chat-area::-webkit-scrollbar-track { background: transparent; }

.scroll-to-bottom-btn {
    position: absolute;
    bottom: 150px;
    left: 50%;
    transform: translateX(-50%) translateY(14px) scale(0.85);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid var(--border-dark);
    background: var(--surface-dark);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    cursor: pointer;
    z-index: 60;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    box-shadow: 0 6px 18px rgba(0,0,0,0.45);
    transition: opacity .28s ease, transform .28s cubic-bezier(0.34, 1.56, 0.64, 1), visibility .28s, background .2s ease;
}

.scroll-to-bottom-btn.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0) scale(1);
}

.scroll-to-bottom-btn:hover {
    background: var(--primary-red);
    border-color: var(--primary-red);
    transform: translateX(-50%) translateY(-3px) scale(1.06);
}

.scroll-to-bottom-btn:active {
    transform: translateX(-50%) translateY(-1px) scale(0.97);
}

.chatgpt-welcome {
    max-width: 760px;
    margin: 0 auto;
    padding-top: 80px;
    text-align: center;
}

.chatgpt-logo {
    width: 76px;
    height: 76px;
    margin: 0 auto 28px;
    position: relative;
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
    box-shadow: 0 8px 32px rgba(220,38,38,0.2), 0 2px 8px rgba(0,0,0,0.4);
}

.chatgpt-logo .logo-glow {
    position: absolute;
    inset: -12px;
    border-radius: 30px;
    background: radial-gradient(circle, rgba(220,38,38,0.2), rgba(139,92,246,0.12), transparent 70%);
    filter: blur(16px);
    opacity: 0.25;
    animation: logoGlow 4s ease-in-out infinite;
    z-index: -1;
}

@keyframes logoGlow {
    0%, 100% { opacity: 0.25; transform: scale(1); }
    50% { opacity: 0.45; transform: scale(1.04); }
}

.chatgpt-logo .logo-mark {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
    overflow: hidden;
}

.chatgpt-logo .logo-mark img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
    display: block;
}

.chatgpt-welcome-title {
    color: var(--text-primary);
    font-size: 26px;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.5px;
}

/* ═══════════════════════════════════════════════════════════
   MESSAGES & CHAT BUBBLES
   ═══════════════════════════════════════════════════════════ */

.message {
    max-width: 820px;
    margin: 0 auto 2px;
    display: flex;
    gap: 12px;
    padding: 6px 24px;
    animation: msgSlideUp 0.28s cubic-bezier(0.16,1,0.3,1) both;
    position: relative;
}

.message:last-child { margin-bottom: 0; }

@keyframes msgSlideUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.message.user {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

.message .avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 13px;
    flex-shrink: 0;
    align-self: flex-end;
    margin-bottom: 2px;
}

.message.user .avatar {
    background: linear-gradient(135deg, #7c3aed 0%, var(--primary-red) 100%);
    box-shadow: 0 2px 8px rgba(229,57,53,0.25);
}

.message-content {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.message.user .message-content {
    align-items: flex-end;
    max-width: 70%;
}

.message.bot .message-content {
    width: 100%;
    max-width: 100%;
}

.message-bubble {
    font-size: 15px;
    line-height: 1.75;
    color: var(--text-primary);
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    min-width: 0;
    max-width: 100%;
}

.message.user .message-bubble {
    background: rgba(229,57,53,0.10);
    border: 1px solid rgba(229,57,53,0.18);
    border-radius: 18px 18px 5px 18px;
    padding: 12px 16px;
    white-space: pre-wrap;
    color: var(--text-primary);
    display: inline-block;
    max-width: 100%;
}

html[dir="rtl"] .message.user .message-bubble {
    border-radius: 18px 18px 18px 5px;
}

.message.bot .message-bubble {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.055);
    border-radius: 12px;
    padding: 14px 18px;
    white-space: normal;
}

.message.thinking .message-bubble {
    padding: 10px 4px;
    background: transparent;
}

.typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.typing-dots span {
    display: block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typingBounce 1.2s ease-in-out infinite;
}

.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.16s; }
.typing-dots span:nth-child(3) { animation-delay: 0.32s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.35; }
    30% { transform: translateY(-6px); opacity: 1; }
}

.message.streaming .message-bubble:not(:empty)::after {
    content: '▋';
    display: inline;
    margin-left: 1px;
    color: var(--primary-red);
    animation: streamCursor 0.8s steps(1) infinite;
}

@keyframes streamCursor {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* ─── Bot message Markdown typography ─── */
.message.bot .message-bubble p { margin: 0 0 10px; line-height: 1.75; }
.message.bot .message-bubble p:last-child { margin-bottom: 0; }
.message.bot .message-bubble > *:first-child { margin-top: 0 !important; }
.message.bot .message-bubble > *:last-child { margin-bottom: 0 !important; }

.message.bot .message-bubble h1 {
    font-size: 1.45em; font-weight: 700; margin: 20px 0 10px;
    line-height: 1.25; border-bottom: 1px solid rgba(255,255,255,0.08);
    padding-bottom: 8px; color: var(--text-primary);
}
.message.bot .message-bubble h2 { font-size: 1.25em; font-weight: 700; margin: 16px 0 8px; color: var(--text-primary); }
.message.bot .message-bubble h3 { font-size: 1.08em; font-weight: 600; margin: 13px 0 5px; color: var(--text-primary); }
.message.bot .message-bubble h4,
.message.bot .message-bubble h5,
.message.bot .message-bubble h6 { font-size: 1em; font-weight: 600; margin: 10px 0 4px; color: var(--text-primary); }

.message.bot .message-bubble ul,
.message.bot .message-bubble ol { margin: 6px 0 10px; padding-left: 24px; }
html[dir="rtl"] .message.bot .message-bubble ul,
html[dir="rtl"] .message.bot .message-bubble ol { padding-left: 0; padding-right: 24px; }
.message.bot .message-bubble li { margin: 4px 0; line-height: 1.68; }
.message.bot .message-bubble li::marker { color: var(--primary-red); }
.message.bot .message-bubble ul li::marker { content: '▸ '; }

.message.bot .message-bubble strong { font-weight: 700; color: var(--text-primary); }
.message.bot .message-bubble em { color: rgba(234,234,242,0.75); font-style: italic; }
.message.bot .message-bubble del { text-decoration: line-through; opacity: 0.6; }

.message.bot .message-bubble a {
    color: #f87171;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: rgba(248,113,113,0.35);
    transition: color 0.15s, text-decoration-color 0.15s;
}
.message.bot .message-bubble a:hover { color: #fca5a5; text-decoration-color: currentColor; }

.message.bot .message-bubble code {
    font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, Consolas, monospace;
    font-size: 0.86em;
    background: rgba(255,255,255,0.07);
    padding: 2px 6px;
    border-radius: 5px;
    border: 1px solid rgba(255,255,255,0.09);
    color: #c4b5fd;
    word-break: break-all;
}

.message.bot .message-bubble blockquote {
    margin: 10px 0;
    padding: 10px 16px;
    border-left: 3px solid var(--primary-red);
    background: rgba(229,57,53,0.04);
    border-radius: 0 8px 8px 0;
    color: var(--text-secondary);
}

html[dir="rtl"] .message.bot .message-bubble blockquote {
    border-left: none;
    border-right: 3px solid var(--primary-red);
    border-radius: 8px 0 0 8px;
    text-align: right;
}

.message.bot .message-bubble hr {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.07);
    margin: 16px 0;
}

.message.bot .message-bubble table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 14px; overflow: hidden; border-radius: 8px; }
.message.bot .message-bubble th,
.message.bot .message-bubble td { padding: 9px 13px; border: 1px solid rgba(255,255,255,0.07); text-align: start; }
.message.bot .message-bubble th { background: rgba(255,255,255,0.06); font-weight: 600; color: var(--text-primary); }
.message.bot .message-bubble tr:hover td { background: rgba(255,255,255,0.025); }

.message.bot .message-bubble img { max-width: 100%; border-radius: 10px; margin: 8px 0; display: block; }

/* Inline attachments */
.inline-attachment-image { margin: 8px 0; }
.inline-attachment-image img { max-width: min(100%, 480px); max-height: 320px; border-radius: 12px; cursor: pointer; object-fit: cover; transition: opacity 0.2s, transform 0.2s; display: block; }
.inline-attachment-image img:hover { opacity: 0.92; transform: scale(1.01); }
.inline-attachment-file { display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.09); border-radius: 8px; color: var(--text-secondary); font-size: 13px; text-decoration: none; transition: all 0.18s; margin: 4px 0; }
.inline-attachment-file:hover { background: rgba(255,255,255,0.09); color: var(--text-primary); }

/* ─── User message action buttons ─── */
.msg-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.18s ease;
    padding-top: 3px;
    justify-content: flex-end;
}

.message:hover .msg-actions,
.message:focus-within .msg-actions { opacity: 1; }

.msg-action-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    width: 26px;
    height: 26px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.msg-action-btn:hover {
    background: rgba(255,255,255,0.07);
    color: var(--text-primary);
    border-color: rgba(255,255,255,0.1);
}

.msg-action-btn.copied { color: #4ade80; }

/* ─── Bot message toolbar ─── */
.msg-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-top: 6px;
    opacity: 0;
    transition: opacity 0.18s ease;
    padding: 0 2px;
}

.message.bot:hover .msg-toolbar,
.message.bot:focus-within .msg-toolbar { opacity: 1; }

.msg-tool-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    width: 28px;
    height: 28px;
    border-radius: 7px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.15s ease;
    flex-shrink: 0;
    position: relative;
}

.msg-tool-btn:hover {
    background: rgba(255,255,255,0.07);
    color: var(--text-secondary);
}

.msg-tool-btn.copied { color: #4ade80; }

.msg-tool-btn.tts-playing {
    color: var(--primary-red);
    background: rgba(229,57,53,0.12);
    border-radius: 8px;
    overflow: visible;
}

.msg-tool-btn.tts-playing i {
    animation: ttsIconPulse 0.75s ease-in-out infinite alternate;
    filter: drop-shadow(0 0 4px rgba(220,38,38,0.6));
}

@keyframes ttsIconPulse {
    0%   { transform: scale(0.9);  opacity: 0.75; }
    100% { transform: scale(1.15); opacity: 1;    }
}

.msg-tool-btn.tts-playing::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 10px;
    border: 1.5px solid rgba(220,38,38,0.35);
    animation: ttsRing 1.2s ease-out infinite;
    pointer-events: none;
}

@keyframes ttsRing {
    0%   { opacity: 0.8; transform: scale(0.88); }
    60%  { opacity: 0;   transform: scale(1.35); }
    100% { opacity: 0;   transform: scale(1.35); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.msg-tool-btn.like-btn.active { color: #3B82F6; }
.msg-tool-btn.dislike-btn.active { color: #EF4444; }
.msg-tool-btn.regen-btn:hover { color: var(--primary-red); }
.msg-tool-btn.regen-btn:hover i { animation: regenSpin 0.5s linear; }
@keyframes regenSpin { to { transform: rotate(360deg); } }

/* Sidebar chat rename/delete */
.chatgpt-chat-item {
    display: flex !important;
    align-items: center;
    gap: 0;
    cursor: pointer;
    position: relative;
}

.chat-item-label {
    display: flex;
    align-items: center;
    gap: 9px;
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 13.5px;
    transition: all var(--transition);
    cursor: pointer;
    overflow: hidden;
    text-decoration: none;
}

.chat-item-label:hover { color: var(--text-primary); }
.chat-item-label i { font-size: 12px; flex-shrink: 0; color: var(--text-muted); }

.chat-item-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-item-actions {
    display: flex;
    gap: 1px;
    opacity: 0;
    transition: opacity 0.15s ease;
    flex-shrink: 0;
    padding-right: 4px;
}

.chatgpt-chat-item:hover .chat-item-actions,
.chatgpt-chat-item.active .chat-item-actions { opacity: 1; }

.chat-act-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    width: 24px;
    height: 24px;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    transition: all 0.13s;
    flex-shrink: 0;
}

.chat-act-btn:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }
.chat-act-delete:hover { color: #EF4444; background: rgba(239,68,68,0.1); }

/* Edit area */
.message-edit-area {
    width: 100%;
    min-height: 70px;
    padding: 13px 16px;
    background: rgba(255,255,255,0.04);
    border: 1.5px solid rgba(220,38,38,0.3);
    border-radius: 16px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    line-height: 1.65;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.message-edit-area:focus {
    border-color: rgba(220,38,38,0.6);
    box-shadow: 0 0 0 3px rgba(220,38,38,0.08);
}

.message-edit-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 8px;
}

.message-edit-btn {
    padding: 7px 16px;
    border-radius: 9px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border-dark);
    background: rgba(255,255,255,0.05);
    color: var(--text-secondary);
    transition: all 0.18s ease;
}

.message-edit-btn:hover {
    background: rgba(255,255,255,0.09);
    color: var(--text-primary);
}

.message-edit-btn.primary {
    background: var(--primary-red);
    border-color: var(--primary-red);
    color: #fff;
}

.message-edit-btn.primary:hover {
    background: var(--primary-red-hover);
    box-shadow: 0 4px 14px rgba(220,38,38,0.3);
}
.chatgpt-input-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, var(--dark-bg) 60%, rgba(8,8,9,0) 100%);
    padding: 8px 16px 20px;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    width: 100%;
    z-index: 50;
    pointer-events: none;
}

.chatgpt-input-wrapper {
    pointer-events: auto;
    max-width: 760px;
    margin: 0 auto;
}

.chatgpt-message-counter {
    text-align: center;
    padding: 6px 0;
}

.chatgpt-counter-text {
    color: var(--text-muted);
    font-size: 12px;
    transition: color var(--transition);
}

.chatgpt-counter-text.quota-low {
    color: #fbbf24;
    font-weight: 500;
}

.chatgpt-counter-text.quota-empty {
    color: var(--primary-red-light);
    font-weight: 600;
    cursor: pointer;
}

.chatgpt-message-counter:has(.quota-empty) {
    cursor: pointer;
}

.chatgpt-counter-text.quota-empty:hover {
    text-decoration: underline;
    opacity: 0.85;
}

.chatgpt-input-inner {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(18,18,24,0.9);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border-radius: 22px;
    border: 1px solid rgba(255,255,255,0.09);
    box-shadow:
        0 0 0 1px rgba(255,255,255,0.04),
        0 8px 32px rgba(0,0,0,0.6),
        0 0 60px rgba(220,38,38,0.04);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.chatgpt-input-inner:focus-within {
    border-color: rgba(220,38,38,0.25);
    box-shadow:
        0 0 0 1px rgba(220,38,38,0.08),
        0 8px 32px rgba(0,0,0,0.6),
        0 0 40px rgba(220,38,38,0.06);
}

.chatgpt-attach-btn {
    width: 34px;
    height: 34px;
    min-width: 34px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 17px;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.chatgpt-attach-btn:hover {
    background: rgba(255,255,255,0.07);
    color: var(--primary-red);
}

.chatgpt-attach-btn.active {
    background: rgba(220,38,38,0.15);
    color: var(--primary-red-light);
    transform: rotate(45deg);
}

.attach-wrap {
    position: relative;
}

.chatgpt-upload-menu {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 0;
    min-width: 190px;
    background: rgba(14,14,20,0.97);
    border: 1px solid var(--border-bright);
    border-radius: var(--radius-md);
    padding: 6px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.8), 0 0 0 1px rgba(255,255,255,0.04);
    display: none;
    flex-direction: column;
    gap: 2px;
    z-index: 200;
    transform-origin: bottom left;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.chatgpt-upload-menu.active {
    display: flex;
    animation: slideUpFade 0.2s cubic-bezier(0.16,1,0.3,1);
}

.upload-menu-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 13px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13.5px;
    text-align: start;
    cursor: pointer;
    border-radius: 9px;
    transition: all var(--transition);
}

.upload-menu-item:hover {
    background: rgba(255,255,255,0.06);
    color: var(--text-primary);
}

.upload-menu-item i {
    width: 16px;
    text-align: center;
    color: var(--primary-red);
    font-size: 13px;
}

.chatgpt-textarea {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    resize: none;
    outline: none;
    max-height: 200px;
    line-height: 1.6;
    padding: 5px 0;
}

.chatgpt-textarea::placeholder { color: var(--text-muted); }

.chatgpt-send-btn {
    width: 34px;
    height: 34px;
    min-width: 34px;
    background: var(--primary-red);
    border: none;
    color: white;
    font-size: 15px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    box-shadow: 0 2px 10px rgba(220,38,38,0.35);
}

.chatgpt-send-btn:hover:not(:disabled) {
    background: var(--primary-red-hover);
    transform: scale(1.06);
    box-shadow: 0 4px 16px rgba(220,38,38,0.5);
}

.chatgpt-send-btn:disabled {
    background: rgba(255,255,255,0.07);
    color: var(--text-muted);
    cursor: not-allowed;
    box-shadow: none;
}

.chatgpt-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    z-index: 95;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.chatgpt-sidebar-overlay.active { display: block; }

.settings-modal {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.settings-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.82);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.settings-container {
    position: relative;
    background: rgba(12,12,18,0.97);
    border: 1px solid var(--border-bright);
    border-radius: var(--radius-lg);
    max-width: 480px;
    width: 92%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 80px rgba(0,0,0,0.8), 0 0 0 1px rgba(255,255,255,0.04);
    animation: slideInUp 0.28s cubic-bezier(0.16,1,0.3,1);
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.07) transparent;
}

.settings-container::-webkit-scrollbar { width: 4px; }
.settings-container::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.07); border-radius: 4px; }

@keyframes slideInUp {
    from { opacity: 0; transform: translateY(24px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 22px;
    border-bottom: 1px solid var(--border-dark);
    position: sticky;
    top: 0;
    background: rgba(12,12,18,0.97);
    z-index: 2;
}

.settings-header h2 {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.3px;
}

.settings-close-btn {
    width: 34px;
    height: 34px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-dark);
    color: var(--text-muted);
    font-size: 15px;
    cursor: pointer;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.settings-close-btn:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text-primary);
    border-color: var(--border-bright);
}

.settings-content {
    padding: 14px 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 13px 14px;
    background: rgba(255,255,255,0.025);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.setting-item:hover {
    background: rgba(255,255,255,0.045);
    border-color: rgba(220,38,38,0.2);
}

.setting-label {
    display: flex;
    align-items: center;
    gap: 11px;
    color: var(--text-primary);
    font-size: 13.5px;
    font-weight: 500;
}

.setting-label i {
    width: 18px;
    text-align: center;
    color: var(--primary-red);
    font-size: 14px;
}

.setting-select {
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border-dark);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13.5px;
    padding: 7px 11px;
    border-radius: 9px;
    cursor: pointer;
    outline: none;
    transition: all var(--transition);
    min-width: 145px;
}

.setting-select:hover,
.setting-select:focus {
    border-color: rgba(220,38,38,0.3);
    background: rgba(255,255,255,0.09);
}

.setting-select option { background: #141420; }

.setting-action-btn {
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border-dark);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    padding: 7px 13px;
    border-radius: 9px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 7px;
    transition: all var(--transition);
}

.setting-action-btn:hover {
    background: rgba(220,38,38,0.12);
    border-color: rgba(220,38,38,0.3);
    color: var(--primary-red-light);
}

.setting-value {
    color: var(--text-primary);
    font-size: 13.5px;
    font-weight: 500;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.08);
    border: 1px solid var(--border-dark);
    border-radius: 24px;
    cursor: pointer;
    transition: all var(--transition);
}

.toggle-slider::before {
    content: "";
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--text-muted);
    border-radius: 50%;
    transition: all var(--transition);
}

.toggle-switch input:checked + .toggle-slider {
    background: rgba(220,38,38,0.25);
    border-color: rgba(220,38,38,0.4);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translate(20px, -50%);
    background: var(--primary-red-light);
}

/* ═══════════════════════════════════════════════════════════
   LIGHT MODE — Complete System-Wide Design Overhaul
   Every component, text, icon, and surface inverted cleanly.
   ═══════════════════════════════════════════════════════════ */

body.light {
    --dark-bg:          #ECECEF !important;
    --darker-bg:        #E4E4E8 !important;
    --main-bg:          #F7F7F8 !important;
    --sidebar-bg:       #FFFFFF !important;
    --sidebar-border:   #E7E7EC !important;
    --chat-bg:          #F7F7F8 !important;
    --surface-dark:     rgba(15,15,25,0.04) !important;
    --surface-lighter:  rgba(15,15,25,0.06) !important;
    --text-primary:     #0D0D12 !important;
    --text-secondary:   #565660 !important;
    --text-muted:       #8E8E98 !important;
    --border-dark:      #E7E7EC !important;
    --border-bright:    #D7D7DE !important;
    --glass-blur:       20px !important;
    --user-bubble-fade: #ECECEF !important;
    --input-bg:         #FFFFFF !important;
    --hover-bg:         rgba(15,15,25,0.045) !important;
    --shadow-sm:        0 1px 2px rgba(15,15,25,0.06) !important;
    --shadow-md:        0 4px 16px rgba(15,15,25,0.07) !important;
    --shadow-lg:        0 12px 32px rgba(15,15,25,0.10) !important;
    --shadow-xl:        0 24px 64px rgba(15,15,25,0.12) !important;
    background: #F7F7F8 !important;
    color: #0D0D12 !important;
}

body.light::before { display: none; }
body.light .bg-particles { opacity: 0; }

body.light .message-bubble.liquid-glass {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}
body.light .message-bubble.liquid-glass::before,
body.light .message-bubble.liquid-glass::after { display: none !important; }

body.light .chatgpt-app-container {
    background: var(--dark-bg);
}
body.light .chatgpt-main {
    background: var(--main-bg) !important;
    color: var(--text-primary);
}
body.light .chatgpt-chat-area {
    background: transparent !important;
    scrollbar-color: #C0C0C0 transparent;
}
body.light .chatgpt-chat-area::-webkit-scrollbar-thumb { background: #C0C0C0; border-radius: 4px; }

/* ────────────────────────────────────────────────
   SIDEBAR — white surface, dark text
   ──────────────────────────────────────────────── */
body.light .chatgpt-sidebar {
    background: #FFFFFF;
    border-right: 1px solid #E0E0E0;
    box-shadow: 1px 0 16px rgba(0,0,0,0.06);
}
body.light .chatgpt-sidebar-header { border-bottom: 1px solid #E0E0E0; }
body.light .sidebar-resize-handle { background: #E0E0E0; }
body.light .sidebar-resize-handle:hover,
body.light .sidebar-resize-handle.dragging { background: rgba(220,38,38,0.25); }

body.light .chatgpt-new-chat-btn {
    background: #F2F2F2;
    color: #111111;
    border-color: #E0E0E0;
}
body.light .chatgpt-new-chat-btn:hover {
    background: rgba(220,38,38,0.07);
    border-color: rgba(220,38,38,0.22);
    color: var(--primary-red);
    box-shadow: 0 2px 8px rgba(220,38,38,0.1);
}
body.light .chatgpt-new-chat-btn i { color: var(--primary-red); }

body.light .chatgpt-sidebar-close-btn {
    background: #F0F0F0;
    color: #555555;
    border-color: #E0E0E0;
}
body.light .chatgpt-sidebar-close-btn:hover {
    background: rgba(220,38,38,0.07);
    border-color: rgba(220,38,38,0.22);
    color: var(--primary-red);
}

body.light .chatgpt-sidebar-divider { background: #E0E0E0; }

/* Nav items */
body.light .chatgpt-nav-item { color: #454545; border-color: transparent; }
body.light .chatgpt-nav-item:hover { background: #F0F0F0; color: #111111; border-color: #E0E0E0; }
body.light .chatgpt-nav-item.active { background: rgba(220,38,38,0.08); color: var(--primary-red); border-color: rgba(220,38,38,0.2); }
body.light .chatgpt-nav-item i { color: var(--primary-red); }

body.light .chatgpt-nav-item.nav-osint { background: rgba(14,165,233,0.06); border-color: rgba(14,165,233,0.18); color: #0369A1; }
body.light .chatgpt-nav-item.nav-osint i { color: #0EA5E9; }
body.light .chatgpt-nav-item.nav-osint:hover { background: rgba(14,165,233,0.12); border-color: rgba(14,165,233,0.3); }
body.light .chatgpt-nav-item.nav-worm { background: rgba(22,163,74,0.06); border-color: rgba(22,163,74,0.18); color: #15803D; }
body.light .chatgpt-nav-item.nav-worm i { color: #16A34A; }
body.light .chatgpt-nav-item.nav-worm span:not(.chatgpt-badge) { color: #15803D; }
body.light .chatgpt-nav-item.nav-worm:hover { background: rgba(22,163,74,0.12); border-color: rgba(22,163,74,0.3); }

/* Badges */
body.light .chatgpt-badge.badge-free { background: rgba(14,165,233,0.1); color: #0369A1; border-color: rgba(14,165,233,0.22); }
body.light .chatgpt-badge.badge-pro  { background: rgba(22,163,74,0.1);  color: #15803D;  border-color: rgba(22,163,74,0.22);  }

/* Chat history */
body.light .chats-group-title { color: #888888; }
body.light .chatgpt-chat-item { color: #454545; border-color: transparent; }
body.light .chatgpt-chat-item:hover { background: #F0F0F0; color: #111111; border-color: #E0E0E0; }
body.light .chatgpt-chat-item.active { background: rgba(220,38,38,0.08); color: #B91C1C; border-color: rgba(220,38,38,0.2); }
body.light .chatgpt-chat-item i { color: #888888; }
body.light .chat-item-label { color: #454545; }
body.light .chat-item-label:hover { color: #111111; }
body.light .chat-item-label i { color: #888888; }
body.light .chat-act-btn { color: #888888; }
body.light .chat-act-btn:hover { background: #F0F0F0; color: #454545; }
body.light .chat-act-delete:hover { color: #DC2626; background: rgba(220,38,38,0.08); }
body.light .chats-list-container { scrollbar-color: #C0C0C0 transparent; }
body.light .chats-list-container::-webkit-scrollbar-thumb { background: #C0C0C0; }

/* Sidebar footer */
body.light .chatgpt-sidebar-footer { border-top: 1px solid #E0E0E0; }
body.light .chatgpt-user-profile:hover { background: #F0F0F0; border-color: #E0E0E0; }
body.light .chatgpt-user-name { color: #111111; }
body.light .chatgpt-user-plan { color: #888888; }
body.light .chatgpt-user-menu-icon { color: #888888; }
body.light .chatgpt-login-cta { color: var(--primary-red); background: rgba(220,38,38,0.07); border-color: rgba(220,38,38,0.2); }
body.light .chatgpt-login-cta:hover { background: rgba(220,38,38,0.12); border-color: rgba(220,38,38,0.35); }

/* Dropdown */
body.light .dropdown-menu { background: #FFFFFF; border-color: #E0E0E0; box-shadow: 0 8px 32px rgba(0,0,0,0.1), 0 2px 8px rgba(0,0,0,0.06); }
body.light .dropdown-item { color: #454545; border-color: transparent; }
body.light .dropdown-item:hover { background: #F0F0F0; color: #111111; border-color: #E0E0E0; }
body.light .dropdown-item i { color: #888888; }
body.light .dropdown-item:hover i { color: var(--primary-red); }
body.light .dropdown-divider { background: #E0E0E0; }

/* Upload menu */
body.light .chatgpt-upload-menu { background: #FFFFFF; border-color: #E0E0E0; box-shadow: 0 8px 28px rgba(0,0,0,0.1); }
body.light .upload-menu-item { color: #454545; }
body.light .upload-menu-item:hover { background: #F0F0F0; color: #111111; }
body.light .upload-menu-item i { color: #555555; }

/* Desktop sidebar toggle */
body.light .chatgpt-desktop-toggle { background: #FFFFFF; border-color: #E0E0E0; color: #555555; box-shadow: 0 2px 10px rgba(0,0,0,0.07); }
body.light .chatgpt-desktop-toggle:hover { background: #F4F4F4; color: var(--primary-red); border-color: rgba(220,38,38,0.22); box-shadow: 0 4px 16px rgba(0,0,0,0.08); }


/* ────────────────────────────────────────────────
   WELCOME SCREEN
   ──────────────────────────────────────────────── */
body.light .chatgpt-logo {
    box-shadow: 0 4px 16px rgba(220,38,38,0.14), 0 1px 4px rgba(0,0,0,0.08);
}
body.light .chatgpt-logo .logo-mark {
    background: linear-gradient(135deg,#fff,#F4F4F4);
    color: #111111;
    font-weight: 700;
    font-size: 13px;
}
body.light .chatgpt-logo .logo-glow {
    background: radial-gradient(circle, rgba(220,38,38,0.14), rgba(139,92,246,0.08), transparent 70%);
    opacity: 0.35;
}
body.light .chatgpt-welcome-title { color: #111111; }

/* ────────────────────────────────────────────────
   TOPBAR
   ──────────────────────────────────────────────── */
body.light .chatgpt-topbar {
    background: rgba(255,255,255,0.97);
    border-bottom: 1px solid #E0E0E0;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: 0 1px 0 #E0E0E0, 0 2px 8px rgba(0,0,0,0.04);
}
body.light .topbar-brand-name { color: #111111; }
body.light .topbar-brand-badge { background: rgba(220,38,38,0.07); border-color: rgba(220,38,38,0.18); color: var(--primary-red); }
body.light .topbar-icon-btn { color: #555555; }
body.light .topbar-icon-btn:hover { background: #F0F0F0; color: #111111; }
body.light .topbar-upgrade-btn { background: rgba(220,38,38,0.07); border-color: rgba(220,38,38,0.18); color: #C62828; }
body.light .topbar-upgrade-btn:hover { background: rgba(220,38,38,0.12); border-color: rgba(220,38,38,0.32); color: var(--primary-red); }
body.light .topbar-upgrade-btn i { color: #D97706; }

/* Mobile header */
body.light .chatgpt-mobile-header { background: rgba(255,255,255,0.96); border-bottom: 1px solid #E0E0E0; }
body.light .chatgpt-menu-btn { color: #555555; }
body.light .chatgpt-header-title { color: #111111; }
body.light .chatgpt-icon-btn { color: #555555; }
body.light .chatgpt-icon-btn:hover { background: #F0F0F0; color: var(--primary-red); }

/* ────────────────────────────────────────────────
   WELCOME SCREEN (second instance — remove stub)
   ──────────────────────────────────────────────── */

/* ────────────────────────────────────────────────
   MESSAGE BUBBLES
   User = slate-200 card  /  Bot = white card
   ──────────────────────────────────────────────── */

/* User bubble — clean neutral card, no blue */
body.light .message.user .message-bubble {
    background: #ECECEF;
    border: 1px solid #DEDEE4;
    color: var(--text-primary);
    border-radius: 18px 18px 5px 18px;
    box-shadow: var(--shadow-sm);
}
body.light .message.user .message-bubble::before { display: none; }
html[dir="rtl"] body.light .message.user .message-bubble { border-radius: 18px 18px 18px 5px; }

/* Bot bubble — pure white with subtle border */
body.light .message.bot .message-bubble {
    background: #FFFFFF;
    border: 1px solid var(--border-dark);
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
}

/* Markdown inside bot bubble */
body.light .message.bot .message-bubble p              { color: #1A1A1A; }
body.light .message.bot .message-bubble li             { color: #1A1A1A; }
body.light .message.bot .message-bubble strong         { color: #111111; font-weight: 700; }
body.light .message.bot .message-bubble em             { color: #444444; }
body.light .message.bot .message-bubble del            { color: rgba(0,0,0,0.42); }
body.light .message.bot .message-bubble a              { color: #C41F1F; text-decoration-color: rgba(196,31,31,0.4); }
body.light .message.bot .message-bubble a:hover        { color: #991414; }
body.light .message.bot .message-bubble code           { background: #F0F0F0; color: #6D28D9; border: 1px solid #E0E0E0; }
body.light .message.bot .message-bubble blockquote     { background: rgba(196,31,31,0.04); border-color: #DC2626; color: #444444; }
body.light .message.bot .message-bubble blockquote p   { color: #444444; }
body.light .message.bot .message-bubble h1             { color: #111111; border-bottom-color: #E0E0E0; }
body.light .message.bot .message-bubble h2,
body.light .message.bot .message-bubble h3,
body.light .message.bot .message-bubble h4,
body.light .message.bot .message-bubble h5,
body.light .message.bot .message-bubble h6             { color: #111111; }
body.light .message.bot .message-bubble hr             { border-top-color: #E0E0E0; }
body.light .message.bot .message-bubble ol li::marker,
body.light .message.bot .message-bubble ul li::marker  { color: var(--primary-red); }
body.light .message.bot .message-bubble th             { background: #F4F4F4; color: #111111; }
body.light .message.bot .message-bubble th,
body.light .message.bot .message-bubble td             { border-color: #E0E0E0; color: #1A1A1A; }
body.light .message.bot .message-bubble tr:hover td    { background: #FAFAFA; }
body.light .message.bot .avatar                        { background: linear-gradient(135deg, #FFECEC, #FFE0E0); border-color: rgba(220,38,38,0.2); }
body.light .message.bot .avatar i                      { color: var(--primary-red); }

/* Show More */
body.light .msg-long::after { background: linear-gradient(to bottom, transparent, var(--main-bg)); }
body.light .msg-expand-btn { background: rgba(0,0,0,0.04); border-color: #C8C8C8; color: #444444; backdrop-filter: none; }
body.light .msg-expand-btn:hover { background: rgba(196,31,31,0.06); border-color: rgba(196,31,31,0.28); color: var(--primary-red); }

/* Message action buttons (user) */
body.light .msg-action-btn { color: #888888; }
body.light .msg-action-btn:hover { background: rgba(0,0,0,0.06); color: var(--primary-red); border-color: #C8C8C8; }
body.light .msg-action-btn.copied { color: #059669; }

/* Bot toolbar */
body.light .msg-toolbar { border-top: 1px solid #F0F0F0; }
body.light .msg-tool-btn { color: #888888; }
body.light .msg-tool-btn:hover { background: #F0F0F0; color: #444444; }
body.light .msg-tool-btn.copied { color: #059669; }
body.light .msg-tool-btn.tts-playing { color: var(--primary-red); background: rgba(220,38,38,0.08); }
body.light .msg-tool-btn.regen-btn:hover { color: var(--primary-red); background: rgba(220,38,38,0.07); }
body.light .msg-tool-btn.like-btn.active { color: #2563EB; }
body.light .msg-tool-btn.dislike-btn.active { color: #DC2626; }

/* Streaming / thinking */
body.light .typing-dots span { background: #888888; }
body.light .message.thinking .message-bubble { background: transparent; }
body.light .message.bot.streaming .message-bubble { background: #fff; border-color: #E0E0E0; }
body.light .message.bot.streaming .message-bubble::after { background: var(--primary-red); }

/* Edit area */
body.light .message-edit-area { background: #F8F8F8; color: #111111; border-color: rgba(220,38,38,0.25); }
body.light .message-edit-area:focus { border-color: rgba(220,38,38,0.45); box-shadow: 0 0 0 3px rgba(220,38,38,0.06); }
body.light .message-edit-btn { background: #F0F0F0; color: #444444; border-color: #E0E0E0; }
body.light .message-edit-btn:hover { background: #E2E2E2; color: #111111; }

/* ────────────────────────────────────────────────
   CODE BLOCKS — keep GitHub-dark (standard practice)
   ──────────────────────────────────────────────── */
body.light .cb-container { background: #0D1117; border: 1px solid #30363D; box-shadow: 0 4px 20px rgba(0,0,0,0.15); }
body.light .cb-header { background: #161B22; border-bottom-color: #30363D; }
body.light .cb-lang { color: rgba(255,255,255,0.4); }
body.light .cb-btn { color: rgba(255,255,255,0.55); border-color: rgba(255,255,255,0.12); background: rgba(255,255,255,0.06); }
body.light .cb-btn:hover { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.9); }
body.light .cb-btn.copied { background: rgba(40,200,64,0.15); border-color: rgba(40,200,64,0.4); color: #28c840; }

/* ────────────────────────────────────────────────
   INPUT AREA
   ──────────────────────────────────────────────── */
body.light .chatgpt-input-container {
    background: linear-gradient(to top, var(--main-bg) 70%, transparent 100%);
}
body.light .chatgpt-input-inner {
    background: #FFFFFF;
    border-color: #C8C8C8;
    box-shadow: 0 4px 16px rgba(0,0,0,0.07), 0 1px 4px rgba(0,0,0,0.04);
}
body.light .chatgpt-input-inner:focus-within {
    border-color: rgba(220,38,38,0.4);
    box-shadow: 0 0 0 3px rgba(220,38,38,0.08), 0 4px 16px rgba(0,0,0,0.07);
}
body.light .chatgpt-textarea { color: #111111; }
body.light .chatgpt-textarea::placeholder { color: #888888; }
body.light .chatgpt-attach-btn { color: #555555; }
body.light .chatgpt-attach-btn:hover { background: #F0F0F0; color: var(--primary-red); }
body.light .chatgpt-attach-btn.active { background: rgba(220,38,38,0.08); color: var(--primary-red); }
body.light .chatgpt-send-btn { box-shadow: 0 3px 12px rgba(220,38,38,0.25); }
body.light .chatgpt-send-btn:disabled { background: #DEDEDE; box-shadow: none; }
body.light .chatgpt-counter-text { color: #888888; }
body.light .chatgpt-counter-text.quota-low { color: #D97706; }
body.light .chatgpt-counter-text.quota-empty { color: #DC2626; }
body.light .inline-attachment-file { background: #F0F0F0; border-color: #E0E0E0; color: #111111 !important; }
body.light .inline-attachment-file:hover { background: #E2E2E2; border-color: rgba(220,38,38,0.22); }
body.light .attachment-preview-card { background: #F0F0F0; border-color: #E0E0E0; }
body.light .attachment-preview-card span { color: #444444; }

/* ────────────────────────────────────────────────
   SETTINGS MODAL
   ──────────────────────────────────────────────── */
body.light .settings-overlay { background: rgba(0,0,0,0.3); backdrop-filter: blur(8px); }
body.light .settings-container { background: #FFFFFF; border: 1px solid #E0E0E0; box-shadow: 0 24px 80px rgba(0,0,0,0.12); }
body.light .settings-header { background: #F4F4F4; border-bottom: 1px solid #E0E0E0; }
body.light .settings-header h2 { color: #111111; }
body.light .settings-close-btn { background: #F0F0F0; color: #555555; border-color: #E0E0E0; }
body.light .settings-close-btn:hover { background: #E2E2E2; color: #111111; }
body.light .setting-item { border-bottom: 1px solid #F0F0F0; }
body.light .setting-item:hover { background: #FAFAFA; }
body.light .setting-label { color: #111111; }
body.light .setting-label span { color: #444444; }
body.light .setting-label i { color: #555555; }
body.light .setting-select { background: #F4F4F4; border-color: #E0E0E0; color: #111111; }
body.light .setting-select:hover,
body.light .setting-select:focus { border-color: rgba(220,38,38,0.35); background: #FFFFFF; }
body.light .setting-select option { background: #FFFFFF; color: #111111; }
body.light .setting-value { color: #111111; }
body.light .setting-action-btn { background: #F0F0F0; border-color: #E0E0E0; color: #444444; }
body.light .setting-action-btn:hover { background: rgba(220,38,38,0.07); border-color: rgba(220,38,38,0.22); color: var(--primary-red); }
body.light .toggle-slider { background: #E0E0E0; border-color: #C8C8C8; }
body.light .toggle-slider::before { background: #888888; }
body.light .toggle-switch input:checked + .toggle-slider { background: rgba(220,38,38,0.14); border-color: rgba(220,38,38,0.3); }
body.light .toggle-switch input:checked + .toggle-slider::before { background: var(--primary-red); }

/* ────────────────────────────────────────────────
   SHARE MODAL
   ──────────────────────────────────────────────── */
body.light .share-modal { background: rgba(0,0,0,0.28); }
body.light .share-container {
    background: #FFFFFF;
    border: 1px solid #E0E0E0;
    box-shadow: 0 24px 80px rgba(0,0,0,0.1);
}
body.light .share-header { border-bottom: 1px solid #F0F0F0; }
body.light .share-header h3 { color: #111111; }
body.light .share-desc { color: #444444; }
body.light .share-link-input { background: #F8F8F8; border-color: #E0E0E0; color: #111111; }
body.light .share-enable-btn { box-shadow: 0 2px 8px rgba(220,38,38,0.15); }
body.light .share-disable-btn { background: #F0F0F0; color: #444444; border-color: #E0E0E0; }
body.light .share-disable-btn:hover { background: rgba(220,38,38,0.07); color: #DC2626; border-color: rgba(220,38,38,0.2); }
body.light .share-empty-state { color: #888888; }

/* ────────────────────────────────────────────────
   ACCOUNT MODAL
   ──────────────────────────────────────────────── */
body.light .account-profile-header { background: #F8F8F8; border-color: #E0E0E0; }
body.light .account-avatar { background: linear-gradient(135deg, #FFECEC, #FFE0E0); border-color: rgba(220,38,38,0.2); }
body.light .account-avatar i { color: var(--primary-red); }
body.light .account-title-info h3 { color: #111111; }
body.light .account-title-info .chatgpt-badge { opacity: 1; }
body.light .account-usage-details { color: #555555; }
body.light .account-progress-labels { color: #555555; }
body.light .account-progress-track { background: #E0E0E0; }

/* ────────────────────────────────────────────────
   AUTH MODAL
   ──────────────────────────────────────────────── */
body.light .auth-overlay { background: rgba(0,0,0,0.32); backdrop-filter: blur(12px); }
body.light .auth-card {
    background: #FFFFFF;
    border: 1px solid #E0E0E0;
    box-shadow: 0 32px 96px rgba(0,0,0,0.12);
}
body.light .auth-close-btn { background: #F0F0F0; border-color: #E0E0E0; color: #555555; }
body.light .auth-close-btn:hover { background: #E2E2E2; color: #111111; border-color: #C8C8C8; }
body.light .brand-title { color: #111111; }
body.light .brand-subtitle { color: #444444; }
body.light .tab-btn { color: #555555; border-bottom-color: transparent; }
body.light .tab-btn:hover { background: #F0F0F0; color: #111111; }
body.light .tab-btn.active { background: rgba(220,38,38,0.07); color: var(--primary-red); border-bottom-color: var(--primary-red); }
body.light .tab-btn.active i { color: var(--primary-red); }
body.light .form-label { color: #444444; }
body.light .form-input { background: #F8F8F8; border-color: #E0E0E0; color: #111111; }
body.light .form-input:focus { border-color: rgba(220,38,38,0.4); box-shadow: 0 0 0 3px rgba(220,38,38,0.06); background: #FFFFFF; }
body.light .form-input::placeholder { color: #888888; }

/* ────────────────────────────────────────────────
   UPGRADE / PRO MODAL
   ──────────────────────────────────────────────── */
body.light .upgrade-modal-overlay { background: rgba(0,0,0,0.32); backdrop-filter: blur(12px); }
body.light .upgrade-modal-container {
    background: #FFFFFF;
    border: 1px solid #E0E0E0;
    box-shadow: 0 32px 80px rgba(0,0,0,0.12);
    scrollbar-color: #C8C8C8 transparent;
}
body.light .upgrade-modal-container::-webkit-scrollbar-thumb { background: #C8C8C8; }
body.light .upgrade-modal-close { background: #F0F0F0; border-color: #E0E0E0; color: #555555; }
body.light .upgrade-modal-close:hover { background: #E2E2E2; color: #111111; }
body.light .pro-hero-title { color: #111111; }
body.light .pro-hero-desc { color: #444444; }
body.light .pro-choose-label { color: #888888; }
body.light .pro-feat { background: #F8F8F8; border-color: #E0E0E0; }
body.light .pro-feat:hover { background: #F0F0F0; }
body.light .pro-feat-text strong { color: #111111; }
body.light .pro-feat-text span { color: #555555; }
body.light .pro-plan-inner { background: #F8F8F8; border-color: #E0E0E0; }
body.light .pro-plan:hover .pro-plan-inner { background: #F0F0F0; border-color: #C8C8C8; }
body.light .pro-plan input:checked ~ .pro-plan-inner { border-color: #A855F7; background: rgba(168,85,247,0.06); }
body.light .pro-plan-price { color: #111111; }
body.light .pro-plan-period { color: #555555; }
body.light .pro-plan-tokens { color: #9333ea; }

/* ────────────────────────────────────────────────
   CODEX WEB — LIGHT MODE OVERRIDES
   ──────────────────────────────────────────────── */
body.light .codex-view { background: var(--main-bg); }
body.light .codex-toolbar { background: var(--sidebar-bg); border-bottom-color: var(--border-dark); }
body.light .codex-right-panel { background: var(--sidebar-bg); border-left-color: var(--border-dark); }
body.light .codex-chat-topbar { background: var(--sidebar-bg); border-bottom-color: var(--border-dark); }
body.light .codex-projects-header { border-bottom-color: var(--border-dark); background: var(--sidebar-bg); }
body.light .codex-preview-bar { background: var(--sidebar-bg); border-bottom-color: var(--border-dark); }
body.light .codex-input-wrap { background: var(--sidebar-bg); border-top-color: var(--border-dark); }
body.light .codex-input { background: var(--input-bg); border-color: var(--border-dark); color: var(--text-primary); }
body.light .codex-input::placeholder { color: var(--text-muted); }
body.light .codex-input:focus { border-color: var(--primary-red); background: var(--input-bg); }
body.light .codex-msg-bot { background: var(--surface-dark); border-color: var(--border-dark); color: var(--text-secondary); }
body.light .codex-suggestion-btn { background: var(--sidebar-bg); border-color: var(--border-dark); color: var(--text-secondary); }
body.light .codex-suggestion-btn:hover { background: rgba(220,38,38,0.05); border-color: rgba(220,38,38,0.3); color: var(--text-primary); }
body.light .cdx-sort-select { background: var(--input-bg); border-color: var(--border-dark); color: var(--text-secondary); }
body.light .codex-name-modal-box { background: var(--sidebar-bg); border-color: var(--border-dark); }
body.light .codex-name-modal-input { background: var(--input-bg); border-color: var(--border-dark); color: var(--text-primary); }
body.light .codex-messages { background: var(--main-bg); }
body.light .codex-val-panel { background: #FAFAFA; border-color: #E0E0E0; }
body.light .cv-group { background: #FFFFFF; border-color: #E0E0E0; }
body.light .cv-group-err { border-color: rgba(239,68,68,0.3); background: rgba(239,68,68,0.03); }
body.light .cv-group-warn { border-color: rgba(245,158,11,0.25); background: rgba(245,158,11,0.02); }
body.light .cv-group-ok { border-color: rgba(34,197,94,0.2); }
body.light .cv-group-fix { border-color: rgba(59,130,246,0.25); background: rgba(59,130,246,0.03); }
body.light .cv-item { border-top-color: #F0F0F0; color: #444444; }
body.light .cv-item.cv-clickable:hover { background: #F4F4F4; }
body.light .cv-g-count { background: #F0F0F0; color: #888888; }
body.light .cv-line { background: #EBEBEB; color: #555555; }
body.light .cv-gtitle { color: #111111; }
body.light .codex-val-head { color: #111111; }
body.light .codex-val-ts { color: #888888; }
body.light .codex-project-card { background: var(--sidebar-bg); border-color: var(--border-dark); }
body.light .codex-project-card:hover { background: var(--hover-bg); border-color: rgba(220,38,38,0.25); }
body.light .codex-iframe-shell { background: var(--surface-dark); }
body.light .codex-toolbar-btn,
body.light .codex-back-btn,
body.light .cdx-chat-new-btn { color: var(--text-secondary); }
body.light .codex-toolbar-btn:hover,
body.light .codex-back-btn:hover,
body.light .cdx-chat-new-btn:hover { background: var(--hover-bg); color: var(--text-primary); }
body.light .codex-projects-list::-webkit-scrollbar-thumb { background: var(--border-bright); }

.upgrade-premium-modal {
    position: fixed;
    inset: 0;
    z-index: 12500;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.upgrade-premium-modal.active { display: flex; }

.upgrade-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.88);
    -webkit-backdrop-filter: blur(24px);
    backdrop-filter: blur(24px);
}

.upgrade-modal-container {
    position: relative;
    width: 100%;
    max-width: 660px;
    max-height: 92vh;
    overflow-y: auto;
    background: rgba(12,12,20,0.99);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 22px;
    padding: 42px 38px 34px;
    box-shadow:
        0 0 0 1px rgba(255,255,255,0.04),
        0 24px 80px rgba(0,0,0,0.8),
        0 0 120px rgba(99,102,241,0.05);
    animation: proModalIn 0.32s cubic-bezier(0.16,1,0.3,1);
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.06) transparent;
}
.upgrade-modal-container::-webkit-scrollbar { width: 4px; }
.upgrade-modal-container::-webkit-scrollbar-track { background: transparent; }
.upgrade-modal-container::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06); border-radius: 4px; }

@keyframes proModalIn {
    from { opacity: 0; transform: translateY(14px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.upgrade-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.07);
    color: #6b6b7a;
    font-size: 14px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    transition: all var(--transition);
}
.upgrade-modal-close:hover { background: rgba(255,255,255,0.08); color: #fff; }

.pro-hero {
    text-align: center;
    position: relative;
    margin-bottom: 26px;
}
.pro-hero-glow {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    width: 220px;
    height: 120px;
    background: radial-gradient(ellipse, rgba(168,85,247,0.15) 0%, transparent 70%);
    pointer-events: none;
}
.pro-hero-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    border-radius: 15px;
    background: linear-gradient(135deg, rgba(168,85,247,0.14), rgba(236,72,153,0.12));
    border: 1px solid rgba(168,85,247,0.2);
    margin-bottom: 14px;
    font-size: 22px;
    color: #c084fc;
}
.pro-hero-title {
    font-size: 27px;
    font-weight: 700;
    color: #f0f0f4;
    margin: 0 0 6px;
    letter-spacing: -0.5px;
}
.pro-hero-title span {
    background: linear-gradient(135deg, #c084fc, #e879f9, #f472b6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.pro-hero-desc {
    color: #6b6b7a;
    font-size: 14px;
    margin: 0;
}

.pro-features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    margin-bottom: 26px;
}
.pro-feat {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 13px;
    border-radius: 11px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.04);
    transition: background var(--transition);
}
.pro-feat:hover { background: rgba(255,255,255,0.04); }
.pro-feat-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
    background: rgba(168,85,247,0.1);
    color: #c084fc;
}
.pro-feat-icon.feat-yellow { background: rgba(250,204,21,0.1); color: #facc15; }
.pro-feat-icon.feat-purple { background: rgba(168,85,247,0.1); color: #a855f7; }
.pro-feat-icon.feat-blue { background: rgba(59,130,246,0.1); color: #3b82f6; }
.pro-feat-icon.feat-orange { background: rgba(251,146,60,0.1); color: #fb923c; }
.pro-feat-icon.feat-cyan { background: rgba(14,165,233,0.1); color: #0ea5e9; }
.pro-feat-icon.feat-green { background: rgba(0,255,65,0.08); color: #4ade80; }
.pro-feat-icon.feat-pink { background: rgba(236,72,153,0.1); color: #ec4899; }

.pro-feat-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.pro-feat-text strong { color: #e0e0e8; font-size: 12.5px; font-weight: 600; }
.pro-feat-text span { color: #4a4a56; font-size: 11px; }

.pro-choose-label {
    text-align: center;
    color: #4a4a56;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
    margin: 0 0 11px;
}
.pro-plans {
    display: flex;
    gap: 7px;
    margin-bottom: 18px;
}
.pro-plan { flex: 1; cursor: pointer; position: relative; }
.pro-plan input { display: none; }
.pro-plan-inner {
    position: relative;
    text-align: center;
    padding: 18px 5px 14px;
    border-radius: 13px;
    border: 1.5px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.02);
    transition: all 0.22s cubic-bezier(0.4,0,0.2,1);
}
.pro-plan input:checked ~ .pro-plan-inner {
    border-color: #a855f7;
    background: rgba(168,85,247,0.07);
    box-shadow: 0 0 0 1px rgba(168,85,247,0.13), 0 6px 28px rgba(168,85,247,0.1);
}
.pro-plan:hover .pro-plan-inner {
    border-color: rgba(168,85,247,0.28);
    background: rgba(255,255,255,0.03);
}
.pro-plan-tag {
    position: absolute;
    top: -9px;
    left: 50%;
    transform: translateX(-50%);
    padding: 2px 9px;
    border-radius: 6px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.7px;
    white-space: nowrap;
}
.pro-plan-tag.popular { background: #a855f7; color: #fff; }
.pro-plan-tag.save { background: rgba(34,197,94,0.12); color: #4ade80; border: 1px solid rgba(34,197,94,0.2); }
.pro-plan-tag.best { background: linear-gradient(135deg, #f59e0b, #f97316); color: #fff; }
.pro-plan-price { font-size: 24px; font-weight: 700; color: #f0f0f5; letter-spacing: -0.8px; line-height: 1; margin-bottom: 4px; }
.pro-plan-period { font-size: 11.5px; color: #4a4a56; font-weight: 500; }
.pro-plan-tokens { font-size: 10.5px; color: #b07cf0; font-weight: 600; margin-top: 5px; }

.pro-cta-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 13px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: #fff;
    font-size: 14.5px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.22s;
    box-shadow: 0 4px 22px rgba(168,85,247,0.2);
}
.pro-cta-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 28px rgba(168,85,247,0.32);
    background: linear-gradient(135deg, #6d28d9, #9333ea);
}
.pro-cta-btn i { font-size: 17px; }

.pro-divider {
    display: flex;
    align-items: center;
    margin: 18px 0 14px;
    color: #3a3a46;
    font-size: 11.5px;
}
.pro-divider::before,
.pro-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255,255,255,0.05);
}
.pro-divider span { padding: 0 12px; color: #4a4a58; }

.pro-activation { margin-bottom: 16px; }
.pro-input-row { display: flex; gap: 7px; }
.pro-token-input {
    flex: 1;
    padding: 11px 13px;
    background: rgba(255,255,255,0.03);
    border: 1.5px solid rgba(255,255,255,0.07);
    border-radius: 10px;
    color: #e0e0e8;
    font-size: 13.5px;
    font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
    letter-spacing: 0.4px;
    transition: border-color var(--transition);
    box-sizing: border-box;
}
.pro-token-input:focus {
    outline: none;
    border-color: #a855f7;
    box-shadow: 0 0 0 3px rgba(168,85,247,0.07);
}
.pro-token-input::placeholder { color: #38383e; }
.pro-activate-btn {
    padding: 11px 22px;
    background: rgba(255,255,255,0.04);
    border: 1.5px solid rgba(255,255,255,0.09);
    border-radius: 10px;
    color: #d0d0d8;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}
.pro-activate-btn:hover {
    background: rgba(168,85,247,0.09);
    border-color: rgba(168,85,247,0.28);
    color: #c084fc;
}
.pro-activate-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.upgrade-message {
    margin-top: 9px;
    padding: 11px 13px;
    border-radius: 9px;
    font-size: 13px;
    display: none;
    align-items: center;
    gap: 8px;
}
.upgrade-message.show { display: flex; }
.upgrade-message.success { background: rgba(34,197,94,0.07); border: 1px solid rgba(34,197,94,0.18); color: #4ade80; }
.upgrade-message.error { background: rgba(239,68,68,0.07); border: 1px solid rgba(239,68,68,0.18); color: #f87171; }

.pro-footer {
    text-align: center;
    padding-top: 14px;
    border-top: 1px solid rgba(255,255,255,0.04);
}
.pro-footer a { color: #4a4a56; text-decoration: none; font-size: 12px; font-weight: 500; transition: color var(--transition); }
.pro-footer a:hover { color: #9a9aaa; }
.pro-footer a i { margin-right: 4px; }
.pro-footer-dot { color: #3a3a42; margin: 0 9px; font-size: 10px; }

@media (max-width: 720px) {
    .upgrade-modal-container { padding: 30px 18px 26px; }
    .pro-features { grid-template-columns: 1fr; }
    .pro-plans { flex-wrap: wrap; }
    .pro-plan { flex: 0 0 calc(33.33% - 5px); }
    .pro-hero-title { font-size: 22px; }
    .pro-plan-price { font-size: 20px; }
}
@media (max-width: 480px) {
    .upgrade-modal-container { padding: 22px 14px 18px; border-radius: 16px; }
    .pro-plan { flex: 0 0 calc(50% - 4px); }
    .pro-plan-inner { padding: 14px 3px 11px; }
    .pro-plan-price { font-size: 18px; }
    .pro-hero-icon { width: 44px; height: 44px; font-size: 18px; }
    .pro-hero-title { font-size: 20px; }
    .pro-cta-btn { padding: 11px; font-size: 13.5px; }
    .pro-input-row { flex-direction: column; }
    .pro-activate-btn { width: 100%; padding: 11px; }
}

.chatgpt-login-cta {
    width: 100%;
    padding: 11px;
    background: rgba(220,38,38,0.12);
    border: 1px solid rgba(220,38,38,0.28);
    border-radius: var(--radius-sm);
    color: #fca5a5;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all var(--transition);
}

.chatgpt-login-cta:hover {
    background: rgba(220,38,38,0.2);
    border-color: rgba(220,38,38,0.45);
    color: #fecaca;
    box-shadow: 0 4px 16px rgba(220,38,38,0.15);
    transform: translateY(-1px);
}

.chatgpt-sidebar.mini .chatgpt-login-cta span { display: none; }
.chatgpt-sidebar.mini .chatgpt-login-cta { padding: 11px; }

.auth-modal {
    position: fixed;
    inset: 0;
    z-index: 13000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    overflow-y: auto;
}

.auth-modal[hidden] { display: none; }

.auth-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.94);
    -webkit-backdrop-filter: blur(24px);
    backdrop-filter: blur(24px);
}

.auth-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.auth-card {
    position: relative;
    width: 100%;
    background: rgba(12,12,20,0.99);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-lg);
    padding: 32px 28px;
    box-shadow: 0 24px 80px rgba(0,0,0,0.8), 0 0 0 1px rgba(255,255,255,0.04);
    animation: proModalIn 0.3s cubic-bezier(0.16,1,0.3,1);
}

.auth-close-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 34px;
    height: 34px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    color: #6b6b7a;
    border-radius: 9px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    z-index: 2;
    font-size: 14px;
}

.auth-close-btn:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
    border-color: rgba(255,255,255,0.14);
}

.auth-header {
    text-align: center;
    margin-bottom: 26px;
}

.brand-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    letter-spacing: -0.5px;
}

.brand-title i {
    color: var(--primary-red);
    font-size: 1.7rem;
}

.brand-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0;
}

.auth-tabs {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-bottom: 18px;
    flex-wrap: nowrap;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-dark);
    border-radius: 11px;
    padding: 4px;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.84rem;
    font-family: inherit;
    cursor: pointer;
    font-weight: 600;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
    flex: 1;
    justify-content: center;
}

.tab-btn i { font-size: 0.84rem; opacity: 0.7; }

.tab-btn:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-secondary);
}

.tab-btn.active {
    background: rgba(220,38,38,0.12);
    color: #fca5a5;
    border: 1px solid rgba(220,38,38,0.22);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.tab-btn.active i { opacity: 1; color: var(--primary-red-light); }

.auth-form { display: none; width: 100%; }
.auth-form.active { display: block; }

.form-group { margin-bottom: 16px; width: 100%; }

.form-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    margin-bottom: 7px;
    font-size: 0.88rem;
    font-weight: 500;
}

.form-label i { color: var(--text-muted); width: 14px; font-size: 0.88rem; }

.form-input {
    width: 100%;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.09);
    color: #fff;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: all var(--transition);
    box-sizing: border-box;
}

.form-input::placeholder { color: var(--text-muted); }

.form-input:focus {
    border-color: rgba(220,38,38,0.35);
    box-shadow: 0 0 0 3px rgba(220,38,38,0.08);
    background: rgba(255,255,255,0.06);
}

.submit-btn {
    width: 100%;
    background: rgba(220,38,38,0.12);
    color: #fca5a5;
    border: 1px solid rgba(220,38,38,0.28);
    padding: 13px;
    border-radius: 28px;
    font-size: 0.95rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
}

.submit-btn:hover {
    background: rgba(220,38,38,0.2);
    border-color: rgba(220,38,38,0.45);
    color: #fecaca;
    box-shadow: 0 6px 20px rgba(220,38,38,0.2);
    transform: translateY(-1px);
}

.submit-btn:active { transform: translateY(0); }
.submit-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.submit-btn i { font-size: 0.9rem; }

.google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 13px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: 28px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
    margin-bottom: 14px;
    font-family: inherit;
    transition: all var(--transition);
}

.google-btn:hover {
    background: rgba(255,255,255,0.07);
    border-color: rgba(255,255,255,0.14);
    color: var(--text-primary);
}

.google-btn-primary {
    background: linear-gradient(135deg, rgba(66,133,244,0.15), rgba(52,168,83,0.12));
    border-color: rgba(66,133,244,0.3);
    color: #93c5fd;
    margin-bottom: 0;
}

.google-btn-primary:hover {
    background: linear-gradient(135deg, rgba(66,133,244,0.25), rgba(52,168,83,0.2));
    border-color: rgba(66,133,244,0.5);
    color: #bfdbfe;
    box-shadow: 0 6px 22px rgba(66,133,244,0.2);
    transform: translateY(-1px);
}

.social-btn-fb i { color: #1877f2; font-size: 1.05rem; }
.social-btn-fb:hover { background: rgba(24,119,242,0.12); border-color: rgba(24,119,242,0.4); }
.social-btn-gh i { color: #e6e6ee; font-size: 1.05rem; }
.social-btn-gh:hover { background: rgba(230,230,238,0.1); border-color: rgba(230,230,238,0.28); }
body.light .social-btn-gh i { color: #1f2328; }

.register-google-card {
    text-align: center;
    padding: 8px 4px;
}

.register-google-icon {
    width: 54px;
    height: 54px;
    border-radius: 15px;
    background: linear-gradient(135deg, rgba(66,133,244,0.15), rgba(52,168,83,0.1));
    border: 1px solid rgba(66,133,244,0.28);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #4285F4;
    font-size: 22px;
    margin-bottom: 13px;
}

.register-google-title {
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0 0 7px;
}

.register-google-desc {
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.55;
    margin: 0 0 20px;
}

.register-google-perks {
    list-style: none;
    padding: 0;
    margin: 16px 0 16px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    text-align: start;
}

.register-google-perks li {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-dark);
    border-radius: 9px;
    color: var(--text-secondary);
    font-size: 0.84rem;
}

.register-google-perks li i {
    color: #4285F4;
    width: 15px;
    font-size: 0.88rem;
}

.register-google-fineprint {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin: 0;
}

.register-google-fineprint a {
    color: #60a5fa;
    text-decoration: none;
    font-weight: 600;
}

.register-google-fineprint a:hover { text-decoration: underline; }

.or-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 14px 0;
    color: var(--text-muted);
    font-size: 0.82rem;
    width: 100%;
}

.or-divider::before,
.or-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-dark);
}

.or-divider span {
    padding: 0 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.auth-bottom-link a {
    color: #60a5fa;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
}

.auth-bottom-link a:hover { text-decoration: underline; }

.alert {
    padding: 11px 14px;
    border-radius: 9px;
    margin-bottom: 14px;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 9px;
}

.alert[hidden] { display: none; }

.alert-error {
    background: rgba(239,68,68,0.08);
    color: #f87171;
    border: 1px solid rgba(239,68,68,0.18);
}

.alert-success {
    background: rgba(16,185,129,0.08);
    color: #34d399;
    border: 1px solid rgba(16,185,129,0.18);
}

.auth-footer {
    margin-top: 26px;
    text-align: center;
    border-top: 1px solid var(--border-dark);
    padding-top: 18px;
}

.support-text {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin: 0 0 10px;
}

.support-links {
    display: flex;
    flex-direction: column;
    gap: 7px;
    align-items: center;
}

.support-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #60a5fa;
    text-decoration: none;
    font-size: 0.82rem;
    transition: opacity var(--transition);
}

.support-link:hover { text-decoration: underline; }
.support-link.telegram { color: #38bdf8; }
.support-link.email { color: var(--text-muted); }

@media (max-width: 768px) {
    .chatgpt-app-container { flex-direction: column; }

    .chatgpt-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        width: 285px !important;
        z-index: 10000;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
        max-width: none !important;
        min-width: unset !important;
    }

    .chatgpt-sidebar.mini { width: 285px !important; }

    .chatgpt-sidebar.open {
        transform: translateX(0);
        box-shadow: 24px 0 60px rgba(0,0,0,0.75);
    }

    .chatgpt-main {
        width: 100% !important;
        min-width: 0 !important;
        flex: 1;
    }

    .chatgpt-mobile-header { display: flex; }
    .chatgpt-menu-btn { display: flex; }
    .sidebar-resize-handle { display: none; }

    .chatgpt-topbar {
        padding: 0 12px;
        height: 52px;
    }

    .chatgpt-chat-area {
        padding: 12px 14px;
        padding-bottom: 150px;
    }

    .scroll-to-bottom-btn {
        bottom: 122px;
        width: 38px;
        height: 38px;
        font-size: 14px;
    }

    .chatgpt-welcome { padding-top: 40px; }
    .chatgpt-welcome-title { font-size: 20px; line-height: 1.3; }

    .chatgpt-input-container {
        padding: 6px 10px 12px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }

    .chatgpt-input-wrapper { max-width: 100%; }

    .chatgpt-input-inner {
        padding: 8px 10px;
        border-radius: 18px;
        gap: 6px;
    }

    .chatgpt-textarea { font-size: 15px; }

    .chatgpt-upgrade-btn span { display: none; }
    .chatgpt-upgrade-btn { padding: 7px 10px; }

    .message { padding: 0; }

    .message-bubble { max-width: 90vw; word-break: break-word; }

    .chatgpt-counter-text { font-size: 11px; }

    .chatgpt-attach-btn { width: 30px; height: 30px; min-width: 30px; font-size: 14px; }
    .chatgpt-send-btn { width: 36px; height: 36px; font-size: 14px; }

    .chatgpt-desktop-toggle { display: none !important; }

    .topbar-brand-badge { display: none; }
}

/* ════════════════════════════════════════════════════════════
   RTL / ARABIC — COMPLETE LAYOUT SYSTEM
   Architecture: structural containers keep LTR coordinates.
   Only text-content elements switch to RTL direction.
   This prevents the whole flexbox layout from inverting.
   ════════════════════════════════════════════════════════════ */

html[lang="ar"] body { font-family: 'Cairo', 'Inter', sans-serif; }

/* ── 1. App shell: sidebar moves to RIGHT via row-reverse ── */
html[dir="rtl"] .chatgpt-app-container {
    flex-direction: row-reverse !important;
}

/* ── 2. Topbar: hamburger on RIGHT, actions on LEFT ── */
html[dir="rtl"] .chatgpt-topbar {
    flex-direction: row-reverse !important;
}

/* ── 3. Sidebar on RIGHT: border flips, shadow goes left ── */
html[dir="rtl"] .chatgpt-sidebar {
    border-right: none !important;
    border-left: 1px solid var(--border-dark) !important;
    box-shadow: -2px 0 24px rgba(0,0,0,0.35) !important;
    direction: rtl;
}

html[dir="rtl"] .sidebar-resize-handle { right: auto; left: -4px; }

html[dir="rtl"] .chatgpt-user-info { text-align: right; }
html[dir="rtl"] .chatgpt-badge { margin-inline-start: auto; margin-inline-end: 0; }
html[dir="rtl"] .chat-item-actions { padding-right: 0; padding-left: 4px; }

/* Dropdowns anchor to the start edge in RTL */
html[dir="rtl"] .dropdown-menu { left: auto; right: 0; }
html[dir="rtl"] .chatgpt-upload-menu { left: auto; right: 0; transform-origin: bottom right; }

/* ── 4. Main + chat area: keep LTR layout so messages don't invert ── */
html[dir="rtl"] .chatgpt-main,
html[dir="rtl"] .chatgpt-chat-area {
    direction: ltr;
}

/* ── 5. Messages: LTR layout keeps user-right / bot-left correct ── */
html[dir="rtl"] .message {
    direction: ltr;
}

/* Text INSIDE bubbles → RTL so Arabic reads right-to-left */
html[dir="rtl"] .message-bubble {
    direction: rtl;
    text-align: right;
}

/* User bubble tail: move to bottom-left corner for RTL */
html[dir="rtl"] .message.user .message-bubble {
    border-radius: 18px 18px 18px 4px;
}

/* Bot message content stays left-aligned in LTR coordinate space */
html[dir="rtl"] .message.bot .message-content {
    align-items: flex-start;
}

/* Markdown inside bot bubbles: RTL list padding + blockquote border */
html[dir="rtl"] .message.bot .message-bubble ul,
html[dir="rtl"] .message.bot .message-bubble ol { padding-left: 0; padding-right: 24px; }

html[dir="rtl"] .message.bot .message-bubble blockquote {
    border-left: none;
    border-right: 3px solid var(--primary-red);
    border-radius: 8px 0 0 8px;
}

/* Streaming cursor: mirror to right side */
html[dir="rtl"] .message.streaming .message-bubble:not(:empty)::after {
    margin-left: 0;
    margin-right: 1px;
}

/* Message toolbars */
html[dir="rtl"] .msg-actions { flex-direction: row-reverse; }
html[dir="rtl"] .msg-toolbar { flex-direction: row-reverse; }
html[dir="rtl"] .message-edit-actions { flex-direction: row-reverse; }

/* ── Code blocks: always LTR — code is not bidirectional text ── */
html[dir="rtl"] .cb-container {
    direction: ltr;
    text-align: left;
}

html[dir="rtl"] .cb-header {
    direction: ltr;
}

html[dir="rtl"] .cb-pre,
html[dir="rtl"] .cb-pre code {
    direction: ltr;
    text-align: left;
    unicode-bidi: embed;
}

/* Inline code inside RTL bot bubble must stay LTR */
html[dir="rtl"] .message.bot .message-bubble code {
    direction: ltr;
    unicode-bidi: embed;
    display: inline-block;
}

/* ── RTL list rendering: bullets + alignment ── */
html[dir="rtl"] .message.bot .message-bubble ul,
html[dir="rtl"] .message.bot .message-bubble ol {
    padding-left: 0;
    padding-right: 24px;
    direction: rtl;
    text-align: right;
}

html[dir="rtl"] .message.bot .message-bubble li {
    text-align: right;
}

html[dir="rtl"] .message.bot .message-bubble ul li::marker {
    content: '◂ ';
}

html[dir="rtl"] .message.bot .message-bubble blockquote p {
    text-align: right;
}

/* ── 6. Input area: LTR layout, RTL text inside textarea ── */
html[dir="rtl"] .chatgpt-input-container,
html[dir="rtl"] .chatgpt-input-inner {
    direction: ltr;
}

html[dir="rtl"] .chatgpt-textarea {
    direction: rtl;
    text-align: right;
}

/* ── 7. Modals & Dialogs: apply RTL text direction for proper alignment ── */
html[dir="rtl"] .settings-container,
html[dir="rtl"] .upgrade-modal-container,
html[dir="rtl"] .auth-card,
html[dir="rtl"] .share-container {
    direction: rtl;
    text-align: right;
}

html[dir="rtl"] .settings-header,
html[dir="rtl"] .share-header { flex-direction: row-reverse; }

html[dir="rtl"] .setting-item { flex-direction: row-reverse; }
html[dir="rtl"] .setting-label { flex-direction: row-reverse; }

html[dir="rtl"] .dropdown-item { flex-direction: row-reverse; }
html[dir="rtl"] .upload-menu-item { flex-direction: row-reverse; }

html[dir="rtl"] .pro-hero { text-align: center; }
html[dir="rtl"] .pro-features { direction: rtl; }
html[dir="rtl"] .pro-feat { flex-direction: row-reverse; }

html[dir="rtl"] .form-group { text-align: right; }
html[dir="rtl"] .form-label { flex-direction: row-reverse; }
html[dir="rtl"] .form-input { text-align: right; direction: rtl; }

html[dir="rtl"] .register-google-perks { direction: rtl; }
html[dir="rtl"] .register-google-perks li { flex-direction: row-reverse; }

html[dir="rtl"] .brand-title { flex-direction: row-reverse; }

html[dir="rtl"] .account-profile-header { flex-direction: row-reverse; }
html[dir="rtl"] .account-title-info { text-align: right; align-items: flex-end; }

/* ── RTL light-mode sidebar border mirror ── */
body.light html[dir="rtl"] .chatgpt-sidebar {
    border-right: none;
    border-left: 1px solid #E0E0E0;
}

/* ── RTL chat-item active accent: right edge instead of left ── */
html[dir="rtl"] .chatgpt-chat-item {
    flex-direction: row-reverse;
}

/* ── RTL sidebar user profile: avatar on right ── */
html[dir="rtl"] .chatgpt-user-profile {
    flex-direction: row-reverse;
}
html[dir="rtl"] .chatgpt-user-info { text-align: right; }

/* ── RTL sidebar header: close-btn and new-chat btn swap ── */
html[dir="rtl"] .chatgpt-sidebar-header {
    flex-direction: row-reverse;
}

/* ── RTL new-chat button: icon on right ── */
html[dir="rtl"] .chatgpt-new-chat-btn {
    flex-direction: row-reverse;
}

/* ── RTL nav badge: push to right (start) edge ── */
html[dir="rtl"] .chatgpt-badge {
    margin-left: 0;
    margin-right: auto;
}

/* ── Mobile RTL: sidebar slides in from the RIGHT ── */
@media (max-width: 768px) {
    html[dir="rtl"] .chatgpt-sidebar {
        left: auto;
        right: 0;
        transform: translateX(100%);
    }
    html[dir="rtl"] .chatgpt-sidebar.open {
        transform: translateX(0);
        box-shadow: -24px 0 60px rgba(0,0,0,0.7);
    }
}

/* ═══════════════════════════════════════════════════════════
   CYBER-MARINE RGB MOUSE EFFECT
   ═══════════════════════════════════════════════════════════ */

body[data-theme="marine"] {
    background:
        radial-gradient(700px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
            rgba(6,182,212,0.07) 0%,
            transparent 65%),
        radial-gradient(900px circle at 15% 85%,
            rgba(59,130,246,0.06) 0%,
            transparent 60%),
        radial-gradient(700px circle at 85% 15%,
            rgba(139,92,246,0.05) 0%,
            transparent 60%),
        linear-gradient(160deg, #010E1C 0%, #020A14 55%, #010810 100%);
    transition: background 0.05s linear;
}

body[data-theme="marine"] .chatgpt-chat-area,
body[data-theme="marine"] .chatgpt-main {
    background: transparent;
}

body[data-theme="marine"] .chatgpt-sidebar {
    background: rgba(1,10,22,0.88);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
}

body[data-theme="marine"] .chatgpt-topbar {
    background: rgba(1,10,20,0.82);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
}

.account-profile-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: rgba(255,255,255,0.025);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-md);
    margin-bottom: 10px;
}

.account-avatar {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary-red) 0%, rgba(139,92,246,0.6) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: white;
    box-shadow: 0 0 16px rgba(220,38,38,0.18);
    flex-shrink: 0;
}

.account-title-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.account-title-info h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
}

.account-title-info .chatgpt-badge {
    align-self: flex-start;
    padding: 2px 8px;
    font-size: 10px;
    border-radius: 6px;
    font-weight: 700;
    text-transform: uppercase;
}

.setting-item.account-usage-item {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}

.account-usage-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.account-usage-progress {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.account-progress-track {
    height: 6px;
    background: rgba(255,255,255,0.06);
    border-radius: 6px;
    overflow: hidden;
}

.account-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary-red) 0%, #8b5cf6 100%);
    border-radius: 6px;
    transition: width 0.5s cubic-bezier(0.4,0,0.2,1);
}

.account-progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
}

.account-upgrade-cta-btn {
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, rgba(220,38,38,0.18), rgba(139,92,246,0.15));
    border: 1px solid rgba(220,38,38,0.3);
    border-radius: 11px;
    color: #fca5a5;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all var(--transition);
    box-shadow: 0 4px 16px rgba(220,38,38,0.12);
    margin-top: 8px;
}

.account-upgrade-cta-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(220,38,38,0.22);
    background: linear-gradient(135deg, rgba(220,38,38,0.25), rgba(139,92,246,0.22));
    color: #fecaca;
}

.account-upgrade-cta-btn:active { transform: translateY(0); }

.chatgpt-attach-btn.recording-pulse {
    background: rgba(220,38,38,0.2) !important;
    color: var(--primary-red-light) !important;
    animation: recording-pulse-anim 1.5s infinite ease-in-out;
}

@keyframes recording-pulse-anim {
    0% { box-shadow: 0 0 0 0 rgba(220,38,38,0.5); }
    70% { box-shadow: 0 0 0 8px rgba(220,38,38,0); }
    100% { box-shadow: 0 0 0 0 rgba(220,38,38,0); }
}

.inline-attachment-image {
    margin-top: 10px;
    border-radius: 12px;
    overflow: hidden;
    max-width: 100%;
    max-height: 240px;
    border: 1px solid var(--border-dark);
    box-shadow: 0 4px 18px rgba(0,0,0,0.3);
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition);
    display: block;
}

.inline-attachment-image:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 28px rgba(0,0,0,0.4);
}

.inline-attachment-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.inline-attachment-file {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding: 9px 14px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-dark);
    border-radius: 11px;
    color: var(--text-primary) !important;
    text-decoration: none !important;
    font-size: 13.5px;
    transition: all var(--transition);
}

.inline-attachment-file:hover {
    background: rgba(255,255,255,0.07);
    border-color: rgba(220,38,38,0.25);
}

.inline-attachment-file i {
    font-size: 17px;
    color: var(--primary-red);
}

.attachment-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding: 7px 11px;
    border-bottom: 1px solid var(--border-dark);
    background: rgba(0,0,0,0.12);
}

.attachment-preview-card {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 9px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-dark);
    border-radius: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.attachment-preview-card img {
    width: 22px;
    height: 22px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border-dark);
}

.attachment-preview-card i {
    color: var(--primary-red);
}

.attachment-preview-remove {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 13px;
    transition: color var(--transition);
    margin-left: 3px;
}

.attachment-preview-remove:hover { color: var(--primary-red); }

@keyframes appMount {
    0% { opacity: 0; transform: scale(0.985) translateY(6px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

.chatgpt-app-container {
    animation: appMount 0.55s cubic-bezier(0.16,1,0.3,1) both;
}

@keyframes sidebarSlideIn {
    0% { opacity: 0; transform: translateX(-18px); }
    100% { opacity: 1; transform: translateX(0); }
}

.chatgpt-sidebar-header,
.chatgpt-sidebar-nav,
.chatgpt-sidebar-footer {
    animation: sidebarSlideIn 0.5s cubic-bezier(0.16,1,0.3,1) both;
}

.chatgpt-sidebar-header { animation-delay: 0.05s; }
.chatgpt-sidebar-nav { animation-delay: 0.1s; }
.chatgpt-sidebar-footer { animation-delay: 0.15s; }

@keyframes welcomePop {
    0% { opacity: 0; transform: scale(0.88) translateY(20px); }
    65% { transform: scale(1.03) translateY(-2px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

.chatgpt-welcome {
    animation: welcomePop 0.75s cubic-bezier(0.16,1,0.3,1) both;
    animation-delay: 0.18s;
}

@keyframes logoFloat {
    0%,100% { transform: translateY(0px) rotate(0deg); }
    30% { transform: translateY(-5px) rotate(-1deg); }
    70% { transform: translateY(-3px) rotate(1deg); }
}

.chatgpt-logo {
    animation: logoFloat 5s ease-in-out infinite, welcomePop 0.75s cubic-bezier(0.16,1,0.3,1) both;
    animation-delay: 0s, 0.2s;
}

@keyframes titleGlide {
    0% { opacity: 0; transform: translateY(14px); letter-spacing: -3px; }
    100% { opacity: 1; transform: translateY(0); letter-spacing: -0.5px; }
}

.chatgpt-welcome-title {
    animation: titleGlide 0.65s cubic-bezier(0.16,1,0.3,1) both;
    animation-delay: 0.3s;
}

@keyframes msgSlideIn {
    0% { opacity: 0; transform: translateY(16px) scale(0.97); filter: blur(2px); }
    70% { filter: blur(0); }
    100% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

.message {
    animation: msgSlideIn 0.45s cubic-bezier(0.16,1,0.3,1) both;
}

.message.user {
    animation: msgSlideInRight 0.45s cubic-bezier(0.16,1,0.3,1) both;
}

@keyframes msgSlideInRight {
    0% { opacity: 0; transform: translateY(14px) translateX(14px) scale(0.97); }
    100% { opacity: 1; transform: translateY(0) translateX(0) scale(1); }
}

.chatgpt-send-btn {
    transition: background 0.22s cubic-bezier(0.4,0,0.2,1),
                transform 0.18s cubic-bezier(0.34,1.56,0.64,1),
                box-shadow 0.22s cubic-bezier(0.4,0,0.2,1);
}

.chatgpt-send-btn:not(:disabled):active {
    transform: scale(0.88);
    box-shadow: 0 1px 6px rgba(220,38,38,0.3);
}

.chatgpt-new-chat-btn {
    transition: background 0.3s cubic-bezier(0.4,0,0.2,1),
                border-color 0.3s,
                box-shadow 0.3s,
                transform 0.18s cubic-bezier(0.34,1.56,0.64,1);
}

.chatgpt-new-chat-btn:active {
    transform: scale(0.95);
}

.chatgpt-nav-item {
    transition: background 0.28s cubic-bezier(0.4,0,0.2,1),
                color 0.28s,
                border-color 0.28s,
                transform 0.18s cubic-bezier(0.34,1.56,0.64,1);
}

.chatgpt-nav-item:active {
    transform: scale(0.96) translateX(2px);
}

.chatgpt-chat-item {
    transition: background 0.28s cubic-bezier(0.4,0,0.2,1),
                color 0.28s,
                border-color 0.28s,
                transform 0.16s cubic-bezier(0.34,1.56,0.64,1);
}

.chatgpt-chat-item:active {
    transform: scale(0.97);
}

@keyframes chatItemEnter {
    0% { opacity: 0; transform: translateX(-12px); }
    100% { opacity: 1; transform: translateX(0); }
}

.chatgpt-chat-item {
    animation: chatItemEnter 0.35s cubic-bezier(0.16,1,0.3,1) both;
}

.chats-group:nth-child(1) .chatgpt-chat-item { animation-delay: calc(0.04s * var(--i, 0)); }
.chats-group:nth-child(2) .chatgpt-chat-item { animation-delay: calc(0.04s * var(--i, 0) + 0.08s); }
.chats-group:nth-child(3) .chatgpt-chat-item { animation-delay: calc(0.04s * var(--i, 0) + 0.14s); }
.chats-group:nth-child(4) .chatgpt-chat-item { animation-delay: calc(0.04s * var(--i, 0) + 0.2s); }

.submit-btn {
    transition: background 0.3s cubic-bezier(0.4,0,0.2,1),
                border-color 0.3s,
                color 0.3s,
                box-shadow 0.3s,
                transform 0.18s cubic-bezier(0.34,1.56,0.64,1);
    position: relative;
    overflow: hidden;
}

.submit-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.4s;
    pointer-events: none;
    border-radius: inherit;
}

.submit-btn:hover::after {
    opacity: 1;
}

.submit-btn:active {
    transform: scale(0.96) translateY(1px);
}

.submit-btn:not(:disabled) {
    position: relative;
}

.submit-btn:not(:disabled)::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(220,38,38,0.4), rgba(139,92,246,0.3));
    opacity: 0;
    transition: opacity 0.4s;
    z-index: -1;
    filter: blur(8px);
}

.submit-btn:not(:disabled):hover::before {
    opacity: 1;
}

.google-btn,
.google-btn-primary {
    transition: background 0.32s cubic-bezier(0.4,0,0.2,1),
                border-color 0.32s,
                color 0.32s,
                box-shadow 0.32s,
                transform 0.18s cubic-bezier(0.34,1.56,0.64,1);
}

.google-btn:active,
.google-btn-primary:active {
    transform: scale(0.97) translateY(0) !important;
}

.form-input {
    transition: border-color 0.35s cubic-bezier(0.4,0,0.2,1),
                box-shadow 0.35s cubic-bezier(0.4,0,0.2,1),
                background 0.35s;
}

.form-input:focus {
    animation: inputFocusPop 0.4s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes inputFocusPop {
    0% { transform: scale(1); }
    40% { transform: scale(1.008); }
    100% { transform: scale(1); }
}

.auth-card {
    animation: authCardIn 0.5s cubic-bezier(0.16,1,0.3,1) both;
}

@keyframes authCardIn {
    0% { opacity: 0; transform: translateY(30px) scale(0.94); filter: blur(6px); }
    60% { filter: blur(0); }
    100% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

.auth-overlay {
    animation: overlayFadeIn 0.4s ease both;
}

@keyframes overlayFadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

.tab-btn {
    transition: background 0.3s cubic-bezier(0.4,0,0.2,1),
                color 0.3s,
                border-color 0.3s,
                box-shadow 0.25s,
                transform 0.16s cubic-bezier(0.34,1.56,0.64,1);
}

.tab-btn:active {
    transform: scale(0.94);
}

.tab-btn.active {
    animation: tabActivate 0.35s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes tabActivate {
    0% { transform: scale(0.92); }
    60% { transform: scale(1.04); }
    100% { transform: scale(1); }
}

.settings-container,
.upgrade-modal-container {
    animation: modalSpring 0.5s cubic-bezier(0.16,1,0.3,1) both;
}

@keyframes modalSpring {
    0% { opacity: 0; transform: translateY(28px) scale(0.93); filter: blur(8px); }
    55% { filter: blur(0); }
    100% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

.setting-item {
    transition: background 0.32s cubic-bezier(0.4,0,0.2,1),
                border-color 0.32s,
                transform 0.2s cubic-bezier(0.34,1.56,0.64,1);
}

.setting-item:hover {
    transform: translateX(2px);
}

.dropdown-menu.show {
    animation: dropdownPop 0.28s cubic-bezier(0.16,1,0.3,1) both;
}

@keyframes dropdownPop {
    0% { opacity: 0; transform: translateY(10px) scale(0.94); filter: blur(4px); }
    100% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

.dropdown-item {
    transition: background 0.22s cubic-bezier(0.4,0,0.2,1),
                color 0.22s,
                border-color 0.22s,
                transform 0.16s cubic-bezier(0.34,1.56,0.64,1);
}

.dropdown-item:active {
    transform: scale(0.96);
}

.chatgpt-login-cta {
    transition: background 0.32s cubic-bezier(0.4,0,0.2,1),
                border-color 0.32s,
                color 0.32s,
                box-shadow 0.32s,
                transform 0.18s cubic-bezier(0.34,1.56,0.64,1);
    position: relative;
    overflow: hidden;
}

.chatgpt-login-cta::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255,255,255,0.12);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.5s cubic-bezier(0.4,0,0.2,1), height 0.5s cubic-bezier(0.4,0,0.2,1), opacity 0.5s;
    opacity: 0;
    pointer-events: none;
}

.chatgpt-login-cta:active::after {
    width: 200px;
    height: 200px;
    opacity: 0;
}

.chatgpt-login-cta:active {
    transform: scale(0.97);
}

.chatgpt-upgrade-btn {
    transition: background 0.3s cubic-bezier(0.4,0,0.2,1),
                border-color 0.3s,
                color 0.3s,
                box-shadow 0.3s,
                transform 0.18s cubic-bezier(0.34,1.56,0.64,1);
}

.chatgpt-upgrade-btn:active {
    transform: scale(0.95);
}

.pro-cta-btn {
    transition: background 0.35s cubic-bezier(0.4,0,0.2,1),
                box-shadow 0.35s,
                transform 0.2s cubic-bezier(0.34,1.56,0.64,1);
    position: relative;
    overflow: hidden;
}

.pro-cta-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.12) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.4s;
}

.pro-cta-btn:hover::before {
    opacity: 1;
}

.pro-cta-btn:active {
    transform: scale(0.97) translateY(0) !important;
}

.pro-plan-inner {
    transition: border-color 0.35s cubic-bezier(0.4,0,0.2,1),
                background 0.35s,
                box-shadow 0.35s,
                transform 0.2s cubic-bezier(0.34,1.56,0.64,1);
}

.pro-plan:hover .pro-plan-inner {
    transform: translateY(-2px);
}

.pro-plan input:checked ~ .pro-plan-inner {
    transform: scale(1.03);
}

.pro-activate-btn {
    transition: background 0.3s cubic-bezier(0.4,0,0.2,1),
                border-color 0.3s,
                color 0.3s,
                transform 0.16s cubic-bezier(0.34,1.56,0.64,1);
}

.pro-activate-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.chatgpt-user-profile {
    transition: background 0.3s cubic-bezier(0.4,0,0.2,1),
                border-color 0.3s,
                transform 0.18s cubic-bezier(0.34,1.56,0.64,1);
}

.chatgpt-user-profile:active {
    transform: scale(0.97);
}

.account-upgrade-cta-btn {
    transition: background 0.35s cubic-bezier(0.4,0,0.2,1),
                border-color 0.35s,
                color 0.35s,
                box-shadow 0.35s,
                transform 0.2s cubic-bezier(0.34,1.56,0.64,1);
}

.account-upgrade-cta-btn:active {
    transform: scale(0.97) translateY(0) !important;
}

.msg-action-btn {
    transition: background 0.22s cubic-bezier(0.4,0,0.2,1),
                color 0.22s,
                border-color 0.22s,
                transform 0.14s cubic-bezier(0.34,1.56,0.64,1);
}

.msg-action-btn:active {
    transform: scale(0.82);
}

.upload-menu-item {
    transition: background 0.25s cubic-bezier(0.4,0,0.2,1),
                color 0.25s,
                transform 0.16s cubic-bezier(0.34,1.56,0.64,1);
}

.upload-menu-item:active {
    transform: scale(0.95);
}

.chatgpt-upload-menu.active {
    animation: uploadMenuPop 0.3s cubic-bezier(0.16,1,0.3,1) both;
}

@keyframes uploadMenuPop {
    0% { opacity: 0; transform: scale(0.88) translateY(8px); filter: blur(4px); }
    100% { opacity: 1; transform: scale(1) translateY(0); filter: blur(0); }
}

@keyframes quotaUpdate {
    0% { transform: scale(1); }
    30% { transform: scale(1.12); }
    70% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

.chatgpt-counter-text.quota-update {
    animation: quotaUpdate 0.45s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes shimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

.chatgpt-logo .logo-mark {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
    overflow: hidden;
}
.chatgpt-logo .logo-mark img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
    display: block;
}

.message-edit-area {
    transition: border-color 0.35s cubic-bezier(0.4,0,0.2,1),
                box-shadow 0.35s;
    animation: msgSlideIn 0.35s cubic-bezier(0.16,1,0.3,1) both;
}

.message-edit-btn {
    transition: background 0.25s cubic-bezier(0.4,0,0.2,1),
                color 0.25s,
                border-color 0.25s,
                box-shadow 0.25s,
                transform 0.16s cubic-bezier(0.34,1.56,0.64,1);
}

.message-edit-btn:active {
    transform: scale(0.94);
}

.chatgpt-sidebar.closed {
    transition: width 0.4s cubic-bezier(0.4,0,0.2,1),
                min-width 0.4s cubic-bezier(0.4,0,0.2,1),
                opacity 0.35s;
}

.chatgpt-desktop-toggle {
    transition: background 0.28s cubic-bezier(0.4,0,0.2,1),
                border-color 0.28s,
                color 0.28s,
                transform 0.18s cubic-bezier(0.34,1.56,0.64,1);
}

.chatgpt-desktop-toggle:active {
    transform: scale(0.9) rotate(-8deg);
}

.chatgpt-sidebar-close-btn {
    transition: background 0.28s,
                border-color 0.28s,
                color 0.28s,
                transform 0.18s cubic-bezier(0.34,1.56,0.64,1);
}

.chatgpt-sidebar-close-btn:active {
    transform: scale(0.88) rotate(8deg);
}

.toggle-slider {
    transition: background 0.4s cubic-bezier(0.4,0,0.2,1),
                border-color 0.4s;
}

.toggle-slider::before {
    transition: transform 0.4s cubic-bezier(0.34,1.56,0.64,1),
                background 0.4s;
}

.account-progress-fill {
    transition: width 0.7s cubic-bezier(0.16,1,0.3,1);
}

@keyframes progressPulse {
    0%,100% { opacity: 1; }
    50% { opacity: 0.7; filter: brightness(1.3); }
}

.account-progress-fill {
    animation: progressPulse 2.5s ease-in-out infinite;
}

.inline-attachment-image {
    animation: msgSlideIn 0.4s cubic-bezier(0.16,1,0.3,1) both;
}

.attachment-preview-card {
    animation: chatItemEnter 0.3s cubic-bezier(0.16,1,0.3,1) both;
}

.chatgpt-sidebar {
    transition: width 0.4s cubic-bezier(0.4,0,0.2,1),
                min-width 0.4s cubic-bezier(0.4,0,0.2,1),
                transform 0.4s cubic-bezier(0.16,1,0.3,1);
}

.settings-close-btn {
    transition: background 0.28s,
                color 0.28s,
                border-color 0.28s,
                transform 0.16s cubic-bezier(0.34,1.56,0.64,1);
}

.settings-close-btn:active {
    transform: scale(0.85) rotate(90deg);
}

.auth-close-btn {
    transition: background 0.28s,
                color 0.28s,
                border-color 0.28s,
                transform 0.16s cubic-bezier(0.34,1.56,0.64,1);
}

.auth-close-btn:active {
    transform: scale(0.85) rotate(90deg);
}

.upgrade-modal-close:active {
    transform: scale(0.85) rotate(90deg);
    transition: transform 0.16s cubic-bezier(0.34,1.56,0.64,1);
}

.upgrade-modal-close {
    transition: background 0.28s,
                color 0.28s,
                transform 0.16s cubic-bezier(0.34,1.56,0.64,1);
}

.setting-select {
    transition: border-color 0.32s cubic-bezier(0.4,0,0.2,1),
                background 0.32s,
                box-shadow 0.32s;
}

.setting-action-btn {
    transition: background 0.3s cubic-bezier(0.4,0,0.2,1),
                border-color 0.3s,
                color 0.3s,
                transform 0.16s cubic-bezier(0.34,1.56,0.64,1);
}

.setting-action-btn:active {
    transform: scale(0.94);
}

@keyframes streamingBounce {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(1.3); }
}

.message.streaming .message-bubble::after {
    animation: streamCursor 0.85s steps(2,start) infinite,
               streamingBounce 1.2s ease-in-out infinite;
}

.chatgpt-input-inner {
    transition: border-color 0.4s cubic-bezier(0.4,0,0.2,1),
                box-shadow 0.4s cubic-bezier(0.4,0,0.2,1);
}

.chatgpt-attach-btn {
    transition: background 0.25s cubic-bezier(0.4,0,0.2,1),
                color 0.25s,
                transform 0.18s cubic-bezier(0.34,1.56,0.64,1);
}

.chatgpt-attach-btn:active {
    transform: scale(0.85);
}

.chatgpt-attach-btn.active {
    transition: background 0.25s,
                color 0.25s,
                transform 0.35s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes logoGlowIntense {
    0%, 100% { opacity: 0.25; transform: scale(1); filter: blur(16px); }
    50% { opacity: 0.45; transform: scale(1.04); filter: blur(18px); }
}

.chatgpt-logo .logo-glow {
    animation: logoGlowIntense 4s ease-in-out infinite;
}

@keyframes particleFadeUp {
    0% { transform: translateY(100vh) rotate(0deg) scale(0); opacity: 0; }
    5% { opacity: 0.3; transform: translateY(95vh) rotate(18deg) scale(1); }
    95% { opacity: 0.15; }
    100% { transform: translateY(-8vh) rotate(360deg) scale(0.5); opacity: 0; }
}

.particle {
    animation: particleFadeUp 9s infinite linear;
}

html[dir="rtl"] .setting-item:hover {
    transform: translateX(-2px);
}

html[dir="rtl"] .chatgpt-nav-item:active {
    transform: scale(0.96) translateX(-2px);
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}


/* ═══════════════════════════════════════════════════════════
   PROFESSIONAL CODE BLOCKS
   ═══════════════════════════════════════════════════════════ */

.cb-container {
    margin: 12px 0;
    border-radius: 12px;
    overflow: hidden;
    background: #0d1117;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 4px 24px rgba(0,0,0,0.3);
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
}

.cb-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #161b22;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    min-height: 40px;
}

.cb-dots {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}

.cb-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: block;
}

.cb-dots span:nth-child(1) { background: #ff5f57; }
.cb-dots span:nth-child(2) { background: #febc2e; }
.cb-dots span:nth-child(3) { background: #28c840; }

.cb-lang {
    flex: 1;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.45);
    font-family: inherit;
}

.cb-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

.cb-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 6px;
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.6);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s ease;
    font-family: inherit;
    white-space: nowrap;
}

.cb-btn:hover {
    background: rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.9);
    border-color: rgba(255,255,255,0.22);
    transform: translateY(-1px);
}

.cb-btn.copied {
    background: rgba(40, 200, 64, 0.15);
    border-color: rgba(40, 200, 64, 0.4);
    color: #28c840;
}

.cb-btn i {
    font-size: 10px;
}

.cb-pre {
    margin: 0 !important;
    padding: 16px !important;
    background: transparent !important;
    border-radius: 0 !important;
    overflow-x: auto;
    font-size: 13px !important;
    line-height: 1.65 !important;
}

.cb-pre code {
    background: transparent !important;
    font-size: inherit !important;
    padding: 0 !important;
    border-radius: 0 !important;
    color: #e6edf3;
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace !important;
}

.cb-pre::-webkit-scrollbar {
    height: 6px;
}

.cb-pre::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.04);
}

.cb-pre::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 3px;
}

.token.comment,
.token.prolog,
.token.doctype,
.token.cdata { color: #8b949e; }
.token.punctuation { color: #c9d1d9; }
.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted { color: #79c0ff; }
.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted { color: #a5d6ff; }
.token.operator,
.token.entity,
.token.url { color: #d2a8ff; }
.token.atrule,
.token.attr-value,
.token.keyword { color: #ff7b72; }
.token.function,
.token.class-name { color: #d2a8ff; }
.token.regex,
.token.important,
.token.variable { color: #ffa657; }

/* ═══════════════════════════════════════════════════════════
   LONG MESSAGE COLLAPSE
   ═══════════════════════════════════════════════════════════ */

.msg-long {
    max-height: 8em;
    overflow: hidden;
    position: relative;
    transition: max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.msg-long::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: linear-gradient(to bottom, transparent, var(--user-bubble-fade, rgba(13,13,18,0.97)));
    pointer-events: none;
    transition: opacity 0.35s ease;
    z-index: 1;
}

.msg-long-expanded {
    max-height: 2000px;
}

.msg-long-expanded::after {
    opacity: 0;
}

.msg-expand-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    padding: 5px 14px;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    background: rgba(255,255,255,0.06);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--primary-red, #e53935);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.22s ease;
    align-self: flex-end;
    flex-shrink: 0;
}

html[dir="rtl"] .msg-expand-btn {
    align-self: flex-start;
}

.msg-expand-btn:hover {
    background: rgba(220,38,38,0.1);
    border-color: var(--primary-red, #e53935);
    transform: translateY(-1px);
}

.msg-expand-btn i {
    font-size: 10px;
    transition: transform 0.3s ease;
}

/* ═══════════════════════════════════════════════════════════
   SHARE MODAL
   ═══════════════════════════════════════════════════════════ */

.share-modal {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.share-modal[hidden] {
    display: none;
}

.share-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    cursor: pointer;
}

.share-container {
    position: relative;
    z-index: 1;
    background: var(--dark-surface, #1a1a2e);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    width: min(480px, 100%);
    padding: 28px;
    box-shadow: 0 24px 80px rgba(0,0,0,0.5);
    animation: modalSpring 0.35s cubic-bezier(0.34,1.56,0.64,1) both;
}

.share-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.share-header h3 {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary, #fff);
    margin: 0;
}

.share-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.share-desc {
    font-size: 14px;
    color: var(--text-secondary, rgba(255,255,255,0.6));
    margin: 0;
    line-height: 1.5;
}

.share-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 32px;
    color: rgba(255,255,255,0.4);
    text-align: center;
}

.share-empty-state i {
    font-size: 36px;
    opacity: 0.5;
}

.share-empty-state p {
    margin: 0;
    font-size: 14px;
}

.share-link-box {
    display: flex;
    gap: 8px;
    margin: 4px 0;
}

.share-link-input {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    background: rgba(255,255,255,0.05);
    color: var(--text-primary, #fff);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    cursor: text;
}

.share-copy-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border: 1px solid var(--primary-red, #e53935);
    border-radius: 10px;
    background: transparent;
    color: var(--primary-red, #e53935);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.share-copy-btn:hover {
    background: var(--primary-red, #e53935);
    color: #fff;
    transform: translateY(-1px);
}

.share-copy-btn.copied {
    background: rgba(40,200,64,0.12);
    border-color: #28c840;
    color: #28c840;
}

.share-btn-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.share-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.22s ease;
    border: none;
    width: 100%;
}

.share-enable-btn {
    background: var(--primary-red, #e53935);
    color: #fff;
}

.share-enable-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(229,57,53,0.35);
}

.share-enable-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.share-disable-btn {
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.65);
    border: 1px solid rgba(255,255,255,0.1);
}

.share-disable-btn:hover {
    background: rgba(255,59,59,0.12);
    border-color: rgba(255,59,59,0.3);
    color: #ff5555;
}

/* ════════════════════════════════════════════════════════
   IMAGE MODE BAR
   ════════════════════════════════════════════════════════ */
.image-mode-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin-bottom: 6px;
    background: linear-gradient(90deg, rgba(220,38,38,0.08) 0%, rgba(220,38,38,0.02) 100%);
    border: 1px solid rgba(220,38,38,0.18);
    border-radius: 12px;
    animation: imageModeIn 0.3s cubic-bezier(0.16,1,0.3,1) both;
}
@keyframes imageModeIn {
    from { opacity: 0; transform: translateY(-6px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0)   scale(1); }
}
.image-mode-icon {
    font-size: 15px;
    color: var(--primary-red);
    flex-shrink: 0;
    animation: imgModePulse 2s ease-in-out infinite;
}
@keyframes imgModePulse {
    0%,100% { opacity: 1; }
    50%      { opacity: 0.55; }
}
.image-mode-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary-red);
    flex-shrink: 0;
    letter-spacing: 0.1px;
}
.image-mode-hint {
    font-size: 12px;
    color: var(--text-muted);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.image-mode-exit {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.05);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    flex-shrink: 0;
    transition: all 0.18s;
}
.image-mode-exit:hover {
    background: rgba(220,38,38,0.1);
    border-color: rgba(220,38,38,0.3);
    color: var(--primary-red);
    transform: scale(1.05);
}

/* ════════════════════════════════════════════════════════
   SKELETON LOADER — shimmer while generating
   ════════════════════════════════════════════════════════ */
.gen-skeleton-bubble {
    padding: 0 !important;
    overflow: hidden !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    width: min(520px,100%);
}
.gen-skeleton-bubble::before,
.gen-skeleton-bubble::after { display: none !important; }

.gen-skeleton-body {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 18px;
    overflow: hidden;
    background: linear-gradient(135deg,
        rgba(255,255,255,0.035) 0%,
        rgba(255,255,255,0.015) 100%);
    border: 1px solid rgba(255,255,255,0.07);
}
.gen-skeleton-shine {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        110deg,
        transparent 25%,
        rgba(255,255,255,0.055) 45%,
        rgba(255,255,255,0.11)  50%,
        rgba(255,255,255,0.055) 55%,
        transparent 75%
    );
    background-size: 220% 100%;
    animation: shimmerSlide 1.8s ease-in-out infinite;
}
@keyframes shimmerSlide {
    0%   { background-position: -100% 0; }
    100% { background-position: 200%  0; }
}
.gen-skeleton-inner {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
}
.gen-skeleton-icon {
    font-size: 38px;
    color: var(--primary-red);
    opacity: 0.65;
    animation: skIconFloat 2.4s ease-in-out infinite;
}
@keyframes skIconFloat {
    0%,100% { transform: translateY(0) scale(1);    opacity: 0.65; }
    50%      { transform: translateY(-7px) scale(1.08); opacity: 1; }
}
.gen-skeleton-text {
    font-size: 14.5px;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.2px;
}
.gen-skeleton-dots { display: flex; gap: 7px; }
.gen-skeleton-dots span {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--primary-red);
    opacity: 0.4;
    animation: skDot 1.2s ease-in-out infinite;
}
.gen-skeleton-dots span:nth-child(2) { animation-delay: 0.2s; }
.gen-skeleton-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes skDot {
    0%,100% { transform: translateY(0);    opacity: 0.35; }
    50%      { transform: translateY(-6px); opacity: 1; }
}

/* ════════════════════════════════════════════════════════
   GENERATED IMAGE MESSAGE
   ════════════════════════════════════════════════════════ */
.gen-img-message .message-content { padding: 0; }

.gen-image-card {
    width: min(520px, 100%);
    border-radius: 20px;
    overflow: hidden;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.09);
    box-shadow:
        0 0 0 1px rgba(var(--primary-red-rgb, 220,38,38), 0.12),
        0 12px 40px rgba(0,0,0,0.38),
        0 3px 10px rgba(0,0,0,0.22);
    animation: genCardReveal 0.55s cubic-bezier(0.16,1,0.3,1) both;
    transition: transform 0.28s ease, box-shadow 0.28s ease;
}
.gen-image-card:hover {
    transform: translateY(-3px);
    box-shadow:
        0 0 0 1px rgba(220,38,38,0.22),
        0 20px 56px rgba(0,0,0,0.48),
        0 6px 18px rgba(0,0,0,0.28);
}
@keyframes genCardReveal {
    from { opacity: 0; transform: scale(0.9) translateY(16px); filter: blur(4px); }
    60%  { filter: blur(0); }
    to   { opacity: 1; transform: scale(1)   translateY(0);    filter: blur(0); }
}

.gen-image-wrap {
    position: relative;
    overflow: hidden;
    line-height: 0;
}
.gen-image-result {
    display: block;
    width: 100%;
    height: auto;
    max-height: 560px;
    object-fit: cover;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
    transition: transform 0.35s ease;
}
.gen-image-card:hover .gen-image-result { transform: scale(1.015); }

.gen-image-hover-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.0);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s, background 0.25s;
    pointer-events: none;
    font-size: 28px;
    color: rgba(255,255,255,0.85);
}
.gen-image-card:hover .gen-image-hover-overlay {
    opacity: 1;
    background: rgba(0,0,0,0.12);
}

.gen-image-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 14px;
    background: rgba(0,0,0,0.32);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255,255,255,0.07);
    min-height: 52px;
}

.gen-image-badge {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
}
.gen-badge-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--primary-red);
    box-shadow: 0 0 6px var(--primary-red);
    flex-shrink: 0;
    animation: badgePulse 2s ease-in-out infinite;
}
@keyframes badgePulse {
    0%,100% { box-shadow: 0 0 4px var(--primary-red); opacity: 1; }
    50%      { box-shadow: 0 0 10px var(--primary-red); opacity: 0.7; }
}
.gen-badge-text {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255,255,255,0.6);
    white-space: nowrap;
    letter-spacing: 0.2px;
}
.gen-badge-res {
    font-size: 11px;
    color: rgba(255,255,255,0.32);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.gen-dl-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 20px;
    background: linear-gradient(135deg, var(--primary-red) 0%, var(--primary-red-hover) 100%);
    color: #fff;
    border: none;
    border-radius: 11px;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    letter-spacing: 0.15px;
    transition: all 0.22s cubic-bezier(0.4,0,0.2,1);
    box-shadow: 0 2px 12px rgba(220,38,38,0.45), 0 1px 3px rgba(0,0,0,0.3);
    position: relative;
    overflow: hidden;
}
.gen-dl-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.12) 0%, transparent 60%);
    border-radius: inherit;
    pointer-events: none;
}
.gen-dl-btn:hover:not(:disabled) {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 6px 24px rgba(220,38,38,0.55), 0 2px 6px rgba(0,0,0,0.35);
}
.gen-dl-btn:active:not(:disabled) { transform: scale(0.97); }
.gen-dl-btn:disabled { opacity: 0.7; cursor: wait; }
.gen-dl-btn.gen-dl-done {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 2px 12px rgba(5,150,105,0.5);
}
.gen-dl-btn i { font-size: 13px; }

/* ════════════════════════════════════════════════════════
   LIGHT MODE
   ════════════════════════════════════════════════════════ */
body.light .image-mode-bar {
    background: linear-gradient(90deg, rgba(220,38,38,0.06) 0%, rgba(220,38,38,0.01) 100%);
    border-color: rgba(220,38,38,0.15);
}
body.light .image-mode-exit {
    background: #F0F0F0;
    border-color: #E0E0E0;
    color: #555555;
}
body.light .image-mode-exit:hover {
    background: rgba(220,38,38,0.07);
    border-color: rgba(220,38,38,0.2);
    color: var(--primary-red);
}
body.light .image-mode-hint { color: #888888; }

body.light .gen-skeleton-body {
    background: linear-gradient(135deg, #F0F0F0 0%, #E8E8E8 100%);
    border-color: #E0E0E0;
}
body.light .gen-skeleton-shine {
    background: linear-gradient(
        110deg,
        transparent 25%,
        rgba(255,255,255,0.5)  45%,
        rgba(255,255,255,0.85) 50%,
        rgba(255,255,255,0.5)  55%,
        transparent 75%
    );
    background-size: 220% 100%;
}
body.light .gen-skeleton-text { color: #555555; }

body.light .gen-image-card {
    background: #FFFFFF;
    border-color: #E0E0E0;
    box-shadow:
        0 0 0 1px rgba(220,38,38,0.1),
        0 12px 40px rgba(0,0,0,0.08),
        0 3px 10px rgba(0,0,0,0.04);
}
body.light .gen-image-card:hover {
    box-shadow:
        0 0 0 1px rgba(220,38,38,0.2),
        0 20px 56px rgba(0,0,0,0.12),
        0 6px 18px rgba(0,0,0,0.07);
}
body.light .gen-image-footer {
    background: rgba(248,248,248,0.95);
    border-top-color: #E0E0E0;
}
body.light .gen-badge-text { color: #555555; }
body.light .gen-badge-res  { color: #888888; }

.user-img-cmd {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}
.user-img-cmd i {
    color: var(--primary-red);
    font-size: 14px;
    flex-shrink: 0;
}

/* ════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .gen-image-card   { width: 100%; border-radius: 16px; }
    .gen-image-result { max-height: 380px; }
    .image-mode-hint  { display: none; }
    .gen-skeleton-body { aspect-ratio: 1/1; }
    .gen-dl-btn { padding: 9px 14px; font-size: 13px; }
    .gen-badge-res { display: none; }
}

/* ═══════════════════════════════════════════════════════════
   CODEX WEB — AI-powered split-screen web IDE
   ═══════════════════════════════════════════════════════════ */

.chatgpt-main { position: relative; }

.chatgpt-nav-item.active {
    background: rgba(220,38,38,0.1);
    color: var(--primary-red);
    border-color: rgba(220,38,38,0.3);
}
.chatgpt-nav-item.active i { color: var(--primary-red); }

/* === CODEX WEB — COMPLETE UI REDESIGN === */

.codex-view {
    position: absolute; inset: 0; z-index: 300;
    display: flex; flex-direction: column; background: var(--main-bg);
    animation: cdxFadeIn .18s ease;
}
@keyframes cdxFadeIn { from{opacity:0} to{opacity:1} }

.codex-toolbar {
    display: flex; align-items: center; height: 48px;
    padding: 0 10px; background: var(--sidebar-bg);
    border-bottom: 1px solid var(--border-dark);
    flex-shrink: 0; gap: 6px; position: relative; z-index: 10;
}
.cdx-tb-left  { display:flex; align-items:center; gap:8px; flex:1; min-width:0; }
.cdx-tb-center { position:absolute; left:50%; transform:translateX(-50%); }
.cdx-tb-right { display:flex; align-items:center; gap:4px; margin-left:auto; }
.cdx-tb-group { display:flex; align-items:center; gap:2px; }
.cdx-tb-sep   { width:1px; height:20px; background:var(--border-dark); margin:0 4px; }

.cdx-tb-btn, .codex-back-btn {
    width:34px; height:34px; border:none;
    background:transparent; color:var(--text-secondary);
    border-radius:9px; cursor:pointer;
    display:flex; align-items:center; justify-content:center;
    font-size:13px; transition:background .14s,color .14s; flex-shrink:0;
}
.cdx-tb-btn:hover, .codex-back-btn:hover { background:var(--hover-bg); color:var(--text-primary); }
.cdx-tb-btn.active { background:var(--primary-red); color:#fff; }

.codex-brand { display:flex; align-items:center; gap:7px; font-size:13px; font-weight:700; color:var(--text-primary); }
.codex-brand-orb {
    width:26px; height:26px; border-radius:8px;
    background:linear-gradient(135deg,#dc2626,#7f1d1d);
    display:flex; align-items:center; justify-content:center;
    font-size:11px; color:#fff; box-shadow:0 2px 8px rgba(220,38,38,.4);
}
.codex-project-label {
    display:flex; align-items:center; gap:5px;
    font-size:12px; font-weight:600; color:var(--text-secondary);
    cursor:pointer; padding:4px 8px; border-radius:7px;
    transition:background .14s,color .14s; max-width:200px;
    border:1px solid transparent; overflow:hidden;
}
.codex-project-label:hover { background:var(--hover-bg); color:var(--text-primary); border-color:var(--border-dark); }
.codex-project-label:empty { display:none; }
.cdx-proj-text { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.cdx-proj-edit-ico { font-size:9px; opacity:0; transition:opacity .14s; flex-shrink:0; }
.codex-project-label:hover .cdx-proj-edit-ico { opacity:.6; }
.codex-project-label[contenteditable="true"] { background:var(--input-bg); border-color:var(--primary-red); color:var(--text-primary); outline:none; cursor:text; }

.codex-split { display:flex; flex:1; overflow:hidden; min-height:0; }
.codex-left-panel { display:flex; flex-direction:column; flex:1; min-width:0; overflow:hidden; }

.codex-resize-handle {
    width:5px; cursor:col-resize; background:transparent; flex-shrink:0; position:relative; transition:background .15s;
}
.codex-resize-handle::after {
    content:''; position:absolute; top:50%; left:50%; transform:translate(-50%,-50%);
    height:40px; width:3px; border-radius:3px; background:var(--border-dark); opacity:0; transition:opacity .15s;
}
.codex-resize-handle:hover::after,.codex-resize-handle.dragging::after { opacity:1; }
.codex-resize-handle:hover { background:rgba(220,38,38,.07); }
.codex-resize-handle.dragging { background:rgba(220,38,38,.12); }

.codex-right-panel {
    width:300px; min-width:240px; max-width:380px;
    display:flex; flex-direction:column;
    border-left:1px solid var(--border-dark); background:var(--sidebar-bg);
    overflow:hidden; flex-shrink:0;
}

/* Preview */
.codex-preview-wrap { display:flex; flex-direction:column; flex:1; overflow:hidden; }
.codex-preview-bar {
    display:flex; align-items:center; justify-content:space-between;
    height:38px; padding:0 10px; background:var(--sidebar-bg);
    border-bottom:1px solid var(--border-dark); flex-shrink:0; gap:6px;
}
.cpb-left  { display:flex; align-items:center; gap:8px; flex:1; min-width:0; }
.cpb-center { display:flex; align-items:center; gap:2px; }
.cpb-right { display:flex; align-items:center; gap:3px; }
.codex-live-dot { display:flex; align-items:center; gap:5px; font-size:10px; font-weight:600; color:var(--text-secondary); white-space:nowrap; }
.codex-live-dot i { color:#22c55e; font-size:7px; animation:livePulse 2s ease-in-out infinite; }
@keyframes livePulse { 0%,100%{opacity:.5}50%{opacity:1} }
.codex-stream-file { font-size:10px; color:var(--primary-red); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:130px; }
.codex-live-sync { font-size:11px; color:var(--primary-red); }
.cdx-device-btn {
    width:28px; height:26px; border:1px solid transparent; border-radius:7px;
    background:transparent; color:var(--text-secondary); font-size:11px;
    cursor:pointer; display:flex; align-items:center; justify-content:center; transition:all .14s;
}
.cdx-device-btn:hover { background:var(--hover-bg); color:var(--text-primary); }
.cdx-device-btn.active { background:rgba(220,38,38,.12); border-color:rgba(220,38,38,.3); color:var(--primary-red); }
.cdx-pbar-btn {
    width:28px; height:26px; border:none; border-radius:7px;
    background:transparent; color:var(--text-secondary); font-size:11px;
    cursor:pointer; display:flex; align-items:center; justify-content:center; transition:all .14s;
}
.cdx-pbar-btn:hover { background:var(--hover-bg); color:var(--text-primary); }

.codex-iframe-shell {
    flex:1; display:flex; align-items:center; justify-content:center;
    overflow:hidden; background:#0a0b0f; position:relative; transition:padding .25s;
}
.codex-iframe-shell.device-tablet { padding:16px 70px; }
.codex-iframe-shell.device-mobile { padding:16px 150px; }
.codex-iframe {
    width:100%; height:100%; border:none; display:block; background:#fff;
    transition:box-shadow .25s,border-radius .25s;
}
.codex-iframe-shell.device-tablet .codex-iframe,
.codex-iframe-shell.device-mobile .codex-iframe {
    border-radius:14px; box-shadow:0 0 0 2px var(--border-dark),0 8px 40px rgba(0,0,0,.7);
}
.codex-iframe-shell.inspecting { box-shadow:inset 0 0 0 2px rgba(255,60,92,.6); }
.codex-iframe-shell.inspecting .codex-iframe { cursor:crosshair; }
.codex-inspect-banner {
    position:absolute; top:10px; left:50%; transform:translateX(-50%); z-index:30;
    display:none; align-items:center; gap:8px; max-width:92%;
    padding:7px 14px; border-radius:999px;
    background:rgba(20,20,24,.92); color:#fff; font-size:11px; font-weight:500;
    border:1px solid rgba(255,60,92,.5); box-shadow:0 6px 24px rgba(0,0,0,.45);
    backdrop-filter:blur(8px); -webkit-backdrop-filter:blur(8px);
    pointer-events:none; white-space:nowrap;
}
.codex-inspect-banner i { color:#ff3c5c; font-size:12px; }
.codex-fs-exit-btn {
    position:fixed; top:14px; right:14px; z-index:99999;
    width:40px; height:40px; border:none; border-radius:12px;
    background:rgba(0,0,0,.65); color:#fff; font-size:16px; cursor:pointer;
    display:none; align-items:center; justify-content:center;
    backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px);
    box-shadow:0 4px 20px rgba(0,0,0,.4);
    transition:background .18s,transform .15s;
}
.codex-fs-exit-btn:hover { background:rgba(220,38,38,.8); transform:scale(1.08); }

/* Workspace */
.codex-workspace-wrap { display:flex; flex:1; overflow:hidden; }
.codex-file-tree {
    width:150px; min-width:110px; border-right:1px solid var(--border-dark);
    overflow-y:auto; padding:6px 0; background:var(--sidebar-bg);
    display:flex; flex-direction:column; gap:1px; flex-shrink:0;
}
.codex-file-tree::-webkit-scrollbar { width:3px; }
.codex-file-tree::-webkit-scrollbar-thumb { background:var(--border-dark); border-radius:2px; }
.codex-tree-empty { padding:12px; font-size:11px; color:var(--text-secondary); opacity:.5; display:flex; align-items:center; gap:6px; }
.codex-tree-file {
    display:flex; align-items:center; gap:7px; padding:5px 10px;
    font-size:11px; color:var(--text-secondary); cursor:pointer;
    transition:background .12s,color .12s; border-radius:6px; margin:0 4px;
}
.codex-tree-file:hover { background:var(--hover-bg); color:var(--text-primary); }
.codex-tree-file.active { background:rgba(220,38,38,.1); color:var(--primary-red); font-weight:600; }
.codex-tree-file.building { color:var(--primary-red); }
.codex-tree-file.building::after {
    content:''; width:6px; height:6px; margin-left:auto; border-radius:50%;
    background:var(--primary-red); box-shadow:0 0 0 0 rgba(220,38,38,.5);
    animation:cdxBuildPulse 1.1s ease-in-out infinite;
}
@keyframes cdxBuildPulse {
    0% { box-shadow:0 0 0 0 rgba(220,38,38,.5); opacity:1; }
    70% { box-shadow:0 0 0 5px rgba(220,38,38,0); opacity:.6; }
    100% { box-shadow:0 0 0 0 rgba(220,38,38,0); opacity:1; }
}
.codex-tree-file i { font-size:10px; opacity:.6; }
.codex-editor-area { flex:1; display:flex; flex-direction:column; overflow:hidden; }
.codex-code-header {
    display:flex; align-items:center; justify-content:space-between;
    padding:5px 12px; background:var(--sidebar-bg); border-bottom:1px solid var(--border-dark); flex-shrink:0;
}
.codex-code-filename { font-size:11px; color:var(--text-primary); font-weight:600; }
.codex-code-hint { font-size:10px; color:var(--text-secondary); opacity:.5; }
.codex-code-editor {
    flex:1; border:none; outline:none; resize:none;
    background:var(--main-bg); color:var(--text-primary);
    font-family:'JetBrains Mono','Fira Code',monospace; font-size:12px;
    line-height:1.6; padding:14px 16px; tab-size:2; overflow-y:auto;
}
.codex-code-editor::-webkit-scrollbar { width:4px; }
.codex-code-editor::-webkit-scrollbar-thumb { background:var(--border-dark); border-radius:2px; }

/* Projects panel */
.codex-projects-panel { display:flex; flex-direction:column; flex:1; overflow:hidden; }
.codex-projects-header {
    display:flex; align-items:center; padding:10px 12px 8px;
    border-bottom:1px solid var(--border-dark); flex-shrink:0; gap:6px;
}
.cdx-proj-title { font-size:12px; font-weight:700; color:var(--text-primary); flex:1; }
.cdx-proj-count { font-size:10px; color:var(--text-secondary); font-weight:400; }
.cdx-proj-header-actions { display:flex; align-items:center; gap:5px; }
.cdx-sort-select {
    background:var(--input-bg); border:1px solid var(--border-dark);
    color:var(--text-secondary); border-radius:7px; font-size:10px;
    padding:3px 5px; cursor:pointer; outline:none; font-family:inherit;
}
.cdx-sort-select:focus { border-color:var(--primary-red); }
.codex-new-project-btn {
    display:flex; align-items:center; gap:4px;
    padding:5px 10px; border:none; border-radius:8px;
    background:var(--primary-red); color:#fff;
    font-size:11px; font-weight:600; cursor:pointer; font-family:inherit;
    transition:opacity .14s,transform .14s; white-space:nowrap;
}
.codex-new-project-btn:hover { opacity:.88; }
.codex-new-project-btn:active { transform:scale(.95); }

.codex-projects-list {
    flex:1; overflow-y:auto; padding:8px;
    display:flex; flex-direction:column; gap:6px;
}
.codex-projects-list::-webkit-scrollbar { width:3px; }
.codex-projects-list::-webkit-scrollbar-thumb { background:var(--border-dark); border-radius:2px; }

.codex-project-card {
    display:flex; align-items:center; gap:10px;
    padding:10px 12px; border:1px solid var(--border-dark); border-radius:12px;
    background:transparent; cursor:pointer;
    transition:background .15s,border-color .15s,transform .12s;
    position:relative;
}
.codex-project-card:hover { background:var(--hover-bg); border-color:rgba(220,38,38,.35); transform:translateX(3px); }
.cdx-card-orb {
    width:36px; height:36px; border-radius:10px;
    display:flex; align-items:center; justify-content:center;
    font-size:15px; font-weight:700; color:#fff; flex-shrink:0;
    box-shadow:0 2px 8px rgba(0,0,0,.25);
}
.cdx-card-info { flex:1; min-width:0; }
.cdx-card-name {
    font-size:12px; font-weight:600; color:var(--text-primary);
    white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
    outline:none; border-radius:3px;
}
.cdx-card-name[contenteditable="true"] { background:var(--hover-bg); padding:1px 4px; white-space:normal; border:1px solid var(--primary-red); color:var(--text-primary); }
.cdx-card-meta { font-size:10px; color:var(--text-secondary); margin-top:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.cdx-card-footer { display:flex; align-items:center; gap:2px; opacity:0; transition:opacity .14s; }
.codex-project-card:hover .cdx-card-footer { opacity:1; }
.cdx-card-action {
    width:26px; height:26px; border:none; border-radius:7px;
    background:transparent; color:var(--text-secondary); font-size:10px;
    cursor:pointer; display:flex; align-items:center; justify-content:center;
    transition:background .14s,color .14s;
}
.cdx-card-action:hover { background:var(--hover-bg); color:var(--text-primary); }
.cdx-card-action.del:hover { background:rgba(220,38,38,.12); color:var(--primary-red); }

/* Welcome empty state */
.codex-projects-empty { flex:1; display:flex; align-items:center; justify-content:center; padding:16px; }
.cdx-welcome { text-align:center; display:flex; flex-direction:column; align-items:center; gap:10px; }
.cdx-welcome-orb {
    width:54px; height:54px; border-radius:16px;
    background:linear-gradient(135deg,#dc2626,#7f1d1d);
    display:flex; align-items:center; justify-content:center;
    font-size:22px; color:#fff;
    box-shadow:0 6px 24px rgba(220,38,38,.4),0 0 0 8px rgba(220,38,38,.07);
    animation:cdxOrb 2.8s ease-in-out infinite;
}
@keyframes cdxOrb { 0%,100%{box-shadow:0 6px 24px rgba(220,38,38,.4),0 0 0 8px rgba(220,38,38,.07)} 50%{box-shadow:0 8px 32px rgba(220,38,38,.55),0 0 0 14px rgba(220,38,38,.1)} }
.cdx-welcome-title { font-size:15px; font-weight:700; color:var(--text-primary); margin:0; }
.cdx-welcome-sub { font-size:11px; color:var(--text-secondary); margin:0; line-height:1.5; max-width:200px; }
.codex-suggestions { display:flex; flex-direction:column; gap:5px; width:100%; }
.codex-suggestion-btn {
    display:flex; align-items:center; gap:8px;
    width:100%; padding:7px 11px; border:1px solid var(--border-dark);
    background:var(--main-bg); color:var(--text-secondary); border-radius:9px;
    font-size:11px; cursor:pointer; font-family:inherit; text-align:left;
    transition:border-color .14s,background .14s,color .14s,transform .14s;
}
.codex-suggestion-btn i { color:var(--primary-red); font-size:10px; flex-shrink:0; }
.codex-suggestion-btn:hover { border-color:rgba(220,38,38,.4); background:rgba(220,38,38,.05); color:var(--text-primary); transform:translateX(2px); }

/* Chat panel */
.codex-chat-panel { display:flex; flex-direction:column; flex:1; overflow:hidden; position:relative; }
.codex-chat-topbar {
    display:flex; align-items:center; gap:8px;
    padding:7px 10px; border-bottom:1px solid var(--border-dark);
    background:var(--sidebar-bg); flex-shrink:0;
}
.codex-back-to-proj {
    width:28px; height:28px; border:none; background:transparent;
    color:var(--text-secondary); border-radius:7px; cursor:pointer;
    display:flex; align-items:center; justify-content:center; font-size:12px;
    transition:background .14s,color .14s; flex-shrink:0;
}
.codex-back-to-proj:hover { background:var(--hover-bg); color:var(--text-primary); }
.codex-chat-proj-name { flex:1; font-size:12px; font-weight:600; color:var(--text-primary); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.cdx-chat-new-btn {
    width:26px; height:26px; border:none; background:transparent;
    color:var(--text-secondary); border-radius:7px; cursor:pointer;
    display:flex; align-items:center; justify-content:center; font-size:11px;
    transition:background .14s,color .14s; flex-shrink:0;
}
.cdx-chat-new-btn:hover { background:rgba(220,38,38,.1); color:var(--primary-red); }
.codex-messages { flex:1; overflow-y:auto; padding:12px 12px 8px; display:flex; flex-direction:column; gap:8px; min-height:0; }
.codex-messages::-webkit-scrollbar { width:3px; }
.codex-messages::-webkit-scrollbar-thumb { background:var(--border-dark); border-radius:2px; }
.codex-msg { font-size:12px; line-height:1.55; max-width:100%; word-break:break-word; }
.codex-msg-user { align-self:flex-end; background:var(--primary-red); color:#fff; padding:8px 11px; border-radius:12px 12px 3px 12px; max-width:85%; }
.codex-msg-bot { align-self:flex-start; background:var(--hover-bg); color:var(--text-secondary); padding:8px 11px; border-radius:3px 12px 12px 12px; max-width:92%; border:1px solid var(--border-dark); }
.typing-dots { display:inline-flex; gap:4px; padding:2px 0; }
.typing-dots span { width:5px; height:5px; border-radius:50%; background:var(--text-secondary); animation:tdot .9s ease-in-out infinite; }
.typing-dots span:nth-child(2){animation-delay:.2s} .typing-dots span:nth-child(3){animation-delay:.4s}
@keyframes tdot { 0%,60%,100%{transform:translateY(0);opacity:.4} 30%{transform:translateY(-5px);opacity:1} }

/* Resize handle (vertical) */
.codex-chat-resize { height:5px; background:transparent; cursor:ns-resize; flex-shrink:0; position:relative; transition:background .15s; }
.codex-chat-resize::after { content:''; position:absolute; left:50%; top:50%; transform:translate(-50%,-50%); width:28px; height:3px; border-radius:3px; background:var(--border-dark); opacity:0; transition:opacity .15s; }
.codex-chat-resize:hover { background:rgba(220,38,38,.08); }
.codex-chat-resize:hover::after,.codex-chat-resize.dragging::after { opacity:1; }
.codex-chat-resize.dragging { background:rgba(220,38,38,.12); }

/* Input */
.codex-input-wrap { display:flex; align-items:flex-end; gap:7px; padding:8px 10px; border-top:1px solid var(--border-dark); background:var(--sidebar-bg); flex-shrink:0; }
.codex-input {
    flex:1; border:1.5px solid var(--border-dark); background:var(--input-bg);
    color:var(--text-primary); border-radius:11px; padding:8px 12px;
    font-size:12px; font-family:inherit; resize:none; outline:none;
    line-height:1.5; min-height:36px; max-height:140px; transition:border-color .15s; overflow-y:auto;
}
.codex-input:focus { border-color:var(--primary-red); }
.codex-input::placeholder { color:var(--text-secondary); opacity:.5; }
.codex-send-btn { width:34px; height:34px; border:none; background:var(--primary-red); color:#fff; border-radius:10px; cursor:pointer; display:flex; align-items:center; justify-content:center; font-size:13px; transition:opacity .14s,transform .14s; flex-shrink:0; }
.codex-send-btn:disabled { opacity:.35; cursor:not-allowed; }
.codex-send-btn:not(:disabled):hover { opacity:.88; }
.codex-send-btn:not(:disabled):active { transform:scale(.92); }

/* Name modal */
.codex-name-modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,.55); display:flex; align-items:center; justify-content:center; z-index:99999; backdrop-filter:blur(4px); }
.codex-name-modal-box { background:var(--sidebar-bg); border:1px solid var(--border-dark); border-radius:16px; padding:22px 26px; min-width:300px; max-width:400px; width:90vw; box-shadow:0 20px 60px rgba(0,0,0,.5); display:flex; flex-direction:column; gap:14px; animation:nmFadeIn .18s ease; }
@keyframes nmFadeIn { from{opacity:0;transform:scale(.94) translateY(8px)} to{opacity:1;transform:none} }
.codex-name-modal-title { font-size:14px; font-weight:700; color:var(--text-primary); }
.codex-name-modal-input { width:100%; background:var(--input-bg); border:1.5px solid var(--border-dark); border-radius:10px; padding:9px 12px; font-size:13px; color:var(--text-primary); font-family:inherit; outline:none; transition:border-color .15s; box-sizing:border-box; }
.codex-name-modal-input:focus { border-color:var(--primary-red); }
.codex-name-modal-input::placeholder { color:var(--text-secondary); opacity:.5; }
.codex-name-modal-btns { display:flex; justify-content:flex-end; gap:8px; }
.codex-name-modal-cancel { padding:7px 14px; border:1px solid var(--border-dark); background:transparent; color:var(--text-secondary); border-radius:8px; font-size:12px; cursor:pointer; font-family:inherit; transition:background .13s,color .13s; }
.codex-name-modal-cancel:hover { background:var(--hover-bg); color:var(--text-primary); }
.codex-name-modal-ok { padding:7px 16px; border:none; background:var(--primary-red); color:#fff; border-radius:8px; font-size:12px; font-weight:600; cursor:pointer; font-family:inherit; transition:opacity .13s; }
.codex-name-modal-ok:hover { opacity:.88; }

/* Context ring */
.codex-chat-panel { position:relative; }
.codex-ctx-wrap { position:absolute; bottom:58px; right:10px; z-index:20; cursor:pointer; display:flex; flex-direction:column; align-items:flex-end; gap:4px; }
.codex-ctx-ring { width:34px; height:34px; opacity:.65; transition:opacity .2s,transform .2s; filter:drop-shadow(0 2px 6px rgba(0,0,0,.3)); }
.codex-ctx-wrap:hover .codex-ctx-ring { opacity:1; transform:scale(1.1); }
.codex-ctx-tooltip { display:none; background:var(--sidebar-bg); border:1px solid var(--border-dark); border-radius:8px; padding:7px 10px; font-size:11px; color:var(--text-secondary); white-space:pre; line-height:1.6; box-shadow:0 4px 16px rgba(0,0,0,.3); min-width:140px; text-align:left; }
.codex-ctx-tooltip.visible { display:block; }

/* Touch bubble */
.codex-touch-bubble { background:linear-gradient(135deg,rgba(220,38,38,.1),rgba(139,26,42,.07)); border:1px solid rgba(220,38,38,.2); border-radius:10px; padding:8px 12px; font-size:11px; color:var(--text-secondary); display:flex; align-items:center; gap:7px; animation:fadeInUp .3s ease; }
.codex-touch-bubble i { color:var(--primary-red); font-size:12px; }
@keyframes fadeInUp { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:none} }

.codex-resume-card { display:flex; align-items:center; gap:9px; flex-wrap:wrap; background:linear-gradient(135deg,rgba(245,158,11,.12),rgba(220,38,38,.08)); border:1px solid rgba(245,158,11,.3); border-radius:10px; padding:9px 12px; font-size:11px; color:var(--text-secondary); animation:fadeInUp .3s ease; }
.codex-resume-card > i { color:#f59e0b; font-size:13px; }
.codex-resume-card > span { flex:1; min-width:120px; }
.codex-resume-btn { display:inline-flex; align-items:center; gap:6px; background:var(--primary-red); color:#fff; border:none; border-radius:7px; padding:6px 12px; font-size:11px; font-weight:600; cursor:pointer; transition:filter .15s ease, transform .15s ease; }
.codex-resume-btn:hover { filter:brightness(1.08); transform:translateY(-1px); }
.cdx-card-badge { display:inline-flex; align-items:center; gap:4px; margin-inline-start:7px; padding:1px 7px; border-radius:999px; background:rgba(245,158,11,.16); color:#f59e0b; font-size:9px; font-weight:600; vertical-align:middle; }
.cdx-card-badge i { font-size:8px; }
.codex-project-card.is-interrupted { border-color:rgba(245,158,11,.32); }

.codex-plan-panel { flex:none; margin:8px 10px 0; border:1px solid var(--border-dark); border-radius:11px; background:var(--hover-bg); overflow:hidden; animation:fadeInUp .25s ease; }
.codex-plan-head { display:flex; align-items:center; gap:8px; padding:8px 11px; font-size:11px; font-weight:600; color:var(--text-primary); cursor:default; }
.codex-plan-head > i { color:var(--primary-red); font-size:12px; }
.codex-plan-title { flex:1; }
.codex-plan-progress { font-size:10px; font-weight:600; color:var(--text-secondary); background:var(--surface-dark); padding:1px 8px; border-radius:999px; }
.codex-plan-toggle { background:none; border:none; color:var(--text-secondary); cursor:pointer; padding:2px 4px; font-size:11px; }
.codex-plan-toggle:hover { color:var(--text-primary); }
.codex-plan-body { display:flex; flex-direction:column; gap:2px; padding:0 8px 8px; max-height:172px; overflow-y:auto; }
.codex-plan-panel.collapsed .codex-plan-body { display:none; }
.codex-plan-step { display:flex; align-items:flex-start; gap:8px; padding:5px 7px; border-radius:7px; font-size:11px; color:var(--text-secondary); line-height:1.35; }
.codex-plan-step > i { font-size:12px; margin-top:1px; flex:none; width:13px; text-align:center; }
.codex-plan-step.pending > i { color:var(--text-muted); }
.codex-plan-step.active { background:rgba(220,38,38,.08); color:var(--text-primary); }
.codex-plan-step.active > i { color:var(--primary-red); }
.codex-plan-step.done { color:var(--text-secondary); }
.codex-plan-step.done > i { color:#22c55e; }
.codex-plan-step.done .cps-label { text-decoration:line-through; opacity:.7; }
.cps-label { flex:1; word-break:break-word; }

.codex-history-panel { flex:none; margin:8px 10px 0; border:1px solid var(--border-dark); border-radius:11px; background:var(--hover-bg); overflow:hidden; animation:fadeInUp .25s ease; }
.codex-history-head { display:flex; align-items:center; gap:8px; padding:8px 11px; font-size:11px; font-weight:600; color:var(--text-primary); }
.codex-history-head > i { color:var(--primary-red); font-size:12px; }
.codex-history-title { flex:1; }
.codex-history-count { font-size:10px; font-weight:600; color:var(--text-secondary); background:var(--surface-dark); padding:1px 8px; border-radius:999px; }
.codex-history-toggle { background:none; border:none; color:var(--text-secondary); cursor:pointer; padding:2px 4px; font-size:11px; }
.codex-history-toggle:hover { color:var(--text-primary); }
.codex-history-body { display:flex; flex-direction:column; gap:3px; padding:0 8px 8px; max-height:180px; overflow-y:auto; }
.codex-history-panel.collapsed .codex-history-body { display:none; }
.codex-history-item { display:flex; align-items:center; gap:8px; padding:6px 8px; border-radius:7px; background:var(--surface-dark); font-size:11px; }
.chi-main { flex:1; min-width:0; display:flex; flex-direction:column; gap:1px; }
.chi-req { color:var(--text-primary); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.chi-files { color:var(--text-muted); font-size:10px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.chi-side { display:flex; align-items:center; gap:8px; flex:none; }
.chi-stat { font-size:10px; font-weight:600; }
.chi-add { color:#22c55e; }
.chi-del { color:#ef4444; }
.chi-restore { background:none; border:1px solid var(--border-dark); color:var(--text-secondary); cursor:pointer; padding:3px 7px; border-radius:6px; font-size:10px; }
.chi-restore:hover { color:var(--primary-red); border-color:var(--primary-red); }

.codex-diff-card { border:1px solid var(--border-dark); border-radius:10px; background:var(--surface-dark); overflow:hidden; font-size:11px; max-width:100%; }
.cdiff-head { display:flex; align-items:center; gap:7px; padding:7px 10px; font-weight:600; color:var(--text-primary); border-bottom:1px solid var(--border-dark); }
.cdiff-head > i { color:var(--primary-red); }
.cdiff-undo { margin-left:auto; background:none; border:1px solid var(--border-dark); color:var(--text-secondary); cursor:pointer; padding:3px 9px; border-radius:6px; font-size:10px; }
.cdiff-undo:hover { color:var(--primary-red); border-color:var(--primary-red); }
.cdiff-warn { display:flex; align-items:flex-start; gap:6px; padding:6px 10px; background:rgba(245,158,11,.1); color:#f59e0b; font-size:10px; line-height:1.4; }
.cdiff-file { border-bottom:1px solid var(--border-dark); }
.cdiff-file:last-child { border-bottom:none; }
.cdiff-fhead { display:flex; align-items:center; gap:7px; padding:6px 10px; color:var(--text-secondary); }
.cdiff-fname { color:var(--text-primary); font-weight:600; }
.cdiff-fstat { margin-left:auto; font-size:10px; font-weight:600; }
.cdiff-op { font-size:9px; font-weight:700; letter-spacing:.4px; padding:1px 6px; border-radius:4px; background:var(--hover-bg); color:var(--text-secondary); }
.cdiff-op-create { background:rgba(34,197,94,.15); color:#22c55e; }
.cdiff-op-delete { background:rgba(239,68,68,.15); color:#ef4444; }
.cdiff-op-insert { background:rgba(34,197,94,.13); color:#22c55e; }
.cdiff-op-move, .cdiff-op-rename, .cdiff-op-refactor { background:rgba(59,130,246,.15); color:#3b82f6; }
.cdiff-body { font-family:'SF Mono',Menlo,Consolas,monospace; font-size:10.5px; line-height:1.5; overflow-x:auto; max-height:260px; overflow-y:auto; padding:4px 0; }
.cdiff-line { white-space:pre; padding:0 10px; }
.cdiff-sign { display:inline-block; width:12px; opacity:.6; user-select:none; }
.cdiff-add { background:rgba(34,197,94,.12); color:#86efac; }
.cdiff-del { background:rgba(239,68,68,.12); color:#fca5a5; }
.cdiff-same { color:var(--text-muted); }
.cdiff-gap { padding:0 10px; color:var(--text-muted); user-select:none; }

.codex-val-panel { flex:none; margin:8px 10px 0; border:1px solid var(--border-dark); border-radius:11px; background:var(--hover-bg); overflow:hidden; animation:fadeInUp .25s ease; }
.codex-val-head { display:flex; align-items:center; gap:7px; padding:7px 11px; font-size:11px; font-weight:600; color:var(--text-primary); }
.codex-val-head > i { color:var(--primary-red); font-size:12px; flex:none; }
.codex-val-title { flex:none; }
.codex-val-summary { flex:1; display:flex; gap:5px; flex-wrap:wrap; align-items:center; }
.codex-val-ts { font-size:9.5px; color:var(--text-muted); font-weight:400; margin-left:2px; flex:none; }
.cv-s { font-size:10px; font-weight:700; padding:2px 7px; border-radius:999px; background:var(--surface-dark); display:flex; align-items:center; gap:3px; }
.cv-s i { font-size:9px; }
.cv-s.cv-all-pass { color:#22c55e; background:rgba(34,197,94,0.1); }
.cv-pass { color:#22c55e; }
.cv-warn { color:#f59e0b; }
.cv-err { color:#ef4444; }
.cv-fix { color:#3b82f6; }
.codex-val-toggle { background:none; border:none; color:var(--text-secondary); cursor:pointer; padding:2px 5px; font-size:11px; flex:none; margin-left:2px; }
.codex-val-toggle:hover { color:var(--text-primary); }
.codex-val-body { display:flex; flex-direction:column; gap:4px; padding:0 8px 8px; max-height:260px; overflow-y:auto; scrollbar-width:thin; scrollbar-color:var(--border-dark) transparent; }
.codex-val-panel.collapsed .codex-val-body { display:none; }
.cv-group { border:1px solid var(--border-dark); border-radius:8px; overflow:hidden; background:var(--surface-dark); }
.cv-group-err { border-color:rgba(239,68,68,0.25); background:rgba(239,68,68,0.04); }
.cv-group-warn { border-color:rgba(245,158,11,0.2); background:rgba(245,158,11,0.03); }
.cv-group-ok { border-color:rgba(34,197,94,0.15); }
.cv-group-fix { border-color:rgba(59,130,246,0.2); background:rgba(59,130,246,0.04); }
.cv-gtitle { padding:5px 9px; font-size:10.5px; font-weight:600; color:var(--text-primary); cursor:pointer; display:flex; align-items:center; gap:6px; }
.cv-g-icon { font-size:10px; flex:none; }
.cv-g-err { color:#ef4444; }
.cv-g-warn { color:#f59e0b; }
.cv-g-pass { color:#22c55e; }
.cv-g-fix { color:#3b82f6; }
.cv-g-fname { flex:1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.cv-g-count { font-size:9.5px; color:var(--text-muted); background:var(--hover-bg); border-radius:999px; padding:0 5px; margin-left:auto; flex:none; }
.cv-group.collapsed .cv-item { display:none; }
.cv-item { display:flex; align-items:flex-start; gap:6px; padding:3px 9px 3px 10px; font-size:10.5px; line-height:1.4; color:var(--text-secondary); border-top:1px solid var(--border-dark); }
.cv-item:first-of-type { border-top-color:transparent; }
.cv-item.cv-clickable { cursor:pointer; }
.cv-item.cv-clickable:hover { background:var(--hover-bg); }
.cv-item-icon { font-size:9.5px; flex:none; margin-top:2px; }
.cv-i-err .cv-item-icon { color:#ef4444; }
.cv-i-warn .cv-item-icon { color:#f59e0b; }
.cv-i-pass .cv-item-icon { color:#22c55e; }
.cv-i-fix .cv-item-icon { color:#3b82f6; }
.cv-dot { width:6px; height:6px; border-radius:50%; flex:none; margin-top:5px; }
.cv-i-err .cv-dot { background:#ef4444; }
.cv-i-warn .cv-dot { background:#f59e0b; }
.cv-i-pass .cv-dot { background:#22c55e; }
.cv-i-fix .cv-dot { background:#3b82f6; }
.cv-line { font-size:9px; font-family:'SF Mono',Menlo,Consolas,monospace; color:var(--text-muted); background:var(--surface-dark); border-radius:3px; padding:0 4px; flex:none; margin-top:1px; white-space:nowrap; }
.cv-fname { font-weight:600; color:var(--text-primary); margin-right:2px; }
.cv-msg { flex:1; word-break:break-word; }
.cv-where { color:var(--primary-red); font-family:'SF Mono',Menlo,Consolas,monospace; font-size:10px; font-weight:500; }
.cdx-card-badge.is-review { color:#f59e0b; }

/* Sidebar overlay in Codex mode */
.chatgpt-sidebar.codex-overlay-open { position:fixed !important; z-index:9000 !important; box-shadow:-24px 0 60px rgba(0,0,0,.7) !important; }

@media (max-width: 768px) {
    .codex-view { position: fixed; inset: 0; z-index: 500; }

    .codex-toolbar {
        height: 44px;
        padding: 0 8px;
        gap: 4px;
    }
    .cdx-tb-center { position: static; transform: none; flex: 1; justify-content: center; display: flex; }
    .codex-project-label { max-width: 120px; font-size: 11px; }
    .codex-brand span { display: none; }
    .cdx-tb-sep { display: none; }

    .codex-split {
        flex-direction: column;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .codex-left-panel {
        flex: 0 0 52vw;
        min-height: 52vw;
        max-height: 60vw;
        width: 100% !important;
        overflow: hidden;
    }

    .codex-preview-bar { height: 34px; padding: 0 8px; }
    .cpb-left { gap: 5px; }
    .codex-live-dot { font-size: 9px; }
    .codex-stream-file { max-width: 80px; font-size: 9px; }

    .codex-iframe-shell { background: #fff; }
    .codex-iframe-shell.device-tablet,
    .codex-iframe-shell.device-mobile { padding: 6px 16px; }

    .codex-resize-handle { display: none; }

    .codex-right-panel {
        width: 100% !important;
        max-width: none;
        min-width: 0;
        border-left: none;
        border-top: 1px solid var(--border-dark);
        flex: 1;
        min-height: 0;
        overflow: hidden;
    }

    .codex-projects-panel { min-height: 0; }
    .codex-projects-list { max-height: 40vh; }

    .codex-chat-panel { min-height: 0; }
    .codex-messages { max-height: 35vh; min-height: 80px; }
    .codex-chat-resize { display: none; }

    .codex-input-wrap {
        padding: 6px 8px;
        padding-bottom: max(6px, env(safe-area-inset-bottom));
    }
    .codex-input { font-size: 14px; min-height: 34px; }
    .codex-send-btn { width: 34px; height: 34px; }

    .codex-file-tree { width: 120px; min-width: 90px; }
    .codex-tree-file { font-size: 10px; padding: 4px 8px; }

    .codex-ctx-wrap { bottom: 54px; right: 8px; }
    .codex-ctx-ring { width: 28px; height: 28px; }

    .cdx-welcome-orb { width: 44px; height: 44px; font-size: 18px; }
    .cdx-welcome-title { font-size: 13px; }
    .cdx-welcome-sub { font-size: 10px; }
    .codex-suggestion-btn { font-size: 10px; padding: 6px 9px; }

    .codex-project-card { border-radius: 10px; padding: 8px 10px; gap: 8px; }
    .cdx-card-orb { width: 30px; height: 30px; font-size: 13px; border-radius: 8px; }
    .cdx-card-name { font-size: 11px; }
    .cdx-card-meta { font-size: 9px; }
    .cdx-card-footer { opacity: 1; }

    .codex-name-modal-box { min-width: 280px; padding: 18px 20px; }
    .codex-name-modal-title { font-size: 13px; }
}


/* ══════════════════════════════════════════════════════════════
   RTL STRUCTURAL ENFORCEMENT — last in file, beats everything
   ══════════════════════════════════════════════════════════════ */

html[dir="rtl"] .chatgpt-app-container {
    flex-direction: row-reverse !important;
}

html[dir="rtl"] .chatgpt-sidebar {
    order: 2 !important;
    position: relative !important;
    left: unset !important;
    right: unset !important;
    border-right: none !important;
    border-left: 1px solid var(--sidebar-border) !important;
    box-shadow: -2px 0 24px rgba(0,0,0,0.35) !important;
}

html[dir="rtl"] .chatgpt-main {
    order: 1 !important;
}

html[dir="rtl"] .chatgpt-topbar {
    flex-direction: row-reverse !important;
}

body.light html[dir="rtl"] .chatgpt-sidebar {
    border-left: 1px solid #E0E0E0 !important;
}

@keyframes sidebarSlideInRTL {
    0%   { opacity: 0; transform: translateX(18px); }
    100% { opacity: 1; transform: translateX(0); }
}

html[dir="rtl"] .chatgpt-sidebar-header,
html[dir="rtl"] .chatgpt-sidebar-nav,
html[dir="rtl"] .chatgpt-sidebar-footer {
    animation-name: sidebarSlideInRTL !important;
}

html[dir="rtl"] .sidebar-resize-handle {
    right: auto !important;
    left: -4px !important;
}

html[dir="rtl"] .chatgpt-desktop-toggle {
    left: auto !important;
    right: 14px !important;
}

html[dir="rtl"] .chatgpt-app-container:has(.chatgpt-sidebar.closed) .topbar-left {
    margin-right: 54px;
}

@media (max-width: 768px) {
    html[dir="rtl"] .chatgpt-sidebar {
        position: fixed !important;
        left: auto !important;
        right: 0 !important;
        transform: translateX(100%) !important;
    }
    html[dir="rtl"] .chatgpt-sidebar.open {
        transform: translateX(0) !important;
        box-shadow: -24px 0 60px rgba(0,0,0,0.7) !important;
    }
}

.setpw-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 14px;
}

.pw-rules {
    list-style: none;
    margin: 4px 0 16px;
    padding: 12px 14px;
    border: 1px solid var(--border-dark);
    border-radius: 12px;
    background: var(--surface-dark);
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.pw-rule {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 13px;
    color: var(--text-secondary);
    transition: color 0.18s ease;
}
.pw-rule i {
    font-size: 13px;
    color: var(--text-muted);
    width: 15px;
    text-align: center;
    transition: color 0.18s ease;
}
.pw-rule.ok { color: var(--text-primary); }
.pw-rule.ok i { color: var(--success); }

.setpw-logout {
    text-align: center;
    margin-top: 14px;
    font-size: 13px;
}
.setpw-logout a {
    color: var(--text-secondary);
    text-decoration: none;
}
.setpw-logout a:hover {
    color: var(--primary-red);
    text-decoration: underline;
}

