:root {
    --bg-dark: #0a0b16;
    --bg-glass: rgba(16, 18, 35, 0.45);
    --bg-glass-active: rgba(26, 29, 56, 0.65);
    --border-glass: rgba(255, 255, 255, 0.08);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --accent-glow: #6366f1;
    --accent-indigo: #6366f1;
    --accent-magenta: #d946ef;
    --success-color: #10b981;
}

body.light-theme {
    --bg-dark: #f6f7fb;
    --bg-glass: #ffffff;
    --bg-glass-active: #ffffff;
    --border-glass: #e1e5ee;
    --text-primary: #1f2937;
    --text-secondary: #64748b;
}


* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    position: relative;
}

.app-version {
    position: fixed;
    right: 1rem;
    bottom: 0.75rem;
    z-index: 1000;
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    opacity: 0.8;
    pointer-events: none;
    user-select: none;
}

.user-management-panel,
.scanner-settings-panel {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    background: rgba(99, 102, 241, 0.04);
}

.user-management-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.user-management-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border-glass);
    border-radius: 8px;
}

.user-management-row span {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.user-management-row small {
    color: var(--text-secondary);
}

.settings-category-tabs,
.settings-submenus {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    align-items: stretch;
    padding: 0 0.25rem;
    background: transparent;
}

.settings-category-tabs {
    border-bottom: 1px solid var(--border-glass);
}

.settings-category-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.72rem 0.7rem 0.62rem;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font: inherit;
    font-size: 0.76rem;
    font-weight: 700;
    white-space: nowrap;
}

.settings-category-tab:hover,
.settings-category-tab.active {
    color: var(--accent-indigo);
    border-bottom-color: var(--accent-indigo);
}

.settings-submenus {
    min-height: 2.55rem;
    border-bottom: 1px solid var(--border-glass);
}

.settings-content-hidden {
    display: none !important;
}

.settings-category-hidden {
    display: none !important;
}

.settings-menu-group {
    display: flex;
    align-items: stretch;
    min-width: 0;
    border: 0;
    background: transparent;
}

.settings-menu-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    padding: 0;
}

.settings-menu-items a {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.72rem 0.55rem 0.62rem;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    color: var(--text-secondary);
    font-size: 0.73rem;
    text-decoration: none;
    white-space: nowrap;
}

.settings-menu-items a:hover {
    color: var(--accent-indigo);
    border-bottom-color: var(--accent-indigo);
}

.settings-menu-items a.active {
    color: var(--accent-indigo);
    border-bottom-color: var(--accent-indigo);
}

/* Organic Glowing Orbs */
.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    pointer-events: none;
    opacity: 0.5;
}

.glow-orb-1 {
    width: 600px;
    height: 600px;
    top: -200px;
    left: -200px;
    background: rgba(99, 102, 241, 0.12);
}

.glow-orb-2 {
    width: 500px;
    height: 500px;
    bottom: -150px;
    right: -150px;
    background: rgba(217, 70, 239, 0.10);
}

/* App Wrapper Grid */
.app-wrapper {
    --left-sidebar-width: 340px;
    --right-sidebar-width: 440px;
    display: flex;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    overflow: hidden;
    align-items: stretch;
}

/* Glassmorphic Cards Classes */
.glass {
    background: var(--bg-glass);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-glass);
}

/* 1. SIDEBAR */
.sidebar {
    position: relative;
    width: var(--left-sidebar-width);
    height: 100%;
    max-height: 100%;
    border-right: 1px solid var(--border-glass);
    padding: 2.2rem 1.8rem;
    display: flex;
    flex-direction: column;
    gap: 2.2rem;
    flex: 0 0 var(--left-sidebar-width);
    min-width: 0;
    overflow: hidden;
    transition: width 0.22s ease, flex-basis 0.22s ease, padding 0.22s ease;
}

.sidebar-resize-handle {
    bottom: 0;
    cursor: col-resize;
    position: absolute;
    right: 0;
    top: 0;
    width: 10px;
    z-index: 25;
}

.sidebar-resize-handle::after {
    background: transparent;
    border-radius: 999px;
    bottom: 0.75rem;
    content: "";
    left: 7px;
    position: absolute;
    top: 0.75rem;
    transition: background 0.16s ease, box-shadow 0.16s ease;
    width: 2px;
}

.sidebar-resize-handle:hover::after,
body.sidebar-resizing .sidebar-resize-handle::after {
    background: var(--accent-indigo);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

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

body.sidebar-resizing .app-wrapper,
body.sidebar-resizing .sidebar {
    transition: none;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.brand-logo {
    font-size: 2.2rem;
    background: var(--accent-glow);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: rotate 20s linear infinite;
}

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

.brand-name h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.brand-name span {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 600;
}

.user-profile-widget {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.user-profile-widget label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.profile-select {
    background: rgba(7, 9, 19, 0.85);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 0.6rem 0.8rem;
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
    flex-grow: 1;
    overflow-y: auto;
}

.nav-section {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.nav-section h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    font-weight: 700;
}

.section-title-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.action-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    transition: color 0.3s ease;
}

.action-btn:hover {
    color: var(--text-primary);
}

.sidebar-nav ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-nav li a {
    color: var(--text-secondary);
    text-decoration: none;
    display: grid;
    grid-template-columns: 1.35rem minmax(0, 1fr) auto;
    align-items: center;
    justify-content: start;
    gap: 0.8rem;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: left;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
}

.sidebar-nav li a > i {
    width: 1.35rem;
    text-align: center;
}

#navInputInbox {
    position: relative;
}

#navInputInbox.drop-target-active > a {
    outline: 2px dashed var(--accent-indigo);
    outline-offset: -2px;
    background: rgba(99, 102, 241, 0.12);
}

.global-drop-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    background: rgba(30, 41, 59, 0.18);
}

.global-drop-overlay.active {
    display: flex;
}

.global-drop-overlay-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.55rem;
    min-width: 18rem;
    padding: 2rem 3rem;
    color: var(--text-primary);
    background: var(--bg-primary, #fff);
    border: 2px dashed var(--accent-indigo);
    text-align: center;
}

.global-drop-overlay-content i {
    color: var(--accent-indigo);
    font-size: 2.4rem;
}

.global-drop-overlay-content strong {
    font-size: 1.15rem;
}

.global-drop-overlay-content span {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

#navInputInbox > a {
    padding-right: 2.6rem;
}

.nav-sync-input-btn {
    position: absolute;
    top: 50%;
    right: 0.7rem;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.35rem;
}

.nav-sync-input-btn:hover {
    color: var(--accent-indigo);
}

.sidebar-nav li.active a, .sidebar-nav li a:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-glass);
}

.sidebar-nav li.active a {
    border-left: 3px solid var(--accent-indigo);
}

.badge-accent {
    background: var(--accent-glow);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    letter-spacing: 0.5px;
}

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.btn-sync {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    color: var(--text-primary);
    padding: 0.8rem;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.btn-sync:hover {
    background: var(--accent-glow);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
    border-color: transparent;
}

.status-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.connection-status-bar {
    align-items: center;
    background: var(--bg-glass);
    border-top: 1px solid var(--border-glass);
    bottom: 0;
    color: var(--text-secondary);
    display: flex;
    gap: 0.8rem;
    height: 30px;
    min-height: 30px;
    box-sizing: border-box;
    padding: 0.25rem 1rem;
    position: fixed;
    left: 0;
    right: 0;
    justify-content: center;
    z-index: 10020;
    border-radius: 0 !important;
}

/* Compact sidebar account row: align it with the main connection status bar. */
.sidebar-footer {
    position: absolute !important;
    left: 0;
    right: 0;
    bottom: 0;
    height: 30px;
    min-height: 30px;
    padding: 0 !important;
    border-top: 0 !important;
    gap: 0 !important;
    background: var(--bg-glass);
}

.user-profile-widget,
.active-profile-header {
    height: 30px !important;
    min-height: 30px !important;
    margin: 0 !important;
    padding: 0 0.7rem !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

.active-profile-header { gap: 0.45rem !important; }
.active-profile-header img {
    width: 22px !important;
    height: 22px !important;
    border-width: 1px !important;
}
.active-profile-header .profile-info { flex-direction: row !important; align-items: center; gap: 0.4rem; }
.active-profile-header .profile-info strong { font-size: 0.75rem !important; }
.active-profile-header .profile-info span { font-size: 0.65rem !important; }
.active-profile-header button { font-size: 0.85rem !important; padding: 2px !important; }

.connection-status-item {
    align-items: center;
    color: var(--text-secondary);
    display: inline-flex;
    font-size: 0.7rem;
    gap: 0.35rem;
    text-decoration: none;
    white-space: nowrap;
}

.connection-status-item:hover { color: var(--text-primary); }

.connection-status-dot {
    background: #94a3b8;
    border-radius: 50%;
    display: inline-block;
    height: 7px;
    width: 7px;
}

.connection-status-item.is-connected { color: #16a34a; }
.connection-status-item.is-connected .connection-status-dot { background: #16a34a; }
.connection-status-item.is-disconnected { color: #dc2626; }
.connection-status-item.is-disconnected .connection-status-dot { background: #dc2626; }
.connection-status-item.is-checking .connection-status-dot { animation: status-pulse 1.2s infinite; }

.connection-status-divider {
    background: var(--border-glass);
    height: 16px;
    width: 1px;
}

.connection-status-version {
    color: var(--text-secondary);
    font-size: 0.7rem;
    margin-left: auto;
    white-space: nowrap;
}

@keyframes status-pulse {
    50% { opacity: 0.35; }
}

@media (max-width: 700px) {
    .connection-status-bar {
        gap: 0.45rem;
        left: 0;
        overflow-x: auto;
        padding: 0.25rem 0.5rem;
    }
}

.pulse-green {
    width: 8px;
    height: 8px;
    background: var(--success-color);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--success-color);
}

/* 2. TIMELINE FEED (CENTER) */
.timeline-container {
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 1.2rem 2.5rem 1.2rem;
    gap: 1.5rem;
}

.top-search-header {
    padding: 0.8rem 1.5rem;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.search-input-wrapper {
    position: relative;
    flex-grow: 1;
    max-width: 800px;
}

.search-icon {
    position: absolute;
    left: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.search-input-wrapper input {
    width: 100%;
    background: rgba(7, 9, 19, 0.4);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 0.8rem 1rem 0.8rem 3rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s ease;
}

.search-input-wrapper input:focus {
    border-color: var(--accent-indigo);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.15);
}

.btn-scan {
    background: var(--accent-glow);
    border: none;
    border-radius: 12px;
    color: #fff;
    padding: 0.8rem 1.4rem;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.btn-scan:hover {
    box-shadow: 0 0 20px rgba(217, 70, 239, 0.4);
}

.feed-section {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow: hidden;
}

.feed-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.feed-header h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
}

.feed-counter {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    padding: 0.4rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.timeline-feed {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    padding-right: 0.5rem;
}

/* Timeline Cards */
.timeline-card {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-left: 5px solid transparent;
    border-radius: 16px;
    padding: 1.4rem 1.6rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    gap: 1.2rem;
    position: relative;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.02);
}

.timeline-card.email { border-left-color: #6366f1; }
.timeline-card.telegram { border-left-color: #38bdf8; }
.timeline-card.whatsapp { border-left-color: #22c55e; }
.timeline-card.letter { border-left-color: #f59e0b; }

.timeline-card:hover {
    background: var(--bg-glass-active);
    transform: translateY(-2px) scale(1.005);
    border-color: rgba(99, 102, 241, 0.15);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.06);
}

.timeline-card.active {
    border-color: rgba(217, 70, 239, 0.35);
    box-shadow: 0 10px 30px rgba(217, 70, 239, 0.08);
}

.timeline-card.email.active { border-color: rgba(99, 102, 241, 0.4); }
.timeline-card.telegram.active { border-color: rgba(56, 189, 248, 0.4); }
.timeline-card.whatsapp.active { border-color: rgba(34, 197, 94, 0.4); }
.timeline-card.letter.active { border-color: rgba(245, 158, 11, 0.4); }

.channel-icon-container {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.timeline-card:hover .channel-icon-container {
    transform: scale(1.05);
}

.channel-icon-container.email { background: rgba(99, 102, 241, 0.1); color: #6366f1; }
.channel-icon-container.telegram { background: rgba(56, 189, 248, 0.1); color: #38bdf8; }
.channel-icon-container.whatsapp { background: rgba(34, 197, 94, 0.1); color: #22c55e; }
.channel-icon-container.letter { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }

.card-thumbnail-wrapper {
    width: 80px;
    height: 104px;
    flex-shrink: 0;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(99, 102, 241, 0.15);
    background: #fff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.3s ease;
    align-self: center;
}

.timeline-card:hover .card-thumbnail-wrapper {
    transform: scale(1.04);
    border-color: rgba(99, 102, 241, 0.3);
}

.card-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.card-details-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.sender-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.sender-info h3 {
    font-size: 0.95rem;
    font-weight: 650;
    color: var(--text-primary);
    margin: 0;
}

.channel-badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    opacity: 0.85;
}

.time-stamp {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-secondary);
    opacity: 0.8;
}

.card-subject {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    font-size: 0.84rem;
    color: var(--text-secondary);
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer-meta {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    margin-top: 0.3rem;
}

.badge-tag {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-glass);
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
}

body.light-theme .badge-tag {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.05);
}

.badge-project {
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.18);
    color: var(--accent-indigo);
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
}

.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1rem;
    height: 300px;
    color: var(--text-secondary);
}

.loading-state i {
    font-size: 2.2rem;
    color: var(--accent-indigo);
}

/* 3. CONTEXT PANEL (RIGHT) */
.context-panel {
    position: relative;
    width: var(--right-sidebar-width);
    height: 100%;
    max-height: 100%;
    border-left: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    flex: 0 0 var(--right-sidebar-width);
    overflow: hidden;
    transition: width 0.22s ease, flex-basis 0.22s ease;
}

.context-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 100%;
    padding: 3rem;
    color: var(--text-secondary);
    gap: 1.2rem;
}

.context-placeholder i {
    font-size: 2.5rem;
    color: rgba(255, 255, 255, 0.15);
}

.context-active-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
}

.context-header {
    padding: 2.2rem 2rem;
    border-bottom: 1px solid var(--border-glass);
}

.contact-card-header {
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

.avatar-large {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
}

.contact-details-text h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
}

.contact-details-text span {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.context-body {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2.2rem;
}

.card-group {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.card-group h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.meta-field {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
}

.meta-field label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    font-weight: 600;
}

.meta-field span {
    font-size: 0.9rem;
    font-weight: 500;
}

.address-box {
    background: rgba(7, 9, 19, 0.6);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    padding: 0.8rem;
    font-family: monospace;
    font-size: 0.8rem !important;
    line-height: 1.4;
}


.contact-address-grid,
.document-metadata-fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.8rem 0.75rem;
    align-items: start;
}

.contact-address-grid .meta-field:nth-child(odd):last-child,
.document-metadata-fields .meta-field:nth-child(odd):last-child {
    grid-column: 1 / -1;
}

.filing-group {
    border-left: 3px solid rgba(16, 185, 129, 0.75);
    padding-left: 1rem;
}

.filing-remember-row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 700;
}

.filing-remember-row input {
    width: auto;
    accent-color: var(--accent-indigo);
}

@media (max-width: 1200px) {
    .contact-address-grid,
    .document-metadata-fields {
        grid-template-columns: 1fr;
    }
}

/* Tax toggle and project select */
.tax-toggle-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    padding: 1rem;
    border-radius: 12px;
}

.label-with-desc {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.label-with-desc strong {
    font-size: 0.85rem;
}

.label-with-desc span {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.project-assign-box {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.project-assign-box label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.project-assign-box select {
    background: rgba(7, 9, 19, 0.85);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 0.6rem 0.8rem;
    outline: none;
}

/* Switch styling */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
}

input:checked + .slider {
  background-color: var(--accent-indigo);
}

input:focus + .slider {
  box-shadow: 0 0 1px var(--accent-indigo);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

/* In-place PDF iframe */
.preview-group {
    margin-top: 1rem;
}

.pdf-iframe-wrapper {
    height: 380px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border-glass);
    background: #000;
}

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

/* --- MODAL WINDOWS --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(7, 9, 19, 0.8);
    backdrop-filter: blur(10px);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    width: 460px;
    background: var(--bg-glass-active);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 2.2rem;
    gap: 1.8rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.4rem;
    cursor: pointer;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

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

.form-group label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.form-group input, .form-group textarea {
    background: rgba(7, 9, 19, 0.6);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    padding: 0.8rem 1rem;
    color: var(--text-primary);
    outline: none;
}

.form-group textarea {
    height: 100px;
    resize: none;
}

.password-wrapper {
    position: relative;
    width: 100%;
}

.password-wrapper input {
    width: 100%;
    padding-right: 2.8rem !important;
}

.toggle-password {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--text-secondary);
    opacity: 0.6;
    transition: all 0.2s ease;
    font-size: 1.1rem;
    z-index: 5;
    padding: 4px;
}

.toggle-password:hover {
    opacity: 1;
    color: var(--accent-indigo);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    color: var(--text-primary);
    padding: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

body.light-theme .btn-secondary {
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.25);
    color: #4f46e5;
}

.btn-secondary:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.4);
}

body.light-theme .btn-secondary:hover {
    background: #4f46e5;
    color: #fff;
    border-color: #4f46e5;
}

.preset-buttons button:hover {
    background: #4f46e5 !important;
    color: #fff !important;
    border-color: #4f46e5 !important;
}

.btn-primary {
    background: var(--accent-glow);
    border: none;
    border-radius: 12px;
    color: #fff;
    padding: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    box-shadow: 0 0 15px rgba(217, 70, 239, 0.4);
}

.hidden {
    display: none !important;
}


.global-search-btn {
    width: 100%;
    height: 44px;
    margin: 0.9rem 0 1rem;
    border: 1px solid rgba(99, 102, 241, 0.28);
    border-radius: 10px;
    background: rgba(99, 102, 241, 0.10);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    font-weight: 800;
    cursor: pointer;
}

.global-search-btn:hover {
    background: var(--accent-indigo);
    color: #fff;
}

.sidebar-nav li.sub-nav a {
    grid-template-columns: 1.15rem minmax(0, 1fr);
    padding-left: 2.25rem;
    font-size: 0.82rem;
    opacity: 0.88;
}

.sidebar-nav li.sub-nav a > i {
    width: 1.15rem;
}

.smart-select-box {
    gap: 0.45rem;
}

.smart-select-search {
    margin-bottom: 0.25rem;
}

.inline-add-row,
.folder-picker-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 0.45rem;
    align-items: center;
}

.inline-add-row {
    grid-template-columns: minmax(0, 1fr) auto;
}

.icon-action-btn {
    width: 38px;
    height: 38px;
    border: 1px solid rgba(99, 102, 241, 0.22);
    border-radius: 8px;
    background: rgba(99, 102, 241, 0.08);
    color: var(--accent-indigo);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.icon-action-btn:hover {
    background: var(--accent-indigo);
    color: #fff;
}

.fs-browser-dropdown {
    margin-top: 0.45rem;
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.92);
    overflow: hidden;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.16);
}

.fs-current-path {
    padding: 0.55rem 0.65rem;
    font-size: 0.74rem;
    font-family: monospace;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-glass);
}

.fs-browser-list {
    list-style: none;
    max-height: 180px;
    overflow: auto;
}

.fs-browser-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.65rem;
    cursor: pointer;
    font-size: 0.82rem;
}

.fs-browser-item:hover {
    background: rgba(99, 102, 241, 0.08);
}

body:not(.light-theme) .fs-browser-dropdown {
    background: rgba(15, 23, 42, 0.96);
}

/* Theme Toggle Button Styles */
.theme-toggle-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--accent-indigo);
    transform: scale(1.05);
}

body.light-theme .theme-toggle-btn {
    background: rgba(99, 102, 241, 0.05);
}

/* Light theme orb adaptation */
body.light-theme .glow-orb {
    opacity: 0.25;
}

/* Form Inputs and selects adaptation for Light Theme */
body.light-theme input, 
body.light-theme select, 
body.light-theme textarea,
body.light-theme .address-box {
    background: rgba(255, 255, 255, 0.7) !important;
    color: #1e1b4b !important;
}

body.light-theme .search-input-wrapper input {
    background: rgba(255, 255, 255, 0.7);
}

body.light-theme .sidebar-nav li.active a,
body.light-theme .sidebar-nav li a:hover {
    background: rgba(99, 102, 241, 0.05);
}

body.light-theme .tax-toggle-box,
body.light-theme .user-profile-widget {
    background: rgba(99, 102, 241, 0.02);
}

/* AI Copilot & Settings Styles */
.ai-copilot-group {
    border-left: 3px solid var(--accent-indigo);
    padding-left: 1rem;
}

.ai-status-badge {
    align-self: flex-start;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.2);
    margin-bottom: 0.5rem;
}

.ai-status-badge.approved {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.form-input {
    width: 100%;
    background: rgba(7, 9, 19, 0.6);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    padding: 0.6rem 0.8rem;
    color: var(--text-primary);
    outline: none;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

.meta-field:has(.ocr-pick-btn) .form-input {
    padding-right: 2.75rem;
}

.form-input:focus {
    border-color: var(--accent-indigo);
}

.ai-recommendation-card {
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.ai-recommendation-card label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--accent-indigo);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.ai-recommendation-card p {
    font-size: 0.85rem;
    line-height: 1.4;
}


.settings-help-text {
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.45;
    margin: 0 0 0.9rem;
}

.llm-preset-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: -0.4rem;
}

.llm-preset-btn {
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 8px;
    background: rgba(99, 102, 241, 0.08);
    color: var(--accent-indigo);
    cursor: pointer;
    font-size: 0.76rem;
    font-weight: 800;
    min-height: 2rem;
    padding: 0 0.65rem;
}

.llm-preset-btn:hover {
    background: var(--accent-indigo);
    color: #fff;
}

.llm-toggle-grid {
    display: grid;
    gap: 0.45rem;
}

.llm-toggle-grid label {
    align-items: center;
    display: flex;
    gap: 0.5rem;
    font-size: 0.82rem;
    font-weight: 700;
}

/* Settings folders styling */
.settings-folder-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    font-size: 0.85rem;
}

.folder-config-head,
.folder-config-actions,
.folder-config-title,
.folder-config-controls {
    display: flex;
    align-items: center;
}

.folder-settings-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 1rem;
}

.folder-settings-head .settings-help-text {
    max-width: 54rem;
    margin: 0;
}

.settings-action-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
}

.folder-settings-actions {
    justify-content: flex-start;
    margin: 0.75rem 0;
}

.folder-settings-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    margin: 0.75rem 0 1rem;
    border-bottom: 1px solid var(--border-glass);
}

