    @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);
        --divider-thread-preview: rgba(0, 0, 0, 0.06);

        /* 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);

        /* Liquid Glass (Preferences) */
        --lg-blur-frosted: blur(8px);
        --lg-blur-heavy: blur(20px);
        --lg-saturation: saturate(180%);
    }

    /* 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);
        position: relative;
    }

    /* 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;
    }

    /* Subtle seam between middle thread list and right reading pane. */
    #reading-pane {
        border-left: 1px solid var(--divider-thread-preview);
    }

    /* Pane Resizers (Sidebar + Thread List) */
    :root {
        --pane-resizer-width: 10px;
        --pane-resizer-line: 2px;
    }

    .pane-resizer {
        position: absolute;
        top: 0;
        bottom: 0;
        width: var(--pane-resizer-width);
        cursor: col-resize;
        z-index: 60;
        touch-action: none;
        background: transparent;
    }

    .pane-resizer::before {
        content: '';
        position: absolute;
        top: 0;
        bottom: 0;
        left: 50%;
        width: var(--pane-resizer-line);
        transform: translateX(calc(var(--pane-resizer-line) / -2));
        background: transparent;
        transition: background-color 120ms ease;
    }

    .pane-resizer:hover::before,
    body.main-resizing .pane-resizer::before {
        background: #cbd5f5;
    }

    .pane-resizer--sidebar {
        left: calc(var(--width-sidebar) - (var(--pane-resizer-width) / 2));
    }

    .pane-resizer--thread {
        left: calc(var(--width-sidebar) + var(--width-thread-list) - (var(--pane-resizer-width) / 2));
    }

    body.main-resizing {
        cursor: col-resize;
        user-select: none;
    }

    body.mobile-mode .pane-resizer,
    body.attachment-browser-open .pane-resizer {
        display: none;
    }

    @media (max-width: 767px) {
        .pane-resizer {
            display: none;
        }
    }

    body.attachment-browser-open #thread-list-pane,
    body.attachment-browser-open #reading-pane {
        display: none !important;
    }

    body.attachment-browser-open #attachment-browser-view {
        display: flex !important;
        height: 100%;
        min-height: 0;
    }

    .attachment-resizer {
        width: 2px;
        flex: 0 0 2px;
        position: relative;
        cursor: col-resize;
        background: transparent;
        touch-action: none;
    }

    .attachment-resizer::before {
        content: '';
        position: absolute;
        top: 0;
        bottom: 0;
        left: 50%;
        width: 2px;
        transform: translateX(-1px);
        background: #e5e7eb;
    }

    .attachment-resizer:hover::before,
    body.attachment-resizing .attachment-resizer::before {
        background: #cbd5f5;
    }

    body.attachment-resizing {
        cursor: col-resize;
        user-select: none;
    }

    body.mobile-mode .attachment-resizer {
        display: none;
    }

    /* 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;
        }

        #main-sidebar .message-content-surface {
            width: 100% !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: rgba(5, 5, 5, 0.33);
        border-radius: 3px;
    }


    /* 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: 8px 14px;
        border-radius: 14px;
        background: rgba(255, 255, 255, 0.36);
        backdrop-filter: blur(24px) saturate(180%);
        -webkit-backdrop-filter: blur(24px) saturate(180%);
        color: #1f2937;
        border: 1px solid rgba(255, 255, 255, 0.3);
        box-shadow:
            0 10px 40px rgba(0, 0, 0, 0.1),
            0 4px 12px rgba(0, 0, 0, 0.06),
            inset 0 1px 0 rgba(255, 255, 255, 0.4);
        font-size: 12px;
        line-height: 1.2;
        opacity: 0;
        transform: translateY(8px);
        transition: opacity 0.18s ease, transform 0.18s ease;
    }

    .theme-dark .app-notification {
        background: rgba(0, 0, 0, 0.36);
        color: #f9fafb;
        border-color: rgba(255, 255, 255, 0.08);
        box-shadow:
            0 10px 40px rgba(0, 0, 0, 0.3),
            0 4px 12px rgba(0, 0, 0, 0.2),
            inset 0 1px 0 rgba(255, 255, 255, 0.06);
    }

    .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: #2563eb;
        font-size: 11px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        cursor: pointer;
        padding: 2px 4px;
    }

    .app-notification__action:hover {
        color: #1d4ed8;
    }

    .theme-dark .app-notification__action {
        color: #93c5fd;
    }

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

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

    .theme-dark .app-notification__close {
        color: #9ca3af;
    }

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

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

    .theme-dark .app-notification__spinner {
        border-color: rgba(255, 255, 255, 0.2);
        border-top-color: rgba(255, 255, 255, 0.9);
    }

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

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

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

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

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

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

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

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

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

    .app-notification--board-pin {
        position: relative;
        overflow: hidden;
        background: linear-gradient(180deg, #fdfefe 0%, #e9f0ff 100%);
        color: #1f2937;
        border-color: rgba(100, 130, 220, 0.45);
        box-shadow: 0 12px 30px rgba(63, 94, 194, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.9);
    }

    .app-notification--board-pin::after {
        content: '';
        position: absolute;
        inset: 0;
        border-radius: inherit;
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.62) 0%, rgba(255, 255, 255, 0) 46%);
        pointer-events: none;
    }

    .app-notification--board-pin.is-visible {
        animation: board-pin-toast-pop 560ms cubic-bezier(0.18, 0.88, 0.22, 1.12);
    }

    .app-notification--board-pin .app-notification__message {
        font-weight: 600;
        color: #25324a;
    }

    .app-notification__board-badge {
        position: relative;
        z-index: 1;
        width: 18px;
        height: 18px;
        border-radius: 999px;
        color: #3451a7;
        background: radial-gradient(circle at 30% 20%, #ffffff 0%, #c5d5ff 34%, #7f9bf0 100%);
        box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.86), 0 1px 4px rgba(54, 78, 153, 0.45);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        animation: board-pin-bob 420ms ease-out;
    }

    .app-notification__board-badge svg {
        width: 12px;
        height: 12px;
        position: relative;
        z-index: 1;
    }

    .app-notification__board-badge::before,
    .app-notification__board-badge::after {
        content: '';
        position: absolute;
        border-radius: 999px;
        opacity: 0;
        pointer-events: none;
    }

    .app-notification__board-badge::before {
        width: 4px;
        height: 4px;
        top: -4px;
        right: -3px;
        background: #fff9c2;
        box-shadow: 0 0 6px rgba(255, 249, 194, 0.9);
        animation: board-pin-spark 680ms ease-out 80ms;
    }

    .app-notification__board-badge::after {
        width: 3px;
        height: 3px;
        bottom: -3px;
        left: -3px;
        background: #ffffff;
        box-shadow: 0 0 5px rgba(255, 255, 255, 0.9);
        animation: board-pin-spark 680ms ease-out 130ms;
    }

    .app-notification--genie-flight {
        will-change: transform, opacity, filter;
        pointer-events: none !important;
    }

    .board-stardust {
        position: fixed;
        width: 6px;
        height: 6px;
        border-radius: 999px;
        background: #fff;
        box-shadow: 0 0 10px 3px rgba(127, 155, 240, 0.8), 0 0 4px 1px rgba(255, 255, 255, 0.8) inset;
        pointer-events: none;
        z-index: 10120;
        margin-left: -3px;
        margin-top: -3px;
        will-change: transform, opacity;
    }

    .board-stardust.trail {
        width: 4px;
        height: 4px;
        margin-left: -2px;
        margin-top: -2px;
        background: #fff7be;
        box-shadow: 0 0 8px 2px rgba(255, 247, 190, 0.9), 0 0 12px 3px rgba(127, 155, 240, 0.6);
    }

    .board-stardust.sparkle {
        width: 8px;
        height: 8px;
        margin-left: -4px;
        margin-top: -4px;
        background: #ffffff;
        box-shadow: 0 0 16px 4px #7f9bf0, 0 0 6px 2px #c5d5ff inset;
    }

    .sidebar-item.board-genie-target-hit {
        position: relative;
        animation: board-genie-target-hit 860ms cubic-bezier(0.2, 0.92, 0.24, 1);
    }

    .sidebar-item.board-genie-target-pre-spark {
        position: relative;
    }

    .sidebar-item.board-genie-target-pre-spark::before {
        content: '';
        position: absolute;
        left: 16px;
        top: 50%;
        width: 4px;
        height: 4px;
        margin-top: -2px;
        border-radius: 999px;
        background: #fff;
        box-shadow:
            0 -8px 0 #d8e4ff,
            9px -6px 0 #fff7be,
            11px 4px 0 #c7d8ff,
            18px -1px 0 #fff;
        opacity: 1;
        pointer-events: none;
        animation: board-genie-target-pre-spark 560ms ease-out;
    }

    .sidebar-item.board-genie-target-hit::before {
        content: '';
        position: absolute;
        left: 16px;
        top: 50%;
        width: 4px;
        height: 4px;
        margin-top: -2px;
        border-radius: 999px;
        background: #fff;
        box-shadow:
            0 -10px 0 #d8e4ff,
            11px -7px 0 #fff7be,
            13px 5px 0 #c7d8ff,
            22px -2px 0 #fff;
        opacity: 0;
        pointer-events: none;
        animation: board-genie-target-spark 1120ms ease-out;
    }

    .sidebar-item.board-genie-target-hit::after {
        content: '';
        position: absolute;
        inset: -3px;
        border-radius: 11px;
        border: 1px solid rgba(122, 145, 226, 0.65);
        pointer-events: none;
        animation: board-genie-target-ring 780ms ease-out;
    }

    @keyframes board-pin-toast-pop {
        0% {
            transform: translateY(12px) scale(0.96);
            opacity: 0;
        }

        55% {
            transform: translateY(-2px) scale(1.02);
            opacity: 1;
        }

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

    @keyframes board-pin-bob {
        0% {
            transform: scale(0.72) translateY(2px);
        }

        65% {
            transform: scale(1.12) translateY(-1px);
        }

        100% {
            transform: scale(1) translateY(0);
        }
    }

    @keyframes board-pin-spark {
        0% {
            transform: scale(0.3);
            opacity: 0;
        }

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

        100% {
            transform: scale(0.2);
            opacity: 0;
        }
    }

    @keyframes board-genie-target-hit {
        0% {
            transform: scale(1) rotate(0deg);
        }

        26% {
            transform: scale(1.055) rotate(-0.35deg);
        }

        52% {
            transform: scale(0.975) rotate(0.2deg);
        }

        78% {
            transform: scale(1.025) rotate(-0.12deg);
        }

        100% {
            transform: scale(1) rotate(0deg);
        }
    }

    @keyframes board-genie-target-ring {
        0% {
            opacity: 0;
            transform: scale(0.88);
        }

        30% {
            opacity: 1;
            transform: scale(1.02);
        }

        100% {
            opacity: 0;
            transform: scale(1.1);
        }
    }

    @keyframes board-genie-target-spark {
        0% {
            opacity: 1;
            transform: translate(0, 0) scale(0.92);
        }

        26% {
            opacity: 1;
            transform: translate(2px, -1px) scale(1);
        }

        56% {
            opacity: 0.92;
            transform: translate(4px, -2px) scale(0.9);
        }

        100% {
            opacity: 0;
            transform: translate(10px, -4px) scale(0.35);
        }
    }

    @keyframes board-genie-target-pre-spark {
        0% {
            opacity: 1;
            transform: translate(0, 0) scale(0.92);
        }

        46% {
            opacity: 0.95;
            transform: translate(2px, -1px) scale(1);
        }

        100% {
            opacity: 0;
            transform: translate(7px, -3px) scale(0.3);
        }
    }

    @media (prefers-reduced-motion: reduce) {

        .app-notification--board-pin.is-visible,
        .app-notification__board-badge,
        .app-notification__board-badge::before,
        .app-notification__board-badge::after,
        .sidebar-item.board-genie-target-pre-spark::before,
        .sidebar-item.board-genie-target-hit,
        .sidebar-item.board-genie-target-hit::before,
        .sidebar-item.board-genie-target-hit::after {
            animation: none;
        }
    }

    /* 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: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        color: var(--text-muted);
        transition: background 0.2s, box-shadow 0.2s, color 0.15s;
    }

    .btn-icon:hover {
        background: rgba(0, 0, 0, 0.06);
        box-shadow: 0 0 0 2.5px rgba(255, 255, 255, 0.5);
        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;
    }

    @supports (content-visibility: auto) {
        #thread-list .thread-item {
            content-visibility: auto;
            contain-intrinsic-size: 84px;
        }
    }

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

    /* Thread list: OTP copy hover action (compact + subtle shimmer) */
    .otp-copy-btn {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 5px 8px;
        border-radius: 6px;
        font-size: 9px;
        line-height: 1;
        font-weight: 700;
        letter-spacing: 0.08em;
        color: rgb(82 82 91);
        /* zinc-600 */
        user-select: none;
        white-space: nowrap;
        transition: background-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
    }

    .otp-copy-btn:hover {
        background-color: rgba(99, 102, 241, 0.10);
        /* indigo */
        color: rgb(67 56 202);
        /* indigo-700 */
        box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.18);
    }

    .otp-copy-btn:focus-visible {
        outline: 2px solid rgba(99, 102, 241, 0.35);
        outline-offset: 2px;
    }

    .otp-copy-btn .otp-copy-icon {
        width: 14px;
        height: 14px;
        flex: 0 0 auto;
        opacity: 0.95;
    }

    .otp-copy-btn .otp-copy-label {
        display: inline-block;
    }

    @supports (-webkit-background-clip: text) or (background-clip: text) {
        .otp-copy-btn:hover .otp-copy-label {
            background-image: linear-gradient(90deg, #4338ca 0%, #a5b4fc 42%, #4338ca 88%);
            background-size: 220% 100%;
            background-position: 120% 50%;
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
            animation: otp-text-shimmer 650ms ease-out 1;
        }

        .theme-dark .otp-copy-btn:hover .otp-copy-label {
            background-image: linear-gradient(90deg, #c7d2fe 0%, #e0e7ff 42%, #c7d2fe 88%);
        }
    }

    @keyframes otp-text-shimmer {
        0% {
            background-position: 120% 50%;
        }

        100% {
            background-position: -20% 50%;
        }
    }

    @media (prefers-reduced-motion: reduce) {
        .otp-copy-btn:hover .otp-copy-label {
            animation: none !important;
        }
    }

    .theme-dark .otp-copy-btn {
        color: rgb(161 161 170);
        /* zinc-400 */
    }

    .theme-dark .otp-copy-btn:hover {
        background-color: rgba(129, 140, 248, 0.16);
        /* indigo-400-ish */
        color: rgb(199 210 254);
        /* indigo-200 */
        box-shadow: inset 0 0 0 1px rgba(129, 140, 248, 0.22);
    }

    /* 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: none;
    }

    #main-sidebar .message-content-surface {
        border-right: none !important;
        box-shadow: none !important;
    }

    /* 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;
        box-shadow: none !important;
        pointer-events: 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%;
        box-sizing: border-box;
        padding-inline: 3px;
        border: none;
        display: block;
    }

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

    #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.25;
        color: #1f2937;
    }

    .tiptap-editor .ProseMirror p {
        margin: 0;
    }

    .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.2em;
    }

    .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-editor .ProseMirror [data-fetch-quoted-root="true"] blockquote {
        border-left: initial;
        padding-left: initial;
        margin-left: initial;
        color: inherit;
    }

    .tiptap-editor .ProseMirror [data-fetch-quoted-root="true"] a {
        color: inherit;
        text-decoration: inherit;
    }

    .tiptap-editor .fetch-signature {
        border: 1px dashed #e5e7eb;
        background: transparent;
        border-radius: 8px;
        padding: 8px 10px;
    }

    .tiptap-editor .fetch-signature-spacer {
        margin: 0;
    }

    /* 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;
    }

    /* ========================================
       Unified Glass Modal System
       ======================================== */

    /* Glass overlay — shared by all modals */
    .confirmation-overlay,
    #preferences-modal,
    #help-modal,
    #fetch-custom-dialog {
        background: rgba(0, 0, 0, 0.48);
        backdrop-filter: blur(6px) saturate(120%);
        -webkit-backdrop-filter: blur(6px) saturate(120%);
    }

    /* Glass dialog panel — shared by all modal dialogs */
    #preferences-modal [role="dialog"],
    #help-modal [role="dialog"],
    #fetch-custom-dialog>div,
    #fetch-custom-dialog .fetch-dialog-panel {
        background-color: rgba(255, 255, 255, 0.96);
        backdrop-filter: blur(20px) saturate(180%);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
        border: 1px solid rgba(0, 0, 0, 0.12);
        box-shadow:
            0 18px 48px rgba(0, 0, 0, 0.24),
            inset 0 1px 0 rgba(255, 255, 255, 0.5);
    }

    /* Help modal subsections — match glass treatment */
    #help-modal .bg-gray-50 {
        background-color: rgba(249, 250, 251, 0.5);
    }

    #fetch-custom-dialog .fetch-dialog-title {
        color: #111827;
    }

    #fetch-custom-dialog .fetch-dialog-message {
        color: #3f3f46;
    }

    /* Dialog cancel button — explicit style, avoid tinting the panel itself */
    #fetch-custom-dialog .fetch-dialog-btn-cancel {
        background: rgba(255, 255, 255, 0.9);
        color: #3f3f46;
        border-color: rgba(24, 24, 27, 0.14);
    }

    #fetch-custom-dialog .fetch-dialog-btn-cancel:hover {
        background: rgba(255, 255, 255, 0.98);
    }

    /* Dialog input — glass treatment */
    #fetch-custom-dialog .fetch-dialog-input {
        border: 1px solid rgba(0, 0, 0, 0.14);
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.92);
        color: #18181b;
    }

    #fetch-custom-dialog .fetch-dialog-input:focus {
        outline: none;
        border-color: rgba(0, 122, 255, 0.6);
        box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
    }

    /* Signature preview: default to dark text in light mode */
    #preferences-modal [data-signature-preview] {
        color: #111827;
    }

    #preferences-modal [data-signature-preview] p {
        color: inherit;
    }

    /* Search modal glass shell (light mode) */
    #search-modal .search-modal-content {
        background-color: rgba(255, 255, 255, 0.88);
        backdrop-filter: blur(40px) saturate(130%);
        -webkit-backdrop-filter: blur(40px) saturate(130%);
    }

    #search-modal .search-modal-input,
    #search-modal .search-modal-footer,
    #search-modal #search-preview-panel {
        background-color: transparent;
    }

    #search-modal .search-input-pill {
        background-color: rgba(0, 0, 0, 0.06);
    }

    #search-modal .search-result-item.search-result-item--selected {
        background-color: rgba(0, 0, 0, 0.08);
    }

    #search-modal .search-result-item:hover:not(.search-result-item--selected) {
        background-color: rgba(0, 0, 0, 0.04);
    }

    #search-modal .search-result-item.search-result-item--selected .search-result-enter {
        opacity: 1;
    }

    .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,
    .thread-context-menu {
        position: fixed;
        z-index: 10000;
        width: 260px;
        background: rgba(255, 255, 255, 0.85);
        backdrop-filter: blur(24px) saturate(180%);
        -webkit-backdrop-filter: blur(14px) saturate(180%);
        border: 1px solid rgba(0, 0, 0, 0.12);
        border-radius: 12px;
        box-shadow:
            0 10px 40px rgba(0, 0, 0, 0.1),
            0 4px 12px rgba(0, 0, 0, 0.06),
            inset 0 1px 0 rgba(255, 255, 255, 0.4);
        padding: 6px;
        font-size: 14px;
        animation: contextMenuFadeIn 0.15s ease-out;
    }

    /* Dark mode glass */
    .theme-dark #thread-context-menu,
    .theme-dark .thread-context-menu {
        background: rgba(30, 30, 30, 0.82);
        border: 1px solid rgba(255, 255, 255, 0.12);
        box-shadow:
            0 10px 40px rgba(0, 0, 0, 0.3),
            0 4px 12px rgba(0, 0, 0, 0.2),
            inset 0 1px 0 rgba(255, 255, 255, 0.06);
    }

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

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

    .thread-context-menu .context-menu-btn,
    .context-menu-item {
        padding: 7px 12px;
        cursor: pointer;
        border-radius: 8px;
        transition: background-color 0.12s ease;
        color: #374151;
        font-weight: 400;
        user-select: none;
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .thread-context-menu .context-menu-btn:hover,
    .context-menu-item:hover {
        background-color: rgba(0, 0, 0, 0.04);
    }

    .thread-context-menu .context-menu-btn:active,
    .context-menu-item:active {
        background-color: rgba(0, 0, 0, 0.07);
    }

    /* Dark mode menu items */
    .theme-dark .thread-context-menu .context-menu-btn,
    .theme-dark .context-menu-item {
        color: #e5e7eb;
    }

    .theme-dark .thread-context-menu .context-menu-btn:hover,
    .theme-dark .context-menu-item:hover {
        background-color: rgba(255, 255, 255, 0.06);
    }

    .theme-dark .thread-context-menu .context-menu-btn:active,
    .theme-dark .context-menu-item:active {
        background-color: rgba(255, 255, 255, 0.1);
    }

    /* Dark mode for delete button */
    .theme-dark .thread-context-menu .context-menu-btn.text-rose-600 {
        color: #fb7185;
    }

    .thread-context-menu .border-gray-100,
    .context-menu-divider {
        height: 1px;
        background: rgba(0, 0, 0, 0.08);
        margin: 4px 6px;
        border: none;
    }

    .theme-dark .thread-context-menu .border-gray-100,
    .theme-dark .context-menu-divider {
        background: rgba(255, 255, 255, 0.1);
    }

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

    .context-menu-btn:hover {
        background-color: rgba(0, 0, 0, 0.05);
    }

    .context-menu-btn:active {
        background-color: rgba(0, 0, 0, 0.08);
    }

    /* =============================================
     * 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;
    }

    #sync-subject-snippet {
        display: block;
        max-width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        -webkit-mask-image: linear-gradient(90deg, #000 0%, #000 82%, transparent 100%);
        mask-image: linear-gradient(90deg, #000 0%, #000 82%, transparent 100%);
    }

    #sync-status-idle {
        min-width: 0;
        gap: 0.5rem;
    }

    #connection-status-text,
    #sync-status-count-idle {
        white-space: nowrap;
    }

    #sync-status-count-idle {
        display: block;
        flex: 1 1 auto;
        min-width: 0;
        text-align: right;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* ========================================
       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;
    }

    .label-drop-indicator {
        height: 0;
        border-top: 1px solid #9bb6ff;
        margin: 2px 10px;
        pointer-events: none;
    }

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

    ::-webkit-scrollbar-thumb {
        background: rgba(5, 5, 5, 0.33);
        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";
    }

    .thread-board-badge {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        max-width: 170px;
        padding: 1px 7px;
        border-radius: 999px;
        border: 1px solid rgba(102, 137, 230, 0.24);
        background: rgba(102, 137, 230, 0.1);
        color: #4b67b8;
        font-size: 11px;
        line-height: 1.2;
        font-weight: 600;
        flex-shrink: 0;
    }

    .thread-board-badge__icon {
        width: 12px;
        height: 12px;
        flex-shrink: 0;
    }

    .thread-board-badge__label {
        max-width: 120px;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }

    .thread-viewer-board-slot {
        display: flex;
        align-items: center;
    }

    .thread-board-badge--viewer {
        font-size: 12px;
        padding: 2px 9px;
        max-width: 280px;
    }

    .thread-board-badge--viewer .thread-board-badge__label {
        max-width: 230px;
    }

    .thread-item.active .thread-board-badge {
        border-color: rgba(255, 255, 255, 0.78) !important;
        background: rgba(255, 255, 255, 0.24) !important;
        color: #f8fbff !important;
        text-shadow: 0 1px 2px rgba(26, 58, 142, 0.42);
    }

    /* 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);
    }

    /* ========================================
       Liquid Glass Layout - Thread List & Sidebar
       ======================================== */

    /* Thread list rounded corner */
    #thread-list-pane {
        border-right: none !important;
        border-color: transparent !important;
        box-shadow: none !important;
        border-top-left-radius: 12px !important;
        border-bottom-left-radius: 12px !important;
        overflow: hidden !important;
    }

    /* Sidebar - remove right border */
    #main-sidebar {
        border-right: none !important;
    }

    /* ========================================
       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;
    }

    /* Dialog grid layout */
    #preferences-modal [role="dialog"] {
        display: grid;
        grid-template-columns: 200px 1fr;
        grid-template-rows: auto 1fr;
        overflow: hidden;
    }

    /* Header bar — spans full width */
    .pref-header {
        grid-column: 1 / -1;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 14px 16px 12px;
        border-bottom: 1px solid rgba(0, 0, 0, 0.06);
        background: rgba(249, 250, 251, 0.5);
        backdrop-filter: var(--lg-blur-frosted);
        -webkit-backdrop-filter: var(--lg-blur-frosted);
        border-radius: 12px 12px 0 0;
    }
    .pref-header-title { font-size: 13px; font-weight: 600; color: #1d1d1f; }
    .pref-header-close {
        color: rgba(0, 0, 0, 0.35);
        padding: 4px;
        border-radius: 6px;
        transition: background 0.15s, color 0.15s;
    }
    .pref-header-close:hover { color: rgba(0, 0, 0, 0.6); background: rgba(0, 0, 0, 0.06); }

    /* Sidebar nav */
    .pref-sidebar {
        grid-column: 1;
        grid-row: 2;
        padding: 10px 8px;
        overflow-y: auto;
        border-right: 1px solid rgba(0, 0, 0, 0.06);
        background: rgba(246, 246, 248, 0.4);
        backdrop-filter: var(--lg-blur-frosted);
        -webkit-backdrop-filter: var(--lg-blur-frosted);
        display: flex;
        flex-direction: column;
        gap: 1px;
    }
    .pref-sidebar-item {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 5px 8px;
        border-radius: 7px;
        font-size: 13px;
        font-weight: 400;
        color: #1d1d1f;
        cursor: pointer;
        transition: background 0.15s;
        user-select: none;
        white-space: nowrap;
    }
    .pref-sidebar-item:hover { background: rgba(0, 0, 0, 0.04); }

    /* Icon badge (macOS System Settings style) */
    .pref-sidebar-badge {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 22px;
        height: 22px;
        border-radius: 5px;
        flex-shrink: 0;
        filter: grayscale(1);
        opacity: 0.6;
        transition: filter 0.15s, opacity 0.15s;
    }
    .pref-sidebar-badge svg {
        width: 14px;
        height: 14px;
    }

    /* Active sidebar item */
    #pref-tab-accounts:checked ~ .pref-sidebar label[for="pref-tab-accounts"],
    #pref-tab-general:checked ~ .pref-sidebar label[for="pref-tab-general"],
    #pref-tab-calendar:checked ~ .pref-sidebar label[for="pref-tab-calendar"],
    #pref-tab-appearance:checked ~ .pref-sidebar label[for="pref-tab-appearance"],
    #pref-tab-ai:checked ~ .pref-sidebar label[for="pref-tab-ai"],
    #pref-tab-shortcuts:checked ~ .pref-sidebar label[for="pref-tab-shortcuts"],
    #pref-tab-sync:checked ~ .pref-sidebar label[for="pref-tab-sync"],
    #pref-tab-dev:checked ~ .pref-sidebar label[for="pref-tab-dev"],
    #pref-tab-security:checked ~ .pref-sidebar label[for="pref-tab-security"],
    #pref-tab-data:checked ~ .pref-sidebar label[for="pref-tab-data"] {
        background: rgba(0, 0, 0, 0.06);
    }

    /* Active badge — restore color */
    #pref-tab-accounts:checked ~ .pref-sidebar label[for="pref-tab-accounts"] .pref-sidebar-badge,
    #pref-tab-general:checked ~ .pref-sidebar label[for="pref-tab-general"] .pref-sidebar-badge,
    #pref-tab-calendar:checked ~ .pref-sidebar label[for="pref-tab-calendar"] .pref-sidebar-badge,
    #pref-tab-appearance:checked ~ .pref-sidebar label[for="pref-tab-appearance"] .pref-sidebar-badge,
    #pref-tab-ai:checked ~ .pref-sidebar label[for="pref-tab-ai"] .pref-sidebar-badge,
    #pref-tab-shortcuts:checked ~ .pref-sidebar label[for="pref-tab-shortcuts"] .pref-sidebar-badge,
    #pref-tab-sync:checked ~ .pref-sidebar label[for="pref-tab-sync"] .pref-sidebar-badge,
    #pref-tab-dev:checked ~ .pref-sidebar label[for="pref-tab-dev"] .pref-sidebar-badge,
    #pref-tab-security:checked ~ .pref-sidebar label[for="pref-tab-security"] .pref-sidebar-badge,
    #pref-tab-data:checked ~ .pref-sidebar label[for="pref-tab-data"] .pref-sidebar-badge {
        filter: none;
        opacity: 1;
    }

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

    .pref-content-wrapper {
        grid-column: 2;
        grid-row: 2;
        overflow-y: auto;
        min-height: 0;
        background: rgba(255, 255, 255, 0.5);
        backdrop-filter: var(--lg-blur-frosted) saturate(120%);
        -webkit-backdrop-filter: var(--lg-blur-frosted) saturate(120%);
    }

    /* Show active panel based on checked radio */
    #pref-tab-accounts:checked~.pref-content-wrapper #pref-panel-accounts {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 0;
        overflow: hidden;
    }

    #pref-tab-general:checked~.pref-content-wrapper #pref-panel-general,
    #pref-tab-calendar:checked~.pref-content-wrapper #pref-panel-calendar,
    #pref-tab-appearance:checked~.pref-content-wrapper #pref-panel-appearance,
    #pref-tab-ai:checked~.pref-content-wrapper #pref-panel-ai,
    #pref-tab-shortcuts:checked~.pref-content-wrapper #pref-panel-shortcuts,
    #pref-tab-sync:checked~.pref-content-wrapper #pref-panel-sync,
    #pref-tab-dev:checked~.pref-content-wrapper #pref-panel-dev,
    #pref-tab-security:checked~.pref-content-wrapper #pref-panel-security,
    #pref-tab-data:checked~.pref-content-wrapper #pref-panel-data {
        display: block;
    }

    /* ========================================
       Preferences - Grouped Section System (Apple Settings)
       ======================================== */

    /* Section title — small uppercase heading above card groups */
    .pref-section-title {
        font-size: 11px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: rgba(0, 0, 0, 0.45);
        padding: 0 4px;
        margin-bottom: 6px;
    }

    /* Liquid Glass section card */
    .pref-section-card {
        position: relative;
        background: rgba(255, 255, 255, 0.15);
        backdrop-filter: var(--lg-blur-frosted) var(--lg-saturation);
        -webkit-backdrop-filter: var(--lg-blur-frosted) var(--lg-saturation);
        border: 1px solid rgba(0, 0, 0, 0.06);
        border-radius: 14px;
        overflow: hidden;
        box-shadow:
            0 4px 16px rgba(0, 0, 0, 0.06),
            inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }

    .pref-section-card::before {
        content: '';
        position: absolute;
        inset: 0;
        z-index: 0;
        border-radius: 14px;
        background: rgba(255, 255, 255, 0.05);
        pointer-events: none;
    }

    /* Individual setting row inside a section card */
    .pref-row {
        position: relative;
        z-index: 1;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 16px;
        min-height: 44px;
        transition: background 0.15s ease;
    }

    .pref-row-border {
        border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    }

    .pref-row:hover {
        background: rgba(0, 0, 0, 0.03);
    }

    /* Row label area */
    .pref-row-label {
        flex: 1;
        margin-right: 16px;
    }

    .pref-label {
        font-size: 13px;
        font-weight: 500;
        color: #1d1d1f;
        line-height: 1.3;
    }

    .pref-desc {
        font-size: 11px;
        color: rgba(0, 0, 0, 0.5);
        margin-top: 1px;
        line-height: 1.3;
    }

    /* Standardized select — covers .pref-select and any select inside preferences */
    .pref-select,
    #preferences-modal select {
        padding: 5px 10px;
        border: 1px solid rgba(0, 0, 0, 0.08);
        border-radius: 8px;
        font-size: 12px;
        background: rgba(255, 255, 255, 0.06);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        color: #1d1d1f;
        transition: border-color 0.2s ease, box-shadow 0.2s ease;
    }

    .pref-select:focus,
    #preferences-modal select:focus {
        outline: none;
        border-color: rgba(0, 122, 255, 0.6);
        box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
    }

    /* Liquid Glass text inputs scoped to preferences */
    #preferences-modal input[type="text"],
    #preferences-modal input[type="email"],
    #preferences-modal input[type="url"],
    #preferences-modal input[type="number"],
    #preferences-modal input[type="password"] {
        border: 1px solid rgba(0, 0, 0, 0.08);
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.06);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        transition: border-color 0.2s ease, box-shadow 0.2s ease;
    }

    #preferences-modal input[type="text"]:focus,
    #preferences-modal input[type="email"]:focus,
    #preferences-modal input[type="url"]:focus,
    #preferences-modal input[type="number"]:focus,
    #preferences-modal input[type="password"]:focus {
        outline: none;
        border-color: rgba(0, 122, 255, 0.6);
        box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
    }

    /* Liquid Glass toggle: 44x24 */
    .pref-toggle-track {
        position: relative;
        width: 44px;
        height: 24px;
        background: rgba(0, 0, 0, 0.08);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        border: 1px solid rgba(0, 0, 0, 0.12);
        border-radius: 12px;
        cursor: pointer;
        transition: background 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275),
            border-color 0.25s ease;
        flex-shrink: 0;
    }

    .pref-toggle-track::after {
        content: '';
        position: absolute;
        top: 2px;
        left: 2px;
        width: 18px;
        height: 18px;
        background: rgba(255, 255, 255, 0.85);
        border-radius: 50%;
        box-shadow:
            0 1px 4px rgba(0, 0, 0, 0.3),
            inset 0 1px 1px rgba(255, 255, 255, 0.8);
        transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }

    .pref-toggle-track.checked {
        background: rgba(52, 199, 89, 0.7);
        border-color: rgba(52, 199, 89, 0.5);
    }

    .pref-toggle-track.checked::after {
        transform: translateX(20px);
    }

    /* Also support peer-checked pattern for real checkbox toggles */
    input.sr-only:checked+.pref-toggle-track {
        background: rgba(52, 199, 89, 0.7);
        border-color: rgba(52, 199, 89, 0.5);
    }

    input.sr-only:checked+.pref-toggle-track::after {
        transform: translateX(20px);
    }

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

    /* Liquid Glass shortcut category cards */
    .shortcut-category {
        background: rgba(255, 255, 255, 0.12);
        backdrop-filter: var(--lg-blur-frosted);
        -webkit-backdrop-filter: var(--lg-blur-frosted);
        border: 1px solid rgba(0, 0, 0, 0.06);
        border-radius: 12px;
        padding: 10px 12px;
    }

    .shortcut-category-title {
        font-size: 10px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: rgba(0, 0, 0, 0.45);
        margin-bottom: 6px;
    }

    .shortcut-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 4px 0;
        border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    }

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

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

    /* Liquid Glass keyboard shortcut badges */
    .shortcut-key {
        display: inline-flex;
        align-items: center;
        gap: 3px;
        padding: 2px 6px;
        font-size: 11px;
        font-weight: 500;
        font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
        color: #1d1d1f;
        background: rgba(255, 255, 255, 0.15);
        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);
        border: 1px solid rgba(0, 0, 0, 0.1);
        border-radius: 5px;
        box-shadow:
            0 1px 3px rgba(0, 0, 0, 0.08),
            inset 0 0.5px 0 rgba(255, 255, 255, 0.4);
    }

    /* ========================================
       Liquid Glass — Fallbacks & Accessibility
       ======================================== */

    /* Fallback for browsers without backdrop-filter */
    @supports not (backdrop-filter: blur(1px)) {
        #preferences-modal [role="dialog"] {
            background-color: rgba(245, 245, 247, 0.95);
        }

        .pref-section-card {
            background: rgba(245, 245, 247, 0.95);
        }

        .pref-sidebar {
            background: rgba(246, 246, 248, 0.95);
        }

        .shortcut-category {
            background: rgba(245, 245, 247, 0.95);
        }
    }

    /* Reduced motion: disable all preference transitions */
    @media (prefers-reduced-motion: reduce) {

        .pref-sidebar-item,
        .pref-toggle-track,
        .pref-toggle-track::after,
        #preferences-modal [role="dialog"] {
            transition: none !important;
            animation: none !important;
        }
    }

    .message-content-surface {
        background-color: rgb(244, 244, 244);
    }

    .compose-button-round {
        position: relative;
        width: 34px;
        height: 34px;
        border-radius: 50%;
        background: transparent;
        border: none;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: background 0.2s, box-shadow 0.2s;
        box-shadow: none;
        flex-shrink: 0;
    }

    .compose-button-round:hover {
        background: rgba(0, 0, 0, 0.06);
        box-shadow: 0 0 0 2.5px rgba(255, 255, 255, 0.5);
    }

    .compose-button-round:active {
        background: rgba(0, 0, 0, 0.10);
    }

    .compose-round-icon {
        color: rgba(0, 0, 0, 0.40);
        transition: color 0.15s;
    }

    .compose-button-round:hover .compose-round-icon {
        color: rgba(0, 0, 0, 0.55);
    }

    .compose-round-badge {
        position: absolute;
        bottom: 0;
        right: -1px;
        width: 14px;
        height: 14px;
        border-radius: 50%;
        background: rgba(0, 0, 0, 0.30);
        color: white;
        font-size: 10px;
        font-weight: 700;
        line-height: 14px;
        text-align: center;
        pointer-events: none;
    }

    body.sidebar-narrow #main-sidebar .sync-status-label,
    body.sidebar-narrow #main-sidebar #sync-subject-snippet,
    body.sidebar-narrow #main-sidebar #connection-status-text,
    body.sidebar-narrow #main-sidebar #sync-status-count-idle {
        display: none;
    }

    body.sidebar-narrow #main-sidebar #sync-status-idle {
        justify-content: flex-start;
    }

    /* Attachment browser compact thread preview */
    .attachment-thread-compact .message-item {
        box-shadow: none;
    }

    .attachment-thread-compact .message-item .px-5 {
        padding: 0.4rem 0.5rem 0.35rem;
    }

    .attachment-thread-compact .message-item .message-sender {
        font-size: 11px;
    }

    .attachment-thread-compact .message-item .message-timestamp {
        font-size: 9px;
    }

    .attachment-thread-compact .message-item .message-body {
        font-size: 11px;
        line-height: 1.35;
    }

    .attachment-thread-compact .message-item .message-body-container {
        max-height: 160px;
        overflow: hidden;
    }

    .attachment-thread-compact .message-compact .message-body-container {
        max-height: 110px;
        overflow: hidden;
    }

    .attachment-thread-compact .message-item .w-10.h-10 {
        width: 1.5rem;
        height: 1.5rem;
        font-size: 0.65rem;
    }

    .attachment-thread-compact .message-item .message-body {
        padding-top: 0.25rem;
        padding-bottom: 0.5rem;
    }

    .attachment-thread-compact .message-item .message-body p,
    .attachment-thread-compact .message-item .message-body div {
        margin-bottom: 0.35rem;
    }

    .attachment-thread-compact .message-item .footer-actions {
        gap: 0.25rem;
    }

    .attachment-thread-compact .message-item button[data-action] {
        display: none;
    }

    .attachment-thread-compact .message-item .footer-expand,
    .attachment-thread-compact .message-item .footer-actions {
        display: none;
    }

    .attachment-thread-expanded .attachment-preview-header {
        display: none;
    }

    .attachment-thread-expanded #attachment-thread-list {
        flex: 1 1 auto;
    }

    .attachment-thread-preview-list {
        display: flex;
        flex-direction: column;
        gap: 4px;
        padding: 4px 4px;
    }

    .attachment-thread-message {
        position: relative;
        overflow: hidden;
        border-radius: 12px;
        width: 100%;
    }

    .attachment-thread-message-expanded {
        overflow: visible;
    }

    .attachment-thread-message-frame {
        width: 100%;
        height: 100%;
        display: block;
    }

    .attachment-thread-overlay {
        position: absolute;
        inset: 0;
        cursor: pointer;
        z-index: 2;
    }

    /* ========================================
   Liquid Glass Mode (Tauri + macOS) - Light
   ======================================== */

    /* Make html/body transparent so glass shows through */
    html.liquid-glass,
    body.tauri-app.liquid-glass,
    html.vibrancy,
    body.tauri-app.vibrancy {
        background-color: transparent !important;
    }

    /* Make app-grid and all main containers transparent so glass shows through */
    body.tauri-app.liquid-glass .app-grid,
    body.tauri-app.vibrancy .app-grid {
        background: transparent !important;
    }
    body.tauri-app.liquid-glass #main-content,
    body.tauri-app.vibrancy #main-content,
    body.tauri-app.liquid-glass .main-content,
    body.tauri-app.vibrancy .main-content {
        background-color: transparent !important;
    }

    /* Thread list semi-transparent */
    body.tauri-app.liquid-glass #thread-list-pane,
    body.tauri-app.vibrancy #thread-list-pane {
        background-color: rgba(255, 255, 255, 0.9) !important;
        border-right: none !important;
        border-color: transparent !important;
        box-shadow: none !important;
        border-top-left-radius: 12px !important;
        border-bottom-left-radius: 12px !important;
    }

    body.tauri-app.liquid-glass #thread-list-header,
    body.tauri-app.vibrancy #thread-list-header {
        background-color: transparent !important;
        border-color: rgba(0, 0, 0, 0.06) !important;
    }

    /* Reading pane */
    body.tauri-app.liquid-glass #reading-pane,
    body.tauri-app.vibrancy #reading-pane {
        background-color: transparent !important;
    }

    /* Message content surface - make transparent for glass effect */
    body.tauri-app.liquid-glass .message-content-surface,
    body.tauri-app.vibrancy .message-content-surface {
        background-color: transparent !important;
    }

    body.tauri-app.liquid-glass #message-content,
    body.tauri-app.vibrancy #message-content {
        background-color: rgba(255, 255, 255, 0.66) !important;
    }

    /* Sidebar slightly frosted - 10% opacity for readability */
    body.tauri-app.liquid-glass #main-sidebar,
    body.tauri-app.liquid-glass #main-sidebar>div {
        background-color: rgba(255, 255, 255, 0.1) !important;
    }

    body.tauri-app.liquid-glass #main-sidebar .message-content-surface {
        background-color: transparent !important;
        border-right: none !important;
        box-shadow: none !important;
    }

    /* Darker text for readability on glass in light mode */
    body.tauri-app.liquid-glass #main-sidebar {
        color: #1a1a1a !important;
    }

    body.tauri-app.liquid-glass #main-sidebar span,
    body.tauri-app.liquid-glass #main-sidebar a,
    body.tauri-app.liquid-glass #main-sidebar button,
    body.tauri-app.liquid-glass #main-sidebar p,
    body.tauri-app.liquid-glass #main-sidebar div,
    body.tauri-app.vibrancy #main-sidebar span,
    body.tauri-app.vibrancy #main-sidebar a,
    body.tauri-app.vibrancy #main-sidebar button,
    body.tauri-app.vibrancy #main-sidebar p,
    body.tauri-app.vibrancy #main-sidebar div {
        color: rgba(0, 0, 0, 0.90) !important;
    }

    body.tauri-app.liquid-glass #main-sidebar .text-zinc-500,
    body.tauri-app.liquid-glass #main-sidebar .text-zinc-400,
    body.tauri-app.liquid-glass #main-sidebar .text-gray-500,
    body.tauri-app.liquid-glass #main-sidebar .text-gray-400,
    body.tauri-app.vibrancy #main-sidebar .text-zinc-500,
    body.tauri-app.vibrancy #main-sidebar .text-zinc-400,
    body.tauri-app.vibrancy #main-sidebar .text-gray-500,
    body.tauri-app.vibrancy #main-sidebar .text-gray-400 {
        color: rgba(0, 0, 0, 0.55) !important;
    }

    /* Section titles (LABELS, etc.) - better contrast */
    body.tauri-app.liquid-glass #main-sidebar .text-xs.font-semibold,
    body.tauri-app.liquid-glass #main-sidebar .uppercase,
    body.tauri-app.liquid-glass #main-sidebar h3,
    body.tauri-app.liquid-glass #main-sidebar h4,
    body.tauri-app.vibrancy #main-sidebar .text-xs.font-semibold,
    body.tauri-app.vibrancy #main-sidebar .uppercase,
    body.tauri-app.vibrancy #main-sidebar h3,
    body.tauri-app.vibrancy #main-sidebar h4 {
        color: rgba(0, 0, 0, 0.65) !important;
    }

    /* Icons dark/black in light mode */
    body.tauri-app.liquid-glass #main-sidebar svg {
        color: #1a1a1a !important;
        stroke: #1a1a1a !important;
    }

    /* Vibrancy fallback */
    body.tauri-app.vibrancy #main-sidebar,
    body.tauri-app.vibrancy #main-sidebar>div {
        background-color: rgba(255, 255, 255, 0.03) !important;
    }

    body.tauri-app.vibrancy #main-sidebar .message-content-surface {
        background-color: transparent !important;
    }

    body.tauri-app.vibrancy #main-sidebar {
        color: #1a1a1a !important;
    }

    body.tauri-app.vibrancy #main-sidebar svg {
        color: #1a1a1a !important;
        stroke: #1a1a1a !important;
    }

    /* macOS-style rounded selection for sidebar items in liquid glass mode */
    body.tauri-app.liquid-glass #main-sidebar .sidebar-item-active,
    body.tauri-app.liquid-glass #main-sidebar .sidebar-item.sidebar-item-active,
    body.tauri-app.liquid-glass #main-sidebar a.sidebar-item-active,
    body.tauri-app.vibrancy #main-sidebar .sidebar-item-active,
    body.tauri-app.vibrancy #main-sidebar .sidebar-item.sidebar-item-active,
    body.tauri-app.vibrancy #main-sidebar a.sidebar-item-active {
        background-color: rgba(0, 0, 0, 0.10) !important;
        border-radius: 8px !important;
        color: #1a1a1a !important;
    }

    body.tauri-app.liquid-glass #main-sidebar .sidebar-item-active svg,
    body.tauri-app.liquid-glass #main-sidebar a.sidebar-item-active svg,
    body.tauri-app.vibrancy #main-sidebar .sidebar-item-active svg,
    body.tauri-app.vibrancy #main-sidebar a.sidebar-item-active svg {
        color: #1a1a1a !important;
        stroke: #1a1a1a !important;
    }

    /* Hover state for sidebar items - subtle rounded bg */
    body.tauri-app.liquid-glass #main-sidebar .sidebar-item:hover:not(.sidebar-item-active),
    body.tauri-app.vibrancy #main-sidebar .sidebar-item:hover:not(.sidebar-item-active) {
        background-color: rgba(0, 0, 0, 0.04) !important;
        border-radius: 8px !important;
    }

    /* Remove shadows and white borders from labels and account colors - FLAT DESIGN */
    body.tauri-app.liquid-glass #main-sidebar .shadow-sm,
    body.tauri-app.liquid-glass #main-sidebar [class*="shadow"],
    body.tauri-app.vibrancy #main-sidebar .shadow-sm,
    body.tauri-app.vibrancy #main-sidebar [class*="shadow"] {
        box-shadow: none !important;
    }

    body.tauri-app.liquid-glass #main-sidebar .ring-1,
    body.tauri-app.liquid-glass #main-sidebar .ring-white\/50,
    body.tauri-app.liquid-glass #main-sidebar [class*="ring-"],
    body.tauri-app.vibrancy #main-sidebar .ring-1,
    body.tauri-app.vibrancy #main-sidebar .ring-white\/50,
    body.tauri-app.vibrancy #main-sidebar [class*="ring-"] {
        --tw-ring-shadow: none !important;
        box-shadow: none !important;
    }

    /* Color bars - crisp vertical lines for labels and accounts */
    body.tauri-app.liquid-glass #main-sidebar .label-color-bar,
    body.tauri-app.liquid-glass #main-sidebar .account-color-bar,
    body.tauri-app.vibrancy #main-sidebar .label-color-bar,
    body.tauri-app.vibrancy #main-sidebar .account-color-bar {
        box-shadow: none !important;
        outline: none !important;
    }

    /* Label items - same active styling as system folders */
    body.tauri-app.liquid-glass #main-sidebar .label-link.sidebar-item-active,
    body.tauri-app.liquid-glass #main-sidebar a.label-link.sidebar-item-active,
    body.tauri-app.vibrancy #main-sidebar .label-link.sidebar-item-active,
    body.tauri-app.vibrancy #main-sidebar a.label-link.sidebar-item-active {
        background-color: rgba(0, 0, 0, 0.10) !important;
        border-radius: 8px !important;
        color: #1a1a1a !important;
    }

    body.tauri-app.liquid-glass #main-sidebar .label-link.sidebar-item-active span,
    body.tauri-app.vibrancy #main-sidebar .label-link.sidebar-item-active span {
        color: #1a1a1a !important;
    }

    /* Labels scrollbar - darker, matching active pill style */
    body.tauri-app.liquid-glass #main-sidebar .scroll-y::-webkit-scrollbar-thumb,
    body.tauri-app.vibrancy #main-sidebar .scroll-y::-webkit-scrollbar-thumb,
    body.tauri-app.liquid-glass #main-sidebar [class*="overflow"]::-webkit-scrollbar-thumb,
    body.tauri-app.vibrancy #main-sidebar [class*="overflow"]::-webkit-scrollbar-thumb {
        background: rgba(5, 5, 5, 0.33) !important;
        border-radius: 4px !important;
    }

    body.tauri-app.liquid-glass #main-sidebar .scroll-y:hover::-webkit-scrollbar-thumb,
    body.tauri-app.vibrancy #main-sidebar .scroll-y:hover::-webkit-scrollbar-thumb,
    body.tauri-app.liquid-glass #main-sidebar [class*="overflow"]:hover::-webkit-scrollbar-thumb,
    body.tauri-app.vibrancy #main-sidebar [class*="overflow"]:hover::-webkit-scrollbar-thumb {
        background: rgba(5, 5, 5, 0.45) !important;
    }

    /* Labels list scrollbar - keep lighter, no hover effect */
    body.tauri-app.liquid-glass #labels-list::-webkit-scrollbar-thumb,
    body.tauri-app.vibrancy #labels-list::-webkit-scrollbar-thumb,
    #labels-list::-webkit-scrollbar-thumb,
    body.tauri-app.liquid-glass #labels-list:hover::-webkit-scrollbar-thumb,
    body.tauri-app.vibrancy #labels-list:hover::-webkit-scrollbar-thumb,
    #labels-list:hover::-webkit-scrollbar-thumb {
        background: rgba(5, 5, 5, 0.12) !important;
    }

    /* Remove all borders in sidebar for clean glass look */
    body.tauri-app.liquid-glass #main-sidebar [class*="border-dashed"],
    body.tauri-app.liquid-glass #main-sidebar [class*="border-white"],
    body.tauri-app.liquid-glass #main-sidebar .border-t,
    body.tauri-app.liquid-glass #main-sidebar [class*="border-zinc"],
    body.tauri-app.vibrancy #main-sidebar [class*="border-dashed"],
    body.tauri-app.vibrancy #main-sidebar [class*="border-white"],
    body.tauri-app.vibrancy #main-sidebar .border-t,
    body.tauri-app.vibrancy #main-sidebar [class*="border-zinc"] {
        border-color: transparent !important;
    }

    /* Specifically target the labels section border */
    body.tauri-app.liquid-glass #sidebar-labels-section,
    body.tauri-app.vibrancy #sidebar-labels-section {
        border-color: transparent !important;
    }

    /* Already handled by [class*="border-zinc"] above */

    /* Status footer and user footer - remove white bg and borders */
    body.tauri-app.liquid-glass #main-sidebar .bg-white\/30,
    body.tauri-app.vibrancy #main-sidebar .bg-white\/30 {
        background-color: transparent !important;
    }

    body.tauri-app.liquid-glass #sidebar-status-footer,
    body.tauri-app.liquid-glass #main-sidebar>div>.border-t,
    body.tauri-app.vibrancy #sidebar-status-footer,
    body.tauri-app.vibrancy #main-sidebar>div>.border-t {
        border-color: transparent !important;
    }

    /* Sidebar status footer - better contrast for connection info (light mode) */
    body.tauri-app.liquid-glass #sidebar-status-footer span,
    body.tauri-app.liquid-glass #sidebar-status-footer .text-zinc-500,
    body.tauri-app.liquid-glass #sidebar-status-footer .text-zinc-400,
    body.tauri-app.liquid-glass #sidebar-status-footer .text-gray-500,
    body.tauri-app.liquid-glass #sidebar-status-footer .text-gray-400,
    body.tauri-app.vibrancy #sidebar-status-footer span,
    body.tauri-app.vibrancy #sidebar-status-footer .text-zinc-500,
    body.tauri-app.vibrancy #sidebar-status-footer .text-zinc-400,
    body.tauri-app.vibrancy #sidebar-status-footer .text-gray-500,
    body.tauri-app.vibrancy #sidebar-status-footer .text-gray-400 {
        color: rgba(0, 0, 0, 0.6) !important;
    }

    /* Active label item - flat background instead of white with shadow */
    body.tauri-app.liquid-glass #main-sidebar .bg-white.shadow-sm,
    body.tauri-app.vibrancy #main-sidebar .bg-white.shadow-sm {
        background-color: rgba(0, 0, 0, 0.08) !important;
        box-shadow: none !important;
    }

    /* Empty state in reading pane - darker for visibility on glass (light mode) */
    body.tauri-app.liquid-glass #message-content>.flex-1.text-gray-400,
    body.tauri-app.vibrancy #message-content>.flex-1.text-gray-400 {
        color: rgba(0, 0, 0, 0.5) !important;
    }

    body.tauri-app.liquid-glass #message-content .text-gray-300,
    body.tauri-app.vibrancy #message-content .text-gray-300 {
        color: rgba(0, 0, 0, 0.35) !important;
    }

    body.tauri-app.liquid-glass #message-content svg.text-gray-300,
    body.tauri-app.vibrancy #message-content svg.text-gray-300 {
        color: rgba(0, 0, 0, 0.35) !important;
        stroke: rgba(0, 0, 0, 0.35) !important;
    }

    /* Message item cards in reading pane - light mode glass only */
    html:not(.theme-dark) body.tauri-app.liquid-glass .message-item.bg-white,
    html:not(.theme-dark) body.tauri-app.vibrancy .message-item.bg-white {
        background-color: rgba(255, 255, 255, 0.95) !important;
        border-color: rgba(0, 0, 0, 0.08) !important;
    }

    /* Unread count badges in liquid glass mode - flat, no shadows, glass-like */
    body.tauri-app.liquid-glass #main-sidebar .folder-unread-badge,
    body.tauri-app.liquid-glass #main-sidebar .account-unread-badge,
    body.tauri-app.vibrancy #main-sidebar .folder-unread-badge,
    body.tauri-app.vibrancy #main-sidebar .account-unread-badge {
        background-color: rgba(0, 0, 0, 0.08) !important;
        color: rgba(0, 0, 0, 0.55) !important;
        box-shadow: none !important;
        border: none !important;
    }

    /* Active state badges - subtle inversion */
    body.tauri-app.liquid-glass #main-sidebar .sidebar-item-active .folder-unread-badge,
    body.tauri-app.liquid-glass #main-sidebar .sidebar-nested-item.sidebar-item-active .account-unread-badge,
    body.tauri-app.vibrancy #main-sidebar .sidebar-item-active .folder-unread-badge,
    body.tauri-app.vibrancy #main-sidebar .sidebar-nested-item.sidebar-item-active .account-unread-badge {
        background-color: rgba(0, 0, 0, 0.12) !important;
        color: rgba(0, 0, 0, 0.7) !important;
    }

    /* Search pill in liquid glass - visible glass container */
    body.tauri-app.liquid-glass #search-pill,
    body.tauri-app.vibrancy #search-pill {
        background: rgba(0, 0, 0, 0.06) !important;
        border: 0.5px solid rgba(0, 0, 0, 0.10) !important;
    }

    body.tauri-app.liquid-glass #search-pill:hover,
    body.tauri-app.vibrancy #search-pill:hover {
        background: rgba(0, 0, 0, 0.09) !important;
    }

    /* Search icon + placeholder - better contrast on glass */
    body.tauri-app.liquid-glass #search-pill svg,
    body.tauri-app.vibrancy #search-pill svg {
        color: rgba(0, 0, 0, 0.45) !important;
        stroke: rgba(0, 0, 0, 0.45) !important;
    }

    body.tauri-app.liquid-glass #search-pill input::placeholder,
    body.tauri-app.vibrancy #search-pill input::placeholder {
        color: rgba(0, 0, 0, 0.40) !important;
    }

    /* Kbd shortcut badge in glass sidebar - match glass style, not white */
    body.tauri-app.liquid-glass #main-sidebar .kbd,
    body.tauri-app.vibrancy #main-sidebar .kbd {
        background: rgba(0, 0, 0, 0.06) !important;
        border-color: rgba(0, 0, 0, 0.12) !important;
        color: rgba(0, 0, 0, 0.45) !important;
    }

    /* Attachment pills - active state (light) */
    [data-attachment-pill="true"][data-attachment-active="true"] {
        background-color: #f5f9ff !important;
        border-color: #cfe1ff !important;
        box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06) !important;
    }

    /* Collaborative editing sync status indicator */
    .collab-sync-status {
        font-size: 11px;
        padding: 2px 8px;
        color: #854d0e;
        background: #fefce8;
        border-radius: 4px;
    }

    /* =============================================
   CALENDAR INVITES (.ics) DAY VIEW
   ============================================= */

    /* Existing ("busy") event: keep subtle; conflicts get a red stripe (like most calendar UIs). */
    .calendar-event--busy-conflict::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 4px;
        background: rgba(244, 63, 94, 0.9);
        /* rose-500 */
    }

    /* Proposed invite: provisional/pending gets a lighter, dashed treatment (calendar-style). */
    .calendar-event--invite-provisional {
        border-style: dashed !important;
        background-color: rgba(59, 130, 246, 0.72) !important;
        /* blue-500 w/ alpha */
    }

    .calendar-invite-pill {
        font-size: 10px;
        line-height: 1;
        padding: 3px 7px;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.22);
        border: 1px solid rgba(255, 255, 255, 0.28);
        color: rgba(255, 255, 255, 0.95);
        flex-shrink: 0;
        white-space: nowrap;
    }

    /* Hatched overlay for the overlapping portion of the proposed event. */
    .calendar-invite-conflict-hatch {
        background-image: repeating-linear-gradient(135deg,
                rgba(244, 63, 94, 0.32) 0px,
                rgba(244, 63, 94, 0.32) 6px,
                rgba(244, 63, 94, 0.10) 6px,
                rgba(244, 63, 94, 0.10) 12px);
    }

    /* ========================================
       Tahoe-style Search Pill & Category Chips
       ======================================== */

    #search-pill {
        background: rgba(0, 0, 0, 0.04);
        border-radius: 9999px;
        transition: background 0.15s;
    }

    #search-pill:hover {
        background: rgba(0, 0, 0, 0.06);
    }

    /* ========================================
       Tahoe Glass Toolbar Buttons
       ======================================== */

    .footer-actions {
        background: rgba(255, 255, 255, 0.82) !important;
        border: 1px solid rgba(0, 0, 0, 0.06) !important;
        box-shadow:
            0 0 0 0.5px rgba(0, 0, 0, 0.06),
            0 2px 8px rgba(0, 0, 0, 0.05) !important;
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
    }

    .footer-actions button {
        color: rgba(0, 0, 0, 0.50) !important;
        border-color: rgba(0, 0, 0, 0.06) !important;
        transition: background 0.12s, color 0.12s;
    }

    .footer-actions button:hover {
        background: rgb(var(--accent-500-rgb) / 0.10) !important;
        color: var(--accent-700) !important;
    }

    .footer-actions button:active {
        background: rgb(var(--accent-500-rgb) / 0.20) !important;
        color: var(--accent-800) !important;
    }

    .footer-actions button svg {
        stroke-width: 2.5;
    }

    .footer-calendar-pill {
        background: rgba(255, 255, 255, 0.82) !important;
        border: 1px solid rgba(0, 0, 0, 0.06) !important;
        box-shadow:
            0 0 0 0.5px rgba(0, 0, 0, 0.06),
            0 2px 8px rgba(0, 0, 0, 0.05) !important;
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-radius: 9999px;
        overflow: hidden;
    }

    .footer-calendar-pill button {
        color: var(--accent-600) !important;
        transition: background 0.12s, color 0.12s;
    }

    .footer-calendar-pill button:hover {
        background: rgb(var(--accent-500-rgb) / 0.10) !important;
        color: var(--accent-700) !important;
    }

    .footer-calendar-pill button:active {
        background: rgb(var(--accent-500-rgb) / 0.20) !important;
        color: var(--accent-800) !important;
    }

    .footer-calendar-pill button svg {
        stroke-width: 2.5;
    }

    .msg-header-btn:hover {
        background: rgba(0, 0, 0, 0.06);
        box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.4);
    }

    #search-pill input:focus {
        outline: none;
    }

    .category-chips-row {
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 0 16px 10px;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .category-chips-row::-webkit-scrollbar {
        display: none;
    }

    .category-chip {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 5px;
        padding: 6px 12px;
        border-radius: 9999px;
        background: rgba(0, 0, 0, 0.05);
        color: #6b7280;
        font-size: 13px;
        font-weight: 500;
        white-space: nowrap;
        cursor: pointer;
        transition: background 0.15s, color 0.15s;
        border: none;
        outline: none;
        line-height: 1;
    }

    .category-chip:hover {
        background: rgba(0, 0, 0, 0.08);
    }

    .category-chip.active {
        background: rgba(0, 122, 255, 0.12);
        color: #007AFF;
    }

    .category-chip.active:hover {
        background: rgba(0, 122, 255, 0.18);
    }

    .category-chip svg {
        width: 16px;
        height: 16px;
        flex-shrink: 0;
    }

    .category-chip .chip-label {
        display: none;
    }

    .category-chip.active .chip-label {
        display: inline;
    }

/* ═══════════════════════════════════════════════════════════════
   Sidebar accent themes — per-theme gradients + shared overrides
   ═══════════════════════════════════════════════════════════════ */

/* ── Per-theme gradients ── */

/* Deep Blue */
.accent-deep-blue #main-sidebar .message-content-surface {
    background: linear-gradient(180deg, rgba(20, 35, 75, 0.92), rgba(10, 20, 48, 0.95)) !important;
}
html.accent-deep-blue body.tauri-app.liquid-glass #main-sidebar .message-content-surface,
html.accent-deep-blue body.tauri-app.vibrancy #main-sidebar .message-content-surface {
    background: linear-gradient(180deg, rgba(20, 35, 75, 0.85), rgba(10, 20, 48, 0.90)) !important;
}

