/* ============================================
   CSS CUSTOM PROPERTIES (THEME TOKENS)
   ============================================ */
:root {
    /* Primary palette */
    --primary: #2563EB;
    --primary-hover: #1D4ED8;
    --primary-light: rgba(37, 99, 235, 0.08);
    --primary-ghost: rgba(37, 99, 235, 0.04);

    /* Semantic colors */
    --success: #22C55E;
    --success-light: rgba(34, 197, 94, 0.1);
    --warning: #F59E0B;
    --warning-light: rgba(245, 158, 11, 0.1);
    --danger: #EF4444;
    --danger-light: rgba(239, 68, 68, 0.1);
    --info: #0EA5E9;
    --purple: #A855F7;

    /* Surfaces */
    --bg-body: #F8FAFC;
    --bg-card: #FFFFFF;
    --bg-sidebar: #FFFFFF;
    --bg-navbar: rgba(255, 255, 255, 0.82);
    --bg-input: #F1F5F9;
    --bg-hover: #F1F5F9;

    /* Text */
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-tertiary: #94A3B8;
    --text-inverse: #FFFFFF;

    /* Borders */
    --border: #E2E8F0;
    --border-light: #F1F5F9;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.03);

    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 72px;
    --navbar-height: 64px;
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.25s ease;
    --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   DARK MODE TOKENS
   ============================================ */
[data-theme="dark"] {
    --bg-body: #0F172A;
    --bg-card: #1E293B;
    --bg-sidebar: #1E293B;
    --bg-navbar: rgba(30, 41, 59, 0.88);
    --bg-input: #334155;
    --bg-hover: #334155;
    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-tertiary: #64748B;
    --border: #334155;
    --border-light: #1E293B;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.3);
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.2), 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background var(--transition-base), color var(--transition-base);
}

a {
    text-decoration: none;
    color: inherit;
}

ul, ol {
    list-style: none;
}

button {
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

input, textarea, select {
    font-family: inherit;
    font-size: inherit;
    border: none;
    outline: none;
    background: none;
    color: inherit;
}

img {
    max-width: 100%;
    display: block;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width var(--transition-slow), transform var(--transition-slow);
    overflow: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .sidebar-collapse-btn svg {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar.collapsed .sidebar-collapse-btn svg {
    transform: rotate(180deg);
}

.sidebar.collapsed .logo {
    justify-content: center;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 16px;
    min-height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    flex-shrink: 0;
}

.logo-text {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    transition: opacity var(--transition-base), width var(--transition-base);
}

.sidebar-collapse-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    transition: background var(--transition-fast), color var(--transition-fast);
}

.sidebar-collapse-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: 8px 12px;
    overflow-y: auto;
}

.sidebar-nav ul {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.nav-item svg {
    flex-shrink: 0;
}

.nav-item span {
    transition: opacity var(--transition-base), width var(--transition-base);
}

.nav-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.sidebar-footer {
    padding: 8px 12px 20px;
    border-top: 1px solid var(--border);
}

/* Sidebar Overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 99;
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.sidebar-overlay.visible {
    display: block;
    opacity: 1;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left var(--transition-slow);
    display: flex;
    flex-direction: column;
}

body.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

/* ============================================
   TOP NAVBAR
   ============================================ */
.top-navbar {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--navbar-height);
    background: var(--bg-navbar);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    gap: 16px;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    max-width: 480px;
}

.mobile-menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-xs);
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 0 14px;
    height: 40px;
    flex: 1;
    border: 1px solid transparent;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.search-box svg {
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.search-box input {
    flex: 1;
    height: 100%;
    font-size: 0.875rem;
    color: var(--text-primary);
}

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

.search-box kbd {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.7rem;
    color: var(--text-tertiary);
    font-weight: 600;
    line-height: 1;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-xs);
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    transition: background var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-text {
    background: none;
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: var(--radius-xs);
    transition: background var(--transition-fast);
}

.btn-text:hover {
    background: var(--primary-light);
}

.btn-quick-add span {
    /* Hidden on small screens via responsive.css */
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    position: relative;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.icon-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Dark mode toggle icons */
[data-theme="light"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }

/* Notification badge */
.notification-btn {
    position: relative;
}

.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    background: var(--danger);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 99px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
}

.notification-badge:empty,
.notification-badge[data-count="0"] {
    display: none;
}

/* Navbar date */
.navbar-date {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    font-weight: 500;
    white-space: nowrap;
}

/* Profile avatar */
.profile-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #7C3AED);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: box-shadow var(--transition-fast);
}