.folder-settings-tab {
    border: 0;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    padding: 0.7rem 1rem;
}

.folder-settings-tab:hover,
.folder-settings-tab.active {
    color: var(--accent-indigo);
    border-bottom-color: var(--accent-indigo);
}

.folder-settings-card-hidden,
.settings-inline-folder-form {
    display: none !important;
}

.settings-empty-note {
    color: var(--text-secondary);
    padding: 0.7rem 0;
}

.settings-folder-browser {
    border: 1px solid var(--border-glass);
    padding: 0.75rem;
    margin-top: 1rem;
    min-height: 30rem;
}

.settings-folder-details {
    border: 1px solid var(--border-glass);
    padding: 0.75rem;
}

.settings-folder-details > summary {
    color: var(--accent-indigo);
    cursor: pointer;
    font-weight: 800;
    list-style: none;
    padding: 0.35rem 0;
}

.settings-folder-details > summary::-webkit-details-marker { display: none; }

.settings-folder-details > summary::before {
    content: "▸";
    display: inline-block;
    margin-right: 0.4rem;
}

.settings-folder-details[open] > summary::before { content: "▾"; }

.settings-folder-browser-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.settings-folder-browser-head span {
    color: var(--text-secondary);
    font-family: monospace;
    flex: 1;
    min-width: 12rem;
}

.settings-folder-browser-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid var(--border-glass);
    padding: 0.45rem 0.65rem;
    flex: 1 1 16rem;
    margin-left: auto;
    max-width: 30rem;
}

.settings-folder-browser-search input {
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text-primary);
    width: 100%;
}

.settings-folder-browser-list {
    list-style: none;
    padding: 0;
    margin: 0.65rem 0 0;
    max-height: 32rem;
    overflow-y: auto;
}

.settings-folder-browser-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    border-top: 1px solid var(--border-glass);
    padding: 0.55rem 0.25rem;
}

.settings-folder-browser-hint {
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin-top: 0.55rem;
}

.settings-folder-browser-item input[type="checkbox"] {
    flex: 0 0 auto;
}

.settings-folder-browser-item .folder-browser-name {
    background: transparent;
    border: 0;
    color: var(--text-primary);
    cursor: pointer;
    flex: 1;
    font: inherit;
    min-width: 0;
    overflow: hidden;
    padding: 0;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.settings-browser-sidebar-toggle {
    color: var(--text-secondary);
    font-size: 0.72rem;
    white-space: nowrap;
}

.settings-browser-view-toggle {
    color: var(--text-secondary);
    font-size: 0.72rem;
    white-space: nowrap;
}

.settings-browser-favorite-toggle {
    border: 0 !important;
    color: var(--accent-indigo) !important;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0.15rem !important;
}

.tree-node-favorite {
    color: #eab308;
    font-size: 0.7rem;
    margin-left: 0.25rem;
}

.settings-browser-tags-inline {
    align-items: center;
    color: var(--accent-indigo);
    display: inline-flex;
    flex: 0 1 18rem;
    gap: 0.25rem;
    min-width: 8rem;
}

.settings-browser-tags-input {
    background: transparent;
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    min-width: 0;
    padding: 0.3rem 0.4rem;
    width: 100%;
}

.settings-browser-schedule {
    align-items: center;
    color: var(--text-secondary);
    display: inline-flex;
    flex: 0 0 auto;
    gap: 0.25rem;
    white-space: nowrap;
}

.settings-browser-schedule-select {
    background: transparent;
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    font: inherit;
    max-width: 10rem;
    padding: 0.3rem 0.4rem;
}

.settings-browser-select-btn {
    white-space: nowrap;
}

.settings-folder-browser-item .folder-browser-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.settings-folder-browser-item button {
    border: 1px solid var(--border-glass);
    background: transparent;
    color: var(--accent-indigo);
    cursor: pointer;
    padding: 0.3rem 0.5rem;
}

.folder-document-index-status {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.72rem;
}

.folder-document-index-status.is-indexed {
    color: #16a34a;
}

.folder-document-index-status.is-not-indexed {
    color: var(--text-secondary);
}

.folder-config-head {
    justify-content: space-between;
    gap: 0.75rem;
}

.folder-config-title {
    gap: 0.55rem;
    min-width: 0;
}

.folder-config-title i {
    color: var(--accent-indigo);
}

.folder-config-title strong,
.folder-config-title span,
.folder-path-code {
    display: block;
}

.folder-config-title span,
.folder-sync-note {
    color: var(--text-secondary);
    font-size: 0.74rem;
}

.folder-config-name-wrap {
    display: inline-flex !important;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-primary) !important;
    font-size: inherit !important;
}

.btn-rename-folder,
.folder-rename-save,
.folder-rename-cancel {
    border: 0;
    background: transparent;
    color: var(--accent-indigo);
    cursor: pointer;
    padding: 0.15rem 0.25rem;
}

.btn-rename-folder:hover,
.folder-rename-save:hover,
.folder-rename-cancel:hover {
    color: var(--text-primary);
}

.folder-rename-form {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
}

.folder-rename-input {
    width: min(22rem, 45vw);
    min-width: 10rem;
    padding: 0.25rem 0.4rem;
    border: 1px solid var(--accent-indigo);
    background: var(--bg-glass-active);
    color: var(--text-primary);
    font: inherit;
}

.folder-config-actions {
    gap: 0.45rem;
    flex-shrink: 0;
}

.btn-edit-folder-tags {
    border: 1px solid var(--border-glass);
    background: transparent;
    color: var(--accent-indigo);
    cursor: pointer;
    padding: 0.35rem 0.55rem;
}

.folder-interval-control {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.folder-interval-control select {
    border: 1px solid var(--border-glass);
    background: var(--bg-glass-active);
    color: var(--text-primary);
    padding: 0.25rem 0.4rem;
}

.folder-custom-interval {
    border: 1px solid var(--border-glass);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 0.25rem 0.4rem;
    width: 5.5rem;
}

.folder-status-pill {
    border: 1px solid var(--border-glass);
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    white-space: nowrap;
}

.folder-status-pill.is-syncing {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.35);
    color: #059669;
}

.folder-status-pill.is-indexed {
    background: rgba(99, 102, 241, 0.12);
    border-color: rgba(99, 102, 241, 0.35);
    color: var(--accent-indigo);
}

.folder-status-pill.is-disabled {
    background: rgba(148, 163, 184, 0.12);
    color: var(--text-secondary);
}

.folder-path-code {
    background: rgba(15, 23, 42, 0.04);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.74rem;
    overflow: hidden;
    padding: 0.42rem 0.5rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.folder-path-editor { align-items: center; display: flex; gap: 0.5rem; margin: 0.55rem 0; }
.folder-path-input { background: rgba(15, 23, 42, 0.04); border: 1px solid var(--border-glass); border-radius: 8px; color: var(--text-secondary); flex: 1; font: 0.74rem/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; min-width: 0; padding: 0.55rem 0.65rem; }
.folder-path-input:focus { border-color: var(--accent-indigo); color: var(--text-primary); outline: 2px solid var(--accent-glow); outline-offset: 1px; }
.folder-path-browse { background: var(--accent-glow); border: 1px solid var(--accent-indigo); border-radius: 8px; color: #fff; cursor: pointer; font-size: 0.74rem; font-weight: 600; padding: 0.55rem 0.75rem; white-space: nowrap; }
.folder-path-browse:hover { filter: brightness(1.08); }
@media (max-width: 700px) { .folder-path-editor { align-items: stretch; flex-direction: column; } }

.folder-config-controls {
    flex-wrap: wrap;
    gap: 0.8rem;
}

.folder-config-controls label {
    align-items: center;
    color: var(--text-primary);
    display: inline-flex;
    font-size: 0.78rem;
    font-weight: 700;
    gap: 0.35rem;
}

.folder-tags-row {
    display: grid;
    gap: 0.3rem;
}

.folder-tags-row span {
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.folder-tags-input {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.82rem;
    min-width: 0;
    padding: 0.55rem 0.65rem;
    width: 100%;
}

body:not(.light-theme) .folder-tags-input,
body:not(.light-theme) .folder-path-code {
    background: rgba(15, 23, 42, 0.55);
}



.folder-config-card.is-syncing-now {
    border-color: rgba(99, 102, 241, 0.36);
    box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.12), 0 10px 24px rgba(99, 102, 241, 0.08);
}

.folder-status-pill.is-live-sync {
    background: rgba(99, 102, 241, 0.11);
    border-color: rgba(99, 102, 241, 0.28);
    color: var(--accent-indigo);
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
}

.btn-sync-folder-now {
    border: 1px solid rgba(99, 102, 241, 0.18);
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.08);
    color: var(--accent-indigo);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    height: 1.45rem;
    padding: 0 0.48rem;
    font-size: 0.66rem;
    font-weight: 850;
    white-space: nowrap;
}

.btn-sync-folder-now:hover:not(:disabled) {
    background: var(--accent-indigo);
    border-color: var(--accent-indigo);
    color: #fff;
}

.btn-sync-folder-now:disabled {
    cursor: progress;
    opacity: 0.7;
}

.btn-delete-folder {
    background: transparent;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 0.95rem;
    padding: 0.2rem;
    transition: color 0.3s ease;
}

.btn-delete-folder:hover {
    color: #f87171;
}

body.light-theme .settings-folder-item {
    background: rgba(99, 102, 241, 0.02);
}

/* --- AUTHENTICATION & IAM STYLES --- */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(7, 9, 19, 0.85);
    backdrop-filter: blur(25px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s ease;
}

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

.auth-box {
    width: 420px;
    background: rgba(13, 17, 39, 0.65);
    border: 1px solid var(--border-glass);
    border-radius: 28px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
    overflow: hidden;
}

.auth-header {
    text-align: center;
}

.logo-wrapper-large {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.brand-orb-large {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--accent-indigo);
    box-shadow: 0 10px 24px rgba(99, 102, 241, 0.24);
    display: grid;
    place-items: center;
    opacity: 1;
    position: static;
}

.brand-orb-large::before {
    color: #fff;
    content: "C";
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    font-weight: 800;
}

.logo-wrapper-large h2 {
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1.05;
}

.auth-subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 0.3rem;
}

.auth-tab-btn {
    background: transparent;
    border: none;
    border-radius: 9px;
    color: var(--text-secondary);
    padding: 0.6rem;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.auth-tab-btn.active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

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

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

.auth-submit-btn {
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

body.light-theme .auth-box {
    background: rgba(255, 255, 255, 0.8) !important;
}

body.light-theme .auth-overlay {
    background: rgba(243, 244, 246, 0.85) !important;
}

body.light-theme .auth-tab-btn.active {
    background: rgba(99, 102, 241, 0.1) !important;
    color: var(--accent-indigo) !important;
}

body.light-theme .auth-subtitle {
    color: #475569;
}

body:has(.auth-overlay.active) .glow-orb {
    opacity: 0.12;
}

/* Tree View and Collapsible Folders/Tags styling */
.tree-view {
    list-style: none;
    padding-left: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.tree-node {
    display: flex;
    flex-direction: column;
    padding-left: 0.8rem;
}

.tree-node-header {
    display: flex;
    align-items: center;
    padding: 0.4rem 0.6rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: all 0.2s;
    user-select: none;
}

.tree-node-header:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.tree-node-header.active {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-indigo);
    font-weight: 500;
}

.tree-toggle-icon {
    width: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.4rem;
    transition: transform 0.2s;
}

.tree-toggle-icon.expanded {
    transform: rotate(90deg);
}

.tree-node-children {
    display: none;
    flex-direction: column;
    gap: 0.2rem;
    border-left: 1px dashed var(--border-glass);
    margin-left: 0.5rem;
    padding-left: 0.5rem;
}

.tree-node-children.expanded {
    display: flex;
}

/* Interactive User Profile & Phone Upload Enhancements */
.active-profile-header {
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.active-profile-header:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(99, 102, 241, 0.35) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.08);
}

body.light-theme .active-profile-header:hover {
    background: rgba(99, 102, 241, 0.06) !important;
    border-color: rgba(99, 102, 241, 0.25) !important;
}

.active-profile-header:active {
    transform: translateY(0);
}

#logoutBtn {
    transition: all 0.2s ease;
}

