/* ============================================================
   24todo — Premium Dark Mode Stylesheet
   Mobile-first, glassmorphism, micro-animations
   ============================================================ */

/* --- Design Tokens (Dark — default) --- */
:root {
    --bg-primary: #0f0f14;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.07);
    --bg-active: rgba(79, 140, 255, 0.08);
    --bg-input: rgba(255, 255, 255, 0.06);
    --bg-input-bar: rgba(15, 15, 20, 0.92);
    --accent: #4f8cff;
    --accent-hover: #6ba0ff;
    --accent-glow: rgba(79, 140, 255, 0.25);
    --text-primary: #f0f0f5;
    --text-secondary: #8a8a9a;
    --text-muted: #555566;
    --danger: #ff5c5c;
    --danger-hover: #ff7a7a;
    --border: rgba(255, 255, 255, 0.06);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-pill: 100px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color-scheme: dark light;
}

/* --- Design Tokens (Light — system preference) --- */
@media (prefers-color-scheme: light) {
    :root {
        --bg-primary: #f5f5f8;
        --bg-card: rgba(0, 0, 0, 0.03);
        --bg-card-hover: rgba(0, 0, 0, 0.06);
        --bg-active: rgba(79, 140, 255, 0.06);
        --bg-input: rgba(0, 0, 0, 0.04);
        --bg-input-bar: rgba(245, 245, 248, 0.95);
        --accent: #3a75e0;
        --accent-hover: #2d63c4;
        --accent-glow: rgba(58, 117, 224, 0.2);
        --text-primary: #1a1a2e;
        --text-secondary: #5a5a6e;
        --text-muted: #9a9aaa;
        --danger: #e04040;
        --danger-hover: #c93030;
        --border: rgba(0, 0, 0, 0.08);
    }
}

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;
    height: 100dvh;
}

body {
    margin: 0;
    padding: 0;
}

/* --- App Container (Full-height flex layout) --- */
.app {
    max-width: 480px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    height: 100dvh;
    overflow: hidden;
}

/* --- Fixed Top Section (header + active card) --- */
.app-fixed-top {
    flex-shrink: 0;
    padding: 0 16px;
}

/* --- Fixed Bottom Section (categories + input) --- */
.app-fixed-bottom {
    flex-shrink: 1;
    min-height: 0;
    overflow: hidden;
    padding: 0 16px;
    display: flex;
    flex-direction: column;
    max-height: 50vh;
}

/* --- Header --- */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0 20px;
}

.app-logo {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.logo-accent {
    color: var(--accent);
}

.user-badge {
    font-size: 0.6rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    margin-left: 8px;
    vertical-align: middle;
}

.logout-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.7rem;
    padding: 2px 4px;
    margin-left: 4px;
    opacity: 0.5;
    transition: opacity 0.2s;
    vertical-align: middle;
}
.logout-btn:hover {
    opacity: 1;
    color: var(--danger);
}

/* --- Login Screen --- */
.login-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    padding: 2rem;
    text-align: center;
}

.login-logo {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

.login-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 280px;
}

.login-btn {
    display: block;
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    transition: transform 0.15s, box-shadow 0.15s;
    cursor: pointer;
}
.login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.login-btn-google {
    background: #fff;
    color: #333;
    border: 1px solid #dadce0;
}
.login-btn-google:hover {
    background: #f8f9fa;
}

.login-btn-microsoft {
    background: #2f2f2f;
    color: #fff;
    border: 1px solid #444;
}
.login-btn-microsoft:hover {
    background: #404040;
}

.login-btn-passkey {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border: 1px solid #7c3aed;
    cursor: pointer;
}
.login-btn-passkey:hover {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
}

