/* =========================================================================
   "Platinum Liquid Glass" Design System
   ========================================================================= */

/* Ensure [hidden] always wins over component-level display rules */
[hidden] { display: none !important; }

:root {
    /* Colors - Pure Monochrome & Platinum */
    --surface: #f4f5f8;
    --surface-container: rgba(255, 255, 255, 0.25);
    --surface-container-low: rgba(255, 255, 255, 0.15);
    --surface-container-highest: #ffffff;
    --surface-container-lowest: #ffffff;
    --surface-bright: rgba(255, 255, 255, 0.7);
        --glass-bg: rgba(255, 255, 255, 0.45);
    --glass-focus-bg: rgba(255, 255, 255, 0.65);
    --glass-shadow: 0 8px 24px -12px rgba(0, 0, 0, 0.18), 0 18px 42px -28px rgba(0, 0, 0, 0.12);
    --glass-focus-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.92), 0 8px 24px -14px rgba(0, 0, 0, 0.18), 0 16px 40px -30px rgba(0, 0, 0, 0.14);
    --glass-border: rgba(255, 255, 255, 0.8);
    --glass-focus-border: rgba(255, 255, 255, 1);
    --glass-blur: blur(80px) saturate(200%);

    /* Legacy colors neutralized to monochrome constants */
    --sakura-pink: #ffffff;
    --morning-white: #f5f6fa;
    --soft-lavender: #ffffff;

    --primary: #121212;
    --primary-dim: #737373;
    --primary-container: #e5e5e5;

    --on-surface: #121212;
    --on-primary: #ffffff;

    --outline-variant: rgba(0, 0, 0, 0.05);
    --outline-variant-focus: rgba(0, 0, 0, 0.12);

    /* Spacing Tokens */
    --space-4: 1.4rem;
    --space-8: 2.75rem;
    --space-10: 3.5rem;
    --space-20: 7rem;
    --space-24: 8.5rem;

    /* Material 3 organic Radii */
    --radius-xs: 8px;
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 28px;
    --radius-sys: 32px;
    --radius-full: 9999px;

    /* Shadows & Hover Drops */
    --shadow-ambient: 0 12px 48px rgba(0, 0, 0, 0.04);
    --shadow-glass-pop: 0 16px 40px rgba(0,0,0,0.15), 0 0 0 1px rgba(255,255,255,0.05);
    --shadow-glass-pop-light: 0 16px 40px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.05);
}

[data-theme="dark"] {
    /* Grok-inspired pure black palette */
    --surface: #000000;
    --surface-container: rgba(255, 255, 255, 0.05);
    --surface-container-low: rgba(255, 255, 255, 0.03);
    --surface-container-highest: #141414;
    --surface-container-lowest: #000000;
    --surface-bright: rgba(255, 255, 255, 0.08);

    --glass-bg: transparent;
    --glass-focus-bg: rgba(255, 255, 255, 0.04);
    --glass-shadow: none;
    --glass-focus-shadow: none;
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-focus-border: rgba(255, 255, 255, 0.2);
    --glass-blur: none;

    --primary: #e3e3e3;
    --primary-dim: #8e8e8e;
    --primary-container: #1a1a1a;

    --on-surface: #e3e3e3;
    --on-primary: #000000;

    --outline-variant: rgba(255, 255, 255, 0.08);
    --outline-variant-focus: rgba(255, 255, 255, 0.2);

    --shadow-ambient: none;
    --shadow-glass-pop: 0 4px 16px rgba(0,0,0,0.6);
    --shadow-glass-pop-light: 0 4px 16px rgba(0,0,0,0.4);
}


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

body {
    background-color: var(--surface);
    color: var(--on-surface);
    font-family: 'Inter', 'Poppins', -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
    letter-spacing: -0.015em;
    font-size: 1rem;
    line-height: 1.6;
    overflow: hidden;
    height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1,h2,h3,h4,h5,h6 {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 600;
    color: var(--on-surface);
}

/* Ambient Blobs */
.ambient-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    z-index: -1;
    pointer-events: none;
    opacity: 0.8;
}

.blob-1 {
    width: 60vw;
    height: 60vh;
    background: #e8e8e8;
    top: -10vh;
    left: -10vw;
    animation: floatBlob1 20s infinite alternate ease-in-out;
}

.blob-2 {
    width: 50vw;
    height: 50vh;
    background: #ffffff;
    bottom: -10vh;
    right: -10vw;
    animation: floatBlob2 25s infinite alternate ease-in-out;
}




@keyframes floatBlob1 {
    100% {
        transform: translate(15vw, 15vh) scale(1.1);
    }
}

@keyframes floatBlob2 {
    100% {
        transform: translate(-15vw, -10vh) scale(1.2);
    }
}

/* ============================
   Page Layout
   ============================ */
.page-wrapper {
    flex: 1;
    display: flex;
    height: 100vh;
    width: 100vw;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.page-wrapper.sidebar-collapsed .sidebar {
    width: 86px;
}

.page-wrapper.sidebar-collapsed .sidebar-top .home-link {
    left: 50%;
    transform: translateX(-50%);
}

.page-wrapper.sidebar-collapsed .sidebar-top .home-link img {
    transform: scale(0.7);
    margin-left: 0;
}

.page-wrapper.sidebar-collapsed .nav-text {
    opacity: 0;
    display: none;
}

.page-wrapper.sidebar-collapsed .icon-toggle-btn#sidebarCloseBtn {
    display: none;
}

.page-wrapper.sidebar-collapsed .expand-btn {
    display: flex !important;
    margin: 12px auto;
    min-width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.3rem;
    background: var(--surface-container-highest);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    justify-content: center;
    align-items: center;
    border: 1px solid rgba(0, 0, 0, 0.03);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.page-wrapper.sidebar-collapsed .expand-btn:hover {
    background: rgba(0, 0, 0, 0.03);
}

.page-wrapper.sidebar-collapsed .history-group-title,
.page-wrapper.sidebar-collapsed .history-item,
.page-wrapper.sidebar-collapsed .nav-divider {
    display: none !important;
}

.page-wrapper.sidebar-collapsed .sidebar-user-btn {
    display: none !important;
}

.page-wrapper.sidebar-collapsed .nav-menu-btn {
    width: 44px;
    height: 44px;
    padding: 0;
    justify-content: center;
    margin: 0 auto;
    aspect-ratio: 1;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.page-wrapper.sidebar-collapsed .nav-menu-btn i {
    font-size: 1.2rem;
    margin: 0;
}

/* ============================
   Sidebar (Floating Glass Pane)
   ============================ */
.sidebar {
    width: 280px;
    margin: 16px;
    border-radius: var(--radius-xl);
    background: var(--glass-bg); /* Very high translucency */
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1), margin 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    flex-shrink: 0;
    overflow: hidden;
    box-shadow: 8px 0 36px rgba(0, 0, 0, 0.08), inset 0 0 0 1px rgba(255, 255, 255, 0.6); /* Aggressive shadow */
}

.sidebar-top {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 1.5rem 1rem 1.5rem;
    min-height: 84px;
}

.home-link {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: inline-flex;
    text-decoration: none;
    align-items: center;
    justify-content: center;
    width: 140px;
    height: 36px;
    margin: 0;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.company-logo-mask {
    height: 100%;
    width: 100%;
    /* Gradient: Monochrome Liquid Chrome */
    background: linear-gradient(90deg, #111111, #444444, #888888, #444444, #111111);
    background-size: 250% auto;
    -webkit-mask: url("/static/pepperlabs%20(1).png") no-repeat center;
    -webkit-mask-size: contain;
    mask: url("/static/pepperlabs%20(1).png") no-repeat center;
    mask-size: contain;
    animation: logoShine 4s linear infinite;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes logoShine {
    to {
        background-position: -250% center;
    }
}

.icon-toggle-btn {
    background: transparent;
    border: none;
    color: var(--primary-dim);
    cursor: pointer;
    font-size: 1.2rem;
    min-width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    margin: 0;
    padding: 0;
    z-index: 2;
}

.icon-toggle-btn:hover {
    background: var(--outline-variant);
    color: var(--primary);
}

.icon-toggle-btn.expand-btn {
    display: none;
    margin-bottom: 8px;
}

/* Sidebar items */
.sidebar-nav-menu {
    display: flex;
    flex-direction: column;
    padding: 0 12px;
    gap: 4px;
    margin-bottom: 1rem;
}

.nav-menu-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 8px 14px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--primary-dim);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
    overflow: hidden;
    margin: 0 auto;
}

.nav-menu-btn:hover {
    background: var(--surface-container-low);
    color: var(--on-surface);
}

.nav-menu-btn i {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
    color: var(--primary-dim);
    transition: color 0.2s;
}

.nav-menu-btn:hover i {
    color: var(--primary);
}

.nav-menu-btn.active {
    background: rgba(0, 0, 0, 0.06);
    font-weight: 600;
    color: var(--on-surface);
}

.nav-menu-btn.requires-login {
    opacity: 0.84;
}

.nav-menu-btn.requires-login:hover {
    opacity: 1;
}

.nav-menu-btn.active i {
    color: var(--primary);
}

.nav-divider {
    height: 1px;
    background: var(--outline-variant);
    margin: 8px 12px;
}

.history-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 0 12px 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-dim);
    cursor: pointer;
    transition: all 0.3s;
}

.history-dropdown-header:hover {
    color: var(--on-surface);
}

.history-dropdown-header i {
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.history-dropdown-header.collapsed i {
    transform: rotate(-90deg);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 0 12px;
    display: flex;
    flex-direction: column;
}

.sidebar-content::-webkit-scrollbar {
    width: 4px;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: var(--outline-variant);
    border-radius: var(--radius-sm);
}

/* History List / Grouping */
.history-list {
    list-style: none;
    margin: 0;
    padding: 0;
    transition: max-height 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.3s;
    overflow: hidden;
    max-height: 2000px;
    opacity: 1;
}

.history-list.collapsed {
    max-height: 0;
    opacity: 0;
}

.history-group-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary-dim);
    text-transform: capitalize;
    letter-spacing: 0.02em;
    margin-top: 16px;
    margin-bottom: 8px;
    padding: 0 12px;
}

.history-group-title::after {
    content: '';
    flex: 1;
    height: 1.5px;
    background: var(--outline-variant);
    opacity: 0.9;
}

.history-item {
    padding: 0.5rem 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--on-surface);
    opacity: 0.85;
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2px;
}

.history-item:hover {
    background: rgba(0, 0, 0, 0.03);
    color: var(--primary);
}

.history-item.active {
    background: rgba(0, 0, 0, 0.06);
    color: var(--on-surface);
    font-weight: 600;
}

.history-item-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    font-weight: 500;
}

.history-del-btn {
    background: transparent;
    border: none;
    color: inherit;
    opacity: 0;
    cursor: pointer;
    padding: 6px;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: var(--radius-xs);
    display: block;
    transform: scale(0.9);
}

.history-item:hover .history-del-btn {
    opacity: 0.6;
    transform: scale(1);
}

.history-item.active .history-del-btn {
    color: var(--on-primary);
}

.history-del-btn:hover {
    color: #ff3b30 !important; /* Vivid Apple Red */
    transform: scale(1.15) !important;
    opacity: 1 !important;
}

.history-del-btn:active {
    transform: scale(0.95) !important;
}

.history-placeholder {
    font-size: 0.9rem;
    color: var(--primary-dim);
    font-style: italic;
    padding: 10px;
}

.sidebar-footer {
    padding: 12px;
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-user-btn {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--on-surface);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.95rem;
    transition: 0.2s ease;
    font-family: inherit;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar-user-btn:hover {
    background: rgba(0, 0, 0, 0.04);
}

.user-avatar-mimic {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #444, #111);
    flex-shrink: 0;
    box-shadow: var(--glass-shadow);
}

/* ============================
   Guest Navigation Bar (top-right)
   ============================ */
.guest-header {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 999;
    display: flex;
    justify-content: flex-end;
    padding: 24px 48px 0;
    background: transparent;
    pointer-events: none;
}

.guest-nav {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1000;
    max-width: min(100%, 420px);
    pointer-events: auto;
}

.guest-nav-gear {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--on-surface);
    opacity: 0.5;
    font-size: 1.05rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.guest-nav-gear:hover {
    opacity: 1;
    transform: rotate(45deg);
}

.guest-nav-gear.active {
    opacity: 1;
}

/* Ghost Button: Login */
.guest-nav-login {
    padding: 9px 22px;
    border-radius: var(--radius-full);
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.06);
    color: var(--on-surface);
    font-size: 0.88rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    letter-spacing: 0.02em;
}

.guest-nav-login:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
}

/* Solid Button: Register */
.guest-nav-register {
    padding: 9px 22px;
    border-radius: var(--radius-full);
    border: none;
    background: var(--on-surface);
    color: var(--surface);
    font-size: 0.88rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    letter-spacing: 0.02em;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.guest-nav-register:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

/* Settings Dropdown - Glassmorphism */
.settings-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 220px;
    padding: 14px;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(50px) saturate(200%);
    -webkit-backdrop-filter: blur(50px) saturate(200%);
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.08),
        0 2px 8px rgba(0, 0, 0, 0.04),
        inset 0 1px 1px rgba(255, 255, 255, 0.9);
    /* Hidden by default */
    opacity: 0;
    visibility: hidden;
    transform: scale(0.92) translateY(-6px);
    transform-origin: top right;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

.settings-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

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

.settings-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--primary-dim);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding-left: 2px;
}

.settings-divider {
    height: 1px;
    background: rgba(0, 0, 0, 0.06);
    margin: 10px 0;
}

.theme-toggle-group {
    display: flex;
    align-items: center;
    gap: 3px;
    background: rgba(0, 0, 0, 0.04);
    border-radius: var(--radius-md);
    padding: 4px;
}

