        /* Empty State */
        .empty-state {
            display: none;
            flex-direction: column;
            align-items: center;
            /* Top-aligned (not centred) so the illustration is always visible
               near the top of a blank view rather than floating mid-screen. */
            justify-content: flex-start;
            padding: var(--space-16) var(--space-10);
            text-align: center;
        }

        .empty-state.visible {
            display: flex;
        }

        .empty-state-art {
            display: flex;
            justify-content: center;
            align-items: center;
            width: 100%;
            max-width: 800px;
            margin-bottom: 1rem;
        }

        .empty-state-art svg {
            width: 100%;
            height: 100%;
            max-height: 220px;
        }

        .empty-state-image {
            display: block;
            width: 100%;
            max-width: 320px;
            height: auto;
            opacity: 0.5;
        }

        .empty-state-text {
            font-family: var(--font-family);
            font-size: var(--font-size-14);
            color: var(--text-tertiary);
            line-height: 1.6;
            max-width: 280px;
            font-style: italic;
            text-align: center;
            margin-top: 0.5rem;
        }

        /* Today-specific empty state */
        #todayEmptyState {
            justify-content: flex-start;
            padding: var(--space-10) var(--space-5);
            height: 100%;
        }

        #todayEmptyState .empty-state-image {
            max-width: 280px;
        }

        /* Tasks View */
        .tasks-view {
            display: none;
            flex-direction: column;
        }

        .tasks-view.active {
            display: flex;
        }

        .tasks-header {
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            gap: var(--space-4);
            margin-bottom: 24px;
        }

        .tasks-filter {
            display: flex;
            gap: var(--space-1);
            background: var(--bg-secondary);
            padding: var(--space-1);
            border-radius: var(--radius-md);
        }

        .tasks-filter-btn {
            padding: var(--space-1-5) var(--space-3-5);
            border: none;
            background: transparent;
            font-family: var(--font-family);
            font-size: var(--font-size-sm);
            font-weight: 500;
            color: var(--text-secondary);
            border-radius: var(--radius-sm);
            cursor: pointer;
            transition: all var(--transition-fast);
        }

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

        .tasks-filter-btn.active {
            background: white;
            color: var(--text-primary);
            box-shadow: var(--shadow-1);
        }

        .tasks-content {
            flex: 1;
            min-height: 0;
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }

        /* Archive View */
        .archive-view {
            display: none;
            flex-direction: column;
        }

        .archive-view.active {
            display: flex;
        }

        .archive-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 8px;
        }

        .archive-select-all {
            display: flex;
            align-items: center;
            gap: var(--space-2);
            cursor: pointer;
            font-size: var(--font-size-14);
            color: var(--text-secondary);
            user-select: none;
        }

        .archive-select-all input[type="checkbox"] {
            width: 18px;
            height: 18px;
            cursor: pointer;
            accent-color: var(--accent-blue);
        }

        [data-theme="dark"] .archive-select-all input[type="checkbox"] {
            color-scheme: dark;
        }

        /* Unguarded, this darkened the NATIVE checkbox for every 'system' user
           on a dark OS — including one who had explicitly chosen light, giving
           a dark control inside a light UI. The guard, not a root-level
           `color-scheme`: setting that at :root would restyle every native
           control in the app. */
        @media (prefers-color-scheme: dark) {
            :root:not([data-theme="light"]) .archive-select-all input[type="checkbox"] {
                color-scheme: dark;
            }
        }

        .archive-select-all:hover {
            color: var(--text-primary);
        }

        .archive-select-all:hover .select-all-label {
            color: var(--text-primary);
        }

        .archive-search-wrapper {
            position: relative;
        }

        .archive-search-btn {
            width: 32px;
            height: 32px;
            border: none;
            background: transparent;
            border-radius: var(--radius-sm);
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--text-tertiary);
            transition: all var(--transition-fast);
        }

        .archive-search-btn:hover {
            background: var(--bg-hover);
            color: var(--text-secondary);
        }

        .archive-search-btn.active {
            background: var(--bg-secondary);
            color: var(--accent-blue);
        }

        .archive-search-btn svg {
            width: 18px;
            height: 18px;
        }

        .archive-search-dropdown {
            position: absolute;
            top: calc(100% + 8px);
            right: 0;
            width: 280px;
            background: white;
            border-radius: var(--radius-md);
            box-shadow: var(--shadow-2);
            border: 1px solid var(--border-light);
            opacity: 0;
            visibility: hidden;
            transform: translateY(-8px) scale(0.95);
            transition: all var(--transition-normal);
            z-index: var(--z-layer-raised);
            overflow: hidden;
        }

        .archive-search-dropdown.visible {
            opacity: 1;
            visibility: visible;
            transform: translateY(0) scale(1);
        }

        .archive-search-input {
            width: 100%;
            padding: var(--space-3) var(--space-3-5);
            border: none;
            border-bottom: 1px solid var(--border-light);
            font-family: var(--font-family);
            font-size: var(--font-size-14);
            outline: none;
            box-sizing: border-box;
        }

        .archive-search-input::placeholder {
            color: var(--text-tertiary);
        }

        .archive-search-results {
            max-height: 240px;
            overflow-y: auto;
        }

        .archive-search-item {
            display: flex;
            align-items: center;
            gap: var(--space-2-5);
            padding: var(--space-3) var(--space-4);
            cursor: pointer;
            transition: background-color var(--transition-fast);
        }

        .archive-search-item:hover {
            background: var(--bg-hover);
        }

        .archive-search-item-icon {
            width: 20px;
            height: 20px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--text-tertiary);
        }

        .archive-search-item-icon svg {
            width: 16px;
            height: 16px;
        }

        .archive-search-item-label {
            font-family: var(--font-family);
            font-size: var(--font-size-sm);
            color: var(--text-primary);
        }

        .archive-search-item-type {
            font-family: var(--font-family);
            font-size: var(--font-size-xs);
            color: var(--text-tertiary);
            margin-left: auto;
        }

        .archive-search-empty {
            padding: 16px 14px;
            text-align: center;
            font-family: var(--font-family);
            font-size: var(--font-size-sm);
            color: var(--text-tertiary);
        }

        .archive-active-filter {
            display: none;
            align-items: center;
            gap: var(--space-2);
            margin-bottom: 12px;
        }

        .archive-active-filter.visible {
            display: flex;
        }

        .archive-filter-tag {
            display: flex;
            align-items: center;
            gap: var(--space-1-5);
            padding: var(--space-1) var(--space-2-5);
            background: var(--accent-fill);
            color: white;
            border-radius: var(--radius-lg);
            font-family: var(--font-family);
            font-size: var(--font-size-12);
            font-weight: 500;
        }

        .archive-filter-tag-close {
            width: 14px;
            height: 14px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            opacity: 0.8;
            transition: opacity var(--transition-fast);
        }

        .archive-filter-tag-close:hover {
            opacity: 1;
        }

        .archive-filter-tag-close svg {
            width: 10px;
            height: 10px;
        }

        .archive-content {
            flex: 1;
            padding-top: 8px;
        }

        .archive-group {
            margin-bottom: 24px;
        }

        .archive-group-header {
            font-family: var(--font-family);
            font-size: var(--font-size-14);
            font-weight: 600;
            color: var(--text-primary);
            padding-bottom: 8px;
            border-bottom: 1px solid var(--border-light);
            margin-bottom: 8px;
        }

        .archive-task-row {
            display: flex;
            align-items: center;
            gap: var(--space-3);
            padding: var(--space-3) var(--space-2);
            border-radius: var(--radius-md);
            cursor: pointer;
            transition: background-color var(--transition-fast);
        }

        .archive-task-row:hover {
            background: var(--bg-hover);
        }

        .archive-checkbox-wrapper {
            flex-shrink: 0;
        }

        .archive-checkbox {
            width: 20px;
            height: 20px;
            border: 1.5px solid var(--accent-blue);
            border-radius: var(--radius-sm);
            background: var(--accent-blue);
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all var(--transition-fast);
        }

        .archive-checkbox svg {
            width: 12px;
            height: 12px;
            stroke: white;
            stroke-width: 2.5;
        }

        .archive-checkbox:hover {
            transform: scale(1.05);
            box-shadow: 0 0 0 3px var(--accent-blue-opacity-20);
        }

        .archive-task-date {
            width: 60px;
            flex-shrink: 0;
            font-family: var(--font-family);
            font-size: var(--font-size-sm);
            font-weight: 500;
            color: var(--accent-blue);
        }

        .archive-task-content {
            flex: 1;
            min-width: 0;
            display: flex;
            flex-direction: column;
            gap: var(--space-half);
        }

        .archive-task-title {
            font-family: var(--font-family);
            font-size: var(--font-size-14);
            font-weight: 400;
            color: var(--text-primary);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .archive-task-title.has-notes::after {
            content: '';
            display: inline-block;
            width: 12px;
            height: 12px;
            margin-left: 6px;
            background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpolyline points='14 2 14 8 20 8'/%3E%3C/svg%3E");
            background-size: contain;
            vertical-align: middle;
            opacity: 0.5;
        }

        .archive-task-project {
            font-family: var(--font-family);
            font-size: var(--font-size-12);
            color: var(--text-tertiary);
        }