/* Charcoal */
.accent-charcoal #main-sidebar .message-content-surface {
    background: linear-gradient(180deg, rgba(45, 45, 48, 0.93), rgba(28, 28, 30, 0.96)) !important;
}
html.accent-charcoal body.tauri-app.liquid-glass #main-sidebar .message-content-surface,
html.accent-charcoal body.tauri-app.vibrancy #main-sidebar .message-content-surface {
    background: linear-gradient(180deg, rgba(45, 45, 48, 0.86), rgba(28, 28, 30, 0.90)) !important;
}

/* Forest */
.accent-forest #main-sidebar .message-content-surface {
    background: linear-gradient(180deg, rgba(20, 60, 40, 0.92), rgba(10, 35, 22, 0.95)) !important;
}
html.accent-forest body.tauri-app.liquid-glass #main-sidebar .message-content-surface,
html.accent-forest body.tauri-app.vibrancy #main-sidebar .message-content-surface {
    background: linear-gradient(180deg, rgba(20, 60, 40, 0.85), rgba(10, 35, 22, 0.90)) !important;
}

/* Plum */
.accent-plum #main-sidebar .message-content-surface {
    background: linear-gradient(180deg, rgba(60, 20, 70, 0.92), rgba(35, 10, 42, 0.95)) !important;
}
html.accent-plum body.tauri-app.liquid-glass #main-sidebar .message-content-surface,
html.accent-plum body.tauri-app.vibrancy #main-sidebar .message-content-surface {
    background: linear-gradient(180deg, rgba(60, 20, 70, 0.85), rgba(35, 10, 42, 0.90)) !important;
}