.theme-btn {
    background: transparent;
    border: none;
    color: var(--on-surface);
    opacity: 0.6;
    height: 34px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    transition: all 0.25s ease;
    flex: 1;
}

.theme-btn:hover {
    opacity: 0.85;
}

.theme-btn.active {
    opacity: 1;
    background: #ffffff;
    color: #000000;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.1);
}

.lang-selector {
    display: flex;
    align-items: center;
    gap: 4px;
}

.lang-btn {
    background: transparent;
    border: none;
    color: var(--on-surface);
    opacity: 0.6;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.25s ease;
    white-space: nowrap;
    flex: 1;
    text-align: center;
}

.lang-btn:hover {
    opacity: 0.85;
    background: rgba(0, 0, 0, 0.04);
}

.lang-btn.active {
    opacity: 1;
    background: #ffffff;
    color: #000000;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* ============================
   DARK MODE — Component Overrides
   ============================ */

/* Sidebar: transparent background, no glass, no white border */
[data-theme="dark"] .sidebar {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0;
    margin: 0;
}

/* Ambient blobs hidden in dark mode */
[data-theme="dark"] .ambient-blob {
    display: none;
}

/* Nav buttons: clean, no raised effect */
[data-theme="dark"] .nav-menu-btn {
    background: transparent !important;
    border: 1px solid transparent !important;
    box-shadow: none !important;
}
[data-theme="dark"] .nav-menu-btn:hover {
    background: rgba(255, 255, 255, 0.06) !important;
    border-color: transparent !important;
    box-shadow: none !important;
}
[data-theme="dark"] .nav-menu-btn.active {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: transparent !important;
    box-shadow: none !important;
}

/* History items */
[data-theme="dark"] .history-item:hover {
    background: rgba(255, 255, 255, 0.05);
}
[data-theme="dark"] .history-item.active {
    background: rgba(255, 255, 255, 0.08);
}

/* Settings dropdown */
[data-theme="dark"] .settings-dropdown {
    background: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

/* Theme/Lang toggle group */
[data-theme="dark"] .theme-toggle-group {
    background: rgba(255, 255, 255, 0.06);
}
[data-theme="dark"] .theme-btn.active {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    box-shadow: none;
}
[data-theme="dark"] .lang-btn.active {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    box-shadow: none;
}
[data-theme="dark"] .lang-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* Input box: subtle dark fill so it's visible against pure black */
[data-theme="dark"] .liquid-glass-input::after {
    background: #2b2b2b;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.28);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
[data-theme="dark"] .liquid-glass-input:focus-within::after {
    background: #303030;
    border-color: rgba(255, 255, 255, 0.22);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.26);
    transform: none;
}

/* Toggle chips */
[data-theme="dark"] .toggle-switch {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
    color: rgba(255, 255, 255, 0.76);
}
[data-theme="dark"] .toggle-switch:hover {
    background: rgba(255, 255, 255, 0.12);
    box-shadow: none;
}

[data-theme="dark"] .toggle-switch.active {
    color: #ffffff;
}

[data-theme="dark"] #thinkToggle.active {
    background: #5a1025;
    color: #fff8fb;
    box-shadow: inset 0 0 0 1px rgba(255, 192, 210, 0.08), 0 0 0 1px rgba(74, 12, 30, 0.42), 0 4px 12px rgba(74, 12, 30, 0.28);
}

[data-theme="dark"] #webToggle.active {
    background: linear-gradient(145deg, #0b2239 0%, #0f4d64 55%, #14a0a8 100%);
    color: #f4ffff;
    box-shadow: inset 0 0 0 1px rgba(208, 255, 255, 0.12), 0 0 0 1px rgba(10, 74, 92, 0.36), 0 4px 12px rgba(6, 64, 90, 0.3);
}

/* Submit button */
[data-theme="dark"] .submit-btn {
    background: #fff;
    color: #000;
    border: none;
    box-shadow: none;
}
[data-theme="dark"] .submit-btn:hover {
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.15);
}

/* Message bubbles */
[data-theme="dark"] .message-bubble.user {
    background: #1a1a1a;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
[data-theme="dark"] .message-bubble.assistant {
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: none;
    border-radius: 0;
}

/* Think wrapper */
[data-theme="dark"] .think-wrapper {
    background: #0a0a0a;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
[data-theme="dark"] .think-wrapper:not(.done):not(.collapsed) {
    animation: think-pulse-dark 2.5s ease-in-out infinite;
}
@keyframes think-pulse-dark {
    0%, 100% { border-color: rgba(255, 255, 255, 0.08); box-shadow: 0 0 0 0 rgba(134, 120, 255, 0); }
    50% { border-color: rgba(134, 120, 255, 0.25); box-shadow: 0 0 16px 0 rgba(134, 120, 255, 0.08); }
}

/* User context menu */
[data-theme="dark"] .user-context-menu {
    background: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* Expand button */
[data-theme="dark"] .page-wrapper.sidebar-collapsed .expand-btn {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: none;
}
[data-theme="dark"] .page-wrapper.sidebar-collapsed .expand-btn:hover {
    background: rgba(255, 255, 255, 0.06);
}

/* Sidebar user button hover */
[data-theme="dark"] .sidebar-user-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Search modal */
[data-theme="dark"] .search-sidebar {
    background: #0a0a0a;
}
[data-theme="dark"] .search-modal-top-bar {
    background: #0a0a0a;
}
[data-theme="dark"] .modal-overlay {
    background: rgba(0, 0, 0, 0.85);
}
[data-theme="dark"] .liquid-glass-panel {
    background: #111;
}

/* Guest nav buttons */
[data-theme="dark"] .guest-nav-login {
    border-color: rgba(255, 255, 255, 0.15);
    background: transparent;
}
[data-theme="dark"] .guest-nav-login:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.3);
}

[data-theme="dark"] .guest-limit-banner {
    background: #2f2f2f;
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

[data-theme="dark"] .guest-limit-banner__text {
    color: #f2f2f2;
}

[data-theme="dark"] .guest-limit-banner__btn--secondary {
    background: #ffffff;
    color: #111111;
    border-color: transparent;
}

[data-theme="dark"] .guest-limit-banner__btn--primary {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .guest-limit-banner__btn--primary:hover {
    background: rgba(255, 255, 255, 0.14);
}

[data-theme="dark"] .guest-limit-banner.attention {
    animation-name: guestBannerAttentionDark;
}

[data-theme="dark"] .guest-limit-banner.attention::before {
    background: linear-gradient(100deg, transparent 0%, rgba(255, 255, 255, 0.03) 18%, rgba(255, 255, 255, 0.16) 42%, rgba(255, 255, 255, 0.03) 66%, transparent 100%);
}

/* File pills */
[data-theme="dark"] .file-pill {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
    backdrop-filter: none;
}
[data-theme="dark"] .file-attachment-card {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
}

/* History search list items dark override */
[data-theme="dark"] .history-search-list .history-item {
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
}
[data-theme="dark"] .history-search-list .history-item:hover,
[data-theme="dark"] .history-search-list .history-item.active-preview {
    background: rgba(255, 255, 255, 0.06) !important;
    border-color: transparent !important;
    box-shadow: none !important;
}

/* Inline code in dark mode */
[data-theme="dark"] .markdown-content code:not(pre code) {
    background: rgba(255, 255, 255, 0.08);
    color: #f0a0a0;
    border-color: rgba(255, 255, 255, 0.1);
}

/* Table dark mode */
[data-theme="dark"] .markdown-content th {
    background: rgba(255, 255, 255, 0.06);
}
[data-theme="dark"] .markdown-content td {
    border-color: rgba(255, 255, 255, 0.06);
}

/* Settings divider */
[data-theme="dark"] .settings-divider {
    background: rgba(255, 255, 255, 0.08);
}

/* PDF card */
[data-theme="dark"] .pdf-download-card {
    background: rgba(226, 87, 76, 0.08);
    border-color: rgba(226, 87, 76, 0.2);
    box-shadow: none;
}

/* Markdown content: better visibility in dark mode */
[data-theme="dark"] .markdown-content hr {
    border-color: rgba(255, 255, 255, 0.12);
    opacity: 1;
}
[data-theme="dark"] .markdown-content blockquote {
    border-left-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.04);
    color: #b0b0b0;
}
[data-theme="dark"] .markdown-content a,
[data-theme="dark"] .markdown-content a.md-link {
    color: #6cb6ff;
    border-bottom-color: rgba(108, 182, 255, 0.3);
}
[data-theme="dark"] .markdown-content a:hover {
    color: #8fcaff;
    background: rgba(108, 182, 255, 0.08);
}
[data-theme="dark"] .markdown-content table {
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}
[data-theme="dark"] .markdown-content th {
    background: rgba(255, 255, 255, 0.08);
    border-bottom: 2px solid rgba(255, 255, 255, 0.14);
    color: #e0e0e0;
}
[data-theme="dark"] .markdown-content td {
    border-bottom-color: rgba(255, 255, 255, 0.06);
    color: #c8c8c8;
}
[data-theme="dark"] .markdown-content tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.03);
}
[data-theme="dark"] .markdown-content tr:hover td {
    background: rgba(255, 255, 255, 0.06);
}
[data-theme="dark"] .markdown-content td strong {
    color: #fff;
}

/* Scrollbar dark mode */
[data-theme="dark"] .chat-area::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
}
[data-theme="dark"] .sidebar-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
}

/* Edit input dark mode */
[data-theme="dark"] .edit-input {
    background: #111;
    border-color: rgba(255, 255, 255, 0.12);
}
[data-theme="dark"] .edit-input:focus {
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: none;
}

/* Source cards dark mode */
[data-theme="dark"] .source-card {
    border-color: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .source-card::after {
    background: #111;
}

/* Auth modal dark */
[data-theme="dark"] .input-group input {
    background: #111;
    border-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .input-group input:focus {
    background: #151515;
    border-color: rgba(255, 255, 255, 0.2);
}

/* Sidebar border for non-collapsed */
[data-theme="dark"] .sidebar {
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

/* Action buttons on hover */
[data-theme="dark"] .msg-action-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* Price badge dark mode */
[data-theme="dark"] .price-badge {
    background: rgba(255, 200, 0, 0.12);
    color: #ffd666;
    border-color: rgba(255, 200, 0, 0.2);
}


/* ============================
   Main Content
   ============================ */
.main-content {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: transparent;
    /* Changed from Base Layer so blobs can shine */
}

.mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--surface-container);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.4);
    z-index: 50;
}

.mobile-logo-text {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--on-surface);
    letter-spacing: 0px;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 880px;
    margin: 0 auto;
    padding-top: 92px;
    position: relative;
    width: 100%;
}

/* Centered Landing State */
.app-container.centered-landing {
    justify-content: center;
    align-items: center;
    padding-top: clamp(96px, 14vh, 148px);
}

.app-container.centered-landing .chat-area {
    flex: none;
    height: auto;
    padding: 0;
    overflow: visible;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    max-width: 100%;
}

.app-container.centered-landing .greeting-container {
    flex: none;
    height: auto;
    text-align: center;
}

.app-container.centered-landing .messages {
    display: none;
}

.app-container.centered-landing .input-wrapper {
    position: relative;
    bottom: auto;
    left: auto;
    right: auto;
    margin: 0 auto;
    width: 100%;
    max-width: 880px;
}

.chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 1.4rem 1.2rem 11.6rem;
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
}

.app-container.guest-cta-visible .chat-area {
    padding-bottom: 16rem;
}

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

.chat-area::-webkit-scrollbar-thumb {
    background: var(--outline-variant);
    border-radius: var(--radius-sm);
}

.greeting-container {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    transition: all 0.5s ease-in-out;
}

.greeting-container h2 {
    font-size: 2.15rem;
    font-weight: 700;
    color: var(--on-surface);
    letter-spacing: -0.02em;
}

#logoContainer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 8px;
}

.logo-icon i {
    font-size: 1.6rem;
    color: var(--on-surface);
}

.logo-text {
    font-size: 1.4rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    margin: 0;
    background: linear-gradient(90deg, #ff3b30, #ff9500, #ffcc00, #8e8e93, #ff3b30, #ff9500);
    background-size: 200% auto;
    color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
    animation: textShine 10s linear infinite;
}

@keyframes textShine {
    to {
        background-position: -200% center;
    }
}

.messages {
    display: flex;
    flex-direction: column;
    gap: 1.35rem;
    width: 100%;
}

/* ============================
   Input Bar - Glass & Gradient
   ============================ */
.input-wrapper {
    position: absolute;
    bottom: 1.3rem;
    left: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 10;
}

.guest-limit-banner {
    width: 100%;
    max-width: 880px;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    margin-bottom: 12px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    position: relative;
    isolation: isolate;
    transform-origin: center bottom;
}

.guest-limit-banner[hidden] {
    display: none !important;
}

.guest-limit-banner.show {
    display: flex;
}

.guest-limit-banner.attention {
    animation: guestBannerAttention 620ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.guest-limit-banner.attention::before {
    content: '';
    position: absolute;
    inset: -1px;
    z-index: -1;
    background: linear-gradient(100deg, transparent 0%, rgba(0, 0, 0, 0.03) 18%, rgba(0, 0, 0, 0.14) 42%, rgba(0, 0, 0, 0.03) 66%, transparent 100%);
    transform: translateX(-115%);
    animation: guestBannerSheen 620ms cubic-bezier(0.2, 0.8, 0.2, 1);
    pointer-events: none;
}

@keyframes guestBannerAttention {
    0% {
        transform: translateY(0) scale(0.996);
        box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08);
    }
    42% {
        transform: translateY(-1px) scale(1.006);
        box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12), 0 14px 32px rgba(0, 0, 0, 0.12);
    }
    100% {
        transform: translateY(0) scale(1);
        box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08);
    }
}