.profile-avatar:hover {
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* ============================================
   PAGE CONTENT
   ============================================ */
.page-content {
    flex: 1;
    padding: 28px;
}

.page {
    display: none;
    animation: fadeIn 0.3s ease;
}

.page.active {
    display: block;
}

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

.page-header {
    margin-bottom: 28px;
}

.page-title {
    font-size: 1.65rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.page-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Placeholder pages */
.placeholder-content {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 2px dashed var(--border);
    padding: 60px 28px;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 0.95rem;
}

/* ============================================
   STAT CARDS
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-light);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.78rem;
    color: var(--text-tertiary);
    font-weight: 500;
    margin-top: 2px;
}

/* ============================================
   DASHBOARD GRID
   ============================================ */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.dashboard-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-light);
    transition: box-shadow var(--transition-fast);
}

.dashboard-card:hover {
    box-shadow: var(--shadow-md);
}

.dashboard-card.card-wide {
    grid-column: span 2;
}

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

.card-header h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.card-badge {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-light);
    padding: 3px 10px;
    border-radius: 99px;
}

/* Chart containers */
.chart-container {
    position: relative;
    width: 100%;
    height: 260px;
}

.chart-container.chart-sm {
    height: 220px;
}

/* Empty states */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    gap: 12px;
}

.empty-state p {
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

/* Focus list / Deadline list / Activity list */
.focus-list,
.deadline-list,
.activity-list,
.project-progress-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 280px;
    overflow-y: auto;
}

.focus-item,
.deadline-item,
.activity-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-body);
    transition: background var(--transition-fast);
}

.focus-item:hover,
.deadline-item:hover,
.activity-item:hover {
    background: var(--bg-hover);
}