/* Slate Teal */
.accent-slate-teal #main-sidebar .message-content-surface {
    background: linear-gradient(180deg, rgba(25, 55, 65, 0.92), rgba(15, 35, 42, 0.95)) !important;
}
html.accent-slate-teal body.tauri-app.liquid-glass #main-sidebar .message-content-surface,
html.accent-slate-teal body.tauri-app.vibrancy #main-sidebar .message-content-surface {
    background: linear-gradient(180deg, rgba(25, 55, 65, 0.85), rgba(15, 35, 42, 0.90)) !important;
}

/* ── Shared rules for ALL accent themes ── */

.accent-deep-blue #main-sidebar .message-content-surface,
.accent-charcoal #main-sidebar .message-content-surface,
.accent-forest #main-sidebar .message-content-surface,
.accent-plum #main-sidebar .message-content-surface,
.accent-slate-teal #main-sidebar .message-content-surface {
    border-right: none !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

.accent-deep-blue #main-sidebar,
.accent-deep-blue #main-sidebar > div,
.accent-charcoal #main-sidebar,
.accent-charcoal #main-sidebar > div,
.accent-forest #main-sidebar,
.accent-forest #main-sidebar > div,
.accent-plum #main-sidebar,
.accent-plum #main-sidebar > div,
.accent-slate-teal #main-sidebar,
.accent-slate-teal #main-sidebar > div {
    background: transparent !important;
}