@keyframes guestBannerAttentionDark {
    0% {
        transform: translateY(0) scale(0.996);
        box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
    }
    42% {
        transform: translateY(-1px) scale(1.006);
        box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18), 0 16px 34px rgba(0, 0, 0, 0.36);
    }
    100% {
        transform: translateY(0) scale(1);
        box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
    }
}

@keyframes guestBannerSheen {
    0% {
        transform: translateX(-115%);
    }
    100% {
        transform: translateX(115%);
    }
}

.guest-limit-banner__text {
    flex: 1;
    font-size: 0.94rem;
    font-weight: 600;
    color: var(--on-surface);
    line-height: 1.45;
}

.guest-limit-banner__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.guest-limit-banner__btn {
    height: 40px;
    border-radius: 999px;
    border: 1px solid transparent;
    padding: 0 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.88rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.guest-limit-banner__btn--secondary {
    background: #ffffff;
    color: #121212;
    border-color: rgba(0, 0, 0, 0.08);
}

.guest-limit-banner__btn--secondary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.guest-limit-banner__btn--primary {
    background: #121212;
    color: #ffffff;
}

.guest-limit-banner__btn--primary:hover {
    transform: translateY(-1px);
    background: #000000;
}

.liquid-glass-input {
    width: 100%;
    max-width: 880px;
    display: flex;
    flex-direction: column;
    background: transparent;
    border-radius: 999px;
    padding: 0;
    transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1), max-height 0.22s ease;
    position: relative;
    z-index: 10;
    isolation: isolate;
}

.liquid-glass-input.guest-agent-locked {
    cursor: not-allowed;
}

.liquid-glass-input.guest-agent-locked::after {
    border-color: rgba(0, 0, 0, 0.12);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.03), var(--glass-shadow);
}

.liquid-glass-input.guest-agent-locked > * {
    pointer-events: none;
}

.liquid-glass-input.guest-agent-locked .input-top-row,
.liquid-glass-input.guest-agent-locked .input-bottom-row,
.liquid-glass-input.guest-agent-locked .attachments-preview {
    opacity: 0.68;
}

.liquid-glass-input.guest-agent-locked textarea,
.liquid-glass-input.guest-agent-locked input {
    cursor: not-allowed;
    caret-color: transparent;
}

.liquid-glass-input.lock-tap {
    animation: lockedComposerTap 260ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.liquid-glass-input.lock-tap::after {
    border-color: rgba(0, 0, 0, 0.18);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.04), var(--glass-shadow);
}

@keyframes lockedComposerTap {
    0% {
        transform: translateY(0) scale(1);
    }
    38% {
        transform: translateY(1px) scale(0.997);
    }
    100% {
        transform: translateY(0) scale(1);
    }
}

.input-wrapper.guest-input-hidden .liquid-glass-input {
    display: none;
}

.app-container.guest-input-hidden .chat-area {
    padding-bottom: 8rem;
}

.liquid-glass-input::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: inherit;
    z-index: -1;
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.liquid-glass-input:focus-within::after {
    background: var(--glass-focus-bg);
    border: 1px solid var(--glass-focus-border);
    box-shadow: var(--glass-focus-shadow);
    transform: none;
}

.liquid-glass-input>* {
    position: relative;
    z-index: 1;
}

.input-top-row {
    display: flex;
    align-items: center;
    padding: 0.64rem 0.66rem 0.64rem 0.82rem;
    gap: 10px;
}

.composer-main-row {
    min-height: 62px;
}

.liquid-glass-input textarea {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--on-surface);
    font-size: 1rem;
    font-weight: 500;
    font-family: inherit;
    outline: none;
    letter-spacing: 0;
    line-height: 28px;
    min-height: 28px;
    max-height: 168px;
    height: 28px;
    resize: none;
    overflow-y: hidden;
    scrollbar-width: thin;
}

.liquid-glass-input textarea::-webkit-scrollbar {
    width: 5px;
}

.liquid-glass-input textarea::-webkit-scrollbar-thumb {
    background: var(--outline-variant-focus);
    border-radius: 999px;
}

.liquid-glass-input textarea::placeholder {
    color: var(--primary-dim);
    opacity: 0.6;
}

.input-bottom-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.16rem 0.78rem 0.58rem;
    gap: 8px;
    flex-wrap: wrap;
    min-height: 0;
}

.liquid-glass-input.composer-expanded .input-top-row {
    padding-top: 0.74rem;
    padding-bottom: 0.74rem;
    align-items: flex-end;
}

.liquid-glass-input.composer-expanded {
    border-radius: 28px;
}

.liquid-glass-input.composer-expanded textarea {
    overflow-y: auto;
}

/* Tertiary style buttons for icons */
.icon-btn {
    background: transparent;
    border: none;
    color: var(--primary-dim);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s ease-in-out;
    flex-shrink: 0;
}

.icon-btn:hover {
    color: var(--primary);
    background: var(--surface-container-low);
}

.toggles-container {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.submit-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Selection Chips */
.toggle-switch {
    position: relative;
    isolation: isolate;
    width: 38px;
    height: 38px;
    background: transparent;
    border: 1px solid transparent;
    box-shadow: none;
    color: var(--on-surface);
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Manrope', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0;
    border-radius: var(--radius-full);
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
    z-index: 1;
}

.toggle-switch:hover {
    background: rgba(0, 0, 0, 0.06);
    border-color: transparent;
    box-shadow: none;
}

.toggle-switch span {
    display: none;
}

.toggle-switch i {
    color: currentColor !important;
}

/* =========================================
   Connectors Dropdown (Agent Mode)
   ========================================= */
.connectors-container {
    position: relative;
}

.connector-trigger {
    position: relative;
    isolation: isolate;
    background: var(--surface-container-low);
    border: 1px solid rgba(0, 0, 0, 0.12);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.7);
    color: var(--on-surface);
    font-size: 0.84rem;
    font-weight: 600;
    font-family: 'Manrope', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.42rem 0.86rem;
    border-radius: var(--radius-full);
    transition: all 0.3s ease-in-out;
    z-index: 2;
}

.connector-trigger:hover {
    background: var(--surface-container-highest);
}

.connector-dropdown {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 0;
    width: 260px;
    background: var(--surface-container-highest);
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    padding: 8px 0;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 100;
}

.connectors-container.open .connector-dropdown {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.connectors-container.open .connector-trigger .fa-chevron-up {
    transform: rotate(180deg);
}

.connector-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.2s;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    color: var(--on-surface);
}

.connector-item:hover {
    background: var(--surface-container-low);
}

.connector-icon-name {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Liquid Glass Toggle Switch for Connectors */
.liquid-glass-switch {
    display: inline-block;
    position: relative;
    width: 60px;
    height: 34px;
    border-radius: 17px;
    background: rgba(0, 0, 0, 0.08); /* Soft dark background when off */
    box-shadow: 
        inset 0 2px 5px rgba(0, 0, 0, 0.15),
        inset 0 0 0 1px rgba(0, 0, 0, 0.05),
        0 1px 1px rgba(255, 255, 255, 0.4); /* Glass bottom rim */
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.25, 1, 0.5, 1);
    margin-left: auto;
    overflow: visible;
}

.liquid-glass-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
    position: absolute;
}

.liquid-glass-switch .slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    /* Liquid glass knob: solid white but glossy */
    background: #ffffff;
    box-shadow: 
        0 2px 5px rgba(0, 0, 0, 0.25), 
        0 1px 2px rgba(0, 0, 0, 0.1),
        inset 0 -2px 3px rgba(0, 0, 0, 0.05),
        inset 0 1px 2px rgba(255, 255, 255, 0.9);
    transition: all 0.35s cubic-bezier(0.25, 1, 0.3, 1.2); /* Subtle bounce effect */
    pointer-events: none;
    z-index: 2;
}

.liquid-glass-switch input:checked + .slider {
    transform: translateX(26px);
    box-shadow: 
        -2px 2px 5px rgba(0, 0, 0, 0.15), 
        0 1px 2px rgba(0, 0, 0, 0.1),
        inset 0 -2px 3px rgba(0, 0, 0, 0.05),
        inset 0 1px 2px rgba(255, 255, 255, 0.9);
}

/* Base off-state */
.liquid-glass-switch {
    background: rgba(0, 0, 0, 0.08); /* Soft dark background when off */
}

/* Green active state driven purely by the checkbox being checked */
.liquid-glass-switch:has(input:checked) {
    /* Vibrant iOS-like green as requested in image */
    background: #4de669;
    box-shadow: 
        inset 0 2px 5px rgba(0, 0, 0, 0.2), 
        inset 0 0 0 1px rgba(0, 0, 0, 0.1),
        0 1px 3px rgba(77, 230, 105, 0.3);
}

/* Glassy top highlight for track */
.liquid-glass-switch::after {
    content: '';
    position: absolute;
    top: 1px; left: 10px; right: 10px; height: 10px;
    background: linear-gradient(to bottom, rgba(255,255,255,0.4), transparent);
    border-radius: 10px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.liquid-glass-switch:has(input:checked)::after {
    opacity: 1; /* Highlight shows when green */
}

/* Dark mode overrides */
[data-theme="dark"] .liquid-glass-switch {
    background: rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .liquid-glass-switch:has(input:checked) {
    background: #30d158; /* iOS dark mode green */
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.4), 0 0 8px rgba(48, 209, 88, 0.3);
}

[data-theme="dark"] .liquid-glass-switch .slider {
    background: linear-gradient(135deg, #e0e0e0, #ffffff);
    box-shadow: 
        0 2px 5px rgba(0,0,0,0.6), 
        inset 0 -1px 2px rgba(0,0,0,0.2),
        inset 0 1px 1px rgba(255,255,255,0.8);
}

.toggle-switch.active {
    color: #ffffff;
    border-color: transparent;
    box-shadow: none;
}

#thinkToggle.active {
    background: #5a1025;
    color: #fff7fa;
    box-shadow: inset 0 0 0 1px rgba(255, 220, 230, 0.08), 0 0 0 1px rgba(74, 12, 30, 0.28), 0 4px 12px rgba(74, 12, 30, 0.2);
}

#webToggle.active {
    background: linear-gradient(145deg, #0f2c49 0%, #12607a 55%, #19aeb2 100%);
    color: #f4ffff;
    box-shadow: inset 0 0 0 1px rgba(220, 255, 255, 0.12), 0 0 0 1px rgba(11, 80, 99, 0.26), 0 4px 12px rgba(9, 76, 102, 0.22);
}

.toggle-switch.active::before {
    display: none;
}

.toggle-switch.active::after {
    display: none;
}

@keyframes rainbowHalo {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Primary Button */
.submit-btn {
    background: #111111;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.12);
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    flex-shrink: 0;
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.16);
}

.submit-btn:hover {
    transform: translateY(-1px) scale(1.03);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18);
}

/* States for Submit Button */
.submit-btn.thinking-state, .submit-btn.answering-state {
    background: rgba(0, 0, 0, 0.05);
    color: var(--on-surface);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.6), 0 2px 8px rgba(0, 0, 0, 0.05);
}

.submit-btn.thinking-state:hover, .submit-btn.answering-state:hover {
    background: rgba(0, 0, 0, 0.08);
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.8), 0 4px 12px rgba(0, 0, 0, 0.1);
}

.submit-btn.thinking-state {
    position: relative;
}

.submit-btn.thinking-state::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 2px solid rgba(0,0,0,0.06);
    border-top-color: #c084fc;
    border-right-color: #f472b6;
    animation: submitSpinRing 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
    z-index: 0;
}

@keyframes submitSpinRing {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.submit-btn i {
    z-index: 1;
    position: relative;
    transition: transform 0.2s;
}

.submit-btn.thinking-state:hover i, .submit-btn.answering-state:hover i {
    transform: scale(1.15);
}

.wave-icon {
    font-weight: bold;
    font-size: 0.8rem;
    transform: rotate(90deg) translateX(1px);
}

/* ============================
   Message Bubbles - Asymmetry Rule
   ============================ */
.user-msg-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    animation: fadeSlideUp 0.4s ease-in-out;
}

.message-bubble.user {
    background: linear-gradient(135deg, rgba(82, 142, 255, 0.05), rgba(192, 132, 252, 0.05));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 0.82rem 1rem;
    border-radius: var(--radius-xl) var(--radius-xl) var(--radius-sm) var(--radius-xl);
    max-width: min(76%, 720px);
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--on-surface);
    word-break: break-word;
    box-shadow: 
        inset 0 1px 2px rgba(255, 255, 255, 0.8), 
        inset 0 0 0 1px rgba(255, 255, 255, 0.5),
        0 10px 30px -5px rgba(0, 0, 0, 0.05),
        0 0 30px 2px rgba(255, 255, 255, 0.2);
}

.user-msg-actions {
    display: flex;
    gap: 6px;
    padding-right: 8px;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.user-msg-wrapper:hover .user-msg-actions {
    opacity: 1;
}

.msg-action-btn {
    background: transparent;
    border: none;
    color: var(--primary-dim);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.2s;
}

.msg-action-btn:hover {
    color: var(--primary);
    background: rgba(0, 0, 0, 0.05);
}

.message-bubble.assistant {
    align-self: flex-start;
    max-width: 100%;
    width: 100%;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    color: var(--on-surface);
    font-size: 0.96rem;
    line-height: 1.72;
    word-break: break-word;
    animation: fadeSlideUp 0.4s ease-in-out;
}

/* ============================
   Message Wrappers & Action Bars
   ============================ */
.user-msg-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    width: 100%;
    gap: 6px;
}

.assistant-msg-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    gap: 4px;
}

.answer-content {
    width: 100%;
    font-size: 0.96rem;
    line-height: 1.72;
}

.answer-content > :first-child {
    margin-top: 0;
}