#logoutBtn:hover {
    color: #ef4444 !important;
    transform: scale(1.1);
}

.mobile-upload-dropzone:hover {
    background: rgba(34, 197, 94, 0.08) !important;
    border-color: rgba(34, 197, 94, 0.5) !important;
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.05);
}

/* --- VIEW CONTROLS TOOLBAR & VIEW STYLES --- */
.feed-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 0.6rem 1.2rem;
    margin-bottom: 1.2rem;
    gap: 1rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.01);
}

.feed-filter-button {
    align-items: center;
    background: transparent;
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    cursor: pointer;
    display: inline-flex;
    gap: 0.35rem;
    margin-left: auto;
    padding: 0.45rem 0.7rem;
}

.feed-filter-button:hover,
.feed-filter-button[aria-expanded="true"] {
    border-color: var(--accent-indigo);
    color: var(--accent-indigo);
}

.content-filter-panel {
    align-items: end;
    background: var(--bg-glass);
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.7rem 0 0.8rem;
}

.content-filter-panel[hidden] { display: none; }
.content-filter-panel label {
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    font-size: 0.7rem;
    gap: 0.3rem;
    min-width: 125px;
}
.content-filter-panel input,
.content-filter-panel select,
.content-filter-panel button {
    border-radius: 3px !important;
    box-sizing: border-box;
    min-height: 32px;
}
.content-filter-panel input {
    background: var(--bg-primary);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    min-width: 125px;
    padding: 0.4rem 0.55rem;
}
.content-filter-panel input:focus {
    border-color: var(--accent-indigo);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.12);
    outline: none;
}
.content-filter-panel .content-filter-tags { flex: 1 1 190px; }
.content-filter-actions { align-items: end; display: flex; gap: 0.45rem; }
.content-filter-actions .timeline-tool-btn { min-height: 32px; padding: 0.4rem 0.7rem; }

.feed-control-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.feed-control-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Segmented Buttons */
.segmented-control {
    display: flex;
    padding: 2px;
    border-radius: 8px;
    border: 1px solid var(--border-glass);
    background: rgba(99, 102, 241, 0.04);
}

body.light-theme .segmented-control {
    background: rgba(99, 102, 241, 0.05);
}

.segmented-btn {
    background: transparent;
    border: none;
    outline: none;
    padding: 0.4rem 0.8rem;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.segmented-btn:hover {
    color: var(--text-primary);
}

.segmented-btn.active {
    background: var(--accent-indigo);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

/* Premium Select Dropdown */
.premium-select {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 8px;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.premium-select:focus {
    border-color: var(--accent-indigo);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

/* Sizing Variables & Classes */
.card-thumbnail-wrapper.size-s { width: 70px !important; height: 91px !important; }
.card-thumbnail-wrapper.size-m { width: 130px !important; height: 169px !important; }
.card-thumbnail-wrapper.size-l { width: 190px !important; height: 247px !important; }
.card-thumbnail-wrapper.size-xl { width: 250px !important; height: 325px !important; }

/* Pulse skeleton animation */
.card-thumbnail-wrapper {
    position: relative;
    background: rgba(99,102,241,0.06);
    animation: skeleton-pulse 1.6s infinite;
}

@keyframes skeleton-pulse {
    0%, 100% { opacity: 0.65; }
    50% { opacity: 1; }
}

.card-thumbnail-fallback {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--accent-indigo);
    opacity: 0.3;
    z-index: 1;
}

.card-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.35s ease;
}

.card-thumbnail.loaded {
    opacity: 1;
}

/* Grid View Layout & Sizing overrides */
.timeline-feed.grid-view {
    --gallery-gap: 1rem;
    --gallery-columns: 3;
    display: grid;
    grid-template-columns: repeat(var(--gallery-columns), minmax(0, 1fr));
    gap: var(--gallery-gap);
    grid-auto-flow: row;
    align-content: start;
    align-items: start;
    padding: 0.1rem 0.5rem 1.5rem 0;
}

.timeline-feed.grid-view .timeline-card.paperless-card {
    display: flex;
    flex-direction: column;
    gap: 0.38rem;
    align-items: stretch;
    width: 100%;
    min-width: 0;
    max-width: none;
    justify-self: stretch;
    height: auto;
    padding: 0;
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
    transform: none;
    z-index: 1;
}

.timeline-feed.grid-view .timeline-card.paperless-card:hover {
    background: transparent;
    transform: none;
    box-shadow: none;
    z-index: 30;
}

.timeline-feed.grid-view > .timeline-card.paperless-card {
    box-sizing: border-box;
}

.timeline-feed.grid-view .paperless-thumb {
    position: relative;
    width: 100%;
    height: auto;
    flex: 0 0 auto;
    min-height: 0;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.14);
    border-radius: 5px;
    overflow: hidden;
    contain: layout paint;
    isolation: isolate;
    animation: skeleton-pulse 1.6s infinite;
    background-image: none;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.14);
    transform-origin: top center;
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.timeline-feed.grid-view .paperless-thumb::before {
    content: "";
    display: block;
    padding-top: 138.8889%;
}

.timeline-feed.grid-view .paperless-thumb .card-thumbnail {
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #ffffff;
}

.timeline-feed.grid-view .timeline-card.paperless-card:hover .paperless-thumb {
    transform: scale(1.45);
    border-color: rgba(99, 102, 241, 0.32);
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.26);
}

.paperless-hover-meta {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 4;
    display: grid;
    gap: 0.24rem;
    padding: 0.55rem;
    color: #0f172a;
    font-size: 0.66rem;
    line-height: 1.25;
    background: rgba(255, 255, 255, 0.94);
    border-top: 1px solid rgba(15, 23, 42, 0.12);
    opacity: 0;
    transform: translateY(0.35rem);
    transition: opacity 0.12s ease, transform 0.12s ease;
    pointer-events: none;
}

.timeline-feed.grid-view .timeline-card.paperless-card:hover .paperless-hover-meta {
    opacity: 1;
    transform: translateY(0);
}

.paperless-hover-meta > div:not(.paperless-hover-badges) {
    display: grid;
    grid-template-columns: 0.8rem minmax(0, 1fr);
    align-items: center;
    gap: 0.3rem;
    min-width: 0;
}

.paperless-hover-meta span,
.paperless-hover-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.paperless-hover-title {
    display: block !important;
    grid-template-columns: none !important;
    font-weight: 800;
}

.paperless-hover-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.paperless-hover-badges .badge-tag,
.paperless-hover-badges .badge-project {
    font-size: 0.6rem;
    padding: 0.08rem 0.3rem;
    border-radius: 4px;
}

.timeline-feed.grid-view .paperless-thumb-empty {
    color: rgba(22, 101, 52, 0.4);
    font-size: 2.4rem;
}

.timeline-feed.grid-view .paperless-thumb-empty > i {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.paperless-title-row {
    min-height: 1.2rem;
    padding: 0 0.15rem;
    border-bottom: 0;
    display: block;
    background: transparent;
}

.paperless-title {
    display: block;
    color: #334155;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.25;
    overflow: hidden;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.paperless-correspondent,
.paperless-date-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.42rem 0.55rem;
    color: #374151;
    font-size: 0.76rem;
    min-width: 0;
}

.paperless-correspondent {
    padding-bottom: 0.15rem;
}

.paperless-correspondent span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.paperless-date-row {
    border-bottom: 1px solid rgba(15, 23, 42, 0.1);
    color: #4b5563;
}

.paperless-badges {
    min-height: 2.15rem;
    padding: 0.45rem 0.55rem 0.2rem;
    display: flex;
    align-items: flex-start;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.paperless-badges:empty {
    display: none;
}

.paperless-badges .badge-tag,
.paperless-badges .badge-project {
    font-size: 0.64rem;
    padding: 0.12rem 0.35rem;
    border-radius: 4px;
}

.paperless-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-top: 1px solid rgba(15, 23, 42, 0.16);
    margin-top: auto;
}

.paperless-action-btn {
    height: 2rem;
    border: 0;
    border-right: 1px solid rgba(15, 23, 42, 0.16);
    background: #f9fafb;
    color: #4b5563;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.78rem;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.paperless-action-btn:last-child {
    border-right: 0;
}

.paperless-action-btn:hover {
    background: #edf7ed;
    color: #166534;
}

.paperless-action-btn:disabled {
    cursor: not-allowed;
    color: #cbd5e1;
    background: #f8fafc;
}

.timeline-feed.grid-view .paperless-correspondent,
.timeline-feed.grid-view .paperless-date-row,
.timeline-feed.grid-view .paperless-badges,
.timeline-feed.grid-view .paperless-actions {
    display: none;
}

body:not(.light-theme) .timeline-feed.grid-view .timeline-card.paperless-card {
    background: transparent;
    border-color: transparent;
}

body:not(.light-theme) .timeline-feed.grid-view .paperless-thumb {
    background-color: #0f172a;
    border-color: rgba(148, 163, 184, 0.24);
}

body:not(.light-theme) .paperless-hover-meta {
    background: rgba(15, 23, 42, 0.94);
    border-top-color: rgba(148, 163, 184, 0.18);
    color: var(--text-primary);
}

body:not(.light-theme) .paperless-title {
    color: var(--text-primary);
}

body:not(.light-theme) .paperless-title-row,
body:not(.light-theme) .paperless-date-row,
body:not(.light-theme) .paperless-actions {
    border-color: rgba(148, 163, 184, 0.18);
}

body:not(.light-theme) .paperless-correspondent,
body:not(.light-theme) .paperless-date-row {
    color: var(--text-secondary);
}

body:not(.light-theme) .paperless-action-btn {
    background: rgba(15, 23, 42, 0.96);
    border-color: rgba(148, 163, 184, 0.18);
    color: var(--text-secondary);
}

body:not(.light-theme) .paperless-action-btn:hover {
    background: rgba(34, 197, 94, 0.12);
    color: #86efac;
}

/* Full Preview View Layout */
.timeline-feed.preview-view {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.timeline-feed.preview-view .timeline-card {
    flex-direction: column;
    align-items: stretch;
    gap: 1.2rem;
    padding: 1.6rem;
}

.timeline-feed.preview-view .full-preview-container {
    width: 100%;
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    overflow-y: auto;
    max-height: 700px;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.02);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem;
    gap: 1.5rem;
}

.timeline-feed.preview-view .full-preview-page {
    width: 100%;
    max-width: 800px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.05);
}

/* Fullscreen Document Preview Modal */
.fullscreen-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.95);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    color: #ffffff;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.fullscreen-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.fullscreen-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#fullscreenModalTitle {
    font-size: 1.1rem;
    font-weight: 600;
    color: #f1f5f9;
}

.close-modal-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: none;
    outline: none;
    padding: 0.5rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.close-modal-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.fullscreen-modal-body {
    flex-grow: 1;
    padding: 1rem;
    display: flex;
    justify-content: center;
    align-items: stretch;
    background: #0f172a;
}

#fullscreenIframe {
    width: 100%;
    max-width: 1400px;
    height: 100%;
    border: none;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    background: #ffffff;
}






/* --- IN-APP FEEDBACK --- */
.app-notification-stack {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: min(420px, calc(100vw - 2rem));
    pointer-events: none;
}

.app-notification {
    pointer-events: auto;
    display: grid;
    grid-template-columns: 2rem 1fr auto;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border-radius: 12px;
    background: rgba(13, 17, 39, 0.94);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    transform: translateX(12px);
    opacity: 0;
    animation: notification-in 0.18s ease forwards;
}

.app-notification.closing {
    animation: notification-out 0.16s ease forwards;
}

.app-notification-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(99, 102, 241, 0.14);
    color: var(--accent-indigo);
}

.app-notification-copy {
    min-width: 0;
}

.app-notification-title {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.app-notification-message {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.86rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.app-notification-close {
    width: 1.8rem;
    height: 1.8rem;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-notification-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.app-notification.success .app-notification-icon {
    background: rgba(16, 185, 129, 0.14);
    color: var(--success-color);
}

.app-notification.error .app-notification-icon {
    background: rgba(239, 68, 68, 0.14);
    color: #ef4444;
}

.app-notification.warning .app-notification-icon {
    background: rgba(245, 158, 11, 0.16);
    color: #f59e0b;
}

body.light-theme .app-notification {
    background: rgba(255, 255, 255, 0.96);
    border-color: rgba(15, 23, 42, 0.09);
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.16);
}

.app-confirm-modal {
    position: fixed;
    inset: 0;
    z-index: 3100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(7, 9, 19, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.app-confirm-modal.active {
    display: flex;
}

.app-confirm-card {
    width: min(420px, 100%);
    border-radius: 16px;
    padding: 1.4rem;
    display: grid;
    grid-template-columns: 2.6rem 1fr;
    gap: 1rem;
    background: rgba(13, 17, 39, 0.94);
    border: 1px solid var(--border-glass);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.32);
}

.app-confirm-icon {
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(245, 158, 11, 0.16);
    color: #f59e0b;
}

.app-confirm-copy h2 {
    margin: 0 0 0.35rem;
    font-size: 1rem;
    font-weight: 800;
}

.app-confirm-copy p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.4;
}

.app-confirm-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 0.7rem;
    margin-top: 0.4rem;
}

.app-confirm-actions button {
    min-width: 120px;
}

body.light-theme .app-confirm-card {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(15, 23, 42, 0.09);
}

@keyframes notification-in {
    to { transform: translateX(0); opacity: 1; }
}

@keyframes notification-out {
    to { transform: translateX(12px); opacity: 0; }
}


/* --- OCR FIELD SELECTION --- */
.ocr-label-row {
    display: block;
    min-width: 0;
}

.ocr-label-row label {
    display: block;
    padding-right: 0;
}

.ocr-pick-btn {
    position: absolute;
    right: 0.42rem;
    bottom: 0.42rem;
    z-index: 2;
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 8px;
    border: 1px solid rgba(99, 102, 241, 0.2);
    background: rgba(99, 102, 241, 0.07);
    color: var(--accent-indigo);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
    flex-shrink: 0;
}

.ocr-pick-btn:hover,
.ocr-pick-btn.active {
    background: var(--accent-indigo);
    color: #fff;
    border-color: var(--accent-indigo);
}

.ocr-workbench {
    height: auto;
    min-height: 430px;
    background: rgba(15, 23, 42, 0.04);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ocr-preview-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.55rem 0.65rem;
    border-bottom: 1px solid var(--border-glass);
    background: rgba(255, 255, 255, 0.72);
}

.ocr-selection-status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ocr-workbench.selecting .ocr-selection-status {
    color: var(--accent-indigo);
}

.ocr-page-select {
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-primary);
    padding: 0.35rem 0.5rem;
    font-size: 0.75rem;
    outline: none;
}

.ocr-page-viewport {
    max-height: 560px;
    overflow: auto;
    padding: 0.75rem;
    display: flex;
    justify-content: center;
    background: #e5e7eb;
}

.ocr-page-shell {
    position: relative;
    display: inline-block;
    width: min(100%, 860px);
    min-height: 260px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.12);
}

.ocr-preview-image {
    display: block;
    width: 100%;
    height: auto;
    user-select: none;
    -webkit-user-drag: none;
}

.ocr-selection-layer {
    position: absolute;
    inset: 0;
    cursor: crosshair;
    touch-action: none;
}

.ocr-selection-box {
    position: absolute;
    display: none;
    border: 2px solid #22c55e;
    background: rgba(34, 197, 94, 0.14);
    box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.12);
    pointer-events: none;
}

.ocr-workbench.busy .ocr-selection-layer {
    cursor: progress;
}

body:not(.light-theme) .ocr-preview-toolbar {
    background: rgba(15, 23, 42, 0.92);
}

body:not(.light-theme) .ocr-page-viewport {
    background: #111827;
}

body:not(.light-theme) .ocr-page-select {
    background: rgba(15, 23, 42, 0.9);
}



.preview-group.hidden-while-document-open {
    display: none !important;
}

/* --- CENTER DOCUMENT READER --- */
.feed-header.document-open {
    align-items: flex-start;
}

.timeline-document-viewer {
    flex: 1;
    min-height: 560px;
    height: calc(100vh - 150px);
    max-height: calc(100vh - 150px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.06);
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.10);
}

.timeline-document-header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-glass);
    background: rgba(255, 255, 255, 0.82);
}

.timeline-document-back,
.timeline-document-download,
.timeline-icon-btn {
    border: 1px solid rgba(99, 102, 241, 0.22);
    border-radius: 9px;
    background: rgba(99, 102, 241, 0.08);
    color: var(--accent-indigo);
    height: 2.25rem;
    padding: 0 0.8rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    cursor: pointer;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.8rem;
    white-space: nowrap;
}

.timeline-document-back:hover,
.timeline-document-download:hover,
.timeline-icon-btn:hover {
    background: var(--accent-indigo);
    color: #fff;
}

.timeline-document-download.danger {
    border-color: rgba(239, 68, 68, 0.25);
    background: rgba(239, 68, 68, 0.08);
    color: #dc2626;
}

.timeline-document-download.danger:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
}