/* All accent sidebars have dark backgrounds — SVGs must be white */
.accent-deep-blue #main-sidebar svg,
.accent-charcoal #main-sidebar svg,
.accent-forest #main-sidebar svg,
.accent-plum #main-sidebar svg,
.accent-slate-teal #main-sidebar svg {
    color: rgba(255, 255, 255, 0.85) !important;
    stroke: rgba(255, 255, 255, 0.85) !important;
}
.accent-deep-blue #main-sidebar svg path,
.accent-deep-blue #main-sidebar svg circle,
.accent-deep-blue #main-sidebar svg line,
.accent-deep-blue #main-sidebar svg polyline,
.accent-deep-blue #main-sidebar svg rect,
.accent-charcoal #main-sidebar svg path,
.accent-charcoal #main-sidebar svg circle,
.accent-charcoal #main-sidebar svg line,
.accent-charcoal #main-sidebar svg polyline,
.accent-charcoal #main-sidebar svg rect,
.accent-forest #main-sidebar svg path,
.accent-forest #main-sidebar svg circle,
.accent-forest #main-sidebar svg line,
.accent-forest #main-sidebar svg polyline,
.accent-forest #main-sidebar svg rect,
.accent-plum #main-sidebar svg path,
.accent-plum #main-sidebar svg circle,
.accent-plum #main-sidebar svg line,
.accent-plum #main-sidebar svg polyline,
.accent-plum #main-sidebar svg rect,
.accent-slate-teal #main-sidebar svg path,
.accent-slate-teal #main-sidebar svg circle,
.accent-slate-teal #main-sidebar svg line,
.accent-slate-teal #main-sidebar svg polyline,
.accent-slate-teal #main-sidebar svg rect {
    stroke: rgba(255, 255, 255, 0.85) !important;
}