.answer-content > :last-child {
    margin-bottom: 0;
}

.msg-action-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 4px;
    margin-bottom: 8px;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.user-msg-wrapper:hover .msg-action-bar,
.assistant-msg-wrapper:hover .msg-action-bar {
    opacity: 1;
}

.msg-action-btn {
    background: transparent;
    border: none;
    color: var(--on-surface);
    opacity: 0.4;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.msg-action-btn:hover {
    opacity: 1;
    background: var(--surface-container-low);
    color: var(--primary);
}

.msg-action-btn.active {
    opacity: 1;
    color: var(--primary);
    background: var(--primary-container);
}

/* ============================
   Thinking Area - The Layering Principle
   ============================ */
.think-wrapper {
    margin-bottom: 0.85rem;
    border-radius: 18px;
    overflow: hidden;
    position: relative;
    background: var(--surface-container-lowest);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.04), inset 0 0 0 1px rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    transition: all 0.4s ease-in-out;
    max-width: 100%;
    width: 100%;
}

/* Light mode pulse animation while thinking */
.think-wrapper:not(.done):not(.collapsed) {
    animation: think-pulse-light 2.5s ease-in-out infinite;
}
@keyframes think-pulse-light {
    0%, 100% { box-shadow: 0 12px 48px rgba(0, 0, 0, 0.04), inset 0 0 0 1px rgba(255, 255, 255, 0.8); }
    50% { box-shadow: 0 12px 48px rgba(100, 80, 220, 0.08), inset 0 0 0 1px rgba(100, 80, 220, 0.2); }
}

.think-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.88rem 1.05rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.3s ease-in-out;
}

.think-header:hover {
    background: var(--surface-container-low);
}

.think-icon {
    color: var(--primary);
    font-size: 1.1rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-container);
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.think-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 0.05rem;
}

.think-duration {
    font-family: 'Manrope', sans-serif;
    font-size: 0.85rem;
    color: var(--primary-dim);
    margin-left: 4px;
    font-variant-numeric: tabular-nums;
}

.think-toggle-arrow {
    margin-left: auto;
    color: var(--primary-dim);
    font-size: 0.9rem;
    transition: transform 0.4s ease-in-out;
    display: flex;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.think-header:hover .think-toggle-arrow {
    background: var(--outline-variant);
    color: var(--primary);
}

.think-content {
    padding: 0 1.05rem 1rem;
    max-height: 800px;
    overflow-y: auto;
    font-size: 0.92rem;
    line-height: 1.7;
    color: var(--primary-dim);
    transition: max-height 0.5s ease-in-out, padding 0.5s ease-in-out, opacity 0.4s ease-in-out;
    font-style: italic;
}

.think-content::-webkit-scrollbar {
    width: 4px;
}

.think-content::-webkit-scrollbar-thumb {
    background: var(--outline-variant);
    border-radius: var(--radius-sm);
}

.think-wrapper.collapsed .think-content {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
}

.think-wrapper.collapsed .think-sources-bar {
    max-height: 0;
    padding: 0 var(--space-4);
    opacity: 0;
}

.think-wrapper.collapsed .think-toggle-arrow {
    transform: rotate(-90deg);
}

.think-wrapper.done {
    box-shadow: none;
    background: transparent;
    border: 1px solid var(--outline-variant);
}

.think-wrapper.done .think-icon {
    background: var(--surface-container);
    color: var(--on-surface);
}

.think-wrapper.done .think-label {
    color: var(--on-surface);
}

/* ============================
   Sources Bar
   ============================ */
.think-sources-bar {
    display: none;
    padding: 1rem var(--space-4);
    border-top: 1px solid var(--outline-variant);
    transition: max-height 0.5s, padding 0.5s, opacity 0.4s;
}

.sources-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 0.85rem;
    color: var(--primary-dim);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
}

.sources-header i {
    color: var(--primary);
}

.sources-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: none;
}

.sources-scroll::-webkit-scrollbar {
    display: none;
}

.source-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    background: transparent;
    box-shadow: 0 4px 15px rgba(135, 79, 91, 0.05);
    border: 1px solid var(--outline-variant);
    z-index: 1;
    color: var(--on-surface);
    font-size: 0.9rem;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    cursor: pointer;
    max-width: 260px;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.source-card::before {
    content: '';
    position: absolute;
    top: -150%;
    left: -50%;
    width: 200%;
    height: 400%;
    background: conic-gradient(from 0deg, transparent 0%, rgba(135, 79, 91, 0.25) 30%, transparent 60%);
    opacity: 0;
    z-index: -1;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.source-card:hover::before {
    opacity: 1;
    animation: spinGlow 4s linear infinite;
}

@keyframes spinGlow {
    100% {
        transform: rotate(360deg);
    }
}

.source-card::after {
    content: '';
    position: absolute;
    inset: 1px;
    background: var(--surface-container-highest);
    border-radius: var(--radius-sm);
    z-index: -1;
    transition: background 0.3s ease;
}

.source-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 35px rgba(135, 79, 91, 0.15);
    border-color: transparent;
}

.source-card-favicon {
    width: 22px;
    height: 22px;
    border-radius: var(--radius-xs);
    flex-shrink: 0;
    z-index: 2;
}

.source-card-text {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    gap: 2px;
    z-index: 2;
}

.source-card-title {
    font-weight: 600;
    color: var(--on-surface);
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.source-card-domain {
    font-size: 0.75rem;
    color: var(--primary-dim);
    opacity: 0.85;
}

/* ============================
   Edit Box Styling
   ============================ */
.edit-input {
    width: 100%;
    margin-bottom: var(--space-4);
    background: var(--surface-container-lowest);
    border: 1px solid var(--outline-variant);
    border-radius: var(--radius-xl);
    padding: var(--space-4) 1.8rem;
    color: var(--on-surface);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: all 0.3s ease-in-out;
    box-shadow: var(--shadow-ambient);
}

.edit-input:focus {
    border-color: var(--outline-variant-focus);
    box-shadow: 0 10px 40px rgba(135, 79, 91, 0.08);
}

/* ============================
   Markdown Formatting
   ============================ */
.markdown-content p {
    margin-bottom: 0.88rem;
}

.markdown-content code {
    background: var(--surface-container);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-xs);
    font-family: 'Fira Code', monospace;
    font-size: 0.9em;
    color: var(--primary);
}

.markdown-content pre {
    margin-bottom: 1.5rem;
}

.markdown-content pre code {
    display: block;
    padding: var(--space-4);
    border-radius: var(--radius-xl);
    background: var(--surface-container-lowest);
    box-shadow: var(--shadow-ambient);
    color: var(--on-surface);
    overflow-x: auto;
    line-height: 1.7;
}

.markdown-content h1 {
    margin: 1.45rem 0 0.85rem;
    font-size: 1.72rem;
}

.markdown-content h2 {
    margin: 1.2rem 0 0.7rem;
    font-size: 1.4rem;
}

.markdown-content h3 {
    margin: 1rem 0 0.45rem;
    font-size: 1.15rem;
}

.markdown-content ul,
.markdown-content ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.markdown-content li {
    margin-bottom: 0.35rem;
    line-height: 1.62;
}

.markdown-content a {
    color: var(--primary);
    text-decoration: underline;
    text-decoration-color: transparent;
    transition: text-decoration-color 0.3s ease-in-out;
    font-weight: 500;
}

.markdown-content a:hover {
    text-decoration-color: var(--primary);
}

.markdown-content blockquote {
    border-left: 3px solid var(--primary);
    padding-left: 1rem;
    margin: 1.5rem 0;
    color: var(--primary-dim);
    font-style: italic;
    background: var(--primary-container);
    padding: 1.5rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.95rem;
}

.markdown-content th {
    text-align: left;
    padding: 1rem;
    background: var(--primary-container);
    color: var(--primary);
    border-bottom: 1px solid var(--outline-variant);
}

.markdown-content td {
    padding: 1rem;
    border-bottom: 1px solid var(--outline-variant);
    color: var(--on-surface);
}

@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================
   Auth Modal - Ethereal Floating Tier
   ============================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(253, 248, 249, 0.7);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: 0.4s ease-in-out;
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.liquid-glass-panel {
    background: var(--surface-container-lowest);
    box-shadow: 0 30px 60px rgba(135, 79, 91, 0.1);
    border-radius: var(--radius-xl);
    padding: var(--space-10) var(--space-8) var(--space-8);
    width: 100%;
    max-width: 420px;
    position: relative;
    transform: translateY(20px) scale(0.98);
    transition: 0.4s ease-in-out;
}

.modal-overlay.show .liquid-glass-panel {
    transform: translateY(0) scale(1);
}

.modal-close {
    position: absolute;
    top: 1.2rem;
    right: 1.2rem;
    background: transparent;
    border: none;
    color: var(--primary-dim);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.modal-close:hover {
    color: var(--primary);
    background: var(--surface-container-low);
}

.auth-tabs {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
}

.auth-tab {
    background: transparent;
    border: none;
    color: var(--primary-dim);
    font-size: 1.1rem;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    cursor: pointer;
    position: relative;
    transition: color 0.3s ease-in-out;
    padding-bottom: 0.5rem;
}

.auth-tab.active {
    color: var(--primary);
}

.auth-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary);
    border-radius: var(--radius-xs);
}

.auth-form {
    display: none;
    flex-direction: column;
    gap: 1.5rem;
}

.auth-form.active {
    display: flex;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-size: 0.85rem;
    color: var(--primary-dim);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
}

.input-group input {
    background: var(--surface-container);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 1rem 1.2rem;
    color: var(--on-surface);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease-in-out;
    font-family: 'Manrope', sans-serif;
}

.input-group input:focus {
    background: var(--surface-container-lowest);
    border-color: var(--outline-variant-focus);
    box-shadow: var(--shadow-ambient);
}

.auth-error {
    color: #d9465a;
    font-size: 0.9rem;
    min-height: 20px;
    font-weight: 500;
}

.auth-submitBtn {
    background: linear-gradient(135deg, var(--primary), var(--primary-dim));
    color: var(--on-primary);
    border: none;
    padding: 1.2rem;
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 0.5rem;
    transition: all 0.3s ease-in-out;
    font-family: 'Plus Jakarta Sans', sans-serif;
    box-shadow: 0 4px 15px rgba(135, 79, 91, 0.2);
}

.auth-submitBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(135, 79, 91, 0.3);
}

/* ============ Global Submit Button Paused State ============ */
.submit-btn.paused-state {
    background: linear-gradient(135deg, rgba(30, 215, 96, 0.4), rgba(4, 150, 255, 0.6));
    border: 1px solid rgba(30, 215, 96, 0.5);
    box-shadow: 0 4px 15px rgba(30, 215, 96, 0.3), 
                inset 0 0 10px rgba(4, 150, 255, 0.3);
    color: #fff;
    animation: paused-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    transform: scale(1.05);
}

.submit-btn.paused-state i {
    animation: soft-bounce 2s ease-in-out infinite;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
    font-size: 1.1em;
}

@keyframes paused-pulse {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(30, 215, 96, 0.3), inset 0 0 10px rgba(4, 150, 255, 0.3);
    }
    50% {
        box-shadow: 0 8px 25px rgba(30, 215, 96, 0.6), inset 0 0 15px rgba(4, 150, 255, 0.6);
        border-color: rgba(30, 215, 96, 0.8);
    }
}

@keyframes soft-bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* ============================
   Token Slider
   ============================ */
.token-slider-group {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.82rem;
    color: var(--primary-dim);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: rgba(0,0,0,0.04);
    border: 1px solid rgba(0,0,0,0.05);
    transition: background 0.2s;
}

.token-slider-group:hover {
    background: rgba(0,0,0,0.07);
}

#tokenSlider {
    -webkit-appearance: none;
    appearance: none;
    width: 90px;
    height: 4px;
    border-radius: var(--radius-xs);
    background: var(--primary-container);
    outline: none;
    cursor: pointer;
    transition: background 0.2s;
}

#tokenSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
    transition: transform 0.15s;
}

#tokenSlider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

#tokenSliderLabel {
    min-width: 34px;
    text-align: right;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--on-surface);
    font-size: 0.8rem;
}

/* =====================================================
   Rich Content: Code Blocks
   ===================================================== */
.code-block-wrapper {
    margin: 1em 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.code-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: #1e1e2e;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.code-lang-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.45);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-family: "SF Mono", "Fira Code", monospace;
}

.code-copy-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-xs);
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.code-copy-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 0.9);
}

.code-copy-btn.copied {
    background: rgba(52, 199, 89, 0.25);
    border-color: rgba(52, 199, 89, 0.4);
    color: #34c759;
}

.code-block-wrapper pre {
    margin: 0;
    border-radius: 0;
    background: #1e1e2e !important;
    padding: 1rem 1.2rem !important;
    overflow-x: auto;
    font-size: 0.875rem;
    line-height: 1.65;
}

.code-block-wrapper pre code {
    background: transparent !important;
    padding: 0 !important;
    border-radius: 0 !important;
    font-family: "SF Mono", "Fira Code", "Cascadia Code", "Consolas", monospace;
}

/* Inline code (non-block) */
.markdown-content code:not(pre code) {
    background: rgba(0, 0, 0, 0.06);
    color: #c0392b;
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    font-size: 0.88em;
    font-family: "SF Mono", "Fira Code", monospace;
    border: 1px solid rgba(0, 0, 0, 0.07);
}

/* =====================================================
   Rich Content: Links
   ===================================================== */
.markdown-content a.md-link,
.markdown-content a {
    color: #0071e3;
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1.5px solid rgba(0, 113, 227, 0.25);
    transition: all 0.2s ease;
    padding-bottom: 1px;
}