.timeline-document-actions,
.timeline-title-edit-row,
.timeline-view-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.timeline-view-controls {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.timeline-mini-tool.active {
    background: var(--accent-indigo);
    border-color: var(--accent-indigo);
    color: #fff;
}

.timeline-page-rotate .page-rotate-icon {
    position: relative;
    width: 1.15rem;
    height: 1.15rem;
    display: inline-block;
}

.timeline-page-rotate .page-rotate-icon .fa-file {
    position: absolute;
    left: 0.12rem;
    top: 0.04rem;
    font-size: 0.9rem;
    opacity: 0.72;
}

.timeline-page-rotate .page-rotate-icon .fa-arrow-rotate-left,
.timeline-page-rotate .page-rotate-icon .fa-arrow-rotate-right {
    position: absolute;
    right: -0.05rem;
    bottom: -0.02rem;
    font-size: 0.62rem;
}

.timeline-zoom-actual {
    font-size: 0.62rem;
    font-weight: 900;
    letter-spacing: 0;
}

.timeline-document-actions {
    justify-content: flex-end;
}

.timeline-title-edit-row h2 {
    flex: 0 1 auto;
}

.timeline-icon-btn {
    width: 2.25rem;
    padding: 0;
}

.timeline-title-input {
    width: min(100%, 420px);
    border: 1px solid rgba(99, 102, 241, 0.35);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--text-primary);
    padding: 0.45rem 0.6rem;
    font-weight: 800;
    font-size: 1rem;
    outline: none;
}

.print-frame {
    position: fixed;
    right: 0;
    bottom: 0;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.timeline-document-title-wrap {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.timeline-document-label {
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    font-weight: 800;
}

.timeline-document-title-wrap h2 {
    margin: 0;
    font-size: 1rem;
    color: var(--text-primary);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    cursor: text;
}

.timeline-document-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--border-glass);
    background: rgba(255, 255, 255, 0.70);
}

.timeline-tool-cluster,
.timeline-pdf-tools {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
    flex-wrap: wrap;
}

.timeline-tool-btn,
.timeline-mini-tool {
    border: 1px solid rgba(99, 102, 241, 0.18);
    border-radius: 8px;
    background: rgba(99, 102, 241, 0.06);
    color: var(--text-secondary);
    min-height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    cursor: pointer;
    font-size: 0.76rem;
    font-weight: 800;
    white-space: nowrap;
}

.timeline-tool-btn {
    padding: 0 0.65rem;
}

.timeline-mini-tool {
    width: 2rem;
    padding: 0;
}

.timeline-tool-btn:hover,
.timeline-tool-btn.active,
.timeline-mini-tool:hover {
    background: var(--accent-indigo);
    border-color: var(--accent-indigo);
    color: #fff;
}

.timeline-mini-tool.danger:hover {
    background: #ef4444;
    border-color: #ef4444;
}

.paperless-action-btn.danger {
    color: #dc2626;
}

.paperless-action-btn.danger:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
}

.timeline-tool-btn.busy {
    cursor: progress;
    opacity: 0.75;
}

.timeline-selection-status {
    color: var(--text-secondary);
}

.timeline-document-viewer.selecting .timeline-selection-status {
    color: #fff;
}

.timeline-document-page-viewport {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 1.2rem;
    background: #dfe3ea;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 1.2rem;
}

.timeline-document-page-viewport.continuous,
.timeline-document-page-viewport.fit-width {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

.timeline-document-page-viewport.fit-height,
.timeline-document-page-viewport.one-page {
    overflow: hidden;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.timeline-document-page-viewport.actual-size {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

.timeline-document-page-viewport.two-pages {
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
}

.timeline-document-page-shell {
    position: relative;
    width: min(100%, 1180px);
    background: #fff;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
    flex: 0 0 auto;
}

.timeline-document-page-viewport.fit-height .timeline-document-page-shell,
.timeline-document-page-viewport.one-page .timeline-document-page-shell {
    width: auto;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
}

.timeline-document-page-viewport.fit-height .timeline-document-image,
.timeline-document-page-viewport.one-page .timeline-document-image {
    width: auto;
    max-width: 100%;
    height: 100%;
    object-fit: contain;
}

.timeline-document-page-viewport.two-pages .timeline-document-page-shell {
    width: min(48%, 760px);
}

.timeline-document-page-viewport.continuous .timeline-document-page-shell,
.timeline-document-page-viewport.fit-width .timeline-document-page-shell {
    width: min(100%, 1180px);
}

.timeline-document-page-viewport.actual-size .timeline-document-page-shell {
    width: auto;
    max-width: none;
}

.timeline-document-page-viewport.actual-size .timeline-document-image {
    width: auto;
    max-width: none;
}

.timeline-document-image {
    display: block;
    width: 100%;
    height: auto;
    user-select: none;
    -webkit-user-drag: none;
}

.timeline-text-layer {
    position: absolute;
    inset: 0;
    z-index: 2;
    user-select: text;
    pointer-events: auto;
    overflow: hidden;
}

.timeline-text-layer span {
    position: absolute;
    display: inline-block;
    color: rgba(15, 23, 42, 0.01);
    white-space: pre;
    line-height: 1;
    user-select: text;
}

.timeline-text-layer span::selection {
    color: #0f172a;
    background: rgba(99, 102, 241, 0.32);
}

.timeline-selection-layer {
    position: absolute;
    inset: 0;
    z-index: 3;
    cursor: crosshair;
    touch-action: none;
}

.timeline-document-viewer.text-mode .timeline-selection-layer {
    pointer-events: none;
}

.timeline-document-viewer.field-mode .timeline-text-layer {
    pointer-events: none;
    user-select: none;
}

.timeline-selection-layer:focus {
    outline: 2px solid rgba(99, 102, 241, 0.45);
    outline-offset: -2px;
}

.timeline-selection-box {
    position: absolute;
    display: none;
    border: 2px solid #22c55e;
    background: rgba(34, 197, 94, 0.14);
    box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.10);
    pointer-events: none;
}

.timeline-document-viewer.busy .timeline-selection-layer {
    cursor: progress;
}

.timeline-extracted-text-panel {
    border-bottom: 1px solid var(--border-glass);
    background: rgba(255, 255, 255, 0.78);
    padding: 0.7rem 0.85rem;
}

.timeline-extracted-text-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-size: 0.82rem;
}

.timeline-extracted-text-header > div {
    display: flex;
    gap: 0.4rem;
}

.timeline-extracted-textarea {
    width: 100%;
    min-height: 8rem;
    max-height: 16rem;
    resize: vertical;
    border: 1px solid rgba(99, 102, 241, 0.16);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--text-primary);
    padding: 0.7rem;
    font: 0.82rem/1.45 monospace;
    outline: none;
}

.ocr-target-menu {
    position: fixed;
    z-index: 10000;
    width: min(420px, calc(100vw - 24px));
    max-height: min(620px, calc(100vh - 24px));
    overflow: auto;
    padding: 0.75rem;
    border: 1px solid rgba(99, 102, 241, 0.24);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 22px 60px rgba(15, 23, 42, 0.24);
}

.ocr-target-menu-title {
    color: var(--text-primary);
    font-size: 0.88rem;
    font-weight: 850;
    margin-bottom: 0.65rem;
}

.ocr-target-menu-group + .ocr-target-menu-group {
    margin-top: 0.7rem;
    padding-top: 0.7rem;
    border-top: 1px solid rgba(99, 102, 241, 0.12);
}

.ocr-target-menu-group-title {
    color: var(--text-secondary);
    font-size: 0.68rem;
    font-weight: 850;
    text-transform: uppercase;
    margin-bottom: 0.45rem;
}

.ocr-target-menu-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.4rem;
}

.ocr-target-menu-option {
    min-height: 2rem;
    border: 1px solid rgba(99, 102, 241, 0.18);
    border-radius: 8px;
    background: rgba(99, 102, 241, 0.06);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 750;
    text-align: left;
    padding: 0.35rem 0.55rem;
}

.ocr-target-menu-option:hover {
    background: var(--accent-indigo);
    color: #fff;
}


.settings-action-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
    margin-top: 0.4rem;
}

#stirlingStatus.success { color: #16a34a; font-weight: 800; }
#stirlingStatus.error { color: #dc2626; font-weight: 800; }
#stirlingStatus.warning { color: #d97706; font-weight: 800; }
#stirlingStatus.info { color: var(--text-secondary); }

/* --- DETAILED PDF VIEW TOOLBAR --- */
.detail-view-header {
    grid-template-columns: minmax(0, 1fr) auto;
}

.detail-toolbar-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.32rem;
    min-width: 0;
    flex-wrap: wrap;
}

.detail-nav-tools {
    justify-content: center;
    padding: 0.52rem 0.75rem;
}

.detail-page-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.46rem;
    min-width: 0;
    flex-wrap: wrap;
}

.detail-page-input {
    width: 3.35rem;
    height: 2.25rem;
    border: 1px solid rgba(99, 102, 241, 0.28);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--text-primary);
    text-align: center;
    font-weight: 850;
    font-size: 0.95rem;
    outline: none;
}

.detail-page-total,
.detail-zoom-percent,
.detail-zoom-icon {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 800;
}

.detail-zoom-slider {
    width: clamp(90px, 14vw, 180px);
    accent-color: var(--accent-indigo);
}

.detail-secondary-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.42rem 0.75rem;
    border-bottom: 1px solid var(--border-glass);
    background: rgba(255, 255, 255, 0.64);
}

.detail-hidden-select {
    display: none !important;
}

.detail-view-body {
    flex: 1;
    min-height: 0;
    display: flex;
    overflow: hidden;
}

.detail-page-sidebar {
    width: 132px;
    flex: 0 0 132px;
    overflow: auto;
    padding: 0.65rem 0.55rem;
    border-right: 1px solid var(--border-glass);
    background: rgba(248, 250, 252, 0.96);
}

.detail-page-thumb {
    width: 100%;
    border: 1px solid rgba(99, 102, 241, 0.16);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--text-secondary);
    padding: 0.35rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.28rem;
    align-items: center;
    font-size: 0.72rem;
    font-weight: 850;
    margin-bottom: 0.55rem;
}

.detail-page-thumb img {
    width: 88px;
    max-height: 124px;
    object-fit: contain;
    background: #fff;
    box-shadow: 0 5px 12px rgba(15, 23, 42, 0.14);
}

.detail-page-thumb.active {
    border-color: var(--accent-indigo);
    color: var(--accent-indigo);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.16);
}

.detail-view-body .timeline-document-page-viewport {
    flex: 1;
    --detail-zoom: 1;
}

.timeline-document-page-viewport.continuous .timeline-document-page-shell,
.timeline-document-page-viewport.fit-width .timeline-document-page-shell {
    width: min(calc(100% * var(--detail-zoom, 1)), calc(1180px * var(--detail-zoom, 1)));
}

.timeline-document-page-viewport.two-pages .timeline-document-page-shell {
    width: min(calc(48% * var(--detail-zoom, 1)), calc(760px * var(--detail-zoom, 1)));
}

.timeline-document-page-viewport.pan-mode {
    cursor: grab;
}

.timeline-document-page-viewport.pan-mode .timeline-text-layer,
.timeline-document-page-viewport.pan-mode .timeline-selection-layer {
    pointer-events: none;
}

.timeline-mini-tool:disabled {
    opacity: 0.42;
    cursor: not-allowed;
}

.timeline-mini-tool:disabled:hover {
    background: rgba(99, 102, 241, 0.06);
    border-color: rgba(99, 102, 241, 0.18);
    color: var(--text-secondary);
}

.timeline-tool-btn.danger {
    color: #dc2626;
    border-color: rgba(239, 68, 68, 0.22);
    background: rgba(239, 68, 68, 0.06);
}

.timeline-tool-btn.danger:hover {
    color: #fff;
    border-color: #dc2626;
    background: #dc2626;
}

body:not(.light-theme) .detail-secondary-tools,
body:not(.light-theme) .detail-page-sidebar {
    background: rgba(15, 23, 42, 0.92);
}

@media (max-width: 1180px) {
    .detail-toolbar-right {
        justify-content: flex-start;
    }
    .detail-secondary-tools {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 760px) {
    .detail-view-header {
        grid-template-columns: 1fr;
    }
    .detail-page-sidebar {
        display: none;
    }
}

body:not(.light-theme) .timeline-document-viewer {
    background: rgba(15, 23, 42, 0.82);
}

body:not(.light-theme) .timeline-document-header,
body:not(.light-theme) .timeline-document-tools {
    background: rgba(15, 23, 42, 0.94);
}

body:not(.light-theme) .timeline-document-page-viewport {
    background: #111827;
}

@media (max-width: 980px) {
    .timeline-document-header {
        grid-template-columns: 1fr auto;
    }
    
.timeline-document-actions,
.timeline-title-edit-row,
.timeline-view-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.timeline-document-actions {
    justify-content: flex-end;
}

.timeline-title-edit-row h2 {
    flex: 0 1 auto;
}

.timeline-icon-btn {
    width: 2.25rem;
    padding: 0;
}

.timeline-title-input {
    width: min(100%, 420px);
    border: 1px solid rgba(99, 102, 241, 0.35);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--text-primary);
    padding: 0.45rem 0.6rem;
    font-weight: 800;
    font-size: 1rem;
    outline: none;
}

.print-frame {
    position: fixed;
    right: 0;
    bottom: 0;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.timeline-document-title-wrap {
        grid-column: 1 / -1;
        grid-row: 1;
    }
    .timeline-document-actions {
        grid-row: 2;
        justify-content: flex-end;
    }
    .timeline-document-back,
    .timeline-document-download {
        grid-row: 2;
    }
    .timeline-document-tools {
        flex-direction: column;
        align-items: stretch;
    }
    .timeline-view-controls {
        justify-content: space-between;
    }
}

/* --- ADDRESS BOOK LOCAL DATABASE --- */
.addressbook-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    flex-wrap: wrap;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    background: var(--bg-glass);
}

.addressbook-toolbar-actions {
    display: flex;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.addressbook-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.9rem;
}

.addressbook-card {
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 1rem;
    background: var(--bg-glass);
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    cursor: pointer;
}

.addressbook-card:hover {
    border-color: rgba(99, 102, 241, 0.28);
    background: var(--bg-glass-active);
}

.addressbook-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.addressbook-card-avatar {
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid rgba(99, 102, 241, 0.18);
    background: rgba(99, 102, 241, 0.08);
}

.addressbook-card-name {
    min-width: 0;
    flex: 1;
}

.addressbook-card-name strong,
.addressbook-card-line {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.addressbook-card-name strong {
    display: block;
    color: var(--text-primary);
    font-size: 0.92rem;
}

.addressbook-card-name span,
.addressbook-card-line {
    color: var(--text-secondary);
    font-size: 0.78rem;
}

.addressbook-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.addressbook-form {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.65rem;
    padding: 1rem;
    border: 1px solid rgba(99, 102, 241, 0.18);
    border-radius: 12px;
    background: rgba(99, 102, 241, 0.04);
}

.addressbook-form .form-input {
    min-width: 0;
}

.addressbook-form-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 0.55rem;
}

.sync-options-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0.65rem;
    padding: 1rem;
    border: 1px solid rgba(99, 102, 241, 0.16);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
}

.sync-option {
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.04);
}

.sync-option strong {
    display: block;
    color: var(--text-primary);
    font-size: 0.84rem;
    margin-bottom: 0.25rem;
}

.sync-option span {
    color: var(--text-secondary);
    font-size: 0.74rem;
    line-height: 1.35;
}

@media (max-width: 1100px) {
    .addressbook-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.gallery-columns-control {
    display: grid;
    grid-template-columns: minmax(110px, 180px) 2rem;
    align-items: center;
    gap: 0.55rem;
}

.gallery-columns-control input[type="range"] {
    width: 100%;
    accent-color: var(--accent-indigo);
}

.gallery-columns-control output {
    min-width: 2rem;
    height: 2rem;
    border: 1px solid rgba(99, 102, 241, 0.18);
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-indigo);
    font-weight: 850;
    background: rgba(99, 102, 241, 0.06);
}

.picasa-folder-heading {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
    padding: 0.8rem 0.35rem 0.25rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 850;
    border-bottom: 1px solid var(--border-glass);
}

.picasa-folder-heading span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.timeline-feed.picasa-view .timeline-card.paperless-card {
    scroll-margin-top: 1rem;
}


/* Collapsible sidebars */
.sidebar-collapse-btn,
.context-collapse-btn {
    position: absolute;
    z-index: 20;
    width: 28px;
    height: 28px;
    border: 1px solid rgba(99, 102, 241, 0.22);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.sidebar-collapse-btn {
    top: 0.75rem;
    right: 0.75rem;
}

.context-collapse-btn {
    top: 0.75rem;
    left: 0.5rem;
}

.sidebar-collapse-btn:hover,
.context-collapse-btn:hover {
    color: #fff;
    background: var(--accent-indigo);
    border-color: transparent;
}

body.left-sidebar-collapsed .app-wrapper {
    --left-sidebar-width: 72px;
}

body.right-sidebar-collapsed .app-wrapper {
    --right-sidebar-width: 20px;
}

body.left-sidebar-collapsed .sidebar {
    padding: 1.25rem 0.55rem;
    align-items: center;
    gap: 1rem;
}

body.left-sidebar-collapsed .sidebar-collapse-btn {
    position: static;
    flex: 0 0 auto;
    transform: rotate(180deg);
}

body.left-sidebar-collapsed .sidebar-resize-handle {
    display: none;
}

body.left-sidebar-collapsed .brand-name,
body.left-sidebar-collapsed .global-search-btn span,
body.left-sidebar-collapsed .nav-section h3,
body.left-sidebar-collapsed .section-title-action h3,
body.left-sidebar-collapsed .section-title-action .action-btn,
body.left-sidebar-collapsed .sidebar-nav li a > :not(i),
body.left-sidebar-collapsed .sidebar-footer,
body.left-sidebar-collapsed .tree-view,
body.left-sidebar-collapsed #projectsList,
body.left-sidebar-collapsed #tagsTree,
body.left-sidebar-collapsed #foldersTree {
    display: none !important;
}