/* Sidebar text — all accent themes */
.accent-deep-blue #main-sidebar,
.accent-charcoal #main-sidebar,
.accent-forest #main-sidebar,
.accent-plum #main-sidebar,
.accent-slate-teal #main-sidebar {
    color: rgba(255, 255, 255, 0.9) !important;
}

.accent-deep-blue #main-sidebar #sidebar-status-footer,
.accent-deep-blue #main-sidebar .mt-auto,
.accent-charcoal #main-sidebar #sidebar-status-footer,
.accent-charcoal #main-sidebar .mt-auto,
.accent-forest #main-sidebar #sidebar-status-footer,
.accent-forest #main-sidebar .mt-auto,
.accent-plum #main-sidebar #sidebar-status-footer,
.accent-plum #main-sidebar .mt-auto,
.accent-slate-teal #main-sidebar #sidebar-status-footer,
.accent-slate-teal #main-sidebar .mt-auto {
    background: transparent !important;
}

.accent-deep-blue #main-sidebar ::-webkit-scrollbar-thumb,
.accent-charcoal #main-sidebar ::-webkit-scrollbar-thumb,
.accent-forest #main-sidebar ::-webkit-scrollbar-thumb,
.accent-plum #main-sidebar ::-webkit-scrollbar-thumb,
.accent-slate-teal #main-sidebar ::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.15) !important;
}
.accent-deep-blue #main-sidebar ::-webkit-scrollbar-track,
.accent-charcoal #main-sidebar ::-webkit-scrollbar-track,
.accent-forest #main-sidebar ::-webkit-scrollbar-track,
.accent-plum #main-sidebar ::-webkit-scrollbar-track,
.accent-slate-teal #main-sidebar ::-webkit-scrollbar-track {
    background-color: transparent !important;
}