.markdown-content a.md-link:hover,
.markdown-content a:hover {
    color: #0058b8;
    border-bottom-color: #0071e3;
    background: rgba(0, 113, 227, 0.06);
    border-radius: var(--radius-xs);
    padding: 0 3px 1px;
}

/* =====================================================
   Rich Content: Price Badges
   ===================================================== */
.price-badge {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, #fff3cd, #ffe083);
    color: #7d5a00;
    font-weight: 700;
    font-size: 0.9em;
    padding: 1px 7px 2px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(200, 150, 0, 0.25);
    box-shadow: 0 1px 4px rgba(200, 150, 0, 0.15);
    letter-spacing: -0.01em;
    white-space: nowrap;
}

/* =====================================================
   Rich Content: KaTeX Math
   ===================================================== */
.katex-display {
    margin: 1em 0;
    overflow-x: auto;
    padding: 0.5em 0;
}

.katex {
    font-size: 1.05em;
}

/* =====================================================
   Rich Content: Tables — Premium Financial Grade
   ===================================================== */
.markdown-content table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 1.2em 0;
    font-size: 0.88rem;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    font-variant-numeric: tabular-nums;
}

.markdown-content th {
    background: rgba(0, 0, 0, 0.05);
    font-weight: 700;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 2px solid rgba(0, 0, 0, 0.12);
    font-size: 0.82rem;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.markdown-content td {
    padding: 10px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    transition: background 0.15s ease;
    line-height: 1.5;
}

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

.markdown-content tr:nth-child(even) td {
    background: rgba(0, 0, 0, 0.02);
}

.markdown-content tr:hover td {
    background: rgba(0, 0, 0, 0.04);
}

/* Bold rows (e.g., totals) get subtle highlight */
.markdown-content td strong {
    font-weight: 700;
    color: inherit;
}

.markdown-content .table-scroll-wrap {
    width: 100%;
    margin: 1.2em 0 1.35em;
    overflow-x: auto;
    overflow-y: hidden;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
}

.markdown-content .table-scroll-wrap table {
    width: max-content;
    min-width: 100%;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    table-layout: auto;
}

.markdown-content .table-scroll-wrap th,
.markdown-content .table-scroll-wrap td {
    white-space: nowrap;
    vertical-align: middle;
}

.markdown-content .table-scroll-wrap th:first-child,
.markdown-content .table-scroll-wrap td:first-child {
    min-width: 180px;
    white-space: normal;
}

.markdown-content .table-scroll-wrap th:not(:first-child),
.markdown-content .table-scroll-wrap td:not(:first-child) {
    min-width: 132px;
}

.markdown-content .table-scroll-wrap td:not(:first-child) {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

[data-theme="dark"] .markdown-content .table-scroll-wrap {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(27, 27, 27, 0.96);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

[data-theme="dark"] .markdown-content .table-scroll-wrap table {
    background: transparent;
}

/* =====================================================
   Search History Modal Styling
   ===================================================== */

.large-modal {
    width: 90vw !important;
    max-width: 1400px !important;
    height: 85vh;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.search-modal-layout {
    display: flex;
    width: 100%;
    height: 100%;
}

.search-sidebar {
    width: 340px;
    background: rgba(255, 255, 255, 0.4);
    border-right: 1px solid var(--outline-variant);
    display: flex;
    flex-direction: column;
}

.search-modal-top-bar {
    padding: 20px;
    border-bottom: 1px solid var(--outline-variant);
    position: relative;
    background: var(--surface-container-highest);
    display: flex;
    align-items: center;
}

.search-modal-top-bar .search-icon {
    position: absolute;
    left: 36px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary-dim);
    z-index: 2;
}

#historySearchInput {
    width: 100%;
    height: 44px;
    border-radius: var(--radius-xl);
    border: 1px solid var(--outline-variant);
    background: var(--surface-container-highest);
    padding: 0 20px 0 44px;
    font-size: 1rem;
    font-family: inherit;
    color: var(--on-surface);
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

#historySearchInput:focus {
    outline: none;
    border-color: var(--primary-dim);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.history-search-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.history-search-list .history-item {
    padding: 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
}

.history-search-list .history-item.active-preview,
.history-search-list .history-item:hover {
    background: var(--surface-container-lowest);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.search-preview-pane {
    flex: 1;
    background: var(--surface);
    overflow-y: auto;
    padding: 40px;
    position: relative;
}

.preview-empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--primary-dim);
    font-size: 1.1rem;
    pointer-events: none;
}

.preview-content {
    max-width: 800px;
    margin: 0 auto;
}

.preview-title {
    font-size: 1.8rem;
    margin-bottom: 30px;
    color: var(--on-surface);
    border-bottom: 2px solid var(--outline-variant);
    padding-bottom: 10px;
}

.preview-messages {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.preview-msg {
    padding: 16px 20px;
    border-radius: var(--radius-md);
    line-height: 1.6;
}

.preview-msg.user {
    background: var(--surface-container-highest);
    align-self: flex-end;
    box-shadow: var(--shadow-ambient);
    border-bottom-right-radius: 4px;
}

.preview-msg.assistant {
    background: transparent;
    align-self: flex-start;
}
/* Modal Action Buttons inside History Item */
.history-item-actions .modal-action-btn {
    background: transparent;
    border: none;
    color: var(--primary-dim);
    cursor: pointer;
    padding: 6px 8px;
    border-radius: var(--radius-xs);
    opacity: 0;
    transform: translateX(10px);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    margin-left: 2px;
}

.history-item:hover .modal-action-btn {
    opacity: 1;
    transform: translateX(0);
}

.history-item-actions .modal-action-btn:hover {
    color: var(--on-surface);
    background: var(--surface-container-highest);
}

.history-item-actions .delete-btn:hover {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
}

.hidden { display: none !important; }

/* =====================================================
   Button Premium Interactivity Overrides Request
   ===================================================== */

/* Sidebar Buttons matching background + 3D Texture */
.nav-menu-btn {
    background: rgba(0, 0, 0, 0.03) !important;
    border: 1px solid rgba(0, 0, 0, 0.05) !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02), inset 0 1px 0 rgba(255,255,255,0.5) !important;
    transform: translateY(0);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.nav-menu-btn:hover, .nav-menu-btn.active {
    background: rgba(0, 0, 0, 0.06) !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.05), inset 0 1px 0 rgba(255,255,255,0.8) !important;
    transform: translateY(-1px) !important;
}

.nav-menu-btn:active {
    transform: translateY(1px) scale(0.97) !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03), inset 0 2px 4px rgba(0,0,0,0.06) !important;
}

.nav-menu-btn i {
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), color 0.2s;
}

.nav-menu-btn:hover i {
    transform: scale(1.1);
}

.nav-menu-btn:active i {
    transform: scale(0.85);
}

/* History Modal items 3D Texture matching Sidebar Buttons */
.history-search-list .history-item {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.04);
    box-shadow: 0 2px 4px rgba(0,0,0,0.015), inset 0 1px 0 rgba(255,255,255,0.4);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    transform: translateY(0);
    cursor: pointer;
}

.history-search-list .history-item.active-preview,
.history-search-list .history-item:hover {
    background: rgba(0, 0, 0, 0.06);
    box-shadow: 0 4px 8px rgba(0,0,0,0.04), inset 0 1px 0 rgba(255,255,255,0.7);
    transform: translateY(-1px);
}

.history-search-list .history-item:active {
    transform: translateY(1px) scale(0.98);
    box-shadow: 0 1px 2px rgba(0,0,0,0.02), inset 0 2px 4px rgba(0,0,0,0.05);
}

/* Fix action btn hovering inside active history item so it doesn't sink */
.history-search-list .history-item .modal-action-btn:active {
    transform: scale(0.9);
}

/* =====================================================
   Sidebar Alignment & Button Uniformity + Padding fixes
   ===================================================== */
.nav-menu-btn, .nav-menu-btn.active {
    background: rgba(0, 0, 0, 0.035) !important;
    border-radius: var(--radius-md) !important;
    margin-bottom: 10px !important;
}

.nav-menu-btn:hover {
    background: rgba(0, 0, 0, 0.07) !important;
}

/* Space out the buttons completely from the sidebar edges */
.sidebar-top {
    padding-bottom: 6px;
}

/* Right preview spacing to avoid hugging border */
.search-preview-pane {
    padding-left: 30px !important;
    padding-right: 30px !important;
    background: var(--surface-light); /* just ensure smooth bg */
}

.preview-messages {
    padding: 0 40px 40px 40px !important;
    max-width: 900px;
    margin: 0 auto;
}

.preview-title {
    padding: 30px 40px 10px 40px !important;
    max-width: 900px;
    margin: 0 auto;
}



.nav-menu-btn {
    background: transparent !important;
    border: 1px solid transparent !important;
    box-shadow: none !important;
}

.nav-menu-btn.active {
    background: transparent !important;
    border: 1px solid transparent !important;
    box-shadow: none !important;
}

.nav-menu-btn:hover {
    background: rgba(0, 0, 0, 0.05) !important;
    border: 1px solid rgba(0, 0, 0, 0.05) !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.02), inset 0 1px 0 rgba(255,255,255,1) !important;
}

/* History Items background purely transparent by default */
.history-search-list .history-item {
    background: transparent !important;
    border: 1px solid transparent !important;
    box-shadow: none !important;
}

.history-search-list .history-item.active-preview,
.history-search-list .history-item:hover {
    background: rgba(0, 0, 0, 0.05) !important;
    border: 1px solid rgba(0, 0, 0, 0.05) !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.02), inset 0 1px 0 rgba(255,255,255,1) !important;
}

/* =====================================================
   Search Modal: private, quiet, scan-friendly
   ===================================================== */
.large-modal {
    max-width: 1120px !important;
    height: min(78vh, 760px);
    border-radius: 18px !important;
    background: var(--surface-container-lowest) !important;
}

.search-modal-top-bar {
    padding: 18px 20px !important;
    background: var(--surface-container-lowest) !important;
}

.search-modal-layout {
    min-height: 0;
}

.search-sidebar {
    width: 360px;
    background: var(--surface-container-lowest) !important;
    border-right: 1px solid var(--outline-variant);
}

#historySearchInput {
    height: 42px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid transparent;
    box-shadow: none;
    font-size: 0.95rem;
    letter-spacing: 0;
}

#historySearchInput:focus {
    border-color: rgba(0, 0, 0, 0.12);
    box-shadow: none;
}

#historySearchInput:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.history-search-list {
    padding: 14px !important;
}

.search-empty-state {
    list-style: none;
    margin: 36px 16px;
    color: var(--primary-dim);
    font-size: 0.92rem;
    line-height: 1.55;
    text-align: center;
}

.history-search-list .history-group-title {
    margin: 18px 8px 8px;
    padding: 0;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--primary-dim);
}

.history-search-list .history-item {
    min-height: 62px;
    padding: 11px 10px 11px 14px !important;
    margin-bottom: 6px;
    border-radius: 12px !important;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease !important;
}

.history-search-list .history-item.active-preview,
.history-search-list .history-item:hover {
    background: rgba(0, 0, 0, 0.045) !important;
    border-color: rgba(0, 0, 0, 0.06) !important;
    box-shadow: none !important;
    transform: translateY(-1px);
}

.history-item-main {
    min-width: 0;
    flex: 1;
}

.history-search-list .history-item-text {
    font-size: 0.95rem;
    font-weight: 650;
    line-height: 1.3;
    color: var(--on-surface);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0;
}

.history-item-meta {
    margin-top: 5px;
    font-size: 0.76rem;
    font-weight: 500;
    color: var(--primary-dim);
    letter-spacing: 0;
}

.history-item-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.history-item-actions .modal-action-btn {
    width: 30px;
    height: 30px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    font-size: 0.78rem;
    opacity: 0;
    transform: translateX(4px);
}

.history-search-list .history-item:hover .modal-action-btn,
.history-search-list .history-item.active-preview .modal-action-btn {
    opacity: 1;
    transform: translateX(0);
}

.search-preview-pane {
    padding: 0 !important;
    background: var(--surface) !important;
}

.preview-empty-state {
    width: min(360px, 70%);
    text-align: center;
    font-size: 0.96rem;
    line-height: 1.6;
}

.preview-content {
    max-width: 820px;
    padding: 42px 48px;
}

.preview-title {
    padding: 0 0 18px !important;
    margin: 0 0 24px !important;
    max-width: none;
    border-bottom: 1px solid var(--outline-variant);
    font-size: 1.45rem;
    line-height: 1.25;
    font-weight: 750;
    letter-spacing: 0;
}

.preview-messages {
    padding: 0 0 42px !important;
    max-width: none;
    gap: 14px;
}

.preview-msg {
    width: 100%;
    padding: 16px 18px;
    border-radius: 12px;
    border: 1px solid var(--outline-variant);
    background: var(--surface-container-lowest);
    line-height: 1.65;
}

.preview-msg.user {
    align-self: stretch;
    box-shadow: none;
    border-bottom-right-radius: 12px;
}

.preview-msg.assistant {
    background: transparent;
    border-color: transparent;
    padding-left: 0;
    padding-right: 0;
}

.preview-msg-role {
    margin-bottom: 8px;
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--primary-dim);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.preview-msg-body {
    font-size: 0.94rem;
    color: var(--on-surface);
}

.preview-think-note,
.search-status {
    color: var(--primary-dim);
    font-size: 0.88rem;
    line-height: 1.6;
}

[data-theme="dark"] .large-modal,
[data-theme="dark"] .search-sidebar,
[data-theme="dark"] .search-modal-top-bar {
    background: #111111 !important;
}

[data-theme="dark"] #historySearchInput {
    background: rgba(255, 255, 255, 0.06);
    border-color: transparent;
}

[data-theme="dark"] #historySearchInput:focus {
    border-color: rgba(255, 255, 255, 0.16);
}