/* --- Passkey Manager --- */
.passkey-section {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}
.passkey-section h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}
.passkey-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.passkey-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: var(--surface);
    border-radius: 8px;
    border: 1px solid var(--border);
}
.passkey-item-name {
    font-weight: 500;
    font-size: 0.9rem;
}
.passkey-item-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.passkey-item-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
}
.passkey-item-delete:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}
.passkey-register-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    transition: background 0.15s ease;
}
.passkey-register-btn:hover {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
}
.passkey-register-input {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.passkey-register-input input {
    flex: 1;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 0.85rem;
}

/* --- Clock --- */
.clock {
    text-align: right;
}

.clock-time {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.clock-elapsed {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 4px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.clock-pulse {
    color: var(--accent);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* --- Active Task Hero Card --- */
.active-task-card {
    background: var(--bg-active);
    border: 1px solid rgba(79, 140, 255, 0.15);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 20px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    animation: slideIn 0.3s var(--transition);
}

.active-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 600;
}

.active-task-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
}

.active-task-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.active-task-name {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
}

.active-category-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--accent);
    background: rgba(79, 140, 255, 0.12);
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    width: fit-content;
}

/* --- Section Labels --- */
.section-label {
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

/* --- Elapsed Timer (Large, Glowing — inside active card) --- */
.elapsed-timer {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--accent);
    text-align: center;
    margin-top: 14px;
    text-shadow: 0 0 16px var(--accent-glow), 0 0 40px rgba(79, 140, 255, 0.1);
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
}

/* --- Scroll Hint --- */
.scroll-hint {
    text-align: center;
    font-size: 0.56rem;
    font-weight: 500;
    color: var(--text-muted);
    padding: 8px 0 4px;
}

.load-more-btn {
    display: block;
    width: 100%;
    padding: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--accent);
    font-family: var(--font);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition);
    margin: 4px 0;
}

.load-more-btn:hover {
    background: var(--accent-glow);
}

/* --- Task List (scrollable, fills remaining space) --- */
.task-list-container {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 0 16px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.08) transparent;
}

.task-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.task-list-container::-webkit-scrollbar {
    width: 4px;
}

.task-list-container::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.08);
    border-radius: 2px;
}

/* --- Compact Single-Line Task Row --- */
.task-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 12px;
    min-height: 34px;
    transition: background var(--transition), opacity 0.4s ease;
    animation: slideIn 0.2s ease-out;
}

.task-item:hover {
    background: var(--bg-card-hover);
}

.task-active {
    border-left: 3px solid var(--accent);
    background: var(--bg-active);
}

/* Progressive fade for older tasks */
.task-item.task-aged-1 { opacity: 0.7; }
.task-item.task-aged-2 { opacity: 0.5; }

.task-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.task-name {
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
    min-width: 60px;
}

.task-untracked {
    color: var(--text-muted);
    font-style: italic;
    font-weight: 400;
    opacity: 0.6;
}

.task-badges {
    display: flex;
    flex-wrap: nowrap;
    gap: 3px;
    flex-shrink: 0;
}

.task-category-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 0.6rem;
    font-weight: 500;
    padding: 1px 6px;
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
    white-space: nowrap;
}

.badge-icon {
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

.badge-icon svg {
    vertical-align: middle;
}

.cat-icon-swatch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    flex-shrink: 0;
}

.active-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.active-category-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
    width: fit-content;
}

.task-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-left: 8px;
}

.task-duration {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.duration-active {
    color: var(--accent);
}

/* Hidden by default, visible on row hover */
.task-switch {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color var(--transition), background var(--transition), opacity var(--transition);
    line-height: 1;
    opacity: 0;
}

.task-item:hover .task-switch {
    opacity: 1;
}

.task-switch:hover {
    color: var(--accent);
    background: var(--accent-glow);
}

/* --- Task Input Bar (Pinned to bottom of viewport) --- */
.task-input-bar {
    position: sticky;
    bottom: 0;
    flex-shrink: 0;
    padding: 0;
    background: var(--bg-input-bar);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    z-index: 100;
}

.input-bar-inner {
    max-width: 480px;
    margin: 0 auto;
    padding: 10px 16px;
}

.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.category-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
    white-space: nowrap;
}