/* ═══════════════════════════════════════════════════════════════
   Per-theme sidebar active item — bright, recognizable colors
   Selectors must beat liquid-glass specificity (1,3,1)
   ═══════════════════════════════════════════════════════════════ */

/* Deep Blue — bright blue */
html.accent-deep-blue body #main-sidebar .sidebar-item.sidebar-item-active,
html.accent-deep-blue body #main-sidebar a.sidebar-item.sidebar-item-active,
html.accent-deep-blue body #main-sidebar a.label-link.sidebar-item-active {
    background-color: #007AFF !important;
    color: white !important;
}
html.accent-deep-blue body #main-sidebar .sidebar-item.sidebar-item-active svg {
    color: white !important;
    stroke: white !important;
}

/* Charcoal — neutral theme, keep Apple blue */
html.accent-charcoal body #main-sidebar .sidebar-item.sidebar-item-active,
html.accent-charcoal body #main-sidebar a.sidebar-item.sidebar-item-active,
html.accent-charcoal body #main-sidebar a.label-link.sidebar-item-active {
    background-color: #007AFF !important;
    color: white !important;
}
html.accent-charcoal body #main-sidebar .sidebar-item.sidebar-item-active svg {
    color: white !important;
    stroke: white !important;
}

/* Forest — bright green */
html.accent-forest body #main-sidebar .sidebar-item.sidebar-item-active,
html.accent-forest body #main-sidebar a.sidebar-item.sidebar-item-active,
html.accent-forest body #main-sidebar a.label-link.sidebar-item-active {
    background-color: #30D158 !important;
    color: white !important;
}
html.accent-forest body #main-sidebar .sidebar-item.sidebar-item-active svg {
    color: white !important;
    stroke: white !important;
}