/* Priority dot */
.priority-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.priority-dot.low { background: #22C55E; }
.priority-dot.medium { background: #F59E0B; }
.priority-dot.high { background: #F97316; }
.priority-dot.urgent { background: #EF4444; }

/* Project progress bar */
.project-bar {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-body);
}

.project-bar-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
}

.project-bar-header span:first-child {
    font-weight: 600;
    color: var(--text-primary);
}

.project-bar-header span:last-child {
    color: var(--text-tertiary);
    font-weight: 500;
}

.progress-track {
    height: 6px;
    background: var(--border);
    border-radius: 99px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 99px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Quick Notes textarea */
.quick-notes-area textarea {
    width: 100%;
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 0.85rem;
    color: var(--text-primary);
    resize: vertical;
    line-height: 1.6;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.quick-notes-area textarea::placeholder {
    color: var(--text-tertiary);
}

.quick-notes-area textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 20px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
    max-width: 400px;
    font-size: 0.85rem;
    font-weight: 500;
    animation: toastIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.removing {
    opacity: 0;
    transform: translateX(40px);
}

.toast-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info .toast-icon { color: var(--primary); }

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

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

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

/* ============================================
   LOADING SKELETON (utility)
   ============================================ */
.skeleton {
    background: linear-gradient(90deg, var(--bg-input) 25%, var(--border-light) 50%, var(--bg-input) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-xs);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================
   SELECTION
   ============================================ */
::selection {
    background: rgba(37, 99, 235, 0.15);
    color: var(--text-primary);
}

/* ============================================
   PHASE 2: PAGE HEADER FLEX VARIANT
   ============================================ */
.page-header-flex {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

/* ============================================
   TASK TOOLBAR
   ============================================ */
.task-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
}

.task-search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 0 12px;
    height: 38px;
    flex: 1;
    min-width: 180px;
    border: 1px solid transparent;
    transition: border-color var(--transition-fast);
}

.task-search-box:focus-within {
    border-color: var(--primary);
}

.task-search-box svg {
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.task-search-box input {
    flex: 1;
    height: 100%;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.filter-select {
    height: 38px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: border-color var(--transition-fast), color var(--transition-fast);
    max-width: 160px;
}

.filter-select:hover,
.filter-select:focus {
    border-color: var(--primary);
    color: var(--text-primary);
}

.btn-icon-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    padding: 0 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.btn-icon-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-icon-toggle.active {
    background: var(--primary-light);
    color: var(--primary);
}

/* ============================================
   TASK LIST & CARDS
   ============================================ */
.task-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.task-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow-card);
    transition: box-shadow var(--transition-fast), transform var(--transition-fast);
    animation: fadeIn 0.25s ease;
}

.task-card:hover {
    box-shadow: var(--shadow-md);
}

.task-card.is-completed {
    opacity: 0.6;
}

.task-card.is-completed .task-card-title {
    text-decoration: line-through;
}

.task-check-btn {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
    color: #fff;
    transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.task-check-btn:hover {
    border-color: var(--success);
    transform: scale(1.08);
}

.task-check-btn.checked {
    background: var(--success);
    border-color: var(--success);
}

.task-card-body {
    flex: 1;
    min-width: 0;
    cursor: pointer;
}

.task-card-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.task-card-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-chip {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-light);
    padding: 2px 9px;
    border-radius: 99px;
    white-space: nowrap;
    flex-shrink: 0;
}

.task-card-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.5;
}

.task-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

/* Status badge */
.status-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 99px;
    color: var(--badge-color);
    background: color-mix(in srgb, var(--badge-color) 12%, transparent);
}

/* Due date badge — color coded countdown */
.due-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 99px;
}

.due-badge.due-later  { color: #16A34A; background: rgba(34,197,94,0.12); }
.due-badge.due-week   { color: #CA8A04; background: rgba(245,158,11,0.14); }
.due-badge.due-soon   { color: #EA580C; background: rgba(249,115,22,0.14); }
.due-badge.due-today  { color: #DC2626; background: rgba(239,68,68,0.14); }
.due-badge.due-overdue{ color: #FFFFFF; background: #991B1B; }
.due-badge.due-none   { color: var(--text-tertiary); background: var(--bg-input); }

.meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-tertiary);
    background: var(--bg-input);
    padding: 3px 9px;
    border-radius: 99px;
}

.mini-tag {
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-input);
    padding: 2px 8px;
    border-radius: 99px;
}

.task-card-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.task-action-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    transition: background var(--transition-fast), color var(--transition-fast);
}

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

.task-action-btn.danger:hover {
    background: var(--danger-light);
    color: var(--danger);
}

.task-empty-state {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 2px dashed var(--border);
    padding: 60px 28px;
}

/* ============================================
   MODAL SYSTEM
   ============================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-base), visibility var(--transition-base);
    padding: 20px;
}

.modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border-radius: 20px;
    width: 100%;
    max-width: 460px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
    transform: translateY(16px) scale(0.98);
    transition: transform var(--transition-slow);
    overflow: hidden;
}

.modal-overlay.visible .modal {
    transform: translateY(0) scale(1);
}

.modal-lg {
    max-width: 640px;
}

.modal-sm {
    max-width: 380px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.modal-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
}

.modal-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    transition: background var(--transition-fast), color var(--transition-fast);
}

.modal-close-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    flex-shrink: 0;
}

.btn-ghost {
    background: var(--bg-input);
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #DC2626;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* ============================================
   FORM ELEMENTS (inside modal)
   ============================================ */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group label .required {
    color: var(--danger);
}

.form-group label .hint {
    font-weight: 400;
    color: var(--text-tertiary);
    font-size: 0.72rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.form-row-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group input[type="time"],
.form-group input[type="number"],
.form-group input[type="file"],
.form-group textarea,
.form-group select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-group input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.form-group textarea {
    resize: vertical;
    line-height: 1.5;
}

.form-group select {
    cursor: pointer;
}

/* Tag input */
.tag-input-box {
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
}

.tag-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}

.tag-chips:empty {
    margin: 0;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--primary-light);
    color: var(--primary);
    padding: 3px 6px 3px 10px;
    border-radius: 99px;
}

.tag-chip button {
    color: var(--primary);
    font-size: 1rem;
    line-height: 1;
    opacity: 0.7;
}

.tag-chip button:hover {
    opacity: 1;
}

.tag-input-box input {
    background: none;
    border: none;
    width: 100%;
    font-size: 0.85rem;
    padding: 4px 2px;
}

/* Checklist / Subtask rows */
.checklist-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
}