[data-theme="dark"] .history-search-list .history-item.active-preview,
[data-theme="dark"] .history-search-list .history-item:hover {
    background: rgba(255, 255, 255, 0.07) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

[data-theme="dark"] .search-preview-pane {
    background: #090909 !important;
}

[data-theme="dark"] .preview-msg {
    background: #151515;
    border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .preview-msg.assistant {
    background: transparent;
    border-color: transparent;
}

/* =========================================================
   ATTACHMENTS PREVIEW (PLATINUM LIQUID GLASS)
   ========================================================= */
.attachments-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 16px;
    margin-bottom: 2px;
}

.attachments-preview:empty {
    display: none;
}

.file-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: var(--radius-xl);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    font-size: 0.85rem;
    color: var(--text-color);
    animation: fadeIn 0.3s ease;
    transition: all 0.2s ease;
}

.file-pill:hover {
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

.file-pill i.fa-file-pdf { color: #e2574c; }
.file-pill i.fa-file-image { color: #4c8de2; }
.file-pill i.fa-file-lines { color: #8e8e8e; }

.file-pill-name {
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.file-pill-size {
    color: var(--primary-dim);
    font-size: 0.75rem;
}

.file-pill-remove {
    cursor: pointer;
    background: none;
    border: none;
    color: var(--primary-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.file-pill-remove:hover {
    color: #e2574c;
    background: rgba(226, 87, 76, 0.1);
}

.attachments-container-msg {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.file-attachment-card {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: var(--radius-md);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
    text-decoration: none;
    color: var(--text-color);
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.file-attachment-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.file-attachment-card i {
    font-size: 1.2rem;
}

/* =====================================================
   PDF Download Card (Agent Mode)
   ===================================================== */
.pdf-download-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 22px;
    margin-top: 14px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(226, 87, 76, 0.07), rgba(226, 87, 76, 0.02));
    border: 1px solid rgba(226, 87, 76, 0.22);
    box-shadow: 0 4px 20px rgba(226, 87, 76, 0.06), inset 0 1px 0 rgba(255,255,255,0.7);
    animation: fadeSlideUp 0.4s ease-in-out;
}

.pdf-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: rgba(226, 87, 76, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pdf-card-icon i {
    font-size: 1.6rem;
    color: #e2574c;
}

.pdf-card-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.pdf-card-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--on-surface);
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.pdf-card-sub {
    font-size: 0.8rem;
    color: var(--primary-dim);
}

.pdf-dl-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 22px;
    background: #e2574c;
    color: #ffffff;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.88rem;
    font-family: 'Plus Jakarta Sans', sans-serif;
    transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(226, 87, 76, 0.3);
}

.pdf-dl-btn:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(226, 87, 76, 0.4);
    color: #ffffff;
}

.pdf-dl-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(226, 87, 76, 0.3);
}


/* =====================================================
   Gmail Confirmation Card (Agent Mode)
   ===================================================== */
.gmail-confirm-card {
    margin-top: 14px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.07), rgba(99, 102, 241, 0.02));
    border: 1px solid rgba(99, 102, 241, 0.22);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.06), inset 0 1px 0 rgba(255,255,255,0.7);
    animation: fadeSlideUp 0.4s ease-in-out;
    overflow: hidden;
}

.gmail-card-actions {
    display: flex;
    gap: 10px;
    padding: 14px 22px;
    justify-content: flex-start;
}

.gmail-confirm-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 24px;
    background: #6366f1;
    color: #ffffff;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.88rem;
    font-family: 'Plus Jakarta Sans', sans-serif;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.gmail-confirm-btn:hover {
    background: #4f46e5;
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(99, 102, 241, 0.4);
}

.gmail-confirm-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.gmail-confirm-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.gmail-cancel-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 20px;
    background: transparent;
    color: var(--primary-dim);
    border: 1px solid var(--outline-variant);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.88rem;
    font-family: 'Plus Jakarta Sans', sans-serif;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
    white-space: nowrap;
}

.gmail-cancel-btn:hover {
    background: rgba(220, 38, 38, 0.08);
    border-color: rgba(220, 38, 38, 0.3);
    color: #dc2626;
    transform: translateY(-1px);
}

.gmail-cancel-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Dark mode Gmail card */
[data-theme="dark"] .gmail-confirm-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(99, 102, 241, 0.04));
    border-color: rgba(99, 102, 241, 0.25);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.08);
}


/* --- Sidemenu & User Context Additions --- */
.sidebar-user-container {
    position: relative;
    width: 100%;
}
.sidebar-user-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: var(--radius-lg);
    background: transparent;
    border: none;
    width: 100%;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.sidebar-user-btn:hover {
    background: var(--surface-container-low);
}
.user-avatar-mimic {
    border-radius: var(--radius-md);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
    overflow: hidden;
}
.user-avatar-mimic img {
    border-radius: var(--radius-md);
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-context-menu {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 0;
    width: 240px;
    background: var(--surface-container-highest);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px) scale(0.96);
    transform-origin: bottom left;
    transition: all 0.35s cubic-bezier(0.25, 1, 0.5, 1);
    box-shadow: var(--shadow-glass-pop);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 1000;
}
html[data-theme="light"] .user-context-menu {
    box-shadow: var(--shadow-glass-pop-light);
}
.user-context-menu.show {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.ctx-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: none;
    background: transparent;
    border-radius: var(--radius-md);
    color: var(--on-surface);
    font-size: 0.9rem;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}
.ctx-menu-item:hover {
    background: var(--surface-container-low);
}
.ctx-menu-item i {
    width: 16px;
    text-align: center;
    color: var(--primary-dim);
}
.ctx-divider {
    height: 1px;
    background: var(--outline-variant);
    margin: 6px 0;
}
.text-danger {
    color: #ff4d4f;
}
.text-danger:hover {
    background: rgba(255, 77, 79, 0.08);
}
.text-danger i {
    color: #ff4d4f;
}

.page-wrapper.sidebar-collapsed .sidebar-user-btn {
    padding: 8px;
    justify-content: center;
}
.page-wrapper.sidebar-collapsed .user-info-text {
    display: none;
}
.page-wrapper.sidebar-collapsed .user-context-menu {
    left: calc(100% + 12px);
    bottom: 0px;
    transform-origin: left bottom;
    transform: translateX(-12px) scale(0.96);
}
.page-wrapper.sidebar-collapsed .user-context-menu.show {
    transform: translateX(0) scale(1);
}

/* Nested settings in user context */
.ctx-settings-block {
    display: none;
    flex-direction: column;
    gap: 8px;
    padding: 8px 12px;
    background: var(--surface-container-low);
    border-radius: var(--radius-sm);
    margin: 4px 12px;
}
.ctx-settings-block.show {
    display: flex;
}
.ctx-settings-header {
    font-size: 0.75rem;
    color: var(--primary-dim);
    margin-bottom: 4px;
}

/* =====================================================
   User Message: Stacked Attachment + Text Layout
   ===================================================== */
.user-msg-attachment-block {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    width: 100%;
}

.user-msg-attachment-card {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--surface-container-highest);
    border: 1px solid var(--outline-variant);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.25s ease;
    max-width: 340px;
    text-decoration: none;
    color: var(--on-surface);
    font-size: 0.88rem;
    font-weight: 500;
}
.user-msg-attachment-card:hover {
    background: var(--surface-bright);
    transform: translateY(-1px);
}
.user-msg-attachment-card .att-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: rgba(226, 87, 76, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.1rem;
    color: #e2574c;
}
.user-msg-attachment-card .att-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 220px;
}
.user-msg-attachment-card .att-size {
    color: var(--primary-dim);
    font-size: 0.78rem;
    margin-left: auto;
    white-space: nowrap;
}

/* Dark mode attachment card */
[data-theme="dark"] .user-msg-attachment-card {
    background: #151515;
    border-color: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .user-msg-attachment-card:hover {
    background: #1e1e1e;
}

/* =====================================================
   PDF Preview Modal
   ===================================================== */
.pdf-preview-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}
.pdf-preview-overlay.show {
    display: flex;
}

.pdf-preview-container {
    width: 90vw;
    max-width: 900px;
    height: 90vh;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-xl);
    overflow: hidden;
    background: var(--surface-container-highest);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: fadeSlideUp 0.3s ease;
}

.pdf-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: var(--surface-container-highest);
    border-bottom: 1px solid var(--outline-variant);
    flex-shrink: 0;
}

.pdf-preview-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--on-surface);
    overflow: hidden;
}
.pdf-preview-filename {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 600px;
}

.pdf-preview-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--primary-dim);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.pdf-preview-close:hover {
    background: var(--surface-container-low);
    color: var(--on-surface);
}

.pdf-preview-body {
    flex: 1;
    overflow: hidden;
    background: #525659;
}

.pdf-preview-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.pdf-preview-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 10px 20px;
    background: var(--surface-container-highest);
    border-top: 1px solid var(--outline-variant);
    flex-shrink: 0;
}

.pdf-toolbar-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--primary-dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}
.pdf-toolbar-btn:hover {
    background: var(--surface-container-low);
    color: var(--on-surface);
}

.pdf-toolbar-page-info {
    font-size: 0.88rem;
    color: var(--primary-dim);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    min-width: 60px;
    text-align: center;
}