/* Plum — bright purple */
html.accent-plum body #main-sidebar .sidebar-item.sidebar-item-active,
html.accent-plum body #main-sidebar a.sidebar-item.sidebar-item-active,
html.accent-plum body #main-sidebar a.label-link.sidebar-item-active {
    background-color: #BF5AF2 !important;
    color: white !important;
}
html.accent-plum body #main-sidebar .sidebar-item.sidebar-item-active svg {
    color: white !important;
    stroke: white !important;
}

/* Slate Teal — bright teal (dark text for legibility) */
html.accent-slate-teal body #main-sidebar .sidebar-item.sidebar-item-active,
html.accent-slate-teal body #main-sidebar a.sidebar-item.sidebar-item-active,
html.accent-slate-teal body #main-sidebar a.label-link.sidebar-item-active {
    background-color: #5AC8FA !important;
    color: #0a1e26 !important;
}
html.accent-slate-teal body #main-sidebar .sidebar-item.sidebar-item-active svg {
    color: #0a1e26 !important;
    stroke: #0a1e26 !important;
}

/* Unread badges on active items — all accent themes */
html.accent-deep-blue body #main-sidebar .sidebar-item.sidebar-item-active .folder-unread-badge,
html.accent-deep-blue body #main-sidebar .sidebar-item.sidebar-item-active .account-unread-badge,
html.accent-charcoal body #main-sidebar .sidebar-item.sidebar-item-active .folder-unread-badge,
html.accent-charcoal body #main-sidebar .sidebar-item.sidebar-item-active .account-unread-badge,
html.accent-forest body #main-sidebar .sidebar-item.sidebar-item-active .folder-unread-badge,
html.accent-forest body #main-sidebar .sidebar-item.sidebar-item-active .account-unread-badge,
html.accent-plum body #main-sidebar .sidebar-item.sidebar-item-active .folder-unread-badge,
html.accent-plum body #main-sidebar .sidebar-item.sidebar-item-active .account-unread-badge {
    background-color: rgba(255, 255, 255, 0.25) !important;
    color: white !important;
}
html.accent-slate-teal body #main-sidebar .sidebar-item.sidebar-item-active .folder-unread-badge,
html.accent-slate-teal body #main-sidebar .sidebar-item.sidebar-item-active .account-unread-badge {
    background-color: rgba(0, 0, 0, 0.15) !important;
    color: #0a1e26 !important;
}

/* ═══════════════════════════════════════════════════════════════
   Per-theme thread list active item — match sidebar accent color
   ═══════════════════════════════════════════════════════════════ */

/* Forest — bright green */
html.accent-forest #thread-list .thread-item.active,
html.accent-forest .thread-item.active {
    background-color: #30D158 !important;
}
html.accent-forest #thread-list .thread-item.active:hover,
html.accent-forest .thread-item.active:hover {
    background-color: #30D158 !important;
}

/* Plum — bright purple */
html.accent-plum #thread-list .thread-item.active,
html.accent-plum .thread-item.active {
    background-color: #BF5AF2 !important;
}
html.accent-plum #thread-list .thread-item.active:hover,
html.accent-plum .thread-item.active:hover {
    background-color: #BF5AF2 !important;
}

/* Slate Teal — bright teal */
html.accent-slate-teal #thread-list .thread-item.active,
html.accent-slate-teal .thread-item.active {
    background-color: #5AC8FA !important;
    color: #0a1e26 !important;
}
html.accent-slate-teal #thread-list .thread-item.active:hover,
html.accent-slate-teal .thread-item.active:hover {
    background-color: #5AC8FA !important;
}

/* Slate Teal — dark text inside active thread for contrast */
html.accent-slate-teal #thread-list .thread-item.active .thread-sender,
html.accent-slate-teal #thread-list .thread-item.active .thread-subject,
html.accent-slate-teal #thread-list .thread-item.active .thread-snippet,
html.accent-slate-teal #thread-list .thread-item.active .thread-timestamp,
html.accent-slate-teal #thread-list .thread-item.active .thread-badge {
    color: #0a1e26 !important;
}

/* Deep Blue & Charcoal keep default #007AFF — no override needed */

/* ═══════════════════════════════════════════════════════════════
   Accent theme dark mode tinting — override CSS custom properties
   so the entire app picks up a tinted dark palette
   ═══════════════════════════════════════════════════════════════ */

/* ── Deep Blue — very deep navy tones ── */
.theme-dark.accent-deep-blue {
    --dark-bg: #0f1729;
    --dark-panel: #151e35;
    --dark-panel-2: #1b2640;
    --dark-panel-3: #212e4c;
    --dark-surface: #182238;
    --dark-border: #253358;
    --dark-border-strong: #2e3d65;
    --dark-hover: rgba(80, 130, 255, 0.08);
    --dark-hover-strong: rgba(80, 130, 255, 0.14);
    --dark-accent: #7ba8ff;
    --dark-accent-muted: rgba(107, 159, 255, 0.18);
}

/* ── Charcoal — neutral warm dark ── */
.theme-dark.accent-charcoal {
    --dark-bg: #1a1a1c;
    --dark-panel: #222224;
    --dark-panel-2: #2a2a2c;
    --dark-panel-3: #323234;
    --dark-surface: #262628;
    --dark-border: #3a3a3e;
    --dark-border-strong: #454548;
    --dark-hover: rgba(255, 255, 255, 0.07);
    --dark-hover-strong: rgba(255, 255, 255, 0.11);
}

/* ── Forest — very deep green tones ── */
.theme-dark.accent-forest {
    --dark-bg: #0c1a12;
    --dark-panel: #12221a;
    --dark-panel-2: #182a22;
    --dark-panel-3: #1f3229;
    --dark-surface: #152418;
    --dark-border: #1e3e28;
    --dark-border-strong: #274a32;
    --dark-hover: rgba(48, 209, 88, 0.08);
    --dark-hover-strong: rgba(48, 209, 88, 0.14);
    --dark-accent: #5ad87a;
    --dark-accent-muted: rgba(48, 209, 88, 0.18);
}

/* ── Plum — very deep purple tones ── */
.theme-dark.accent-plum {
    --dark-bg: #18101e;
    --dark-panel: #201628;
    --dark-panel-2: #281e32;
    --dark-panel-3: #30243c;
    --dark-surface: #221a2c;
    --dark-border: #3a2650;
    --dark-border-strong: #45305e;
    --dark-hover: rgba(191, 90, 242, 0.08);
    --dark-hover-strong: rgba(191, 90, 242, 0.14);
    --dark-accent: #c78df5;
    --dark-accent-muted: rgba(191, 90, 242, 0.18);
}

/* ── Slate Teal — very deep teal tones ── */
.theme-dark.accent-slate-teal {
    --dark-bg: #0e191e;
    --dark-panel: #142228;
    --dark-panel-2: #1a2a32;
    --dark-panel-3: #20323c;
    --dark-surface: #16242c;
    --dark-border: #1e3e48;
    --dark-border-strong: #274a55;
    --dark-hover: rgba(50, 200, 220, 0.08);
    --dark-hover-strong: rgba(50, 200, 220, 0.14);
    --dark-accent: #5cd4e8;
    --dark-accent-muted: rgba(50, 200, 220, 0.18);
}

/* ── Liquid-glass thread list + reading pane tinting (DARK MODE ONLY) ── */

/* Deep Blue */
.theme-dark.accent-deep-blue body.tauri-app.liquid-glass #thread-list-pane,
.theme-dark.accent-deep-blue body.tauri-app.vibrancy #thread-list-pane {
    background-color: rgba(15, 23, 41, 0.97) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}
.theme-dark.accent-deep-blue body.tauri-app.liquid-glass #reading-pane,
.theme-dark.accent-deep-blue body.tauri-app.vibrancy #reading-pane {
    background-color: rgba(10, 16, 30, 0.92) !important;
}

/* Charcoal */
.theme-dark.accent-charcoal body.tauri-app.liquid-glass #thread-list-pane,
.theme-dark.accent-charcoal body.tauri-app.vibrancy #thread-list-pane {
    background-color: rgba(26, 26, 28, 0.97) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}
.theme-dark.accent-charcoal body.tauri-app.liquid-glass #reading-pane,
.theme-dark.accent-charcoal body.tauri-app.vibrancy #reading-pane {
    background-color: rgba(18, 18, 20, 0.92) !important;
}

/* Forest */
.theme-dark.accent-forest body.tauri-app.liquid-glass #thread-list-pane,
.theme-dark.accent-forest body.tauri-app.vibrancy #thread-list-pane {
    background-color: rgba(12, 26, 18, 0.97) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}
.theme-dark.accent-forest body.tauri-app.liquid-glass #reading-pane,
.theme-dark.accent-forest body.tauri-app.vibrancy #reading-pane {
    background-color: rgba(8, 18, 12, 0.92) !important;
}