body.left-sidebar-collapsed .sidebar-header {
    justify-content: center;
}

body.left-sidebar-collapsed .brand-logo {
    font-size: 1.45rem;
}

body.left-sidebar-collapsed .global-search-btn {
    width: 42px;
    height: 42px;
    margin: 0;
    padding: 0;
}

body.left-sidebar-collapsed .sidebar-nav {
    width: 100%;
    overflow: hidden;
    gap: 0.65rem;
}

body.left-sidebar-collapsed .nav-section {
    align-items: center;
    gap: 0.45rem;
}

body.left-sidebar-collapsed .sidebar-nav ul {
    align-items: center;
}

body.left-sidebar-collapsed .sidebar-nav li a {
    width: 42px;
    height: 42px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    gap: 0;
    font-size: 0;
}

body.left-sidebar-collapsed .badge-accent {
    display: none !important;
}

body.left-sidebar-collapsed .sidebar-nav li.sub-nav a {
    padding-left: 0;
}

body.left-sidebar-collapsed .sidebar-nav li a > i {
    width: auto;
    font-size: 1rem;
}

body.left-sidebar-collapsed .nav-sync-input-btn {
    display: none;
}

body.right-sidebar-collapsed .context-panel {
    background: rgba(255, 255, 255, 0.62);
    border-left-color: rgba(99, 102, 241, 0.16);
}

body.right-sidebar-collapsed .context-panel > :not(.context-collapse-btn) {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

body.right-sidebar-collapsed .context-collapse-btn {
    top: 50%;
    left: 50%;
    width: 18px;
    height: 64px;
    border-radius: 8px 0 0 8px;
    transform: translate(-50%, -50%) rotate(180deg);
    padding: 0;
}

body.right-sidebar-collapsed .context-collapse-btn i {
    font-size: 0.72rem;
}


/* Compact workspace header */
.timeline-container {
    padding: 0.75rem 1.25rem 1rem;
    gap: 0.75rem;
}

.top-search-header {
    min-height: 52px;
    padding: 0.5rem 0.65rem;
    border-radius: 12px;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.62);
    box-shadow: 0 1px 0 rgba(99, 102, 241, 0.06);
}

.top-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.45rem;
    flex: 0 0 auto;
    min-width: 0;
}

.top-search-header .search-input-wrapper {
    max-width: 680px;
    min-width: min(360px, 100%);
}

.top-search-header .search-icon {
    left: 0.9rem;
    font-size: 0.85rem;
}

.top-search-header .search-input-wrapper input {
    height: 36px;
    border-radius: 9px;
    padding: 0 0.9rem 0 2.35rem;
    font-size: 0.84rem;
    background: rgba(255, 255, 255, 0.88);
}

.top-header-actions .theme-toggle-btn {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    font-size: 0.92rem;
}

.top-header-actions .btn-scan {
    height: 36px;
    border-radius: 9px;
    padding: 0 0.85rem;
    font-size: 0.78rem;
    font-weight: 750;
    white-space: nowrap;
}

.feed-section {
    gap: 0.65rem;
}

.feed-header {
    min-height: 34px;
    align-items: flex-end;
    gap: 0.8rem;
}

.feed-header h1 {
    font-size: 1.45rem;
    line-height: 1.05;
    letter-spacing: 0;
}

.feed-counter {
    width: fit-content;
    padding: 0.22rem 0.75rem;
    border-radius: 999px;
    font-size: 0.72rem;
    line-height: 1.1;
    background: rgba(255, 255, 255, 0.58);
}

#lettersActionBar {
    gap: 0.45rem !important;
}

#lettersActionBar .btn-scan {
    min-height: 32px;
    padding: 0.35rem 0.75rem !important;
    border-radius: 10px !important;
    font-size: 0.74rem !important;
}

.feed-controls {
    min-height: 40px;
    padding: 0.35rem 0.6rem;
    margin-bottom: 0.25rem;
    border-radius: 10px;
    gap: 0.65rem;
    background: rgba(255, 255, 255, 0.64);
    box-shadow: none;
}

.feed-control-group {
    gap: 0.45rem;
}

.feed-control-label {
    font-size: 0.64rem;
    font-weight: 800;
    letter-spacing: 0.045em;
}

.segmented-control {
    border-radius: 8px;
    padding: 2px;
}

.segmented-btn {
    min-height: 28px;
    padding: 0 0.55rem;
    font-size: 0.72rem;
    font-weight: 750;
    border-radius: 6px;
}

.segmented-btn i {
    font-size: 0.78rem;
}

.premium-select {
    height: 30px;
    padding: 0 0.65rem;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 750;
}

.gallery-columns-control {
    grid-template-columns: minmax(112px, 160px) 1.65rem;
    gap: 0.45rem;
}

.gallery-columns-control output {
    min-width: 1.65rem;
    height: 1.65rem;
    border-radius: 7px;
    font-size: 0.76rem;
}

.timeline-feed.grid-view {
    padding-top: 0.1rem;
}

@media (max-width: 1050px) {
    .top-search-header,
    .feed-controls,
    .feed-header {
        flex-wrap: wrap;
    }
    .top-search-header .search-input-wrapper {
        min-width: min(280px, 100%);
    }
}


.app-confirm-modal.preview-confirm .app-confirm-card {
    width: min(720px, 96vw);
    max-height: min(760px, 92vh);
    overflow: auto;
}

.confirm-page-preview {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.confirm-page-preview p {
    margin: 0;
}

.confirm-page-preview img {
    display: block;
    max-width: 100%;
    max-height: 520px;
    object-fit: contain;
    border-radius: 10px;
    border: 1px solid rgba(99, 102, 241, 0.18);
    background: #fff;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.22);
}

.timeline-tool-divider {
    width: 1px;
    height: 1.55rem;
    background: rgba(99, 102, 241, 0.18);
    display: inline-block;
}

/* Main-window Workspace Settings */
body.settings-mode .app-wrapper {
    --right-sidebar-width: 20px;
}

body.settings-mode .context-panel > :not(.context-collapse-btn) {
    display: none !important;
}

body.settings-mode .context-panel {
    background: rgba(255, 255, 255, 0.72);
}

.settings-page {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
    padding: 1rem;
}

.settings-page-header {
    align-items: center;
    border-bottom: 1px solid rgba(148, 163, 184, 0.22);
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 0.9rem;
    padding: 0 0 0.9rem;
}

.settings-eyebrow {
    align-items: center;
    color: var(--accent-indigo);
    display: inline-flex;
    font-size: 0.72rem;
    font-weight: 800;
    gap: 0.4rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.settings-page-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.55rem;
    line-height: 1.1;
    margin: 0.15rem 0;
}

.settings-page-header p {
    color: var(--text-secondary);
    font-size: 0.86rem;
}

.settings-back-btn {
    align-items: center;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.22);
    border-radius: 9px;
    color: var(--accent-indigo);
    cursor: pointer;
    display: inline-flex;
    font-size: 0.82rem;
    font-weight: 800;
    gap: 0.45rem;
    min-height: 2.25rem;
    padding: 0 0.85rem;
}

.settings-back-btn:hover {
    background: var(--accent-indigo);
    color: #fff;
}

.settings-page-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 1rem;
}

.settings-page-tabs a {
    align-items: center;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--border-glass);
    border-radius: 999px;
    color: var(--text-secondary);
    display: inline-flex;
    font-size: 0.78rem;
    font-weight: 800;
    gap: 0.45rem;
    min-height: 2rem;
    padding: 0 0.75rem;
    text-decoration: none;
}

.settings-page-tabs a:hover {
    border-color: rgba(99, 102, 241, 0.3);
    color: var(--accent-indigo);
}

.settings-page-body {
    align-items: start;
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(360px, 1.35fr) minmax(320px, 0.85fr);
}

.settings-page-body > .card-group {
    background: rgba(255, 255, 255, 0.68);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 1rem;
    scroll-margin-top: 1rem;
}

.settings-page-body > .card-group:first-child {
    grid-column: 1 / -1;
}

.settings-page-body > .card-group[style] {
    border-top: 1px solid var(--border-glass) !important;
    padding-top: 1rem !important;
}

.settings-page-body .card-group h3 {
    color: var(--text-primary);
    font-size: 0.86rem;
    margin-bottom: 0.15rem !important;
}

.settings-page-body #configuredFoldersList {
    display: grid !important;
    gap: 0.75rem !important;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.settings-page-body .settings-folder-item {
    min-height: 0;
}

.settings-page-body .form-group input,
.settings-page-body .form-group textarea,
.settings-page-body .form-group select,
.settings-page-body #newFolderPurpose,
.settings-page-body #newFolderOwner,
.settings-page-body #newFolderCategoryType,
.settings-page-body #newFolderProjectId,
.settings-page-body #llmProvider,
.settings-page-body #iamSecurityQuestion,
.settings-page-body #settingsDefaultView,
.settings-page-body #settingsItemsPerPage {
    background: rgba(255, 255, 255, 0.84) !important;
    border: 1px solid rgba(99, 102, 241, 0.16) !important;
    border-radius: 9px !important;
    color: var(--text-primary) !important;
    min-height: 2.35rem;
    padding: 0.62rem 0.75rem !important;
    width: 100%;
}

.settings-page-body .btn-primary {
    border-radius: 9px;
    min-height: 2.35rem;
    padding: 0.65rem 0.85rem;
    width: fit-content;
}

body:not(.light-theme) .settings-page,
body:not(.light-theme) .settings-page-body > .card-group,
body:not(.light-theme) .settings-page-tabs a {
    background: rgba(15, 23, 42, 0.72);
}

body:not(.light-theme) .settings-page-body .form-group input,
body:not(.light-theme) .settings-page-body .form-group textarea,
body:not(.light-theme) .settings-page-body .form-group select {
    background: rgba(15, 23, 42, 0.76) !important;
}

@media (max-width: 1120px) {
    .settings-page-body {
        grid-template-columns: 1fr;
    }
}

.admin-section-head {
    align-items: flex-start;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 0.8rem;
}

.indexing-job-queues {
    display: grid;
    gap: 0.85rem;
}

.job-queue-summary {
    align-items: center;
    color: var(--text-secondary);
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    font-size: 0.78rem;
    font-weight: 800;
}

.job-queue-summary span,
.job-queue-title-row,
.job-counter-row,
.job-queue-actions,
.job-action-btn {
    align-items: center;
    display: flex;
}

.is-active-dot {
    color: #22c55e;
}

.job-queue-card {
    background: rgba(248, 250, 252, 0.76);
    border: 1px solid rgba(99, 102, 241, 0.12);
    border-radius: 8px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 4.8rem;
    overflow: hidden;
    position: relative;
}

.job-queue-card.is-active {
    border-color: rgba(34, 197, 94, 0.42);
    box-shadow: 0 12px 30px rgba(34, 197, 94, 0.08);
}

.job-active-bar {
    background: #4ade80;
    color: #064e3b;
    font-size: 0.68rem;
    font-weight: 900;
    left: 0;
    letter-spacing: 0.02em;
    line-height: 1.35rem;
    position: absolute;
    right: 4.8rem;
    text-align: center;
    top: 0;
}

.job-queue-main {
    display: grid;
    gap: 0.55rem;
    padding: 1rem;
    padding-top: 1.15rem;
}

.job-queue-card.is-active .job-queue-main {
    padding-top: 2.05rem;
}

.job-queue-title-row {
    gap: 0.48rem;
    min-width: 0;
}

.job-queue-title-row i {
    color: var(--accent-indigo);
}

.job-queue-title-row h4 {
    color: var(--text-primary);
    font-size: 0.94rem;
    line-height: 1.2;
    min-width: 0;
}

.job-failed-pill {
    background: rgba(79, 70, 229, 0.95);
    border-radius: 5px;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 850;
    padding: 0.18rem 0.45rem;
    white-space: nowrap;
}

.job-queue-main p {
    color: var(--text-secondary);
    font-size: 0.76rem;
    line-height: 1.35;
}

.job-counter-row {
    gap: 0;
}

.job-counter {
    background: rgba(226, 232, 240, 0.78);
    color: var(--text-primary);
    display: grid;
    gap: 0.15rem;
    grid-template-columns: minmax(4rem, 1fr) auto;
    min-width: 8.5rem;
    padding: 0.6rem 0.75rem;
}

.job-counter:first-child {
    border-bottom-left-radius: 6px;
    border-top-left-radius: 6px;
}

.job-counter:last-child {
    border-bottom-right-radius: 6px;
    border-top-right-radius: 6px;
}

.job-counter.active {
    background: #4f46e5;
    color: #fff;
}

.job-counter b {
    font-size: 0.72rem;
}

.job-counter strong {
    font-size: 1.05rem;
}

.job-current-item {
    background: rgba(15, 23, 42, 0.04);
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.7rem;
    overflow: hidden;
    padding: 0.42rem 0.5rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.job-error-line {
    color: #dc2626;
    font-size: 0.74rem;
    font-weight: 750;
}

.job-queue-actions {
    background: rgba(203, 213, 225, 0.72);
    display: grid;
    grid-template-rows: 1fr 1fr;
}

.job-action-btn {
    background: transparent;
    border: 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.24);
    color: #475569;
    cursor: pointer;
    flex-direction: column;
    font-size: 0.66rem;
    font-weight: 800;
    gap: 0.32rem;
    justify-content: center;
    min-height: 3.6rem;
}

.job-action-btn:hover {
    background: rgba(79, 70, 229, 0.1);
    color: var(--accent-indigo);
}

.folder-admin-details {
    border-top: 1px dashed rgba(148, 163, 184, 0.28);
    padding-top: 0.55rem;
}

.folder-admin-details summary {
    color: var(--accent-indigo);
    cursor: pointer;
    font-size: 0.76rem;
    font-weight: 850;
}

.folder-admin-grid {
    display: grid;
    gap: 0.7rem;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    margin-top: 0.75rem;
}

.folder-admin-grid label {
    color: var(--text-secondary);
    display: grid;
    font-size: 0.7rem;
    font-weight: 850;
    gap: 0.3rem;
    text-transform: uppercase;
}

.folder-admin-grid input,
.folder-admin-grid select {
    background: rgba(255, 255, 255, 0.84);
    border: 1px solid rgba(99, 102, 241, 0.16);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.8rem;
    min-height: 2.2rem;
    padding: 0.55rem 0.65rem;
    text-transform: none;
    width: 100%;
}

.folder-admin-wide {
    grid-column: 1 / -1;
}

body:not(.light-theme) .job-queue-card,
body:not(.light-theme) .folder-admin-grid input,
body:not(.light-theme) .folder-admin-grid select,
body:not(.light-theme) .job-current-item {
    background: rgba(15, 23, 42, 0.72);
}

body:not(.light-theme) .job-counter,
body:not(.light-theme) .job-queue-actions {
    background: rgba(30, 41, 59, 0.78);
}

@media (max-width: 720px) {
    .admin-section-head,
    .job-queue-card {
        grid-template-columns: 1fr;
    }

    .admin-section-head {
        display: grid;
    }

    .job-active-bar {
        right: 0;
    }

    .job-queue-actions {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: none;
    }

    .job-counter-row {
        align-items: stretch;
        flex-direction: column;
    }

    .job-counter,
    .job-counter:first-child,
    .job-counter:last-child {
        border-radius: 6px;
        min-width: 0;
    }
}

.import-library-btn {
    margin-top: 0.6rem;
}

.import-option-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.8rem;
}


.remote-browser-actions {
    align-items: center;
    display: flex;
    gap: 0.75rem;
    grid-column: 1 / -1;
}

.remote-browser-status {
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 750;
}

.remote-browser-panel {
    background: rgba(255, 255, 255, 0.58);
    border: 1px solid rgba(99, 102, 241, 0.16);
    border-radius: 9px;
    display: grid;
    gap: 0.55rem;
    grid-column: 1 / -1;
    max-height: 280px;
    min-height: 150px;
    overflow: hidden;
    padding: 0.65rem;
}

.remote-browser-head {
    align-items: center;
    display: flex;
    gap: 0.75rem;
    justify-content: space-between;
}

.remote-browser-head code {
    color: var(--text-secondary);
    font-size: 0.72rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.remote-browser-head span {
    color: var(--accent-indigo);
    flex: 0 0 auto;
    font-size: 0.72rem;
    font-weight: 850;
}

.remote-browser-list {
    display: grid;
    gap: 0.25rem;
    list-style: none;
    margin: 0;
    max-height: 145px;
    overflow: auto;
    padding: 0;
}

.remote-browser-list li {
    align-items: center;
    border-radius: 7px;
    color: var(--text-primary);
    cursor: pointer;
    display: grid;
    font-size: 0.82rem;
    gap: 0.55rem;
    grid-template-columns: auto 1fr auto;
    min-height: 2rem;
    padding: 0.35rem 0.45rem;
}

.remote-browser-list li:hover {
    background: rgba(99, 102, 241, 0.08);
}

.remote-browser-list input {
    width: 1rem;
    height: 1rem;
}

.remote-selected-folders {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    min-height: 1.45rem;
}

.remote-selected-pill {
    align-items: center;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.18);
    border-radius: 999px;
    color: var(--accent-indigo);
    display: inline-flex;
    font-size: 0.72rem;
    font-weight: 850;
    gap: 0.35rem;
    max-width: 100%;
    min-height: 1.6rem;
    padding: 0 0.55rem;
}