/* Dark mode PDF preview */
[data-theme="dark"] .pdf-preview-container {
    background: #111;
}
[data-theme="dark"] .pdf-preview-header {
    background: #111;
    border-bottom-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .pdf-preview-toolbar {
    background: #111;
    border-top-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .pdf-preview-body {
    background: #1a1a1a;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
/* Gmail Email Confirmation Preview Component */
.gmail-preview-container {
    position: relative;
    background: var(--surface-container-low);
    border-radius: var(--radius-sm);
    margin-top: 12px;
    border: 1px solid var(--outline-variant);
    overflow: hidden;
    transition: all 0.3s ease;
}

.gmail-preview-content {
    padding: 16px;
    white-space: pre-wrap;
    font-size: 0.95em;
    color: var(--on-surface);
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    max-height: 400px;
}

/* Scrollbar styling for preview content */
.gmail-preview-content::-webkit-scrollbar {
    width: 6px;
}
.gmail-preview-content::-webkit-scrollbar-track {
    background: transparent;
}
.gmail-preview-content::-webkit-scrollbar-thumb {
    background-color: var(--outline-variant-focus);
    border-radius: 10px;
}

.gmail-preview-content.collapsed {
    max-height: 140px;
    overflow: hidden;
    /* Soft gradient fade out effect at the bottom */
    -webkit-mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
}

.gmail-preview-toggle {
    text-align: center;
    padding: 8px 16px;
    font-size: 0.85em;
    font-weight: 500;
    color: #6366f1;
    cursor: pointer;
    user-select: none;
    border-top: 1px solid var(--outline-variant);
    background: var(--surface-container);
    transition: background 0.2s ease, color 0.2s ease;
}

.gmail-preview-toggle:hover {
    background: var(--outline-variant);
}

/* =========================================
   Responsive: prevent toggle icon overlay
   ========================================= */
.toggles-container {
    flex-wrap: wrap;
    min-width: 0;
}

/* Fullscreen account page */
body.account-page-open {
    overflow: hidden;
}

.account-page-overlay {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: none;
    background: #080808;
    color: #f7f7f7;
    font-family: inherit;
    letter-spacing: 0;
}

html:not([data-theme="dark"]) .account-page-overlay {
    background: #f7f7f5;
    color: #111111;
}

.account-page-overlay.show {
    display: block;
}

.account-brand {
    position: absolute;
    top: 28px;
    left: 34px;
    width: 78px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.account-brand img {
    width: auto;
    height: 34px;
    object-fit: contain;
    border-radius: 4px;
    filter: none;
}

.account-top-actions {
    position: absolute;
    top: 20px;
    right: 28px;
    display: flex;
    align-items: center;
    gap: 26px;
}

.account-lang-switch,
.account-top-icon-btn {
    border: 0;
    color: #f6f6f6;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
}

.account-lang-switch {
    height: 40px;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 0 18px 0 16px;
    border-radius: 999px;
    background: #111111;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
    font-size: 14px;
    font-weight: 650;
    color: #d9d9d9;
}

.account-lang-switch i {
    font-size: 17px;
    color: #b8b8b8;
}

.account-top-icon-btn {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #f5f5f5;
}

.account-top-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: linear-gradient(135deg, #303030, #101010);
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
}

.account-top-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.account-left-panel {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(37vw, 390px);
    min-width: 292px;
    padding: 148px 0 26px 36px;
}

.account-welcome {
    font-size: 28.4px;
    line-height: 1.18;
    font-weight: 760;
    color: #ffffff;
    margin-left: -13px;
    margin-top: -6px;
}

.account-welcome-muted {
    color: #9a9a9a;
    font-weight: 400;
}

.account-nav-list {
    margin-top: 50px;
    width: 222px;
    margin-left: -34px;
    display: flex;
    flex-direction: column;
    gap: 13px;
}

.account-nav-item {
    position: relative;
    width: 222px;
    height: 51px;
    border: 0;
    border-radius: 4px;
    padding: 0 16px 0 22px;
    display: flex;
    align-items: center;
    gap: 15px;
    background: transparent;
    color: #9a9a9a;
    font-family: inherit;
    font-size: 17px;
    font-weight: 800;
    text-align: left;
    cursor: pointer;
}

.account-nav-item i {
    width: 18px;
    color: currentColor;
    text-align: center;
    font-size: 18px;
}

.account-nav-item.active {
    color: #ffffff;
    border: 0;
}

.account-nav-bullet {
    position: absolute;
    left: 7px;
    width: 7px;
    height: 7px;
    background: #f5f5f5;
}

.account-bottom-actions {
    position: absolute;
    left: 34px;
    bottom: 32px;
}

.account-back-main {
    height: 50px;
    min-width: 164px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-radius: 999px;
    border: 1px solid #262626;
    background: transparent;
    color: #ffffff;
    font-family: inherit;
    font-size: 15px;
    font-weight: 750;
    cursor: pointer;
}

.account-main-panel {   
    position: absolute;
    top: 148px;
    left: clamp(210px, 42.5vw, 820px);
    right: clamp(48px, 10vw, 200px);
    max-width: 760px;
}

.account-section-header h1 {
    margin: 0;
    color: #ffffff;
    font-size: 27px;
    line-height: 1.15;
    font-weight: 780;
}

.account-section-header p {
    margin: 12px 0 0;
    color: #a3a3a3;
    font-size: 15px;
    line-height: 1.45;
    font-weight: 400;
}

.account-data-list {
    margin-top: 54px;
    border-top: 1px solid #292929;
}

.account-data-row {
    min-height: 138px;
    padding: 38px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 34px;
    border-bottom: 1px solid #292929;
}

.account-data-copy {
    max-width: 560px;
}

.account-data-copy h2 {
    margin: 0;
    color: #ffffff;
    font-size: 17px;
    line-height: 1.25;
    font-weight: 760;
}

.account-data-copy p {
    margin: 10px 0 0;
    color: #aaa;
    font-size: 14px;
    line-height: 1.5;
    font-weight: 400;
}

.account-row-btn {
    min-width: 100px;
    height: 38px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid #2c2c2c;
    background: transparent;
    color: #ffffff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

.account-row-btn-danger {
    border-color: rgba(165, 52, 44, 0.28);
    background: #a4332c;
}

html:not([data-theme="dark"]) .account-lang-switch {
    background: #ffffff;
    color: #1a1a1a;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.16);
}

html:not([data-theme="dark"]) .account-lang-switch i,
html:not([data-theme="dark"]) .account-top-icon-btn,
html:not([data-theme="dark"]) .account-nav-item,
html:not([data-theme="dark"]) .account-data-copy p,
html:not([data-theme="dark"]) .account-section-header p,
html:not([data-theme="dark"]) .account-welcome-muted {
    color: #666666;
}

html:not([data-theme="dark"]) .account-welcome,
html:not([data-theme="dark"]) .account-section-header h1,
html:not([data-theme="dark"]) .account-data-copy h2,
html:not([data-theme="dark"]) .account-nav-item.active,
html:not([data-theme="dark"]) .account-back-main,
html:not([data-theme="dark"]) .account-row-btn {
    color: #111111;
}

html:not([data-theme="dark"]) .account-nav-item.active {
    border: 0;
}

html:not([data-theme="dark"]) .account-nav-bullet {
    background: #111111;
}

html:not([data-theme="dark"]) .account-data-list,
html:not([data-theme="dark"]) .account-data-row {
    border-color: #d8d8d8;
}

html:not([data-theme="dark"]) .account-back-main,
html:not([data-theme="dark"]) .account-row-btn {
    border-color: #d1d1d1;
}

html:not([data-theme="dark"]) .account-row-btn-danger {
    color: #ffffff;
}

.account-dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 5050;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.42);
}

.account-dialog-backdrop[hidden] {
    display: none;
}

.account-download-dialog {
    width: min(430px, calc(100vw - 42px));
    border-radius: 20px;
    border: 1px solid #343434;
    background: #1a1a1a;
    padding: 26px 26px 22px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
}

.account-dialog-check {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 3px solid #49d06b;
    color: #49d06b;
    font-size: 16px;
    margin-bottom: 22px;
}

.account-download-dialog h2 {
    margin: 0;
    color: #ffffff;
    font-size: 18px;
    line-height: 1.2;
    font-weight: 760;
}

.account-download-dialog p {
    margin: 16px 0 24px;
    color: #a8a8a8;
    font-size: 13.5px;
    line-height: 1.5;
    font-weight: 400;
}

.account-dialog-close {
    width: 100%;
    height: 44px;
    border-radius: 999px;
    border: 2px solid #f4f4f4;
    background: #282828;
    color: #ffffff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

html:not([data-theme="dark"]) .account-download-dialog {
    background: #ffffff;
    border-color: #d8d8d8;
}

html:not([data-theme="dark"]) .account-download-dialog h2 {
    color: #111111;
}

html:not([data-theme="dark"]) .account-download-dialog p {
    color: #666666;
}

html:not([data-theme="dark"]) .account-dialog-close {
    color: #111111;
    background: #eeeeee;
    border-color: #111111;
}

.account-delete-dialog {
    width: min(480px, calc(100vw - 42px));
    border-radius: 22px;
    border: 1px solid #303030;
    background: #1a1a1a;
    padding: 28px 28px 26px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    box-shadow: 0 18px 52px rgba(0, 0, 0, 0.38);
}

.account-dialog-warning {
    align-self: center;
    color: #ff4f4f;
    font-size: 32px;
    line-height: 1;
    margin-bottom: 22px;
}

.account-delete-dialog h2 {
    margin: 0;
    color: #ffffff;
    text-align: center;
    font-size: 20px;
    line-height: 1.2;
    font-weight: 760;
}

.account-delete-dialog p {
    margin: 18px auto 26px;
    max-width: 390px;
    color: #aaa;
    text-align: center;
    font-size: 14px;
    line-height: 1.55;
    font-weight: 400;
}

.account-delete-label {
    color: #aaa;
    font-size: 14px;
    line-height: 1.45;
    font-weight: 650;
    margin-bottom: 14px;
}

.account-delete-label strong {
    color: #f5f5f5;
    font-weight: 760;
}

.account-delete-input {
    width: 100%;
    height: 44px;
    border-radius: 8px;
    border: 1.5px solid #eeeeee;
    background: transparent;
    color: #ffffff;
    padding: 0 16px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 650;
    outline: none;
}

.account-delete-input::placeholder {
    color: #777777;
}

.account-delete-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 24px;
}

.account-delete-cancel,
.account-delete-confirm {
    height: 44px;
    border-radius: 999px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 730;
    cursor: pointer;
}

.account-delete-cancel {
    border: 1px solid #333333;
    background: transparent;
    color: #ffffff;
}

.account-delete-confirm {
    border: 0;
    background: #82302b;
    color: #ffffff;
}

.account-delete-confirm:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

html:not([data-theme="dark"]) .account-delete-dialog {
    background: #ffffff;
    border-color: #d7d7d7;
}

html:not([data-theme="dark"]) .account-delete-dialog h2,
html:not([data-theme="dark"]) .account-delete-label strong,
html:not([data-theme="dark"]) .account-delete-input,
html:not([data-theme="dark"]) .account-delete-cancel {
    color: #111111;
}

html:not([data-theme="dark"]) .account-delete-dialog p,
html:not([data-theme="dark"]) .account-delete-label {
    color: #666666;
}

html:not([data-theme="dark"]) .account-delete-input {
    border-color: #111111;
}

html:not([data-theme="dark"]) .account-delete-cancel {
    border-color: #d1d1d1;
}

@media (max-width: 600px) {
    .guest-header {
        padding: 12px 14px 0;
    }
    .guest-nav {
        width: 100%;
        max-width: none;
        justify-content: flex-end;
        gap: 8px;
    }
    .guest-nav-gear {
        width: 36px;
        height: 36px;
        flex: 0 0 36px;
    }
    .guest-nav-login,
    .guest-nav-register {
        min-height: 38px;
        padding: 8px 16px;
        font-size: 0.84rem;
        white-space: nowrap;
    }
    .settings-dropdown {
        max-width: calc(100vw - 28px);
    }
    .app-container {
        padding-top: 96px;
    }
    .app-container.centered-landing {
        justify-content: flex-start;
        padding-top: 112px;
    }
    .guest-limit-banner {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 14px;
        border-radius: 20px;
    }
    .guest-limit-banner__actions {
        width: 100%;
    }
    .guest-limit-banner__btn {
        flex: 1;
    }
    .toggle-switch span,
    .connector-trigger span {
        display: none;
    }
    .toggle-switch,
    .connector-trigger {
        padding: 0.5rem 0.7rem;
    }
    .input-bottom-row {
        padding: 0.12rem 0.72rem 0.62rem;
    }
    .input-top-row {
        padding: 0.72rem 0.9rem 0.16rem;
    }
    .liquid-glass-input textarea {
        font-size: 0.96rem;
    }
    .chat-area {
        padding: 1rem 0.95rem 10.6rem;
    }
    .app-container.guest-cta-visible .chat-area {
        padding-bottom: 14.5rem;
    }
    .app-container.guest-input-hidden .chat-area {
        padding-bottom: 6.5rem;
    }
    .message-bubble.user {
        max-width: 88%;
    }
}

@media (max-width: 900px) {
    .account-page-overlay {
        overflow-y: auto;
    }
    .account-top-actions {
        right: 18px;
        gap: 14px;
    }
    .account-left-panel,
    .account-main-panel {
        position: relative;
        inset: auto;
        width: auto;
        min-width: 0;
        max-width: none;
    }
    .account-left-panel {
        padding: 96px 22px 18px;
    }
    .account-welcome {
        font-size: 28px;
    }
    .account-nav-list,
    .account-nav-item {
        width: 100%;
    }
    .account-nav-list {
        margin-left: 0;
    }
    .account-bottom-actions {
        position: fixed;
        left: 18px;
        bottom: 18px;
        z-index: 1;
    }
    .account-main-panel {
        padding: 22px 22px 118px;
    }
    .account-data-row {
        align-items: flex-start;
        min-height: 0;
        padding: 34px 0;
    }
}

/* =========================================================================
   Account Page — Global Font Fix
   ========================================================================= */
.account-page-overlay,
.account-download-dialog,
.account-delete-dialog,
.account-confirm-dialog,
.account-edit-dialog,
.cookie-prefs-dialog {
    font-family: 'Inter', 'Poppins', -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
}

/* =========================================================================
   Account Page — Profile Section
   ========================================================================= */
.account-profile-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
}

.account-profile-avatar-large {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: linear-gradient(135deg, #303030, #101010);
    color: #ffffff;
    font-size: 26px;
    font-weight: 700;
    flex-shrink: 0;
}

.account-profile-avatar-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.account-profile-info-card {
    margin-top: 40px;
    border: 1px solid #2a2a2a;
    border-radius: 16px;
    overflow: hidden;
}

html:not([data-theme="dark"]) .account-profile-info-card {
    border-color: #e0e0e0;
    background: #f9f9f9;
}

.account-profile-info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 20px 24px;
    border-bottom: 1px solid #2a2a2a;
    min-height: 80px;
}

.account-profile-info-row--no-border {
    border-bottom: none;
}

html:not([data-theme="dark"]) .account-profile-info-row {
    border-color: #e0e0e0;
}

.account-profile-label {
    font-size: 13px;
    color: #8a8a8a;
    font-weight: 400;
    margin-bottom: 4px;
}

html:not([data-theme="dark"]) .account-profile-label {
    color: #666666;
}

.account-profile-value {
    font-size: 16px;
    color: #f0f0f0;
    font-weight: 400;
}

html:not([data-theme="dark"]) .account-profile-value {
    color: #111111;
}

.account-row-btn-link {
    white-space: nowrap;
}

.account-login-methods-title {
    margin: 52px 0 8px;
    font-size: 24px;
    font-weight: 760;
    color: #ffffff;
}

html:not([data-theme="dark"]) .account-login-methods-title {
    color: #111111;
}

.account-login-methods-subtitle {
    font-size: 14px;
    color: #8a8a8a;
    margin-bottom: 28px;
    line-height: 1.5;
    font-weight: 400;
}

.account-login-methods-card {
    border: 1px solid #2a2a2a;
    border-radius: 16px;
    overflow: hidden;
}

html:not([data-theme="dark"]) .account-login-methods-card {
    border-color: #e0e0e0;
    background: #f9f9f9;
}

.account-login-method-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 24px;
    border-bottom: 1px solid #2a2a2a;
    min-height: 78px;
}

.account-login-method-row--last {
    border-bottom: none;
}

html:not([data-theme="dark"]) .account-login-method-row {
    border-color: #e0e0e0;
}

.account-login-method-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.account-login-method-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #1e1e1e;
    border: 1px solid #333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #d0d0d0;
    flex-shrink: 0;
}

html:not([data-theme="dark"]) .account-login-method-icon {
    background: #f0f0f0;
    border-color: #ddd;
    color: #333;
}

.account-login-method-name {
    font-size: 15px;
    font-weight: 600;
    color: #f0f0f0;
}

html:not([data-theme="dark"]) .account-login-method-name {
    color: #111111;
}

.account-login-method-sub {
    font-size: 13px;
    color: #7a7a7a;
    margin-top: 2px;
    font-weight: 400;
}

.account-login-method-btn {
    height: 36px;
    min-width: 80px;
    padding: 0 18px;
    border-radius: 999px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
    border: 1px solid #3a3a3a;
    background: transparent;
    color: #ffffff;
    white-space: nowrap;
    flex-shrink: 0;
}

.account-login-method-btn--enabled {
    background: #ffffff;
    color: #111111;
    border-color: #ffffff;
    font-weight: 700;
}

.account-login-method-btn--disabled {
    background: transparent;
    color: #a0a0a0;
    border-color: #3a3a3a;
}

.account-login-method-btn--connect {
    background: #ffffff;
    color: #111111;
    border-color: #ffffff;
    font-weight: 700;
}

html:not([data-theme="dark"]) .account-login-method-btn {
    border-color: #d0d0d0;
    color: #333333;
}

html:not([data-theme="dark"]) .account-login-method-btn--enabled,
html:not([data-theme="dark"]) .account-login-method-btn--connect {
    background: #111111;
    color: #ffffff;
    border-color: #111111;
}

/* =========================================================================
   Google Unlink / Generic Confirm Dialog
   ========================================================================= */