.chip-remove {
    background: none;
    border: none;
    color: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
    opacity: 0.6;
    transition: opacity var(--transition);
}

.chip-remove:hover {
    opacity: 1;
}

.input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cat-select-wrapper {
    position: relative;
}

.cat-toggle-btn {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 1rem;
    padding: 8px 10px;
    cursor: pointer;
    transition: border-color var(--transition);
    line-height: 1;
}

.cat-toggle-btn:hover {
    border-color: var(--accent);
}

.cat-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    min-width: 200px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px 0;
    margin-bottom: 6px;
    max-height: 240px;
    overflow-y: auto;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
}

.cat-dropdown-item {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    background: none;
    border: none;
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.8rem;
    padding: 8px 12px;
    cursor: pointer;
    transition: background var(--transition);
    text-align: left;
}

.cat-dropdown-item:hover {
    background: var(--bg-card-hover);
}

.cat-dropdown-item.cat-child {
    padding-left: 28px;
}

.cat-dropdown-item.cat-selected {
    background: var(--bg-active);
}

.cat-swatch {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.cat-icon {
    font-size: 0.75rem;
}

.cat-indent {
    color: var(--text-muted);
}

.cat-check {
    color: var(--accent);
    margin-left: auto;
}

.category-select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.8rem;
    padding: 10px 8px;
    cursor: pointer;
    min-width: 0;
    max-width: 100px;
    transition: border-color var(--transition);
}

.category-select:focus {
    outline: none;
    border-color: var(--accent);
}

.task-input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.9rem;
    padding: 10px 14px;
    transition: border-color var(--transition);
    min-width: 0;
}

.task-input::placeholder {
    color: var(--text-muted);
}

.task-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.task-submit {
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    padding: 10px 16px;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition);
    flex-shrink: 0;
}

.task-submit:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: scale(1.05);
}

.task-submit:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* --- Category Picker (Collapsible Accordion) --- */
.category-picker {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0;
    margin-bottom: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.category-picker.expanded {
    padding-bottom: 14px;
    flex: 1;
    min-height: 0;
}

.category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    user-select: none;
    transition: background var(--transition);
}

.category-header:hover {
    background: var(--bg-card-hover);
}

.category-header h4 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.category-toggle-indicator {
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform var(--transition);
}

.category-picker.expanded .category-toggle-indicator {
    transform: rotate(90deg);
}

.category-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out, overflow 0s 0.3s;
    padding: 0 16px;
}

.category-picker.expanded .category-content {
    max-height: none;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    transition: max-height 0.3s ease-in-out, overflow 0s 0s;
}

.category-add-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--accent);
    font-family: var(--font);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 4px 10px;
    cursor: pointer;
    transition: background var(--transition);
}

.category-add-btn:hover {
    background: rgba(79, 140, 255, 0.08);
}

.category-form {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.category-name-input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.8rem;
    padding: 8px 10px;
    min-width: 80px;
}

.category-name-input:focus {
    outline: none;
    border-color: var(--accent);
}

.category-parent-select,
.category-icon-select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.75rem;
    padding: 8px 6px;
    max-width: 100px;
}

.category-color-input {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    cursor: pointer;
    padding: 2px;
}

.category-color-input::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.category-create-btn {
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    font-family: var(--font);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 8px 12px;
    cursor: pointer;
    transition: background var(--transition);
    white-space: nowrap;
}

.category-create-btn:hover {
    background: var(--accent-hover);
}

.category-list {
    list-style: none;
    margin-top: 10px;
}

.category-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}

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

.category-child {
    padding-left: 16px;
    color: var(--text-muted);
}

.cat-display-icon {
    font-size: 0.75rem;
}