.remote-selected-pill span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.remote-selected-pill button {
    background: transparent;
    border: 0;
    color: currentColor;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 0;
}

body:not(.light-theme) .remote-browser-panel {
    background: rgba(15, 23, 42, 0.62);
}

.import-option-panel {
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    background: rgba(255, 255, 255, 0.035);
}

.import-option-panel strong {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
}

.import-option-panel label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
    font-size: 0.86rem;
    color: var(--text-primary);
}

.import-option-panel input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.folder-detail-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.55rem;
}

.folder-detail-chip {
    border: 1px solid var(--border-glass);
    border-radius: 999px;
    padding: 0.18rem 0.5rem;
    font-size: 0.72rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.045);
}

/* --- Workspace layout polish and small-screen stability --- */
html {
    scroll-behavior: auto;
}

body {
    overflow: hidden;
    overscroll-behavior: none;
}

.app-wrapper {
    position: fixed;
    inset: 0;
    min-height: 0;
    background: #f8fafc;
}

body:not(.light-theme) .app-wrapper {
    background: #0a0b16;
}

.sidebar,
.context-panel,
.timeline-container {
    min-height: 0;
}

.sidebar {
    padding: 1rem 1rem 0.9rem;
    gap: 0.9rem;
    background: rgba(255, 255, 255, 0.76);
}

.sidebar-header {
    min-height: 42px;
}

.brand-logo {
    font-size: 1.55rem;
}

.brand-name h2 {
    font-size: 1.1rem;
    letter-spacing: 0;
}

.brand-name span {
    font-size: 0.62rem;
    letter-spacing: 0.08em;
}

.global-search-btn {
    height: 34px;
    margin: 0;
    border-radius: 9px;
    font-size: 0.82rem;
}

.sidebar-nav {
    gap: 1.15rem;
    padding-right: 0.15rem;
}

.nav-section {
    gap: 0.45rem;
}

.nav-section h3 {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
}

.sidebar-nav li a {
    min-height: 40px;
    padding: 0.62rem 0.75rem;
    border-radius: 10px;
    font-size: 0.9rem;
}

.sidebar-nav li.sub-nav a {
    min-height: 34px;
    padding-left: 1.7rem;
    font-size: 0.78rem;
}

.sidebar-footer {
    gap: 0.6rem !important;
    padding-top: 0.75rem !important;
}

.user-profile-widget {
    border-radius: 12px;
    padding: 0.65rem;
}

.btn-sync {
    min-height: 36px;
    border-radius: 10px;
    padding: 0.55rem 0.7rem;
}

.timeline-container {
    padding: 0.75rem 1rem 0.85rem;
    gap: 0.65rem;
}

.top-search-header,
.feed-controls,
.timeline-document-header,
.timeline-document-tools,
.detail-secondary-tools {
    border-radius: 8px;
}

.top-search-header {
    flex-wrap: wrap;
}

.top-search-header .search-input-wrapper {
    flex: 1 1 260px;
    min-width: 0;
}

.top-header-actions {
    flex-wrap: wrap;
}

.feed-section {
    min-height: 0;
}

.feed-header,
.feed-controls {
    flex-wrap: wrap;
}

.feed-controls {
    justify-content: flex-start;
}

.feed-control-group {
    min-width: 0;
    flex-wrap: wrap;
}

.segmented-control {
    flex-wrap: wrap;
}

.timeline-feed {
    min-height: 0;
}

.context-panel {
    background: rgba(255, 255, 255, 0.78);
}

.context-header {
    padding: 1rem 1.2rem;
}

.context-body {
    padding: 1rem 1.2rem 1.4rem;
    gap: 1.25rem;
}

.card-group {
    gap: 0.75rem;
}

.card-group-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.card-group-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.mini-action-btn {
    min-height: 1.9rem;
    border: 1px solid rgba(99, 102, 241, 0.18);
    border-radius: 7px;
    background: rgba(99, 102, 241, 0.06);
    color: var(--text-primary);
    padding: 0 0.5rem;
    font-size: 0.72rem;
    font-weight: 800;
    cursor: pointer;
}

.mini-action-btn.primary,
.mini-action-btn:hover {
    background: var(--accent-indigo);
    border-color: var(--accent-indigo);
    color: #fff;
}

.contact-address-grid,
.document-metadata-fields {
    gap: 0.65rem;
}

.form-input,
.meta-field input,
.meta-field select,
.meta-field textarea {
    min-width: 0;
}

.settings-page {
    border-radius: 8px;
}

.settings-page-tabs {
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 0.35rem 0;
    background: rgba(248, 250, 252, 0.92);
    backdrop-filter: blur(10px);
}

.settings-page-body {
    grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr));
}

.settings-page-body > .card-group:first-child {
    grid-column: auto;
}

.timeline-document-viewer {
    min-height: 0;
    height: auto;
    max-height: none;
}

.detail-view-header {
    align-items: flex-start;
    gap: 0.75rem;
}

.detail-toolbar-right {
    max-width: min(100%, 760px);
    padding: 0.18rem;
    border: 1px solid rgba(99, 102, 241, 0.12);
    border-radius: 8px;
    background: rgba(99, 102, 241, 0.04);
}

.detail-nav-tools {
    justify-content: center;
}

.detail-page-controls {
    max-width: 100%;
}

.detail-secondary-tools {
    flex-wrap: wrap;
    align-items: center;
}

.timeline-tool-cluster,
.timeline-pdf-tools {
    flex: 1 1 auto;
}

.timeline-pdf-tools {
    justify-content: flex-end;
}

.detail-view-body {
    min-height: 0;
}

@media (max-width: 1260px) {
    .app-wrapper {
        --left-sidebar-width: 300px;
        --right-sidebar-width: 380px;
    }

    .timeline-container {
        padding-inline: 0.75rem;
    }

    .feed-control-label {
        display: none;
    }
}

@media (max-width: 1080px) {
    .app-wrapper {
        --left-sidebar-width: 240px;
        --right-sidebar-width: 340px;
    }

    .brand-name span,
    .top-header-actions .btn-scan span {
        display: none;
    }

    .sidebar-nav li a {
        font-size: 0.82rem;
    }
}

@media (max-width: 900px) {
    .app-wrapper {
        display: grid;
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(0, 1fr) auto;
        overflow: hidden;
    }

    .sidebar,
    .context-panel,
    .timeline-container {
        width: 100%;
        max-width: none;
        flex: none;
    }

    .sidebar {
        height: auto;
        max-height: 42vh;
        border-right: 0;
        border-bottom: 1px solid var(--border-glass);
    }

    .sidebar-header,
    .sidebar-footer,
    .nav-section h3,
    .section-title-action {
        display: none !important;
    }

    .sidebar-nav {
        overflow-x: auto;
        overflow-y: hidden;
        flex-direction: row;
        gap: 0.55rem;
        padding-bottom: 0.15rem;
    }

    .nav-section,
    .sidebar-nav ul {
        flex-direction: row;
        gap: 0.45rem;
    }

    .sidebar-nav li a {
        grid-template-columns: auto auto;
        white-space: nowrap;
    }

    .sidebar-nav li.sub-nav a {
        padding-left: 0.75rem;
    }

    .timeline-container {
        min-height: 0;
        height: auto;
    }

    .context-panel {
        height: min(46vh, 420px);
        border-left: 0;
        border-top: 1px solid var(--border-glass);
    }

    .context-placeholder {
        display: none;
    }

    .context-active-content {
        min-height: 0;
    }

    .timeline-feed.grid-view {
        --gallery-columns: 2;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

/* Keep the compact account row as the sidebar counterpart of the status bar. */
.sidebar > .sidebar-footer {
    position: absolute !important;
    inset: auto 0 0 0 !important;
    height: 30px !important;
    min-height: 30px !important;
    gap: 0 !important;
    padding: 0 !important;
    border: 0 !important;
}

.sidebar > .sidebar-footer .user-profile-widget,
.sidebar > .sidebar-footer .active-profile-header {
    height: 30px !important;
    min-height: 30px !important;
    padding: 0 0.7rem !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

@media (max-width: 620px) {
    .timeline-container {
        padding: 0.55rem;
    }

    .top-search-header {
        align-items: stretch;
    }

    .top-header-actions,
    .top-search-header .search-input-wrapper {
        width: 100%;
    }

    .top-header-actions {
        justify-content: flex-start;
    }

    .feed-header h1 {
        font-size: 1.18rem;
    }

    .segmented-btn span,
    .timeline-tool-btn {
        font-size: 0.68rem;
    }

    .premium-select {
        max-width: 100%;
    }

    .timeline-feed.grid-view {
        --gallery-columns: 1;
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .contact-address-grid,
    .document-metadata-fields {
        grid-template-columns: 1fr;
    }

    .settings-page {
        padding: 0.7rem;
    }

    .settings-page-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .detail-view-header {
        grid-template-columns: 1fr;
    }

    .detail-toolbar-right,
    .detail-page-controls,
    .timeline-tool-cluster,
    .timeline-pdf-tools {
        justify-content: flex-start;
    }

    .detail-zoom-slider {
        width: 110px;
    }
}

/* --- Folder explorer and import workflow polish --- */
.tree-add-folder-btn {
    width: 1.8rem;
    height: 1.8rem;
    border-radius: 7px;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.18);
    color: var(--accent-indigo);
}

.tree-view {
    overflow: auto;
    padding: 0.15rem 0 0.5rem;
    scrollbar-width: thin;
}

.tree-node {
    padding-left: 0;
}

.tree-node-header {
    width: max-content;
    min-width: 100%;
    border: 0;
    background: transparent;
    color: var(--text-secondary);
    display: grid;
    grid-template-columns: 1.1rem 1.15rem minmax(4rem, 1fr);
    gap: 0.25rem;
    align-items: center;
    min-height: 30px;
    padding: 0.25rem 0.45rem 0.25rem calc(0.35rem + (var(--tree-depth, 0) * 1.15rem));
    text-align: left;
    font: inherit;
    font-size: 0.82rem;
    border-radius: 7px;
}

.tree-node-header:hover,
.tree-node-header:focus-visible {
    background: rgba(99, 102, 241, 0.07);
    color: var(--text-primary);
    outline: none;
}

.tree-node-header.active {
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent-indigo);
    font-weight: 800;
}

.tree-toggle-icon {
    width: 1.15rem;
    height: 1.35rem;
    margin-right: 0;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

.tree-toggle-icon:disabled {
    cursor: default;
    opacity: 0.35;
}

.tree-toggle-icon:not(:disabled):hover {
    background: rgba(99, 102, 241, 0.10);
    color: var(--accent-indigo);
}

.tree-toggle-icon i {
    font-size: 0.68rem;
    transition: transform 0.16s ease;
}

.tree-toggle-icon.expanded i {
    transform: rotate(90deg);
}

.tree-node-header .configured-folder {
    color: var(--accent-indigo);
}

.tree-node-header .indexed-folder {
    color: #64748b;
}

.tree-node-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tree-node-children {
    display: none;
    border-left: 1px dotted rgba(99, 102, 241, 0.16);
    margin-left: 0.9rem;
    padding-left: 0;
}

.tree-node-children.expanded {
    display: block;
}

.tree-empty-state {
    color: var(--text-secondary);
    font-size: 0.78rem;
    padding: 0.45rem 0.65rem;
}

.import-modal-content {
    border-radius: 12px !important;
}

.import-modal-body {
    gap: 0.85rem;
}

.import-hidden {
    display: none !important;
}

.import-step-title {
    align-items: center;
    color: var(--text-primary);
    display: flex;
    gap: 0.55rem;
    font-size: 0.86rem;
    font-weight: 850;
    grid-column: 1 / -1;
    margin-top: 0.25rem;
    text-transform: none;
}

.import-step-title span {
    align-items: center;
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.22);
    border-radius: 999px;
    color: var(--accent-indigo);
    display: inline-flex;
    font-size: 0.72rem;
    height: 1.45rem;
    justify-content: center;
    width: 1.45rem;
}

.import-source-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    padding: 0.35rem;
    border: 1px solid rgba(99, 102, 241, 0.14);
    border-radius: 9px;
    background: rgba(99, 102, 241, 0.04);
}

.import-source-chip {
    min-height: 2rem;
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0 0.7rem;
    font-weight: 800;
    cursor: pointer;
}

.import-source-chip span {
    background: rgba(34, 197, 94, 0.16);
    border-radius: 999px;
    color: #047857;
    font-size: 0.62rem;
    padding: 0.12rem 0.38rem;
}

.import-source-chip.active span,
.import-source-chip:hover span {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}

.import-source-chip.active,
.import-source-chip:hover {
    background: var(--accent-indigo);
    border-color: var(--accent-indigo);
    color: #fff;
}

.import-modal-note {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.35;
}

.import-network-panel {
    display: none;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 0.75rem;
    padding: 0.85rem;
    border: 1px dashed rgba(99, 102, 241, 0.22);
    border-radius: 9px;
    background: rgba(99, 102, 241, 0.04);
}

.import-network-panel > .form-group {
    grid-column: span 4;
    min-width: 0;
}

.import-network-panel .network-step-title,
.import-network-panel .browser-step-title,
.import-network-panel .network-url-field,
.import-network-panel .save-network-source-toggle,
.import-network-panel .remote-browser-actions,
.import-network-panel .remote-browser-panel {
    grid-column: 1 / -1;
}

.import-network-panel .network-kind-field,
.import-network-panel .network-saved-field,
.import-network-panel .network-source-name-field {
    grid-column: span 4;
}

.import-network-panel .network-url-field input {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.86rem;
}

.import-network-panel .network-username-field,
.import-network-panel .network-password-field,
.import-network-panel .network-domain-field,
.import-network-panel .network-note-field {
    grid-column: span 3;
}

.remote-credential-grid {
    display: contents;
}

.import-network-panel[data-source-kind="mounted"] .remote-credential-grid,
.import-network-panel[data-source-kind="mounted"] #addFolderRemoteUrl,
.import-network-panel[data-source-kind="mounted"] #addFolderRemoteUrlLabel {
    display: none;
}

.import-network-panel.active {
    display: grid;
}

.import-network-panel select,
.import-network-panel input {
    width: 100%;
    min-height: 2.35rem;
    border-radius: 9px;
    border: 1px solid rgba(99, 102, 241, 0.16);
    background: rgba(255, 255, 255, 0.84);
    color: var(--text-primary);
    padding: 0.62rem 0.75rem;
}


.save-network-source-toggle {
    align-items: center;
    border: 1px solid rgba(99, 102, 241, 0.16);
    border-radius: 9px;
    color: var(--text-secondary);
    display: flex;
    font-size: 0.82rem;
    font-weight: 750;
    gap: 0.55rem;
    grid-column: 1 / -1;
    min-height: 2.35rem;
    padding: 0.55rem 0.75rem;
}

.save-network-source-toggle input {
    width: 1rem;
    min-height: auto;
}

.network-sources-admin {
    border-top: 1px solid rgba(99, 102, 241, 0.16);
    display: grid;
    gap: 0.9rem;
    margin-top: 1.1rem;
    padding-top: 1.1rem;
}

.admin-section-head.compact {
    align-items: center;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.network-sources-list {
    display: grid;
    gap: 0.7rem;
}

.network-source-card {
    align-items: center;
    border: 1px solid rgba(99, 102, 241, 0.16);
    border-radius: 8px;
    display: grid;
    gap: 0.65rem;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 0.8rem;
}

.network-source-card strong {
    color: var(--text-primary);
    display: block;
    font-size: 0.95rem;
}

.network-source-card code {
    color: var(--text-secondary);
    display: block;
    font-size: 0.72rem;
    margin-top: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.network-source-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.45rem;
}

.network-source-meta span {
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.14);
    border-radius: 999px;
    color: var(--accent-indigo);
    font-size: 0.7rem;
    font-weight: 850;
    padding: 0.22rem 0.45rem;
}

.network-source-actions {
    display: flex;
    gap: 0.4rem;
}

.network-source-actions button {
    align-items: center;
    border: 1px solid rgba(239, 68, 68, 0.24);
    border-radius: 8px;
    color: #dc2626;
    cursor: pointer;
    display: inline-flex;
    justify-content: center;
    min-height: 2rem;
    min-width: 2rem;
}

.import-option-panel {
    min-width: 0;
    border-radius: 9px;
}

.import-option-panel label {
    align-items: center;
    display: flex;
    gap: 0.45rem;
    min-height: 1.65rem;
}

@media (max-width: 620px) {
    .import-modal-content {
        width: 96vw !important;
    }

    .import-source-chip {
        flex: 1 1 auto;
        justify-content: center;
    }

    .tree-node-header {
        font-size: 0.78rem;
    }
}


@media (max-width: 900px) {
    .folder-tree-title-row {
        display: flex !important;
        align-items: center;
        min-height: 32px;
    }

    .folder-tree-title-row h3 {
        display: flex !important;
        align-items: center;
    }
}

.tree-node-header[role="treeitem"] {
    cursor: default;
}

.tree-node-header .tree-node-name,
.tree-node-header .configured-folder,
.tree-node-header .indexed-folder {
    cursor: pointer;
}

.tree-toggle-icon.expanded {
    transform: none;
}

/* Native disclosure tree: reliable Windows-Explorer style folding. */
.tree-node-details {
    display: block;
}

.tree-node-details > summary {
    list-style: none;
}

.tree-node-details > summary::-webkit-details-marker {
    display: none;
}