.account-confirm-dialog {
    width: min(370px, calc(100vw - 48px));
    border-radius: 22px;
    background: #1a1a1a;
    border: 1px solid #2e2e2e;
    padding: 30px 28px 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
    box-shadow: 0 20px 54px rgba(0,0,0,0.48);
}

html:not([data-theme="dark"]) .account-confirm-dialog {
    background: #ffffff;
    border-color: #e0e0e0;
    box-shadow: 0 12px 40px rgba(0,0,0,0.12);
}

.account-confirm-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #252525;
    border: 1px solid #3a3a3a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    color: #f0f0f0;
    margin-bottom: 18px;
    flex-shrink: 0;
}

html:not([data-theme="dark"]) .account-confirm-icon {
    background: #f0f0f0;
    border-color: #ddd;
    color: #444;
}

.account-confirm-dialog h2 {
    font-size: 18px;
    font-weight: 760;
    color: #f0f0f0;
    margin: 0 0 12px;
    line-height: 1.3;
    font-family: inherit;
}

html:not([data-theme="dark"]) .account-confirm-dialog h2 {
    color: #111111;
}

.account-confirm-dialog p {
    font-size: 13.5px;
    color: #8a8a8a;
    font-weight: 400;
    margin: 0 0 24px;
    line-height: 1.55;
    font-family: inherit;
}

.account-confirm-actions {
    display: flex;
    gap: 10px;
    width: 100%;
}

.account-confirm-cancel,
.account-confirm-proceed {
    flex: 1;
    height: 42px;
    border-radius: 999px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 650;
    cursor: pointer;
    border: 1px solid transparent;
    transition: opacity 0.15s;
}

.account-confirm-cancel {
    background: #202020;
    border-color: #3a3a3a;
    color: #f0f0f0;
}

.account-confirm-proceed {
    background: #f0f0f0;
    border-color: #f0f0f0;
    color: #111111;
}

html:not([data-theme="dark"]) .account-confirm-cancel {
    background: #111111;
    border-color: #111111;
    color: #ffffff;
}

html:not([data-theme="dark"]) .account-confirm-proceed {
    background: #f0f0f0;
    border-color: #d0d0d0;
    color: #111111;
}

.account-confirm-cancel:hover,
.account-confirm-proceed:hover {
    opacity: 0.82;
}

/* =========================================================================
   Security Section — Breadcrumb & Password Sub-view
   ========================================================================= */
.account-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 28px;
    font-size: 14px;
    color: #8a8a8a;
    font-weight: 400;
}

.account-breadcrumb-link {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: inherit;
    font-size: inherit;
    font-family: inherit;
    font-weight: inherit;
    text-decoration: none;
}

.account-breadcrumb-link:hover {
    text-decoration: underline;
    color: #cccccc;
}

html:not([data-theme="dark"]) .account-breadcrumb-link:hover {
    color: #333333;
}

.account-breadcrumb-sep {
    color: #555;
}

.account-subview-title {
    font-size: 28px;
    font-weight: 760;
    color: #ffffff;
    margin: 0 0 10px;
}

html:not([data-theme="dark"]) .account-subview-title {
    color: #111111;
}

.account-subview-subtitle {
    font-size: 14px;
    color: #8a8a8a;
    margin: 0;
    font-weight: 400;
    line-height: 1.5;
}

.account-password-divider {
    border: none;
    border-top: 1px solid #292929;
    margin: 28px 0;
}

html:not([data-theme="dark"]) .account-password-divider {
    border-color: #e0e0e0;
}

.account-password-field {
    margin-bottom: 8px;
}

.account-password-field label {
    display: block;
    font-size: 13px;
    font-weight: 400;
    color: #8a8a8a;
    margin-bottom: 10px;
}

.account-password-input-wrap {
    display: flex;
    align-items: center;
    border: 1px solid #333;
    border-radius: 10px;
    background: #1a1a1a;
    overflow: hidden;
}

html:not([data-theme="dark"]) .account-password-input-wrap {
    border-color: #d0d0d0;
    background: #f5f5f5;
}

.account-password-input-wrap input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    padding: 13px 16px;
    font-size: 15px;
    color: #f0f0f0;
    font-family: inherit;
}

html:not([data-theme="dark"]) .account-password-input-wrap input {
    color: #111111;
}

.account-password-icon-btn {
    background: none;
    border: none;
    padding: 10px 14px;
    cursor: pointer;
    color: #6a6a6a;
    font-size: 15px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.account-password-icon-btn:hover {
    color: #cccccc;
}

html:not([data-theme="dark"]) .account-password-icon-btn:hover {
    color: #333333;
}

.account-edit-desc {
    font-size: 13px;
    color: #8a8a8a;
    font-weight: 400;
    margin: 4px 0 16px;
    line-height: 1.5;
}

.account-data-row--no-btn {
    min-height: 100px;
}

/* =========================================================================
   Cookie Preference Dialog
   ========================================================================= */
.cookie-prefs-dialog {
    position: relative;
    width: min(560px, calc(100vw - 32px));
    max-height: calc(100vh - 52px);
    overflow-y: auto;
    border-radius: 18px;
    background: #1c1c1c;
    border: 1px solid #2e2e2e;
    padding: 24px 24px 22px;
    box-shadow: 0 22px 56px rgba(0, 0, 0, 0.48);
    display: flex;
    flex-direction: column;
    gap: 0;
}

html:not([data-theme="dark"]) .cookie-prefs-dialog {
    background: #ffffff;
    border-color: #e0e0e0;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.12);
}

.cookie-prefs-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid #3a3a3a;
    background: #2a2a2a;
    color: #aaa;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.cookie-prefs-close:hover {
    background: #3a3a3a;
    color: #fff;
}

html:not([data-theme="dark"]) .cookie-prefs-close {
    background: #f0f0f0;
    border-color: #d8d8d8;
    color: #555;
}

html:not([data-theme="dark"]) .cookie-prefs-close:hover {
    background: #e0e0e0;
    color: #111;
}

.cookie-prefs-logo {
    margin-bottom: 16px;
}

.cookie-prefs-title {
    font-size: 19px;
    font-weight: 760;
    color: #f0f0f0;
    margin: 0 0 14px;
    line-height: 1.2;
}

html:not([data-theme="dark"]) .cookie-prefs-title {
    color: #111111;
}

.cookie-prefs-desc {
    font-size: 13px;
    color: #999;
    line-height: 1.56;
    margin: 0 0 18px;
    font-weight: 400;
}

html:not([data-theme="dark"]) .cookie-prefs-desc {
    color: #555555;
}

.cookie-allow-all-btn {
    display: block;
    width: 100%;
    height: 44px;
    border-radius: 999px;
    border: 0;
    background: #1a1a1a;
    color: #f0f0f0;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    margin-bottom: 24px;
    transition: background 0.2s;
}

.cookie-allow-all-btn:hover {
    background: #252525;
}

html:not([data-theme="dark"]) .cookie-allow-all-btn {
    background: #111111;
    color: #ffffff;
}

html:not([data-theme="dark"]) .cookie-allow-all-btn:hover {
    background: #333333;
}

.cookie-manage-title {
    font-size: 15px;
    font-weight: 700;
    color: #c0c0c0;
    margin: 0 0 12px;
}

html:not([data-theme="dark"]) .cookie-manage-title {
    color: #333333;
}

.cookie-categories {
    display: flex;
    flex-direction: column;
    border: 1px solid #2e2e2e;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 24px;
}

html:not([data-theme="dark"]) .cookie-categories {
    border-color: #e0e0e0;
}

.cookie-category {
    border-bottom: 1px solid #2e2e2e;
}

.cookie-category:last-child {
    border-bottom: none;
}

html:not([data-theme="dark"]) .cookie-category {
    border-color: #e0e0e0;
}

.cookie-category-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    min-height: 54px;
}

.cookie-expand-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid #3a3a3a;
    background: #2a2a2a;
    color: #aaa;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 1;
}

html:not([data-theme="dark"]) .cookie-expand-btn {
    background: #f0f0f0;
    border-color: #d0d0d0;
    color: #444;
}

.cookie-category-name {
    font-size: 14px;
    font-weight: 650;
    color: #e0e0e0;
    flex: 1;
}

html:not([data-theme="dark"]) .cookie-category-name {
    color: #1a1a1a;
}

.cookie-always-active {
    font-size: 13px;
    font-weight: 600;
    color: #5b9cf6;
    white-space: nowrap;
}

/* Cookie toggle switch */
.cookie-toggle-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    cursor: pointer;
    flex-shrink: 0;
}

.cookie-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.cookie-toggle-track {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: #3a3a3a;
    transition: background 0.25s;
    border: 1px solid #4a4a4a;
}

.cookie-toggle-switch input:checked + .cookie-toggle-track {
    background: #4a9eff;
    border-color: #4a9eff;
}

.cookie-toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #888;
    transition: transform 0.25s, background 0.25s;
}

.cookie-toggle-switch input:checked + .cookie-toggle-track .cookie-toggle-thumb {
    transform: translateX(24px);
    background: #ffffff;
}

html:not([data-theme="dark"]) .cookie-toggle-track {
    background: #d0d0d0;
    border-color: #c0c0c0;
}

html:not([data-theme="dark"]) .cookie-toggle-switch input:checked + .cookie-toggle-track {
    background: #4a9eff;
    border-color: #4a9eff;
}

html:not([data-theme="dark"]) .cookie-toggle-thumb {
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Cookie bottom action buttons */
.cookie-prefs-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.cookie-reject-all-btn,
.cookie-confirm-btn {
    height: 44px;
    border-radius: 999px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

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

.mof-toast {
    max-width: min(360px, calc(100vw - 44px));
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(22, 22, 22, 0.94);
    color: #f5f5f5;
    font-family: 'Inter', 'Poppins', -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
    font-size: 13px;
    line-height: 1.45;
    font-weight: 500;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.26);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.mof-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.mof-toast.error {
    border-color: rgba(165, 52, 44, 0.38);
}

html:not([data-theme="dark"]) .mof-toast {
    background: rgba(255, 255, 255, 0.96);
    color: #151515;
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.14);
}

.cookie-reject-all-btn {
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    color: #d0d0d0;
}

.cookie-reject-all-btn:hover {
    background: #353535;
}

.cookie-confirm-btn {
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    color: #d0d0d0;
}

.cookie-confirm-btn:hover {
    background: #353535;
}

html:not([data-theme="dark"]) .cookie-reject-all-btn,
html:not([data-theme="dark"]) .cookie-confirm-btn {
    background: #f0f0f0;
    border-color: #d0d0d0;
    color: #111111;
}

html:not([data-theme="dark"]) .cookie-reject-all-btn:hover,
html:not([data-theme="dark"]) .cookie-confirm-btn:hover {
    background: #e4e4e4;
}

@media (max-width: 480px) {
    .cookie-prefs-dialog {
        padding: 22px 18px 18px;
        border-radius: 16px;
    }
    .cookie-prefs-actions {
        grid-template-columns: 1fr;
    }
}

/* =========================================================================
   Account Profile — Layout fix & Edit Dialogs
   ========================================================================= */
.account-profile-section,
.account-data-section,
.account-security-section {
    padding-right: 24px;
    max-width: 720px;
}

.account-profile-info-card,
.account-login-methods-card {
    max-width: 100%;
}

.account-edit-dialog {
    width: min(460px, calc(100vw - 32px));
    border-radius: 20px;
    background: #1c1c1c;
    border: 1px solid #2e2e2e;
    padding: 28px 28px 24px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.55);
    display: flex;
    flex-direction: column;
    gap: 16px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
}

html:not([data-theme="dark"]) .account-edit-dialog {
    background: #ffffff;
    border-color: #e0e0e0;
    box-shadow: 0 16px 48px rgba(0,0,0,0.12);
}

.account-edit-dialog h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #f0f0f0;
}

html:not([data-theme="dark"]) .account-edit-dialog h3 {
    color: #111111;
}

.account-edit-dialog label {
    font-size: 13px;
    color: #888;
    font-weight: 500;
}

html:not([data-theme="dark"]) .account-edit-dialog label {
    color: #555;
}

.account-edit-dialog input[type="text"],
.account-edit-dialog input[type="email"] {
    width: 100%;
    height: 46px;
    border-radius: 10px;
    border: 1.5px solid #3a3a3a;
    background: #111111;
    color: #f0f0f0;
    padding: 0 14px;
    font-family: inherit;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

.account-edit-dialog input[type="text"]:focus,
.account-edit-dialog input[type="email"]:focus {
    border-color: #5a9fff;
}

html:not([data-theme="dark"]) .account-edit-dialog input[type="text"],
html:not([data-theme="dark"]) .account-edit-dialog input[type="email"] {
    background: #f5f5f5;
    border-color: #d0d0d0;
    color: #111111;
}

html:not([data-theme="dark"]) .account-edit-dialog input:focus {
    border-color: #5a9fff;
}

.account-edit-dialog .account-edit-error {
    font-size: 13px;
    color: #ff6b6b;
    min-height: 16px;
    margin: 0;
}

.account-edit-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 4px;
}

.account-edit-cancel {
    height: 46px;
    border-radius: 999px;
    border: 1px solid #3a3a3a;
    background: transparent;
    color: #d0d0d0;
    font-family: inherit;
    font-size: 14px;
    font-weight: 650;
    cursor: pointer;
}

.account-edit-save {
    height: 46px;
    border-radius: 999px;
    border: 0;
    background: #ffffff;
    color: #111111;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
}

.account-edit-save:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

html:not([data-theme="dark"]) .account-edit-cancel {
    border-color: #d0d0d0;
    color: #555;
}

html:not([data-theme="dark"]) .account-edit-save {
    background: #111111;
    color: #ffffff;
}