.checklist-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    background: var(--bg-input);
    border-radius: var(--radius-xs);
}

.checklist-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}

.checklist-row span {
    flex: 1;
    font-size: 0.82rem;
    color: var(--text-primary);
}

.checklist-row span.done {
    text-decoration: line-through;
    color: var(--text-tertiary);
}

.remove-item-btn {
    color: var(--text-tertiary);
    font-size: 1.1rem;
    line-height: 1;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    border-radius: 4px;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.remove-item-btn:hover {
    background: var(--danger-light);
    color: var(--danger);
}

.add-item-row {
    display: flex;
    gap: 8px;
}

.add-item-row input {
    flex: 1;
    background: var(--bg-input);
    border-radius: var(--radius-xs);
    padding: 8px 10px;
    font-size: 0.82rem;
}

.btn-add-item {
    background: var(--primary-light);
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: var(--radius-xs);
    white-space: nowrap;
    transition: background var(--transition-fast);
}

.btn-add-item:hover {
    background: var(--primary);
    color: #fff;
}

/* Attachments */
.attachment-list {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.attachment-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: var(--bg-input);
    border-radius: var(--radius-xs);
    font-size: 0.78rem;
}

.attachment-row svg {
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.attachment-row span:nth-child(2) {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-size {
    color: var(--text-tertiary);
    font-size: 0.72rem;
}

/* ============================================
   CONFIRM MODAL
   ============================================ */
.confirm-body {
    text-align: center;
    padding: 28px 24px 8px;
}

.confirm-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--danger-light);
    color: var(--danger);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.confirm-body h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.confirm-body p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ============================================
   TOAST UNDO BUTTON
   ============================================ */
.toast-undo-btn {
    color: var(--primary);
    font-weight: 700;
    font-size: 0.8rem;
    white-space: nowrap;
    padding: 4px 10px;
    border-radius: var(--radius-xs);
    transition: background var(--transition-fast);
}

.toast-undo-btn:hover {
    background: var(--primary-light);
}

/* ============================================
   PHASE 3: PROJECTS PAGE
   ============================================ */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
}

.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-left: 3px solid var(--project-color, var(--primary));
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-card);
    cursor: pointer;
    transition: box-shadow var(--transition-fast), transform var(--transition-fast);
}

.project-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.project-card-top {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.project-color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.project-card-title {
    flex: 1;
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-card-actions {
    display: flex;
    gap: 2px;
}

.project-card-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    line-height: 1.5;
}

.project-stat-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--border-light);
}

.project-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.project-stat-value {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-primary);
}

.project-stat-label {
    font-size: 0.68rem;
    color: var(--text-tertiary);
    font-weight: 500;
    margin-top: 2px;
}

.project-deadline {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    font-size: 0.74rem;
    color: var(--text-tertiary);
    font-weight: 500;
}

/* Color swatches (project modal) */
.color-swatch-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.color-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.color-swatch:hover {
    transform: scale(1.1);
}

.color-swatch.selected {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 2px var(--bg-card), 0 0 0 4px var(--text-primary);
}

/* ============================================
   PHASE 3: CALENDAR PAGE
   ============================================ */
.calendar-legend {
    display: flex;
    gap: 18px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.calendar-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-card);
}

/* FullCalendar theme overrides to match design tokens */
#calendarEl {
    --fc-border-color: var(--border-light);
    --fc-page-bg-color: var(--bg-card);
    --fc-neutral-bg-color: var(--bg-input);
    --fc-list-event-hover-bg-color: var(--bg-hover);
    --fc-today-bg-color: var(--primary-ghost);
    --fc-button-bg-color: var(--bg-input);
    --fc-button-border-color: transparent;
    --fc-button-hover-bg-color: var(--bg-hover);
    --fc-button-active-bg-color: var(--primary);
    --fc-button-text-color: var(--text-secondary);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
}