.tree-node-details:not([open]) > .tree-node-children {
    display: none !important;
}

.tree-node-details[open] > .tree-node-children {
    display: block !important;
}

.tree-node-details[open] > .tree-node-header .tree-toggle-icon i {
    transform: rotate(90deg);
}

.tree-node-details[open] > .tree-node-header .tree-toggle-icon {
    transform: none;
}

.tree-node-details > .tree-node-header {
    cursor: pointer;
}

/* Main workspace import panel */
.main-container {
    position: relative;
}

.modal.workspace-modal {
    align-items: flex-start;
    background: rgba(15, 23, 42, 0.18);
    backdrop-filter: blur(2px);
    bottom: 0;
    height: auto;
    justify-content: center;
    left: 0;
    overflow: auto;
    padding: 0.85rem;
    position: absolute;
    right: 0;
    top: 0;
    width: auto;
    z-index: 80;
}

.modal.workspace-modal.active {
    display: flex;
}

.modal.workspace-modal .import-modal-content {
    border-radius: 14px;
    max-height: none !important;
    min-height: min-content;
    overflow: visible !important;
    width: min(1120px, 100%) !important;
}

.modal.workspace-modal .import-modal-body {
    overflow: visible;
}

/* Resizable remote folder browser */
.remote-browser-panel {
    grid-template-rows: auto minmax(0, 1fr) auto;
    height: clamp(230px, 34vh, 440px);
    max-height: 72vh;
    min-height: 190px;
    overflow: auto;
    resize: vertical;
}

.remote-browser-list {
    align-content: start;
    max-height: none;
    min-height: 0;
    overflow: auto;
}

.remote-browser-list li {
    align-items: stretch;
    cursor: default;
    gap: 0.25rem;
    grid-template-columns: minmax(0, 1fr) 2.15rem;
    min-height: 2.35rem;
    padding: 0;
}

.remote-browser-list li:hover {
    background: rgba(99, 102, 241, 0.06);
}

.remote-browser-list li.remote-browser-message {
    align-items: center;
    color: var(--text-secondary);
    cursor: default;
    display: grid;
    gap: 0.55rem;
    grid-template-columns: auto minmax(0, 1fr);
    line-height: 1.35;
    min-height: 2.4rem;
    padding: 0.5rem 0.65rem;
}

.remote-browser-list li.remote-browser-message:hover {
    background: transparent;
}

.remote-browser-message span {
    min-width: 0;
    overflow-wrap: anywhere;
    white-space: normal;
}

.remote-browser-message-error {
    color: #b91c1c !important;
}

.remote-browser-message-muted {
    color: var(--text-secondary) !important;
}

.remote-browser-status.error {
    color: #b91c1c;
    line-height: 1.25;
}

.remote-browser-status.success {
    color: #047857;
}

.remote-row-main,
.remote-folder-select,
.remote-row-action {
    align-items: center;
    background: transparent;
    border: 0;
    color: var(--text-primary);
    display: flex;
    font: inherit;
    min-height: 2.35rem;
}

.remote-row-main,
.remote-folder-select {
    cursor: pointer;
    gap: 0.55rem;
    min-width: 0;
    padding: 0 0.55rem;
    text-align: left;
}

.remote-row-main span,
.remote-folder-name span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.remote-folder-name {
    align-items: center;
    display: flex;
    gap: 0.4rem;
    min-width: 0;
}

.remote-folder-name em {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 999px;
    color: #047857;
    flex: 0 0 auto;
    font-size: 0.68rem;
    font-style: normal;
    font-weight: 850;
    padding: 0.12rem 0.45rem;
}

.remote-folder-connected .remote-folder-select {
    color: var(--text-secondary);
}

.remote-folder-connected .remote-folder-name > i {
    color: #047857;
}

.remote-folder-connected input {
    accent-color: #10b981;
}

.remote-row-action {
    border-radius: 7px;
    cursor: pointer;
    justify-content: center;
    padding: 0;
}

.remote-row-action:hover,
.remote-row-main:hover,
.remote-folder-select:hover {
    background: rgba(99, 102, 241, 0.1);
}

.remote-browser-list input {
    flex: 0 0 auto;
    height: 1rem;
    margin: 0;
    min-height: 1rem;
    width: 1rem;
}

@media (max-width: 920px) {
    .import-network-panel {
        grid-template-columns: 1fr;
    }

    .import-network-panel > .form-group,
    .import-network-panel .network-kind-field,
    .import-network-panel .network-saved-field,
    .import-network-panel .network-source-name-field,
    .import-network-panel .network-username-field,
    .import-network-panel .network-password-field,
    .import-network-panel .network-domain-field,
    .import-network-panel .network-note-field {
        grid-column: 1 / -1;
    }
}

@media (max-width: 720px) {
    .modal.workspace-modal {
        padding: 0.4rem;
    }

    .modal.workspace-modal .import-modal-content {
        border-radius: 10px;
    }
}

/* Explorer-like folder browser */
.folder-browser-view {
    align-content: start;
    display: block;
    overflow: auto;
}

.folder-browser-view.grid-view {
    display: block;
    grid-template-columns: none;
    width: 100%;
}

.folder-browser-shell {
    display: grid;
    gap: 0.8rem;
    min-width: 0;
    width: 100%;
}

.folder-browser-actions {
    align-items: center;
    border: 1px solid var(--border-glass);
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    padding: 0.45rem 0.6rem;
}

.folder-browser-action-hint {
    color: var(--text-secondary);
    font-size: 0.78rem;
}

.folder-breadcrumbs {
    align-items: center;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(99, 102, 241, 0.12);
    border-radius: 10px;
    display: flex;
    gap: 0.35rem;
    min-height: 2.4rem;
    overflow-x: auto;
    padding: 0.35rem 0.45rem;
    width: 100%;
    box-sizing: border-box;
}

.folder-breadcrumbs button {
    background: transparent;
    border: 0;
    border-radius: 7px;
    color: var(--text-secondary);
    cursor: pointer;
    flex: 0 0 auto;
    font-size: 0.82rem;
    font-weight: 800;
    min-height: 1.75rem;
    padding: 0 0.55rem;
}

.folder-breadcrumbs button:hover,
.folder-breadcrumbs button.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent-indigo);
}

.folder-breadcrumbs i {
    color: var(--text-muted);
    flex: 0 0 auto;
    font-size: 0.68rem;
}

.folder-path-copy {
    align-items: center;
    display: flex;
    gap: 0.5rem;
    border: 1px solid var(--border-glass);
    padding: 0.35rem;
}

.folder-path-copy.hidden { display: none; }

.folder-path-copy input {
    background: var(--bg-glass-active);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
    padding: 0.55rem 0.65rem;
}

.folder-browser-grid {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    width: 100%;
}

.folder-browser-folder-row,
.folder-browser-document-grid {
    display: grid;
    gap: 0.45rem;
    grid-template-columns: repeat(var(--folder-gallery-columns, 3), minmax(0, 1fr));
    width: 100%;
}

.folder-browser-folder-row:empty { display: none; }

.folder-browser-tile {
    align-items: stretch;
    background: #ffffff;
    border: 1px solid #e1e5ee;
    border-radius: 0;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-height: 12rem;
    padding: 0.55rem 0.7rem;
    text-align: left;
}

.folder-browser-tile:hover {
    background: #f1f4ff;
    border-color: #9aa8e8;
}

.folder-browser-tile.folder-tile {
    align-items: center;
    flex-direction: row;
    min-height: 3rem;
    height: 3rem;
    justify-content: flex-start;
    padding: 0.45rem 0.7rem;
}

/* Optional Picasa-style recursive folder gallery. */
.folder-picasa-view .folder-browser-grid {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.folder-picasa-section { width: 100%; }
.folder-picasa-section .picasa-folder-heading {
    align-items: center;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    color: var(--text-primary, #1f2937);
    display: flex;
    font-size: 1rem;
    gap: .55rem;
    margin: 0 0 .55rem;
    min-height: 2.25rem;
    padding: .35rem .1rem;
}
.folder-picasa-section .picasa-folder-heading i { color: var(--accent-indigo, #6366f1); }
.folder-picasa-section .picasa-folder-heading small {
    color: var(--text-secondary, #64748b);
    font-size: .78rem;
    font-weight: 400;
    margin-left: auto;
}
.folder-picasa-grid {
    display: grid !important;
    gap: .55rem;
    grid-template-columns: repeat(var(--folder-gallery-columns, 3), minmax(0, 1fr));
    width: 100%;
}

.folder-browser-tile i {
    color: var(--accent-indigo);
    font-size: 1rem;
}

.folder-browser-tile > span:not(.folder-gallery-thumbnail) {
    font-weight: 750;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.folder-browser-tile small {
    color: var(--text-secondary);
    font-size: 0.7rem;
    margin-top: 0;
}

.folder-browser-tile.document-tile i {
    color: #64748b;
}

.folder-gallery-thumbnail {
    align-items: center;
    background: #f8f9fc;
    border: 1px solid var(--border-glass);
    display: flex;
    aspect-ratio: 1 / 1.4142;
    height: auto;
    min-height: 9rem;
    justify-content: center;
    overflow: hidden;
    position: relative;
    width: 100%;
}

.folder-gallery-thumbnail-fallback {
    align-items: center;
    color: var(--accent-indigo);
    display: flex;
    font-size: 2.5rem;
    height: 100%;
    justify-content: center;
    position: absolute;
    width: 100%;
}

.folder-gallery-index-status {
    color: #64748b;
    font-size: 1rem;
    position: absolute;
    right: 0.45rem;
    top: 0.4rem;
    z-index: 3;
}

.folder-gallery-index-status.is-indexed { color: #16a34a; }

.folder-gallery-thumbnail-image {
    height: 100%;
    object-fit: contain;
    opacity: 0;
    position: relative;
    transition: opacity 0.15s ease;
    width: 100%;
    z-index: 1;
}

.folder-browser-view .folder-gallery-thumbnail-fallback i {
    font-size: 2.5rem;
}

@media (max-width: 700px) {
    .folder-browser-folder-row,
    .folder-browser-document-grid {
        grid-template-columns: repeat(min(2, var(--folder-gallery-columns, 2)), minmax(0, 1fr));
    }
}

.folder-gallery-thumbnail-image.loaded {
    opacity: 1;
}

.folder-gallery-filename {
    font-family: "Arial Narrow", "Roboto Condensed", "Liberation Sans Narrow", Arial, sans-serif;
    font-stretch: condensed;
    font-weight: 400;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.folder-browser-empty {
    grid-column: 1 / -1;
}

/* Shared delayed document preview for inbox and folder galleries. */
.timeline-feed.grid-view .timeline-card.paperless-card:hover .paperless-thumb {
    border-color: rgba(15, 23, 42, 0.14);
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.14);
    transform: none;
}

.document-hover-preview {
    align-items: center;
    background: rgba(15, 23, 42, 0.72);
    display: flex;
    inset: 0;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    position: fixed;
    transition: opacity 0.14s ease;
    z-index: 10050;
}

.document-hover-preview.is-visible {
    opacity: 1;
}

.document-hover-preview-page {
    align-items: center;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 1rem);
    justify-content: center;
    max-width: calc(100vw - 1rem);
    position: relative;
}

.document-hover-preview-page img {
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.2);
    height: calc(100vh - 1rem);
    max-height: calc(100vh - 1rem);
    max-width: calc(100vw - 1rem);
    object-fit: contain;
    width: auto;
}

.document-hover-preview-caption {
    background: rgba(255, 255, 255, 0.96);
    bottom: 0;
    color: #0f172a;
    font-family: "Arial Narrow", "Roboto Condensed", "Liberation Sans Narrow", Arial, sans-serif;
    font-size: 0.9rem;
    max-width: min(70vw, 48rem);
    overflow: hidden;
    padding: 0.45rem 0.7rem;
    position: absolute;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 700px) {
    .document-hover-preview-page img {
        height: auto;
        max-height: calc(100vh - 1rem);
        max-width: calc(100vw - 1rem);
        width: 100%;
    }
}

.folder-details-toolbar {
    align-items: center;
    border: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0.7rem;
}

.folder-details-toolbar summary {
    cursor: pointer;
    color: var(--accent-indigo);
    font-weight: 700;
}

.folder-column-menu {
    background: var(--bg-glass-active);
    border: 1px solid var(--border-glass);
    display: grid;
    gap: 0.45rem;
    margin-top: 0.4rem;
    padding: 0.65rem;
    position: absolute;
    right: 0;
    z-index: 5;
}

.folder-details-toolbar details {
    position: relative;
}

.folder-details-grid {
    display: block;
    overflow-x: auto;
}

.folder-details-table {
    border-collapse: collapse;
    min-width: 100%;
    white-space: nowrap;
}

.folder-details-table th,
.folder-details-table td {
    border-bottom: 1px solid var(--border-glass);
    padding: 0.65rem 0.75rem;
    text-align: left;
}

.folder-details-table th {
    background: var(--bg-glass-active);
    color: var(--text-secondary);
    font-size: 0.78rem;
}

.folder-detail-sort {
    background: transparent;
    border: 0;
    color: inherit;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    padding: 0;
    text-align: left;
    width: 100%;
}

.folder-detail-sort:hover {
    color: var(--accent-indigo);
}

.folder-details-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.06);
}

.folder-detail-index {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.folder-detail-index.is-indexed { color: #16a34a; }
.folder-detail-index.is-not-indexed { color: var(--text-secondary); }

.engine-connection-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-glass);
}

.engine-connection-head h3 {
    margin: 0.2rem 0 0.35rem;
}

.engine-connection-head .settings-help-text {
    margin: 0;
}

.engine-connection-status {
    margin: 0.75rem 0 1rem;
    padding: 0.55rem 0.7rem;
    border-left: 3px solid var(--border-glass);
    color: var(--text-secondary);
    font-size: 0.78rem;
}

.engine-connection-status.success {
    border-left-color: var(--success-color);
    color: var(--success-color);
}

.engine-connection-status.error {
    border-left-color: #dc2626;
    color: #dc2626;
}

@media (max-width: 700px) {
    .engine-connection-head {
        flex-direction: column;
    }
}

.sidebar-tools {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0.75rem 0;
    padding: 0.65rem 0;
    border-top: 1px solid var(--border-glass);
    border-bottom: 1px solid var(--border-glass);
}

.sidebar-search-wrapper {
    width: 100%;
    max-width: none;
}

.sidebar-search-wrapper .search-icon {
    left: 0.7rem;
    font-size: 0.8rem;
}

.sidebar-search-wrapper input {
    min-height: 34px;
    padding: 0.5rem 2.1rem 0.5rem 2.1rem;
    font-size: 0.78rem;
}

.search-help-toggle {
    align-items: center;
    background: transparent;
    border: 0;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    height: 28px;
    justify-content: center;
    padding: 0;
    position: absolute;
    right: 0.45rem;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    z-index: 3;
}
.search-help-toggle:hover, .search-help-toggle:focus-visible { color: var(--accent-indigo); }
.search-help-popover {
    background: var(--bg-glass-active);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    left: auto;
    line-height: 1.3;
    padding: 0.8rem;
    position: absolute;
    top: calc(100% + 0.45rem);
    width: min(330px, calc(100vw - 2rem));
    right: 0;
    z-index: 100;
}
.search-help-popover[hidden] {
    display: none !important;
}
.search-help-popover strong {
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 700;
}
.search-help-row {
    display: grid;
    gap: 0.12rem 0.5rem;
    grid-template-columns: 4.6rem minmax(0, 1fr);
    font-size: 0.78rem;
}
.search-help-row > span:first-child {
    color: var(--text-primary);
    font-weight: 600;
}
.search-help-row > span:nth-child(2) {
    color: var(--text-secondary);
}
.search-help-row code {
    color: var(--accent-indigo);
    font-size: 0.72rem;
    grid-column: 2;
    overflow-wrap: anywhere;
}
.search-help-filter {
    border-top: 1px solid var(--border-glass);
    padding-top: 0.55rem;
}

.sidebar-tool-actions {
    display: grid;
    grid-template-columns: auto repeat(3, minmax(0, 1fr));
    gap: 0.35rem;
}

.sidebar-tool-actions .theme-toggle-btn,
.sidebar-tool-actions .btn-scan {
    min-width: 0;
    min-height: 34px;
    padding: 0.45rem 0.55rem;
    font-size: 0.75rem;
}

.sidebar-tool-actions .theme-toggle-btn {
    width: 34px;
    background: transparent;
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    cursor: pointer;
}

/* Keep the primary sidebar actions aligned and predictable. */
.sidebar-tool-actions > button {
    align-items: center;
    display: inline-flex;
    height: 36px;
    justify-content: center;
    margin: 0;
    min-height: 36px;
    white-space: nowrap;
}

body.left-sidebar-collapsed .sidebar-tools {
    align-items: center;
    width: 42px;
}

body.left-sidebar-collapsed .sidebar-search-wrapper {
    height: 42px;
    overflow: hidden;
    position: relative;
    width: 42px;
}

body.left-sidebar-collapsed .sidebar-search-wrapper input {
    cursor: pointer;
    height: 42px;
    opacity: 0;
    padding: 0;
    position: absolute;
    width: 42px;
    z-index: 2;
}

body.left-sidebar-collapsed .sidebar-search-wrapper .search-icon {
    align-items: center;
    background: var(--bg-glass-active);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    display: flex;
    height: 42px;
    justify-content: center;
    left: 0;
    width: 42px;
}
body.left-sidebar-collapsed .search-help-toggle,
body.left-sidebar-collapsed .search-help-popover { display: none; }

body.left-sidebar-collapsed .sidebar-tool-actions {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    width: 42px;
}

body.left-sidebar-collapsed .sidebar-tool-actions > button {
    height: 42px;
    min-height: 42px;
    overflow: visible;
    padding: 0;
    position: relative;
    width: 42px;
}

body.left-sidebar-collapsed .sidebar-tool-actions > button:not(#themeToggleBtn) {
    font-size: 0;
}

body.left-sidebar-collapsed .sidebar-tool-actions > button::after,
body.left-sidebar-collapsed .sidebar-nav li a::after,
body.left-sidebar-collapsed .settings-page-tabs a::after {
    background: var(--bg-glass-active);
    border: 1px solid var(--border-glass);
    border-radius: 6px;
    color: var(--text-primary);
    content: attr(data-flyout);
    font-size: 0.78rem;
    font-weight: 600;
    left: calc(100% + 0.6rem);
    opacity: 0;
    padding: 0.55rem 0.7rem;
    pointer-events: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%) translateX(-4px);
    transition: opacity 0.12s ease, transform 0.12s ease;
    white-space: nowrap;
    z-index: 10060;
}

body.left-sidebar-collapsed .sidebar-tool-actions > button:hover::after,
body.left-sidebar-collapsed .sidebar-nav li:hover a::after,
body.left-sidebar-collapsed .sidebar-search-wrapper:hover::after {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

body.left-sidebar-collapsed .sidebar-search-wrapper::after {
    background: var(--bg-glass-active);
    border: 1px solid var(--border-glass);
    border-radius: 6px;
    color: var(--text-primary);
    content: "Suche";
    font-size: 0.78rem;
    font-weight: 600;
    left: calc(100% + 0.6rem);
    opacity: 0;
    padding: 0.55rem 0.7rem;
    pointer-events: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%) translateX(-4px);
    transition: opacity 0.12s ease, transform 0.12s ease;
    white-space: nowrap;
    z-index: 10060;
}

#settingsTheme {
    min-height: 36px;
    width: 100%;
}

#settingsThemeHint {
    color: var(--text-secondary);
    display: block;
    font-size: 0.72rem;
    margin-top: 0.35rem;
}