.cat-indent-marker {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.cat-name {
    flex: 1;
}

/* --- Status Messages --- */
.error-banner {
    background: rgba(255, 92, 92, 0.1);
    border: 1px solid rgba(255, 92, 92, 0.2);
    border-radius: var(--radius-sm);
    color: var(--danger);
    font-size: 0.8rem;
    padding: 10px 14px;
    margin-bottom: 14px;
    animation: slideIn 0.3s var(--transition);
}

.loading {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 20px;
}

/* --- Animations --- */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Responsive --- */
@media (min-width: 520px) {
    .app {
        padding: 24px;
    }

    .task-input-bar {
        padding: 14px calc(50% - 240px + 16px);
    }
}

/* --- Dark mode scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* --- Connection Status Dot --- */
.header-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.connection-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--danger);
    transition: background 0.5s ease;
    flex-shrink: 0;
}

.connection-dot.connected {
    background: #4caf50;
    box-shadow: 0 0 6px rgba(76, 175, 80, 0.5);
}

/* --- Suggestion Dropdown --- */
.suggestion-dropdown {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    max-height: 200px;
    overflow-y: auto;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.suggestion-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    text-align: left;
    transition: background var(--transition);
}

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

.suggestion-item:hover {
    background: var(--bg-card-hover);
}

.suggestion-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.suggestion-freq {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-left: 8px;
    flex-shrink: 0;
}

/* --- Category Search in Dropdown --- */
.cat-search-input {
    width: 100%;
    padding: 8px 10px;
    background: var(--bg-input);
    border: none;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    font: inherit;
    font-size: 0.85rem;
    outline: none;
    box-sizing: border-box;
}

.cat-search-input::placeholder {
    color: var(--text-muted);
}

.cat-search-input:focus {
    background: var(--bg-card-hover);
}

/* --- SSE Highlight Animation --- */
@keyframes sseHighlight {
    0% {
        background: var(--accent-glow);
    }
    100% {
        background: transparent;
    }
}

.task-item.sse-updated {
    animation: sseHighlight 1.5s ease-out;
}

/* ============================================================
   Entity Manager — People, Projects, Locations
   ============================================================ */

.entity-manager {
    margin-top: 12px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.entity-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
}

.entity-tab {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.72rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font);
    white-space: nowrap;
}

.entity-tab:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.entity-tab.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.entity-tab-content {
    animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.entity-add-form {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

.entity-add-input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.82rem;
    outline: none;
    transition: var(--transition);
}

.entity-add-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.entity-add-input::placeholder {
    color: var(--text-muted);
}

.entity-add-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.entity-add-btn:hover {
    background: var(--accent-hover);
}

.entity-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 180px;
    overflow-y: auto;
}

.entity-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    transition: var(--transition);
}

.entity-item:hover {
    background: var(--bg-card-hover);
}

.entity-icon {
    font-size: 0.9rem;
    line-height: 1;
}

.entity-swatch {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.entity-name {
    flex: 1;
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 500;
}

.entity-detail {
    color: var(--text-muted);
    font-size: 0.72rem;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.entity-badge {
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: var(--radius-pill);
    background: var(--text-muted);
    color: var(--bg-primary);
}

.entity-badge.inactive {
    background: var(--danger);
    color: #fff;
}

.entity-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    padding: 0 4px;
    transition: var(--transition);
    line-height: 1;
}

.entity-delete:hover {
    color: var(--danger);
}

.entity-empty {
    color: var(--text-muted);
    font-size: 0.78rem;
    text-align: center;
    padding: 12px 0;
    font-style: italic;
}

/* Entity chips in task input */
.entity-chip-person {
    background: rgba(168, 85, 247, 0.12);
    color: #a855f7;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.entity-chip-location {
    background: rgba(34, 197, 94, 0.12);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

/* Entity toggle buttons in input bar */
.entity-toggle {
    font-size: 0.85rem;
    opacity: 0.7;
    transition: var(--transition);
}

.entity-toggle:hover {
    opacity: 1;
}