#calendarEl .fc-toolbar-title {
    font-size: 1.1rem;
    font-weight: 700;
}

#calendarEl .fc-button {
    text-transform: capitalize;
    font-weight: 600;
    font-size: 0.8rem;
    box-shadow: none !important;
    border-radius: var(--radius-xs) !important;
}

#calendarEl .fc-button-primary:not(:disabled).fc-button-active {
    color: #fff !important;
}

#calendarEl .fc-daygrid-day-number,
#calendarEl .fc-col-header-cell-cushion {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

#calendarEl .fc-event {
    border-radius: 6px;
    font-size: 0.72rem;
    padding: 1px 4px;
    cursor: grab;
}

#calendarEl .fc-event.fc-event-completed {
    opacity: 0.55;
    text-decoration: line-through;
}

/* ============================================
   PHASE 3: NOTES PAGE
   ============================================ */
.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.note-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow-card);
    transition: box-shadow var(--transition-fast), transform var(--transition-fast);
}

.note-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.note-card.pinned {
    border-color: var(--warning);
    background: linear-gradient(180deg, rgba(245,158,11,0.05), transparent 40%);
}

.note-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.note-pin-btn {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    transition: background var(--transition-fast), color var(--transition-fast);
}

.note-pin-btn:hover {
    background: var(--bg-hover);
}

.note-pin-btn.active {
    color: var(--warning);
}

.note-card-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
    cursor: pointer;
}

.note-card-content {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.6;
    cursor: pointer;
    min-height: 40px;
}

.note-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border-light);
    font-size: 0.7rem;
    color: var(--text-tertiary);
}

.pin-checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin-top: 8px;
}

.pin-checkbox-label input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* ============================================
   PHASE 3: NOTIFICATION PANEL
   ============================================ */
.notification-wrapper {
    position: relative;
}

.notification-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 320px;
    max-height: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity var(--transition-base), transform var(--transition-base), visibility var(--transition-base);
    z-index: 200;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.notification-panel.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.notification-panel-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.notification-panel-header h4 {
    font-size: 0.9rem;
    font-weight: 700;
}

.notification-panel-list {
    overflow-y: auto;
    padding: 8px;
}

.notification-group {
    margin-bottom: 6px;
}

.notification-group-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-tertiary);
    padding: 8px 10px 4px;
}

.notification-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: background var(--transition-fast);
}

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

.notification-row-title {
    flex: 1;
    font-size: 0.8rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================
   PHASE 4: KANBAN BOARD
   ============================================ */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    align-items: start;
}

.kanban-column {
    background: var(--bg-input);
    border-radius: var(--radius);
    padding: 14px;
    min-height: 200px;
    display: flex;
    flex-direction: column;
}

.kanban-column-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding: 0 4px;
}

.kanban-column-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}

.kanban-column-header h4 {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
}

.kanban-count {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-tertiary);
    background: var(--bg-card);
    padding: 2px 8px;
    border-radius: 99px;
}

.kanban-column-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 120px;
    flex: 1;
}

.kanban-card {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    box-shadow: var(--shadow-card);
    cursor: grab;
    transition: box-shadow var(--transition-fast), transform var(--transition-fast);
}

.kanban-card:hover {
    box-shadow: var(--shadow-md);
}

.kanban-card:active {
    cursor: grabbing;
}

.kanban-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.kanban-card-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    margin-bottom: 8px;
}

.kanban-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.kanban-ghost {
    opacity: 0.4;
}

.kanban-dragging {
    transform: rotate(2deg);
}

/* ============================================
   PHASE 4: REPORTS PAGE
   ============================================ */
.report-period-toggle {
    display: flex;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 3px;
    gap: 2px;
    flex-shrink: 0;
}

.period-btn {
    padding: 7px 16px;
    border-radius: var(--radius-xs);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: background var(--transition-fast), color var(--transition-fast);
}

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

.period-btn.active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}
