    @import url('./mobile.css');

    /* Typography is now handled by typography.css */
    /* Only keep thread-specific overrides here */

    /* ========================================
       v3 LAYOUT VARIABLES & UTILITIES
       ======================================== */
    :root {
        /* Layout Dimensions */
        --width-sidebar: 260px;
        /* Slightly wider for cleaner nav */
        --width-thread-list: 400px;
        /* Wider for better readability */
        --width-rail: 320px;

        /* Lumina Base Colors (Zinc-based for neutrality) */
        --bg-app: #f4f4f5;
        /* zinc-100 */
        --bg-surface: #ffffff;
        --bg-glass: rgba(255, 255, 255, 0.75);
        --bg-glass-heavy: rgba(255, 255, 255, 0.9);

        /* Borders & Separators */
        --border-subtle: rgba(0, 0, 0, 0.05);
        --border-glass: rgba(255, 255, 255, 0.2);

        /* Brand Colors (Pastel Blue) */
        --accent-50: #f5f8ff;
        --accent-100: #e7f0ff;
        --accent-200: #cfe0ff;
        --accent-300: #b6ccff;
        --accent-400: #9bb6ff;
        --accent-500: #7fa0ff;
        --accent-600: #6689e6;
        --accent-700: #4f6fbf;
        --accent-800: #3d5696;
        --accent-900: #324477;
        --accent-950: #24335a;
        --accent-500-rgb: 127 160 255;
        --accent-600-rgb: 102 137 230;

        --accent-primary: var(--accent-600);
        --accent-glow: rgb(var(--accent-500-rgb) / 0.2);
        --accent-surface: var(--accent-50);

        /* Typography Colors */
        --text-primary: #18181b;
        /* zinc-900 */
        --text-secondary: #52525b;
        /* zinc-600 */
        --text-tertiary: #a1a1aa;
        /* zinc-400 */

        /* Elevation Shadows */
        --shadow-glass:
            0 4px 6px -1px rgba(0, 0, 0, 0.05),
            0 2px 4px -1px rgba(0, 0, 0, 0.03),
            inset 0 1px 0 rgba(255, 255, 255, 0.3);

        /* Animation */
        --ease-fluid: cubic-bezier(0.32, 0.72, 0, 1);
    }

    /* Connection Dot States */
    #connection-dot.slashed {
        background-color: #a1a1aa !important;
        /* zinc-400 */
        position: relative;
        overflow: hidden;
    }

    #connection-dot.slashed::after {
        content: '';
        position: absolute;
        top: 50%;
        left: -10%;
        width: 120%;
        height: 1px;
        background-color: #71717a;
        /* zinc-500 */
        transform: translateY(-50%) rotate(-45deg);
    }

    /* Main Application Grid (3-pane) */
    html,
    body {
        height: 100%;
        width: 100%;
        margin: 0;
        padding: 0;
        overflow: hidden;
        /* Prevent body scroll */
    }

    .app-grid {
        display: grid;
        grid-template-columns: var(--width-sidebar) var(--width-thread-list) 1fr;
        height: 100vh;
        /* Force to viewport height */
        box-sizing: border-box;
        /* Include padding in height */
        width: 100%;
        overflow: hidden;
        background-color: var(--bg-app);
    }

    /* Only add top padding in Tauri (native app) to account for drag bar */
    /* Only add top padding in Tauri (native app) to account for drag bar - REMOVED: handled by component headers */
    .tauri-app .app-grid {
        padding-top: 0;
    }

    /* Target specific grid items (the panes) to ensure they trap overflow */
    #main-sidebar,
    #thread-list-pane,
    #reading-pane {
        height: 100%;
        max-height: 100%;
        min-height: 0;
        /* CRITICAL: Allows grid item to shrink below content size */
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    /* FORCE SIDEBAR VISIBILITY ON DESKTOP & TAURI */
    /* Mobile-first Tailwind classes might be failing in Tauri, so we force it */
    @media (min-width: 768px) {
        #main-sidebar {
            position: relative !important;
            transform: none !important;
            width: auto !important;
            flex: 1 1 0% !important;
            pointer-events: auto !important;
            display: flex !important;
            visibility: visible !important;
        }
    }

    /* Extra specificity for Tauri app which is always desktop width (min 1200px) */
    .tauri-app #main-sidebar {
        position: relative !important;
        transform: none !important;
        width: auto !important;
        flex: 1 1 0% !important;
        pointer-events: auto !important;
        display: flex !important;
        visibility: visible !important;
        left: 0 !important;
        z-index: 50;
        /* Ensure it's above other content if stacking weirdness occurs */
    }

    /* Scrollbar Utility */
    .scroll-y {
        overflow-y: auto;
        overflow-x: hidden;
    }

    .scroll-y::-webkit-scrollbar {
        width: 6px;
    }

    .scroll-y::-webkit-scrollbar-track {
        background: transparent;
    }

    .scroll-y::-webkit-scrollbar-thumb {
        background: #d1d5db;
        border-radius: 3px;
    }

    .scroll-y:hover::-webkit-scrollbar-thumb {
        background: #9ca3af;
    }

    /* Drag and drop */
    .drop-highlight {
        background-color: rgba(127, 160, 255, 0.16);
        outline: 2px dashed #7FA0FF;
        outline-offset: -2px;
        box-shadow: inset 0 0 0 2px rgba(127, 160, 255, 0.5);
        border-radius: 8px;
    }

    body.dragging-threads .thread-item {
        pointer-events: none;
    }

    /* Folder name truncation with fade effect (only when overflowing) */
    #folder-name {
        max-width: 200px;
        overflow: hidden;
        white-space: nowrap;
        position: relative;
    }

    #folder-name.truncated {
        -webkit-mask-image: linear-gradient(to right, black calc(100% - 15px), transparent 100%);
        mask-image: linear-gradient(to right, black calc(100% - 15px), transparent 100%);
    }

    /* Notifications */
    .app-notification-stack {
        position: fixed;
        left: 50%;
        bottom: 20px;
        transform: translateX(-50%);
        z-index: 10050;
        display: flex;
        flex-direction: column-reverse;
        align-items: center;
        gap: 8px;
        pointer-events: none;
    }

    body.mobile-mode .app-notification-stack {
        top: 16px;
        bottom: auto;
        flex-direction: column;
    }

    body.mobile-mode.mobile-thread-list-view .app-notification-stack {
        top: auto;
        bottom: calc(8px + env(safe-area-inset-bottom));
    }

    body.mobile-mode.mobile-message-view .app-notification-stack {
        top: auto;
        bottom: calc(16px + env(safe-area-inset-bottom) + 72px);
    }

    .app-notification {
        pointer-events: auto;
        display: inline-flex;
        align-items: center;
        gap: 8px;
        min-width: 260px;
        max-width: 420px;
        padding: 6px 12px;
        border-radius: 999px;
        background: #111827;
        color: #f9fafb;
        border: 1px solid rgba(255, 255, 255, 0.08);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
        font-size: 12px;
        line-height: 1.2;
        opacity: 0;
        transform: translateY(8px);
        transition: opacity 0.18s ease, transform 0.18s ease;
    }

    .app-notification.is-visible {
        opacity: 1;
        transform: translateY(0);
    }

    .app-notification.is-leaving {
        opacity: 0;
        transform: translateY(8px);
    }

    .app-notification__message {
        flex: 1;
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .app-notification__action {
        border: none;
        background: transparent;
        color: #93c5fd;
        font-size: 11px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        cursor: pointer;
        padding: 2px 4px;
    }

    .app-notification__action:hover {
        color: #bfdbfe;
    }

    .app-notification__close {
        border: none;
        background: transparent;
        color: #9ca3af;
        width: 18px;
        height: 18px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        padding: 0;
    }

    .app-notification__close svg {
        width: 14px;
        height: 14px;
    }

    .app-notification__spinner {
        width: 14px;
        height: 14px;
        border-radius: 999px;
        border: 2px solid rgba(255, 255, 255, 0.2);
        border-top-color: rgba(255, 255, 255, 0.9);
        animation: app-toast-spin 0.9s linear infinite;
    }

    @keyframes app-toast-spin {
        to {
            transform: rotate(360deg);
        }
    }

    .app-notification--success {
        border-color: rgba(34, 197, 94, 0.6);
    }

    .app-notification--warning {
        border-color: rgba(234, 179, 8, 0.6);
    }

    .app-notification--error {
        border-color: rgba(239, 68, 68, 0.6);
    }

    .app-notification--info {
        border-color: rgba(59, 130, 246, 0.6);
    }

    /* Context Rail Container */
    .crm-rail {
        width: var(--width-rail);
        background: #fafafa;
        border-left: 1px solid var(--border-color);
        display: flex;
        flex-direction: column;
        transition: width 0.2s ease, opacity 0.2s ease;
    }

    .crm-rail.hidden {
        width: 0;
        opacity: 0;
        overflow: hidden;
    }

    /* Lumina Component Utilities */
    /* Reader Mode (Chat Style) */
    .prose-chat {
        font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
        font-size: 1.05rem;
        /* 16.8px */
        line-height: 1.7;
        color: #374151;
        /* gray-700 */
        max-width: 65ch;
        margin: 0;
        white-space: pre-wrap;
        /* Preserve whitespace but wrap text */
    }

    .prose-chat a {
        color: #6689e6;
        /* blue-600 */
        text-decoration: none;
        font-weight: 500;
    }

    .prose-chat a:hover {
        text-decoration: underline;
    }

    .glass-panel {
        background: rgba(255, 255, 255, 0.7);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border: 1px solid rgba(255, 255, 255, 0.5);
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
        border-radius: 1rem;
        /* rounded-xl */
        transition: transform 0.2s var(--ease-fluid), box-shadow 0.2s var(--ease-fluid);
    }

    .glass-panel:hover {
        background: rgba(255, 255, 255, 0.85);
        /* Slightly more opaque on hover */
        box-shadow:
            0 10px 15px -3px rgba(0, 0, 0, 0.05),
            0 4px 6px -2px rgba(0, 0, 0, 0.025),
            inset 0 1px 0 rgba(255, 255, 255, 0.4);
    }

    /* Standard line-clamp for compatibility */
    .line-clamp-2 {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        display: box;
        box-orient: vertical;
        line-clamp: 2;
        overflow: hidden;
    }

    .line-clamp-3 {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 3;
        display: box;
        box-orient: vertical;
        line-clamp: 3;
        overflow: hidden;
    }

    /* v3 Components */
    .btn-icon {
        width: 28px;
        height: 28px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 4px;
        color: var(--text-muted);
        transition: all 0.15s;
    }

    .btn-icon:hover {
        background: rgba(0, 0, 0, 0.05);
        color: var(--text-main);
    }

    .kbd {
        background: white;
        border: 1px solid var(--border-color);
        border-radius: 3px;
        padding: 0 4px;
        font-size: 10px;
        font-family: 'JetBrains Mono', monospace;
    }

    /* Status fade-out animation */
    .fading-out {
        opacity: 0;
        transition: opacity 500ms ease-out;
        pointer-events: none;
    }

    /* Legacy Overrides */
    /* Thread list typography */
    .thread-item {
        letter-spacing: -0.01em;
        position: relative;
        overflow: hidden;
        /* Optimized transitions: only animate cheap properties (no layout reflows) */
        transition: background-color 0.15s ease, border-color 0.15s ease;
        touch-action: pan-y;
        /* Allow vertical scroll, prevent browser swipe navigation */
        user-select: none;
        -webkit-user-drag: element;
        /* Prevent text selection during swipe */
        /* GPU acceleration for smooth rendering */
        transform: translateZ(0);
        will-change: background-color;
    }

    .thread-item:hover {
        background-color: rgba(0, 0, 0, 0.03);
        /* Subtle hover */
    }

    /* Force macOS selection state with high specificity */
    #thread-list .thread-item.active,
    .thread-item.active {
        background-color: #007AFF !important;
        /* macOS System Blue */
        color: white !important;
        border-left: none !important;
    }

    #thread-list .thread-item.active:hover,
    .thread-item.active:hover {
        background-color: #007AFF !important;
    }

    /* Adjust text colors inside active item for contrast */
    #thread-list .thread-item.active .thread-sender,
    #thread-list .thread-item.active .thread-subject,
    #thread-list .thread-item.active .thread-snippet,
    #thread-list .thread-item.active .thread-timestamp,
    #thread-list .thread-item.active .thread-badge,
    .thread-item.active .thread-sender,
    .thread-item.active .thread-subject,
    .thread-item.active .thread-snippet,
    .thread-item.active .thread-timestamp,
    .thread-item.active .thread-badge {
        color: white !important;
        opacity: 1;
        /* Reset opacity overrides */
    }

    #thread-list .thread-item.active .thread-subject,
    #thread-list .thread-item.active .thread-snippet,
    #thread-list .thread-item.active .thread-timestamp,
    .thread-item.active .thread-subject,
    .thread-item.active .thread-snippet,
    .thread-item.active .thread-timestamp {
        opacity: 0.95;
    }

    /* Sidebar background - subtle translucency without blur (keeps text crisp in Chrome) */
    #main-sidebar>div {
        background-color: rgba(255, 255, 255, 0.98) !important;
        border-right: 1px solid rgba(0, 0, 0, 0.08);
    }

    @media (prefers-color-scheme: dark) {
        #main-sidebar>div {
            background-color: rgba(24, 24, 27, 0.92) !important;
            border-right: 1px solid rgba(255, 255, 255, 0.12);
        }
    }


    /* Swipe gesture states */
    .thread-item.swipe-active {
        transition: none;
        /* Disable transitions during drag for immediate feedback */
        cursor: grabbing;
    }

    .thread-item.removing {
        opacity: 0 !important;
        height: 0 !important;
        min-height: 0 !important;
        max-height: 0 !important;
        margin: 0 !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        overflow: hidden;
        border: none !important;
    }

    /* Swipe backgrounds */
    /* DISABLED: Swipe gestures disabled for desktop - hidden by default */
    .swipe-background {
        position: absolute;
        top: 0;
        bottom: 0;
        display: none;
        /* Hidden - swipes disabled for desktop */
        align-items: center;
        padding: 0 20px;
        pointer-events: none;
        z-index: 0;
        opacity: 0;
        transition: opacity 0.2s ease;
    }

    .swipe-background.swipe-left {
        right: 0;
        left: 0;
        width: 100%;
        background: #10b981;
        /* Green for archive */
        justify-content: flex-end;
    }

    .swipe-background.swipe-right {
        left: 0;
        right: 0;
        width: 100%;
        background: #6b7280;
        /* Gray for read/unread */
        justify-content: flex-start;
    }

    .swipe-background.visible {
        opacity: 1;
    }

    .swipe-icon {
        color: white;
        font-weight: 600;
        font-size: 14px;
        display: flex;
        align-items: center;
        gap: 8px;
        white-space: nowrap;
    }

    /* Thread content wrapper */
    .thread-content {
        position: relative;
        z-index: 1;
        background: inherit;
        will-change: transform;
        user-select: none;
        /* Prevent text selection in thread list */
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        min-height: 98px;
        /* Ensure consistent height even with short previews */
    }

    .thread-item.swipe-active .thread-content {
        will-change: transform;
    }

    .message-body {
        width: 100%;
        overflow-x: auto;
        font-family: var(--font-reader);
        font-size: var(--text-reader-base);
        line-height: var(--leading-reader);
        letter-spacing: var(--tracking-normal);
    }

    .message-body.reader-body.pb-3 {
        padding: 20px !important;
    }

    .message-body iframe {
        width: 100%;
        border: none;
        display: block;
    }

    /* Desktop-only padding for email content */
    @media (min-width: 768px) {
        .message-body-container {
            padding-inline: 20px;
        }
    }

    #thread-list:focus {
        outline: none;
    }

    /* For inline code detection in emails */
    .message-body code,
    .message-body pre {
        font-family: var(--font-code);
        font-size: var(--text-code-base);
        line-height: var(--leading-code);
    }

    /* Skeleton loader animation */
    @keyframes shimmer {
        0% {
            background-position: -468px 0;
        }

        100% {
            background-position: 468px 0;
        }
    }

    .skeleton {
        animation: shimmer 1.2s ease-in-out infinite;
        background: linear-gradient(to right, #f0f0f0 8%, #e0e0e0 18%, #f0f0f0 33%);
        background-size: 800px 104px;
        position: relative;
    }

    .skeleton-text {
        height: 0.875rem;
        border-radius: 4px;
    }

    .skeleton-text-lg {
        height: 1rem;
        border-radius: 4px;
    }

    /* Skeleton thread item - mimics thread list structure */
    .skeleton-thread {
        padding: 12px;
        border-bottom: 1px solid #f3f4f6;
    }

    .skeleton-thread .skeleton-avatar {
        width: 32px;
        height: 32px;
        border-radius: 50%;
    }

    .skeleton-thread .skeleton-sender {
        height: 14px;
        width: 40%;
        margin-bottom: 8px;
        border-radius: 4px;
    }

    .skeleton-thread .skeleton-subject {
        height: 12px;
        width: 70%;
        margin-bottom: 6px;
        border-radius: 4px;
    }

    .skeleton-thread .skeleton-preview {
        height: 10px;
        width: 90%;
        border-radius: 4px;
    }

    /* Skeleton message body */
    .skeleton-message {
        padding: 16px;
    }

    .skeleton-message .skeleton-line {
        height: 14px;
        margin-bottom: 12px;
        border-radius: 4px;
    }

    .skeleton-message .skeleton-line:nth-child(1) {
        width: 100%;
    }

    .skeleton-message .skeleton-line:nth-child(2) {
        width: 95%;
    }

    .skeleton-message .skeleton-line:nth-child(3) {
        width: 85%;
    }

    .skeleton-message .skeleton-line:nth-child(4) {
        width: 90%;
    }

    .skeleton-message .skeleton-line:nth-child(5) {
        width: 60%;
    }

    /* Loading spinner utility */
    .loading-spinner {
        display: inline-block;
        width: 16px;
        height: 16px;
        border: 2px solid #e5e7eb;
        border-top-color: #7fa0ff;
        border-radius: 50%;
        animation: spin 0.8s linear infinite;
    }

    .loading-spinner-sm {
        width: 12px;
        height: 12px;
        border-width: 1.5px;
    }

    .loading-spinner-lg {
        width: 24px;
        height: 24px;
        border-width: 3px;
    }

    @keyframes spin {
        to {
            transform: rotate(360deg);
        }
    }

    /* Tiptap Editor */
    .tiptap-editor {
        height: 100%;
        overflow-y: auto;
    }

    .tiptap-editor .ProseMirror {
        outline: none;
        padding: 12px 16px;
        min-height: 200px;
        font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
        font-size: 14px;
        line-height: 1.6;
        color: #1f2937;
    }

    .tiptap-editor .ProseMirror p.is-editor-empty:first-child::before {
        content: attr(data-placeholder);
        color: #9ca3af;
        pointer-events: none;
        float: left;
        height: 0;
    }

    .tiptap-editor .ProseMirror>*+* {
        margin-top: 0.75em;
    }

    .tiptap-editor .ProseMirror ul,
    .tiptap-editor .ProseMirror ol {
        padding-left: 1.5em;
    }

    .tiptap-editor .ProseMirror blockquote {
        border-left: 3px solid #e5e7eb;
        padding-left: 1em;
        margin-left: 0;
        color: #6b7280;
    }

    .tiptap-editor .ProseMirror a {
        color: #2563eb;
        text-decoration: underline;
    }

    .tiptap-editor .ProseMirror img {
        max-width: 100%;
        height: auto;
    }

    /* Tiptap Toolbar */
    .tiptap-toolbar {
        display: flex;
        align-items: center;
        gap: 2px;
        padding: 4px 8px 4px 14px;
        border-bottom: 1px solid #e5e7eb;
        flex-wrap: wrap;
    }

    .tiptap-toolbar button {
        min-width: 26px;
        max-width: 140px;
        height: 26px;
        display: flex;
        align-items: center;
        justify-content: center;
        border: none;
        background: transparent;
        border-radius: 4px;
        cursor: pointer;
        color: #6b7280;
    }

    .tiptap-toolbar button:hover {
        background: #f3f4f6;
        color: #374151;
    }

    .tiptap-toolbar button.is-active {
        background: #e7f0ff;
        color: #2563eb;
    }

    .tiptap-toolbar .divider {
        width: 1px;
        height: 20px;
        background: #e5e7eb;
        margin: 0 4px;
    }

    /* Dropdowns */
    .tiptap-dropdown {
        position: relative;
    }

    .tiptap-dropdown .dropdown-toggle {
        display: flex;
        align-items: center;
        gap: 4px;
        padding: 4px 8px;
        border: none;
        background: transparent;
        font-size: 12px;
        color: #6b7280;
        cursor: pointer;
        border-radius: 4px;
    }

    .tiptap-dropdown .dropdown-toggle:hover {
        background: #f3f4f6;
    }

    .tiptap-dropdown .dropdown-label {
        max-width: 80px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .tiptap-dropdown .dropdown-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        background: white;
        border: 1px solid #e5e7eb;
        border-radius: 6px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        z-index: 100;
        min-width: 120px;
        max-height: 200px;
        overflow-y: auto;
    }

    .tiptap-dropdown[data-dropdown="fontFamily"] .dropdown-label {
        max-width: 160px;
    }

    .tiptap-dropdown[data-dropdown="fontFamily"] .dropdown-menu {
        min-width: 220px;
    }

    .tiptap-dropdown[data-dropdown="fontSize"] .dropdown-label {
        max-width: 80px;
    }

    .tiptap-dropdown[data-dropdown="fontSize"] .dropdown-menu {
        min-width: 140px;
    }

    .tiptap-dropdown.open .dropdown-menu {
        display: block;
    }

    .tiptap-dropdown .dropdown-menu button {
        display: block;
        width: 100%;
        padding: 6px 12px;
        border: none;
        background: transparent;
        text-align: left;
        font-size: 12px;
        color: #374151;
        cursor: pointer;
    }

    .tiptap-dropdown .dropdown-menu button:hover {
        background: #f3f4f6;
    }

    /* Color pickers */
    .tiptap-color-picker {
        position: relative;
    }

    .tiptap-color-picker .color-toggle {
        position: relative;
        width: 26px;
        height: 26px;
        display: flex;
        align-items: center;
        justify-content: center;
        border: none;
        background: transparent;
        border-radius: 4px;
        cursor: pointer;
    }

    .tiptap-color-picker .color-indicator {
        position: absolute;
        bottom: 3px;
        left: 4px;
        right: 4px;
        height: 3px;
        border-radius: 1px;
    }

    .tiptap-color-picker .color-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        background: white;
        border: 1px solid #e5e7eb;
        border-radius: 6px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        padding: 8px;
        z-index: 100;
    }

    .tiptap-color-picker.open .color-menu {
        display: grid;
        grid-template-columns: repeat(6, 24px);
        gap: 4px;
    }

    .tiptap-color-picker .color-swatch {
        width: 24px;
        height: 24px;
        border-radius: 4px;
        border: 1px solid #e5e7eb;
        cursor: pointer;
    }

    /* Confirmation modal */
    .confirmation-overlay {
        background: rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(2px);
    }

    .confirmation-modal {
        animation: modalSlideUp 0.2s ease-out;
    }

    @keyframes modalSlideUp {
        from {
            opacity: 0;
            transform: translateY(20px);
        }

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

    /* Instant tooltips for action buttons */
    .action-btn {
        position: relative;
    }

    .action-btn::after {
        content: attr(data-tooltip);
        position: absolute;
        bottom: 100%;
        left: 50%;
        transform: translateX(-50%) translateY(-4px);
        background: rgba(0, 0, 0, 0.85);
        color: white;
        padding: 4px 8px;
        border-radius: 4px;
        font-size: 11px;
        white-space: nowrap;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.05s ease;
        z-index: 100;
    }

    .action-btn:hover::after {
        opacity: 1;
    }

    /* Dialog animations */
    @keyframes fadeIn {
        from {
            opacity: 0;
        }

        to {
            opacity: 1;
        }
    }

    @keyframes fadeOut {
        from {
            opacity: 1;
        }

        to {
            opacity: 0;
        }
    }

    @keyframes scaleIn {
        from {
            opacity: 0;
            transform: scale(0.95);
        }

        to {
            opacity: 1;
            transform: scale(1);
        }
    }

    /* Inbox navigation improvements */
    #inbox-unified-btn,
    .account-inbox-item {
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* Active state with subtle inner highlight */
    #inbox-unified-btn.bg-gray-600,
    .account-inbox-item.bg-gray-600 {
        background-color: #4b5563 !important;
        /* Stronger gray-600 */
        box-shadow:
            0 1px 3px 0 rgba(0, 0, 0, 0.1),
            0 1px 2px 0 rgba(0, 0, 0, 0.06),
            inset 0 1px 0 rgba(255, 255, 255, 0.05);
    }

    /* Unread filter button active state */
    #unread-filter-btn.bg-blue-600 {
        box-shadow: 0 1px 3px 0 rgba(102, 137, 230, 0.2);
    }

    #unread-filter-btn.bg-blue-600:hover {
        background-color: #6689e6 !important;
        /* Slightly darker blue on hover */
        box-shadow: 0 1px 4px 0 rgba(102, 137, 230, 0.3);
    }

    /* Override the default hover styles when active */
    #unread-filter-btn.bg-blue-600.hover\:bg-blue-50 {
        background-color: #6689e6 !important;
    }

    /* Chevron button styling */
    #inbox-chevron-btn {
        transition: background-color 0.2s ease;
    }

    #inbox-chevron-btn:active {
        background-color: #4b5563;
        /* gray-600 */
    }

    /* Account list collapse animation */
    #account-inbox-list {
        transition: opacity 0.2s ease, max-height 0.3s ease;
        overflow: hidden;
    }

    #account-inbox-list.hidden {
        max-height: 0;
        opacity: 0;
    }

    /* Account items have no spacing between them */
    .account-inbox-item {
        border-radius: 0;
    }

    /* First account item has subtle top border separator */
    .account-inbox-item:first-child {
        border-top: 1px solid rgba(255, 255, 255, 0.05);
        margin-top: 0;
    }

    /* Thread Context Menu - Glassmorphism */
    .thread-context-menu {
        position: fixed;
        z-index: 10000;
        min-width: 200px;
        background: rgba(255, 255, 255, 0.85);
        backdrop-filter: blur(20px) saturate(180%);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
        border: 1px solid rgba(0, 0, 0, 0.1);
        border-radius: 8px;
        box-shadow:
            0 10px 25px rgba(0, 0, 0, 0.15),
            0 5px 10px rgba(0, 0, 0, 0.08);
        padding: 4px;
        font-size: 14px;
        animation: contextMenuFadeIn 0.12s ease-out;
    }

    @keyframes contextMenuFadeIn {
        from {
            opacity: 0;
            transform: scale(0.95);
        }

        to {
            opacity: 1;
            transform: scale(1);
        }
    }

    .context-menu-item {
        padding: 8px 14px;
        cursor: pointer;
        border-radius: 4px;
        transition: background-color 0.08s ease;
        color: #1f2937;
        font-weight: 400;
        user-select: none;
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .context-menu-item:hover {
        background-color: rgba(127, 160, 255, 0.12);
        color: #3d5696;
    }

    .context-menu-item:active {
        background-color: rgba(127, 160, 255, 0.2);
    }

    .context-menu-divider {
        height: 1px;
        background: rgba(0, 0, 0, 0.08);
        margin: 4px 0;
    }

    /* New context menu button styles (Tailwind-based) */
    .context-menu-btn {
        cursor: pointer;
        border-radius: 4px;
        user-select: none;
    }

    .context-menu-btn:hover {
        background-color: #f3f4f6 !important;
        /* gray-100 */
    }

    .context-menu-btn:active {
        background-color: #e5e7eb !important;
        /* gray-200 */
    }

    /* =============================================
     * Multi-Select & Bulk Actions
     * ============================================= */

    /* Selection highlighting - no checkboxes, just background */
    .thread-item.selected {
        background-color: #e7f0ff !important;
        /* Light blue */
        border-left: 3px solid #7fa0ff;
    }

    .thread-item.selected:hover {
        background-color: #cfe0ff !important;
        /* Darker on hover */
    }

    /* Don't override active thread highlighting when selected */
    .thread-item.selected.active {
        background-color: #f5f8ff !important;
        border-left: 3px solid #7fa0ff;
    }

    /* Bulk actions bar - centered, compact, dynamic width */
    #bulk-actions-bar {
        display: none;
        position: fixed;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        height: auto;
        background: white;
        border: 1px solid #e5e7eb;
        border-radius: 12px;
        padding: 8px 12px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.04);
        z-index: 40;
        align-items: center;
        gap: 8px;
    }

    #bulk-actions-bar .selection-count {
        font-weight: 600;
        font-size: 13px;
        color: #374151;
        padding: 0 8px;
        white-space: nowrap;
    }

    #bulk-actions-bar button {
        padding: 6px 12px;
        border: 1px solid #e5e7eb;
        border-radius: 6px;
        background: white;
        cursor: pointer;
        font-size: 13px;
        transition: all 0.15s ease;
        font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
        font-weight: 500;
        white-space: nowrap;
    }

    #bulk-actions-bar button:hover {
        background: #f3f4f6;
        border-color: #d1d5db;
    }

    #bulk-actions-bar button:active {
        background: #e5e7eb;
    }

    #bulk-actions-bar button.danger {
        border-color: #fecaca;
        color: #dc2626;
        background: #fef2f2;
    }

    #bulk-actions-bar button.danger:hover {
        background: #fee2e2;
        border-color: #fca5a5;
    }

    #bulk-actions-bar button[data-action="bulk-clear-selection"] {
        padding: 6px;
        border: none;
        background: transparent;
        color: #9ca3af;
        margin-left: 4px;
    }

    #bulk-actions-bar button[data-action="bulk-clear-selection"]:hover {
        color: #6b7280;
        background: #f3f4f6;
    }

    /* Message Action Buttons - Tertiary style until hovered */
    .message-action-btn {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 6px 12px;
        font-size: 12px;
        color: #9ca3af;
        /* gray-400 - subtle */
        background: rgba(255, 255, 255, 0.9);
        border: 1px solid #e5e7eb;
        /* gray-200 - very subtle */
        border-radius: 9999px;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
        transition: all 0.15s ease;
        cursor: pointer;
    }

    .message-action-btn:hover {
        color: #374151;
        /* gray-700 - prominent */
        background: white;
        border-color: #d1d5db;
        /* gray-300 */
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    }

    .message-action-btn:active {
        background: #f9fafb;
    }

    .message-action-btn svg {
        opacity: 0.6;
        transition: opacity 0.15s ease;
    }

    .message-action-btn:hover svg {
        opacity: 1;
    }

    /* Error/Warning dismissible state */
    .api-error-warning {
        transition: opacity 0.2s ease, transform 0.2s ease;
    }

    .api-error-warning.dismissed {
        opacity: 0;
        transform: scale(0.8);
        pointer-events: none;
    }

    /* Drag-and-drop states (prepared for Stage 2) */
    .thread-item.dragging {
        opacity: 0.5;
        background-color: #f3f4f6;
        cursor: grabbing;
    }

    [data-folder].drag-over {
        background-color: #7fa0ff !important;
        color: white !important;
        border-radius: 4px;
    }

    [data-folder] {
        transition: background-color 0.1s ease;
        cursor: pointer;
    }

    /* ========================================
   TAURI & PLATFORM SPECIFIC STYLES
   Moved from inline style block
   ======================================== */

    /* Tauri-specific styles for macOS title bar integration */
    /* Window dragging is handled via JS in tauri-init.js using startDragging() API */

    /* Add padding in Tauri to avoid traffic lights */
    body.tauri-app #main-sidebar {
        padding-top: 0;
        /* Reset excessive top padding */
        /* Clear traffic lights vertically */
        user-select: none;
        /* Prevent text selection in sidebar */
        -webkit-user-select: none;
        -moz-user-select: none;
    }

    /* Add horizontal padding to clear traffic lights */
    /* Add horizontal padding to clear traffic lights - MIGRATED: handled by inner drag regions now */
    /* Add horizontal padding to clear traffic lights - MIGRATED: handled by inner drag regions now */
    body.tauri-app #main-sidebar>div:first-child {
        padding-top: 0 !important;
        /* Reset padding, let flex header handle spacing */
        cursor: default;
    }

    /* Hide the avatar/profile circle in Tauri - REMOVED as it was hiding the whole sidebar */
    /* body.tauri-app #main-sidebar>div:first-child>div:first-child {
        display: none !important;
    } */

    /* Show/hide compose button text based on environment */
    .compose-text {
        display: inline;
    }

    body.tauri-app .compose-text {
        display: none;
    }

    /* Legacy web browser drag region (non-Tauri) - disabled */
    /* These styles are only needed when running as a web app with window.open() */

    /* Shimmer effect for backfill progress bar */
    @keyframes shimmer {
        0% {
            background-position: -200% center;
        }

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

    #backfill-progress-bar {
        background: linear-gradient(90deg,
                #7fa0ff 0%,
                #7fa0ff 40%,
                #9bb6ff 50%,
                #7fa0ff 60%,
                #7fa0ff 100%);
        background-size: 200% 100%;
        animation: shimmer 2s linear infinite;
    }

    /* Smooth fade-out for progress container */
    #backfill-progress-container {
        transition: opacity 0.5s ease-out, max-height 0.5s ease-out;
    }

    #backfill-progress-container.fading-out {
        opacity: 0;
        max-height: 0;
        overflow: hidden;
    }

    /* ========================================
       COMPACT DESIGN OVERRIDES (V2)
       ======================================== */

    /* Thread content wrapper */
    .thread-content {
        min-height: 66px !important;
        /* Reduced from 98px */
        padding: 9px 13px !important;
        /* Compact padding overrides Tailwind classes */
    }

    /* Compact Thread List Typography Updates */
    .thread-sender {
        font-size: 14px !important;
        margin-bottom: 1px !important;
    }

    .thread-timestamp {
        font-size: 12px !important;
        opacity: 0.7;
    }

    .thread-subject {
        font-size: 14px !important;
        margin: 1px 0 2px 0 !important;
    }

    .thread-snippet {
        font-size: 13px !important;
        margin: 0 !important;
        line-height: 1.3 !important;
        opacity: 0.8;
    }

    /* Improved Sidebar Compactness */
    .folder-link,
    .label-link {
        padding-top: 4px !important;
        padding-bottom: 4px !important;
        font-size: 13px !important;
        border-radius: 6px;
        cursor: pointer;
    }

    .account-inbox-item,
    .account-folder-item {
        padding-top: 4px !important;
        padding-bottom: 4px !important;
        cursor: pointer;
    }

    /* ========================================
   SIDEBAR LIGHT THEME STYLING
   ======================================== */

    /* Folder links base style */
    .folder-link {
        color: #374151;
        /* gray-700 */
        font-weight: 500;
        transition: background-color 0.15s ease, color 0.15s ease;
    }

    .folder-link:hover {
        background-color: #f3f4f6;
        /* gray-100 */
    }

    /* Active folder state */
    .folder-link.bg-blue-100 {
        background-color: #e7f0ff !important;
        /* blue-100 */
        color: #4f6fbf !important;
        /* blue-700 */
        font-weight: 600 !important;
    }

    /* Account items in sidebar */
    .account-inbox-item,
    .account-folder-item {
        color: #4b5563;
        /* gray-600 */
        font-size: 11px;
        transition: background-color 0.15s ease, color 0.15s ease;
    }

    .account-inbox-item:hover,
    .account-folder-item:hover {
        background-color: #f3f4f6;
        /* gray-100 */
    }

    /* Active account item */
    .account-inbox-item.bg-blue-100,
    .account-folder-item.bg-blue-100 {
        background-color: #e7f0ff !important;
        color: #4f6fbf !important;
    }

    /* Labels in sidebar */
    .label-link {
        color: #4b5563;
        /* gray-600 */
    }

    .label-link:hover {
        background-color: #f3f4f6;
    }

    .label-link.bg-blue-100 {
        background-color: #e7f0ff !important;
        color: #4f6fbf !important;
    }

    /* Scrollbar refinements for compact feel */
    ::-webkit-scrollbar {
        width: 6px;
        height: 6px;
    }

    ::-webkit-scrollbar-thumb {
        background: #d1d5db;
        border-radius: 3px;
    }

    ::-webkit-scrollbar-track {
        background: transparent;
    }

    /* Compact Message View Overrides */
    .message-item {
        margin-bottom: 8px !important;
    }

    .message-item .px-4 {
        padding-left: 12px !important;
        /* px-3 equiv */
        padding-right: 12px !important;
    }

    .message-item .pt-3 {
        padding-top: 8px !important;
        /* pt-2 equiv */
    }

    /* ========================================
   MODERN 3-ROW THREAD LIST
   ======================================== */

    .thread-item {
        min-height: 80px;
        position: relative;
        border-bottom: 1px solid rgba(15, 23, 42, 0.06);
        /* gray-200 */
        padding: 0 !important;
    }

    /* Content Container */
    .thread-content {
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: 10px 12px 10px 12px;
        height: 100%;
        min-height: 80px;
    }

    /* Row 1: Header (Dot + Sender + Time) */
    .thread-header {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-bottom: 2px;
        line-height: 1.3;
        min-width: 0;
    }

    /* Unread indicator (inline blue dot) */
    .thread-unread-indicator {
        width: 8px;
        height: 8px;
        min-width: 8px;
        background-color: #6689e6;
        /* blue-600 */
        border-radius: 50%;
        flex-shrink: 0;
    }

    /* White dot when thread is selected */
    .thread-item.active .thread-unread-indicator {
        background-color: white;
    }

    /* Placeholder for read threads to maintain alignment */
    .thread-unread-placeholder {
        width: 8px;
        min-width: 8px;
        flex-shrink: 0;
    }

    .thread-sender {
        font-size: 14px;
        font-weight: 600;
        color: #374151;
        /* gray-700 */
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        flex: 1;
        min-width: 0;
    }

    .thread-timestamp {
        font-size: 12px;
        color: #6b7280;
        /* gray-500 */
        flex-shrink: 0;
        margin-left: auto;
        font-feature-settings: "tnum";
    }

    /* Row 2: Subject Line */
    .thread-subject-line {
        display: flex;
        align-items: center;
        margin-bottom: 2px;
        padding-left: 16px;
        /* Align with text after dot */
        gap: 6px;
    }

    .thread-subject {
        font-size: 14px;
        font-weight: 400;
        color: #374151;
        /* gray-700 */
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        flex: 1;
        min-width: 0;
    }

    /* Row 3: Preview (1-2 lines) */
    .thread-preview-line {
        padding-left: 16px;
        line-height: 1.4;
    }

    .thread-snippet {
        font-size: 13px;
        color: #9ca3af;
        /* gray-400 */
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        line-clamp: 2;
        overflow: hidden;
    }

    .thread-attachment-icon {
        width: 14px;
        height: 14px;
        flex-shrink: 0;
        color: #9ca3af;
        margin-left: 6px;
    }

    .thread-date-header {
        padding: 8px 16px 6px;
        font-size: 12px;
        font-weight: 600;
        color: #9ca3af;
        margin-top: 4px;
        margin-bottom: 2px;
        user-select: none;
    }

    /* Unread State Typography */
    .thread-item.unread .thread-sender {
        font-weight: 700;
        color: #111827;
        /* gray-900 */
    }

    .thread-item.unread .thread-subject {
        font-weight: 500;
        color: #111827;
    }

    .thread-item.unread .thread-timestamp {
        color: #6689e6;
        font-weight: 500;
    }

    /* Active/Selected State */
    .thread-item.active {
        background-color: #f5f8ff !important;
        /* blue-50 */
    }

    .thread-item.active:hover {
        background-color: #e7f0ff !important;
        /* blue-100 */
    }

    /* ========================================
       CUSTOM DIALOG STYLES
       ======================================== */
    #fetch-custom-dialog {
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
    }

    @keyframes dialog-bounce {
        0% {
            transform: scale(0.95);
            opacity: 0;
        }

        100% {
            transform: scale(1);
            opacity: 1;
        }
    }

    #fetch-custom-dialog>div {
        animation: dialog-bounce 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    .dialog-glass {
        background: rgba(255, 255, 255, 0.9);
        backdrop-filter: blur(20px);
        border: 1px solid rgba(255, 255, 255, 0.3);
    }

    /* ========================================
       macOS Native Sidebar Styling
       ======================================== */

    /* Sidebar folder item - macOS style selection */
    .sidebar-item {
        border-radius: 6px;
        transition: background-color 0.1s ease;
    }

    .sidebar-item:hover:not(.sidebar-item-active) {
        background-color: rgba(0, 0, 0, 0.04);
    }

    .sidebar-item-active {
        background-color: #007AFF !important;
        color: white !important;
    }

    .sidebar-item-active svg {
        color: white !important;
    }

    /* Nested account items under folders */
    .sidebar-nested-item {
        border-radius: 6px;
        transition: background-color 0.1s ease;
    }

    .sidebar-nested-item:hover:not(.sidebar-item-active) {
        background-color: rgba(0, 0, 0, 0.04);
    }

    /* ========================================
       Preferences Modal - CSS-Only Tabs (Apple Style)
       ======================================== */

    /* Hide radio inputs */
    .pref-tab-input {
        position: absolute;
        opacity: 0;
        pointer-events: none;
    }

    /* Tab bar container */
    .pref-tabs {
        display: flex;
        gap: 2px;
        padding: 4px;
        background: #f1f1f1;
        border-radius: 8px;
        margin: 0 auto;
        width: fit-content;
    }

    /* Tab labels */
    .pref-tab-label {
        padding: 6px 14px;
        font-size: 13px;
        font-weight: 500;
        color: #666;
        border-radius: 6px;
        cursor: pointer;
        transition: all 0.15s ease;
        white-space: nowrap;
        user-select: none;
    }

    .pref-tab-label:hover {
        color: #333;
    }

    /* Active tab styling */
    #pref-tab-accounts:checked ~ .pref-tabs-wrapper .pref-tabs label[for="pref-tab-accounts"],
    #pref-tab-general:checked ~ .pref-tabs-wrapper .pref-tabs label[for="pref-tab-general"],
    #pref-tab-shortcuts:checked ~ .pref-tabs-wrapper .pref-tabs label[for="pref-tab-shortcuts"],
    #pref-tab-sync:checked ~ .pref-tabs-wrapper .pref-tabs label[for="pref-tab-sync"],
    #pref-tab-security:checked ~ .pref-tabs-wrapper .pref-tabs label[for="pref-tab-security"],
    #pref-tab-data:checked ~ .pref-tabs-wrapper .pref-tabs label[for="pref-tab-data"] {
        background: white;
        color: #1d1d1f;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    }

    /* Tab content panels - all hidden by default */
    .pref-panel {
        display: none;
    }

    /* Show active panel based on checked radio */
    #pref-tab-accounts:checked ~ .pref-content-wrapper #pref-panel-accounts,
    #pref-tab-general:checked ~ .pref-content-wrapper #pref-panel-general,
    #pref-tab-shortcuts:checked ~ .pref-content-wrapper #pref-panel-shortcuts,
    #pref-tab-sync:checked ~ .pref-content-wrapper #pref-panel-sync,
    #pref-tab-security:checked ~ .pref-content-wrapper #pref-panel-security,
    #pref-tab-data:checked ~ .pref-content-wrapper #pref-panel-data {
        display: block;
    }

    /* Keyboard shortcuts grid */
    .shortcuts-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 16px;
    }

    .shortcut-category {
        background: #fafafa;
        border: 1px solid #e5e5e5;
        border-radius: 10px;
        padding: 14px;
    }

    .shortcut-category-title {
        font-size: 11px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: #86868b;
        margin-bottom: 10px;
    }

    .shortcut-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 6px 0;
        border-bottom: 1px solid #f0f0f0;
    }

    .shortcut-item:last-child {
        border-bottom: none;
    }

    .shortcut-action {
        font-size: 13px;
        color: #1d1d1f;
    }

    .shortcut-key {
        display: inline-flex;
        align-items: center;
        gap: 3px;
        padding: 3px 8px;
        font-size: 12px;
        font-weight: 500;
        font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
        color: #1d1d1f;
        background: linear-gradient(180deg, #fff 0%, #f5f5f7 100%);
        border: 1px solid #d2d2d7;
        border-radius: 5px;
        box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
    }