/* Plum */
.theme-dark.accent-plum body.tauri-app.liquid-glass #thread-list-pane,
.theme-dark.accent-plum body.tauri-app.vibrancy #thread-list-pane {
    background-color: rgba(24, 16, 30, 0.97) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}
.theme-dark.accent-plum body.tauri-app.liquid-glass #reading-pane,
.theme-dark.accent-plum body.tauri-app.vibrancy #reading-pane {
    background-color: rgba(16, 10, 22, 0.92) !important;
}

/* Slate Teal */
.theme-dark.accent-slate-teal body.tauri-app.liquid-glass #thread-list-pane,
.theme-dark.accent-slate-teal body.tauri-app.vibrancy #thread-list-pane {
    background-color: rgba(14, 25, 30, 0.97) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}
.theme-dark.accent-slate-teal body.tauri-app.liquid-glass #reading-pane,
.theme-dark.accent-slate-teal body.tauri-app.vibrancy #reading-pane {
    background-color: rgba(10, 18, 22, 0.92) !important;
}

/* ── Thread list text + header — dark mode accent themes ── */

/* Thread list header text + icons — white */
.theme-dark.accent-deep-blue #thread-list-header,
.theme-dark.accent-deep-blue #thread-list-header h2,
.theme-dark.accent-deep-blue #thread-list-header span,
.theme-dark.accent-deep-blue #thread-list-header button,
.theme-dark.accent-charcoal #thread-list-header,
.theme-dark.accent-charcoal #thread-list-header h2,
.theme-dark.accent-charcoal #thread-list-header span,
.theme-dark.accent-charcoal #thread-list-header button,
.theme-dark.accent-forest #thread-list-header,
.theme-dark.accent-forest #thread-list-header h2,
.theme-dark.accent-forest #thread-list-header span,
.theme-dark.accent-forest #thread-list-header button,
.theme-dark.accent-plum #thread-list-header,
.theme-dark.accent-plum #thread-list-header h2,
.theme-dark.accent-plum #thread-list-header span,
.theme-dark.accent-plum #thread-list-header button,
.theme-dark.accent-slate-teal #thread-list-header,
.theme-dark.accent-slate-teal #thread-list-header h2,
.theme-dark.accent-slate-teal #thread-list-header span,
.theme-dark.accent-slate-teal #thread-list-header button {
    color: #ffffff !important;
}

.theme-dark.accent-deep-blue #thread-list-header svg,
.theme-dark.accent-charcoal #thread-list-header svg,
.theme-dark.accent-forest #thread-list-header svg,
.theme-dark.accent-plum #thread-list-header svg,
.theme-dark.accent-slate-teal #thread-list-header svg {
    color: rgba(255, 255, 255, 0.85) !important;
}

.theme-dark.accent-deep-blue #thread-list-header,
.theme-dark.accent-charcoal #thread-list-header,
.theme-dark.accent-forest #thread-list-header,
.theme-dark.accent-plum #thread-list-header,
.theme-dark.accent-slate-teal #thread-list-header {
    border-color: rgba(255, 255, 255, 0.08) !important;
    background-color: transparent !important;
}

/* Thread item hover */
.theme-dark.accent-deep-blue .thread-item:hover,
.theme-dark.accent-charcoal .thread-item:hover,
.theme-dark.accent-forest .thread-item:hover,
.theme-dark.accent-plum .thread-item:hover,
.theme-dark.accent-slate-teal .thread-item:hover {
    background-color: rgba(255, 255, 255, 0.06) !important;
}

/* Thread item selected */
.theme-dark.accent-deep-blue .thread-item.selected,
.theme-dark.accent-charcoal .thread-item.selected,
.theme-dark.accent-forest .thread-item.selected,
.theme-dark.accent-plum .thread-item.selected,
.theme-dark.accent-slate-teal .thread-item.selected {
    background-color: rgba(255, 255, 255, 0.10) !important;
}

/* Sticky date headers bg — match thread list bg */
.theme-dark.accent-deep-blue #thread-list-pane .sticky {
    background-color: #0f1729 !important;
}
.theme-dark.accent-charcoal #thread-list-pane .sticky {
    background-color: #1a1a1c !important;
}
.theme-dark.accent-forest #thread-list-pane .sticky {
    background-color: #0c1a12 !important;
}
.theme-dark.accent-plum #thread-list-pane .sticky {
    background-color: #18101e !important;
}
.theme-dark.accent-slate-teal #thread-list-pane .sticky {
    background-color: #0e191e !important;
}

/* Thread date header color in non-liquid-glass dark mode */
.theme-dark.accent-deep-blue .thread-date-header,
.theme-dark.accent-charcoal .thread-date-header,
.theme-dark.accent-forest .thread-date-header,
.theme-dark.accent-plum .thread-date-header,
.theme-dark.accent-slate-teal .thread-date-header {
    color: rgba(255, 255, 255, 0.45) !important;
}

/* Thread text — explicit white for accent dark modes (beats hardcoded light-mode colors) */
.theme-dark.accent-deep-blue .thread-sender,
.theme-dark.accent-deep-blue .thread-subject,
.theme-dark.accent-charcoal .thread-sender,
.theme-dark.accent-charcoal .thread-subject,
.theme-dark.accent-forest .thread-sender,
.theme-dark.accent-forest .thread-subject,
.theme-dark.accent-plum .thread-sender,
.theme-dark.accent-plum .thread-subject,
.theme-dark.accent-slate-teal .thread-sender,
.theme-dark.accent-slate-teal .thread-subject {
    color: #ffffff !important;
}

.theme-dark.accent-deep-blue .thread-snippet,
.theme-dark.accent-deep-blue .thread-timestamp,
.theme-dark.accent-charcoal .thread-snippet,
.theme-dark.accent-charcoal .thread-timestamp,
.theme-dark.accent-forest .thread-snippet,
.theme-dark.accent-forest .thread-timestamp,
.theme-dark.accent-plum .thread-snippet,
.theme-dark.accent-plum .thread-timestamp,
.theme-dark.accent-slate-teal .thread-snippet,
.theme-dark.accent-slate-teal .thread-timestamp {
    color: rgba(255, 255, 255, 0.55) !important;
}

/* Unread timestamp — themed accent blue */
.theme-dark.accent-deep-blue .thread-item.unread .thread-timestamp {
    color: var(--dark-accent) !important;
}
.theme-dark.accent-charcoal .thread-item.unread .thread-timestamp {
    color: var(--dark-accent, #6b9fff) !important;
}
.theme-dark.accent-forest .thread-item.unread .thread-timestamp {
    color: var(--dark-accent) !important;
}
.theme-dark.accent-plum .thread-item.unread .thread-timestamp {
    color: var(--dark-accent) !important;
}
.theme-dark.accent-slate-teal .thread-item.unread .thread-timestamp {
    color: var(--dark-accent) !important;
}

/* ═══════════════════════════════════════════════════════════════
   Corner-fill for thread-list-pane rounded corners
   — set app-grid bg to match sidebar so gaps behind the radius
   show the correct color. Compositing rgba(R,G,B,a) over
   rgb(R,G,B) = rgb(R,G,B), so sidebar and corner gap are identical.
   ═══════════════════════════════════════════════════════════════ */
.accent-deep-blue .app-grid {
    background: linear-gradient(180deg, rgb(20, 35, 75), rgb(10, 20, 48)) !important;
}
.accent-charcoal .app-grid {
    background: linear-gradient(180deg, rgb(45, 45, 48), rgb(28, 28, 30)) !important;
}
.accent-forest .app-grid {
    background: linear-gradient(180deg, rgb(20, 60, 40), rgb(10, 35, 22)) !important;
}
.accent-plum .app-grid {
    background: linear-gradient(180deg, rgb(60, 20, 70), rgb(35, 10, 42)) !important;
}
.accent-slate-teal .app-grid {
    background: linear-gradient(180deg, rgb(25, 55, 65), rgb(15, 35, 42)) !important;
}

/* ===== Inline message tracking ===== */
.inline-tracking {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 4px;
    color: #52525b;
    white-space: nowrap;
}
.inline-tracking-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}
.inline-tracking-label {
    font-size: 11px;
    font-weight: 500;
}
.inline-tracking-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #a1a1aa;
    background: transparent;
    border: 0;
    padding: 0;
    margin: 0 0 0 1px;
    cursor: help;
    line-height: 0;
}
.inline-tracking-info:hover { color: #3f3f46; }
.theme-dark .inline-tracking { color: #d4d4d8; }
.theme-dark .inline-tracking-info { color: #71717a; }
.theme-dark .inline-tracking-info:hover { color: #e4e4e7; }

.inline-tracking-tooltip {
    position: fixed;
    z-index: 9999;
    display: none;
    max-width: min(360px, calc(100vw - 24px));
    max-height: min(320px, calc(100vh - 40px));
    overflow-y: auto;
    background: #ffffff;
    color: #18181b;
    border: 1px solid #e4e4e7;
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
    padding: 10px 12px;
    font-size: 11px;
    line-height: 1.45;
    text-align: left;
    white-space: normal;
    pointer-events: auto;
}
.inline-tracking-tooltip[data-visible="true"] { display: block; }
.theme-dark .inline-tracking-tooltip {
    background: #27272a;
    color: #f4f4f5;
    border-color: #3f3f46;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}
.tracking-tooltip-row { padding: 6px 0; border-bottom: 1px solid #f4f4f5; }
.tracking-tooltip-row:last-child { border-bottom: 0; padding-bottom: 0; }
.tracking-tooltip-row:first-child { padding-top: 0; }
.theme-dark .tracking-tooltip-row { border-bottom-color: #3f3f46; }
.tracking-tooltip-row-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
}
.tracking-tooltip-recipient {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tracking-tooltip-prob {
    font-variant-numeric: tabular-nums;
    color: #16a34a;
    font-weight: 600;
    flex-shrink: 0;
}
.theme-dark .tracking-tooltip-prob { color: #4ade80; }
.tracking-tooltip-row-meta { color: #52525b; margin-top: 2px; }
.tracking-tooltip-row-time { color: #71717a; margin-top: 2px; font-size: 10px; }
.theme-dark .tracking-tooltip-row-meta { color: #a1a1aa; }
.theme-dark .tracking-tooltip-row-time { color: #71717a; }
.tracking-tooltip-events {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed #e4e4e7;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.theme-dark .tracking-tooltip-events { border-top-color: #3f3f46; }
.tracking-tooltip-event {
    background: #fafafa;
    border: 1px solid #f4f4f5;
    border-radius: 6px;
    padding: 4px 6px;
}
.theme-dark .tracking-tooltip-event {
    background: #18181b;
    border-color: #3f3f46;
}
.tracking-tooltip-event-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    font-size: 10px;
}
.tracking-tooltip-event-signal {
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #18181b;
    font-weight: 600;
}
.theme-dark .tracking-tooltip-event-signal { color: #f4f4f5; }
.tracking-tooltip-event-time { color: #71717a; font-variant-numeric: tabular-nums; }
.tracking-tooltip-event-meta {
    color: #52525b;
    font-size: 10px;
    margin-top: 2px;
    word-break: break-word;
}
.theme-dark .tracking-tooltip-event-meta { color: #a1a1aa; }
.tracking-tooltip-empty {
    color: #71717a;
    font-style: italic;
    margin-top: 4px;
}
.theme-dark .tracking-tooltip-empty { color: #a1a1aa; }
.tracking-tooltip-header {
    font-size: 10px;
    color: #71717a;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.theme-dark .tracking-tooltip-header { color: #a1a1aa; }