/* Compact workspace chrome keeps the title, count, and view controls in one rhythm. */
.feed-header {
    align-items: center;
    gap: 0.55rem;
    min-height: 36px;
}

.feed-header h1 {
    line-height: 1.1;
}

.feed-counter {
    line-height: 1;
    margin: 0;
}

.feed-controls {
    align-items: center;
    min-height: 38px;
}

/* Immich-inspired workspace: calm surfaces, restrained chrome, and gallery-first layout. */
:root {
    --bg-dark: #111318;
    --bg-glass: #191b21;
    --bg-glass-active: #23262e;
    --border-glass: #30343d;
    --text-primary: #f1f3f5;
    --text-secondary: #a6adb8;
    --accent-indigo: #8b9cf7;
    --accent-glow: #8b9cf7;
}

body.light-theme {
    --bg-dark: #f7f8fa;
    --bg-glass: #ffffff;
    --bg-glass-active: #f8fafc;
    --border-glass: #e8eaee;
    --text-primary: #25282e;
    --text-secondary: #747b87;
    --accent-indigo: #5f6fd6;
    --accent-glow: #5f6fd6;
}

*,
*::before,
*::after {
    border-radius: 10px;
    box-shadow: none;
    background-image: none !important;
}

body,
.app-wrapper {
    background: var(--bg-dark);
}

.sidebar,
.main-content,
.glass {
    background: var(--bg-glass);
    border-color: var(--border-glass);
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.sidebar {
    border-right: 1px solid var(--border-glass);
    padding: 1.25rem 1rem;
    gap: 1.25rem;
}

.sidebar-nav { gap: 1.25rem; }
.sidebar-nav ul { gap: 0.2rem; }
.sidebar-nav li a { border-color: transparent; padding: 0.65rem 0.75rem; }
.sidebar-nav li.active a,
.sidebar-nav li a:hover { background: #f0f2f7; border-color: transparent; }
body:not(.light-theme) .sidebar-nav li.active a,
body:not(.light-theme) .sidebar-nav li a:hover { background: #252932; }

.feed-section,
.settings-page-body { gap: 1rem; }
.feed-header,
.folder-browser-actions,
.folder-details-toolbar { border-color: var(--border-glass); background: var(--bg-glass); }
.card-group,
.timeline-card,
.settings-page-body > .card-group { border: 1px solid var(--border-glass); background: var(--bg-glass); }
.folder-browser-tile { border-color: var(--border-glass); }
.folder-browser-tile:hover { border-color: #aeb8ec; }
.btn-primary,
.btn-scan { background: var(--accent-indigo); border-color: transparent; box-shadow: none; }
.btn-primary:hover,
.btn-scan:hover { background: #5062c8; box-shadow: none; }

.glow-orb {
    display: none !important;
    filter: none !important;
}

/* Final workspace layout: a quiet Immich-like header and an open gallery canvas. */
.app-wrapper {
    --left-sidebar-width: 260px;
}

.sidebar {
    padding: 1rem 0.8rem 0.75rem;
    gap: 0.9rem;
}

.sidebar-tools {
    border-bottom: 0;
    border-top: 0;
    margin: 0.35rem 0 0.75rem;
    padding: 0;
}

.sidebar-nav li a {
    min-height: 38px;
    padding: 0.55rem 0.7rem;
}

.timeline-container {
    gap: 0.35rem;
    padding: 0.55rem 1rem 0.8rem;
}

.feed-header {
    background: transparent !important;
    border: 0 !important;
    min-height: 42px;
    padding: 0.1rem 0;
}

.feed-header h1 {
    font-size: 1.35rem;
    font-weight: 650;
}

.feed-controls {
    background: transparent !important;
    border: 0 !important;
    border-bottom: 1px solid var(--border-glass) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    margin-bottom: 0.35rem;
    padding: 0.35rem 0 0.55rem;
}

.feed-control-label {
    font-size: 0.62rem;
}

.timeline-feed {
    padding-top: 0.25rem;
}

.sidebar-tool-actions > button {
    border-radius: 8px;
}

@media (max-width: 1050px) {
    .app-wrapper { --left-sidebar-width: 240px; }
}

/* Unified global search */
.unified-search-results {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-top: 0.5rem;
}

.unified-search-toolbar {
    align-items: center;
    background: var(--bg-glass);
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.7rem 0;
}

.unified-search-toolbar > span { color: var(--text-secondary); font-size: 0.85rem; }
.unified-search-toolbar > span strong { color: var(--text-primary); }
.unified-search-toolbar label { align-items: center; color: var(--text-secondary); display: flex; gap: 0.5rem; font-size: 0.78rem; }
.unified-search-toolbar select { min-width: 170px; }
.search-filter-actions { align-items: center; display: flex; gap: 0.6rem; }
.search-filter-toggle { background: transparent; border: 1px solid var(--border-glass); color: var(--text-primary); cursor: pointer; padding: 0.45rem 0.65rem; }
.search-filters { align-items: end; border-bottom: 1px solid var(--border-glass); display: flex; flex-wrap: wrap; gap: 0.65rem; padding: 0 0 0.7rem; }
.search-filters[hidden] { display: none; }
.search-filters label { color: var(--text-secondary); display: flex; flex-direction: column; font-size: 0.7rem; gap: 0.25rem; }
.search-filters input, .search-filters select { min-width: 115px; }
.search-filters .search-filter-tags { flex: 1 1 180px; }

.search-result-group { display: flex; flex-direction: column; gap: 0.45rem; }
.search-result-group h2 { align-items: center; display: flex; font-size: 1rem; gap: 0.5rem; margin: 0; }
.search-result-group h2 i { color: var(--accent-indigo); }
.search-result-group h2 span { color: var(--text-secondary); font-size: 0.75rem; font-weight: 500; }
.search-result-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.45rem; }
.search-result-gallery { grid-template-columns: repeat(var(--search-gallery-columns, 3), minmax(0, 1fr)); gap: 0.7rem; }
.search-result-item {
    align-items: center;
    background: transparent;
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    gap: 0.7rem;
    min-width: 0;
    padding: 0.7rem;
    text-align: left;
}
.search-result-gallery .search-result-item { align-items: stretch; flex-direction: column; gap: 0.45rem; padding: 0.45rem; }
.search-result-preview { align-items: center; background: var(--bg-secondary); display: flex; height: 190px; justify-content: center; overflow: hidden; position: relative; }
.search-result-documents .search-result-preview { aspect-ratio: 1 / 1.4142; height: auto; min-height: 0; }
.search-result-gallery.size-s .search-result-preview { height: 130px; }
.search-result-gallery.size-l .search-result-preview { height: 250px; }
.search-result-gallery.size-xl .search-result-preview { height: 330px; }
.search-result-documents.size-s .search-result-preview,
.search-result-documents.size-l .search-result-preview,
.search-result-documents.size-xl .search-result-preview { height: auto; }
.search-result-preview img { height: 100%; object-fit: contain; width: 100%; }
.search-result-preview.is-fallback { color: var(--accent-indigo); font-size: 2rem; }
.search-result-gallery .search-result-item > span:last-child { padding: 0.2rem 0.25rem 0.35rem; }
.search-result-item:hover { background: var(--accent-glow); border-color: var(--accent-indigo); }
.search-result-icon { align-items: center; background: var(--accent-glow); color: var(--accent-indigo); display: flex; flex: 0 0 30px; height: 30px; justify-content: center; }
.search-result-item > span:last-child { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.search-result-item strong { font-size: 0.85rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-result-item small { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.llm-analysis-prompt {
    min-height: 12rem;
    resize: vertical;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    line-height: 1.45;
}
.llm-learning-toggle { display: flex; align-items: center; gap: 0.45rem; margin-top: 0.6rem; }
.ai-trace-details { margin: 0.9rem 0; border-top: 1px solid var(--border-glass); padding-top: 0.65rem; }
.ai-trace-details summary { cursor: pointer; color: var(--accent-indigo); font-weight: 600; }
.ai-trace-details label { display: block; margin-top: 0.65rem; color: var(--text-secondary); font-size: 0.75rem; }
.ai-trace-details pre { max-height: 14rem; overflow: auto; white-space: pre-wrap; word-break: break-word; background: var(--bg-secondary); padding: 0.65rem; font-size: 0.75rem; }

/* Eingang processing pipeline */
.input-pipeline-feed { padding-top: 0.5rem; }
.input-pipeline-toolbar { align-items: center; border-bottom: 1px solid var(--border-glass); display: flex; justify-content: space-between; gap: 1rem; padding: 0.75rem 0 1rem; }
.input-pipeline-toolbar div { display: flex; flex-direction: column; gap: 0.2rem; }
.input-pipeline-toolbar-actions { align-items: center; display: flex !important; flex-direction: row !important; gap: 0.5rem !important; }
.input-pipeline-toolbar span { color: var(--text-secondary); font-size: 0.8rem; }
.input-pipeline-progress { color: var(--accent-indigo) !important; display: block; font-size: 0.75rem !important; margin-top: 0.45rem; }
.input-pipeline-progress strong { color: var(--text-primary); font-weight: 600; }
.input-pipeline-stacks { align-items: start; display: grid; gap: 1rem; grid-template-columns: repeat(5, minmax(0, 1fr)); padding-top: 1rem; }
.input-pipeline-stack { background: var(--bg-glass); border: 1px solid var(--border-glass); min-width: 0; }
.input-pipeline-stack.is-drop-target { background: var(--accent-glow); border-color: var(--accent-indigo); outline: 2px dashed var(--accent-indigo); outline-offset: 2px; }
.input-pipeline-stack > header { align-items: start; border-bottom: 1px solid var(--border-glass); display: flex; gap: 0.5rem; justify-content: space-between; padding: 0.8rem; }
.input-pipeline-stack h2 { font-size: 0.95rem; margin: 0; }
.input-pipeline-stack h2 i { color: var(--accent-indigo); margin-right: 0.35rem; }
.input-pipeline-stack p { color: var(--text-secondary); font-size: 0.75rem; margin: 0.25rem 0 0; }
.input-pipeline-state { color: var(--text-secondary); display: block; font-size: 0.68rem; margin-top: 0.35rem; }
.input-pipeline-state i { color: var(--text-secondary); font-size: 0.5rem; margin-right: 0.2rem; }
.input-pipeline-state.is-active { color: var(--accent-indigo); font-weight: 700; }
.input-pipeline-state.is-active i { color: var(--accent-indigo); }
.input-pipeline-count { align-items: center; background: var(--accent-indigo); border-radius: 999px; color: #fff; display: inline-flex; flex: 0 0 1.65rem; font-size: 0.78rem; font-weight: 700; height: 1.65rem; justify-content: center; line-height: 1; min-width: 1.65rem; padding: 0.2rem; }
.input-pipeline-list { display: flex; flex-direction: column; gap: 0.6rem; padding: 0.6rem; }
.input-pipeline-card { appearance: none; background: var(--bg-secondary); border: 1px solid var(--border-glass); color: var(--text-primary); cursor: pointer; display: flex; gap: 0.6rem; padding: 0.5rem; text-align: left; width: 100%; }
.input-pipeline-card[draggable="true"] { cursor: grab; }
.input-pipeline-card.is-dragging { opacity: 0.45; cursor: grabbing; }
.input-pipeline-card:hover { background: var(--accent-glow); border-color: var(--accent-indigo); }
.input-pipeline-thumb { align-items: center; background: var(--bg-primary); display: flex; flex: 0 0 48px; height: 68px; justify-content: center; overflow: hidden; }
.input-pipeline-thumb img { height: 100%; object-fit: contain; width: 100%; }
.input-pipeline-thumb i { color: var(--accent-indigo); font-size: 1.3rem; }
.input-pipeline-card-body { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.input-pipeline-card-body strong, .input-pipeline-card-body small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.input-pipeline-card-body strong { font-size: 0.8rem; }
.input-pipeline-card-body small { color: var(--text-secondary); font-size: 0.7rem; }
.input-pipeline-status { color: var(--accent-indigo); font-size: 0.68rem; line-height: 1.25; }
.input-pipeline-drag-hint { color: var(--text-secondary); font-size: 0.62rem; opacity: 0; transition: opacity 0.15s ease; }
.input-pipeline-card:hover .input-pipeline-drag-hint { opacity: 1; }
.input-pipeline-empty { color: var(--text-secondary); font-size: 0.8rem; padding: 1rem; text-align: center; }
.searchable-data-dropdown { position: relative; z-index: 1; }
.searchable-data-dropdown.is-open { z-index: 1000; }
.searchable-data-dropdown > input { padding-right: 2.2rem; }
.searchable-data-dropdown::after { color: var(--text-secondary); content: "\\f078"; font-family: "Font Awesome 6 Free"; font-size: 0.7rem; font-weight: 900; pointer-events: none; position: absolute; right: 0.8rem; top: 50%; transform: translateY(-50%); }
.searchable-data-options { background: #fff; border: 1px solid var(--accent-indigo); border-radius: 0 0 10px 10px; box-shadow: 0 12px 28px rgba(0,0,0,0.28); display: none; isolation: isolate; left: 0; max-height: 18rem; min-height: 2.2rem; overflow-y: auto; position: absolute; right: 0; top: calc(100% - 1px); z-index: 2000; }
body:not(.light-theme) .searchable-data-options { background: #172033; }
.searchable-data-dropdown.is-open .searchable-data-options { display: block; }
.searchable-data-option { background: transparent; border: 0; color: var(--text-primary); cursor: pointer; display: block; font: inherit; overflow: hidden; padding: 0.65rem 0.8rem; text-align: left; text-overflow: ellipsis; white-space: nowrap; width: 100%; }
.searchable-data-option:hover, .searchable-data-option.is-selected { background: var(--accent-glow); color: #fff; }
.searchable-data-empty { color: var(--text-secondary); font-size: 0.78rem; padding: 0.75rem 0.8rem; }
.ai-detection-settings-fields { display: grid; gap: 0.45rem; min-width: min(32rem, 100%); }
.ai-detection-settings-fields input[type="url"], .ai-detection-settings-fields input[type="password"] { min-width: 0; }
.settings-connection-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: flex-end; }
.ai-detection-result { border: 1px solid var(--border-glass); border-left: 4px solid var(--accent-indigo); border-radius: 8px; color: var(--text-primary); margin: 0.75rem 0; padding: 0.65rem 0.8rem; }
.ai-detection-result.is-ai { border-left-color: #ef4444; }
.ai-detection-result.is-human { border-left-color: #10b981; }
.pipeline-prompt-modal-content { max-width: min(760px, 92vw); width: 760px; }
.pipeline-prompt-input { background: var(--bg-secondary); border: 1px solid var(--border-glass); border-radius: 10px; color: var(--text-primary); font: 0.82rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; min-height: 22rem; padding: 0.85rem; resize: vertical; width: 100%; }
.pipeline-prompt-actions { align-items: center; display: flex; gap: 1rem; justify-content: space-between; margin-top: 0.75rem; }
.settings-url-row { align-items: end; column-gap: 0.75rem; display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.settings-url-row > label { grid-column: 1 / -1; }
.settings-url-row > input { min-width: 0; }
.settings-url-row > button { height: 2.65rem; white-space: nowrap; }
@media (max-width: 1050px) { .input-pipeline-stacks { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .settings-url-row { grid-template-columns: 1fr; } .settings-url-row > button { width: 100%; } }
