/* ===== MINIMAL DESIGN SYSTEM ===== */
/* Tokens: primary=#0C0C09, secondary=#312C85, success=#16A34A, warning=#D97706, danger=#DC2626, surface=#F4F4F1, text=#0C0C09 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&family=Open+Sans:wght@300;400;500;600;700;800&family=Inconsolata:wght@400;700&display=swap');

:root {
    --primary: #0C0C09;
    --secondary: #312C85;
    --success: #16A34A;
    --warning: #D97706;
    --danger: #DC2626;
    --surface: #F4F4F1;
    --text: #0C0C09;
    --text-muted: #6B7280;
    --text-light: #9CA3AF;
    --border: #E5E5E0;
    --border-light: #EDEDEA;
    --card-bg: #FFFFFF;
    --card-hover: #FAFAF8;
    --accent-light: rgba(49, 44, 133, 0.08);
    --shadow-sm: 0 1px 2px rgba(12,12,9,0.04);
    --shadow-md: 0 4px 12px rgba(12,12,9,0.06);
    --shadow-lg: 0 8px 30px rgba(12,12,9,0.08);
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-6: 24px;
    --space-8: 32px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    overflow-x: hidden;
}

body {
    font-family: 'Open Sans', sans-serif;
    background-color: var(--surface);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* === LAYOUT === */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* === SIDEBAR === */
.sidebar {
    width: 280px;
    background: var(--card-bg);
    border-left: 1px solid var(--border);
    padding: var(--space-6);
    display: flex;
    flex-direction: column;
    position: fixed;
    right: 0;
    top: 0;
    height: 100vh;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    padding-bottom: var(--space-6);
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-6);
}

.profile-pic {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border);
    transition: border-color var(--transition);
}

.profile-pic:hover {
    border-color: var(--secondary);
}

.profile-name {
    font-family: 'Inter', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    text-align: center;
}

.profile-rank {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    font-weight: 500;
}

/* Sidebar Nav */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: all var(--transition);
    border: none;
    background: none;
    width: 100%;
    text-align: right;
    font-family: 'Open Sans', sans-serif;
}

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

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

.nav-item .nav-icon {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

/* Sidebar Stats */
.sidebar-stats {
    border-top: 1px solid var(--border);
    padding-top: var(--space-6);
    margin-top: auto;
}

.stat-mini {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-2) 0;
    font-size: 0.85rem;
}

.stat-mini-label {
    color: var(--text-muted);
    font-weight: 400;
}

.stat-mini-value {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    color: var(--text);
}

/* Sync */
.sync-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3);
    background: var(--surface);
    border-radius: var(--radius-sm);
    margin-top: var(--space-4);
    font-size: 0.75rem;
}

#last-sync-time {
    font-size: 0.75rem;
    color: var(--success);
    font-weight: 500;
}

/* === MAIN CONTENT === */
.main-content {
    flex: 1;
    margin-right: 280px;
    padding: var(--space-8) 48px;
    max-width: 960px;
}

/* Page Header */
.page-header {
    margin-bottom: var(--space-8);
}

.page-header h1 {
    font-family: 'Inter', sans-serif;
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
    margin-bottom: var(--space-2);
    line-height: 1.3;
}

.page-header .subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* === METRIC CARDS === */
.metrics-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-4);
    margin-bottom: var(--space-8);
}

.metric-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-6);
    transition: all var(--transition);
}

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

.metric-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: var(--space-2);
}

.metric-value {
    font-family: 'Inter', sans-serif;
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text);
}

.metric-value.xp { color: var(--secondary); }
.metric-value.correct { color: var(--success); }
.metric-value.percent { color: var(--warning); }

/* === PROGRESS === */
.overall-progress {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-6);
    margin-bottom: var(--space-8);
}

.progress-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-3);
}

.progress-label span:first-child {
    font-weight: 600;
    font-size: 0.9rem;
}

.progress-label span:last-child {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--secondary);
}

.progress-bar-bg {
    width: 100%;
    height: 8px;
    background: var(--border-light);
    border-radius: 100px;
    overflow: hidden;
}

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

/* === TRACK STATS GRID === */
.track-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
    margin-bottom: var(--space-8);
}

.track-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-6);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.track-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 3px;
    height: 100%;
}

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

.track-card.js::before { background: #0C0C09; }
.track-card.media::before { background: var(--secondary); }
.track-card.canva::before { background: var(--warning); }
.track-card.capcut::before { background: var(--danger); }

.track-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.88rem;
    font-weight: 700;
    margin-bottom: var(--space-3);
    font-family: 'Inter', sans-serif;
}

.track-count {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 500;
    font-family: 'Open Sans', sans-serif;
}

.track-bar-bg {
    height: 4px;
    background: var(--border-light);
    border-radius: 100px;
    overflow: hidden;
    margin-bottom: var(--space-2);
}

.track-bar-fill {
    height: 100%;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 100px;
}

.js .track-bar-fill { background: #0C0C09; }
.media .track-bar-fill { background: var(--secondary); }
.canva .track-bar-fill { background: var(--warning); }
.capcut .track-bar-fill { background: var(--danger); }

.track-percent {
    text-align: left;
    font-size: 0.78rem;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    color: var(--text-muted);
}

.track-link {
    font-size: 0.75rem;
    color: var(--secondary) !important;
    text-decoration: none !important;
    display: inline-block;
    margin-top: var(--space-2);
    opacity: 0.7;
    transition: opacity var(--transition);
}

.track-link:hover {
    opacity: 1;
}

/* === SECTION CARDS === */
.section-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
}

.section-card h2 {
    font-family: 'Inter', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: var(--space-4);
    color: var(--text);
}

.section-card h3 {
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
}

/* Card Variants */
.advice-card {
    border-right: 3px solid var(--warning);
    background: rgba(217, 119, 6, 0.03);
}

.advice-card h3 { color: var(--warning) !important; }

.chart-card {
    border-right: 3px solid var(--secondary);
}

.overdue-card {
    border-right: 3px solid var(--danger);
    background: rgba(220, 38, 38, 0.02);
}

.overdue-card h2 { color: var(--danger) !important; }

.today-card {
    border-right: 3px solid var(--secondary);
}

.upcoming-card {
    border-right: 3px solid var(--text-light);
}

.success-card {
    background: rgba(22, 163, 74, 0.04);
    border: 1px solid rgba(22, 163, 74, 0.2);
    text-align: center;
    color: var(--success);
}

/* Section Headers */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--border-light);
}

/* === TASK LIST === */
.task-list {
    list-style: none;
}

.task-item {
    display: flex;
    align-items: flex-start;
    padding: var(--space-4);
    margin-bottom: var(--space-3);
    background: var(--surface);
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    transition: all var(--transition);
    animation: taskSlideIn 0.3s ease-out backwards;
}

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

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

.task-item.js-task { border-right: 3px solid #0C0C09; }
.task-item.media-task { border-right: 3px solid var(--secondary); }
.task-item.canva-task { border-right: 3px solid var(--warning); }
.task-item.capcut-task { border-right: 3px solid var(--danger); }

.task-item input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    min-width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    margin-left: var(--space-4);
    cursor: pointer;
    position: relative;
    margin-top: 2px;
    transition: all var(--transition);
    background: var(--card-bg);
}

.task-item input[type="checkbox"]:hover {
    border-color: var(--secondary);
}

.task-item input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--secondary);
    outline-offset: 2px;
}

.task-item input[type="checkbox"]:checked {
    background: var(--success);
    border-color: var(--success);
}

.task-item input[type="checkbox"]:checked::after {
    content: "✓";
    position: absolute;
    color: white;
    font-size: 13px;
    font-weight: bold;
    top: -1px;
    left: 3px;
}

.task-content {
    flex: 1;
}

.task-content label {
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    display: block;
    color: var(--text);
}

.task-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: var(--space-1);
    display: flex;
    gap: var(--space-3);
}

.meta-chip {
    background: var(--surface);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: 0.75rem;
}

.meta-date {
    color: var(--warning) !important;
    background: rgba(217, 119, 6, 0.06) !important;
}

.meta-done {
    color: var(--success) !important;
    background: rgba(22, 163, 74, 0.06) !important;
}

/* === BUTTONS === */
.small-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 500;
    font-family: 'Open Sans', sans-serif;
    transition: all var(--transition);
}

.small-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.small-btn:focus-visible {
    outline: 2px solid var(--secondary);
    outline-offset: 2px;
}

.reset-btn {
    display: block;
    width: 100%;
    padding: var(--space-4);
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 0.9rem;
    margin-top: var(--space-8);
    font-family: 'Open Sans', sans-serif;
}

.reset-btn:hover {
    background: var(--danger);
    color: white;
}

/* === MODAL === */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(12, 12, 9, 0.5);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--card-bg);
    padding: var(--space-8);
    border: 1px solid var(--border);
    width: 90%;
    max-width: 600px;
    border-radius: var(--radius-lg);
    position: relative;
    box-shadow: var(--shadow-lg);
}

.close-btn {
    position: absolute;
    left: var(--space-6);
    top: var(--space-4);
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    transition: color var(--transition);
    background: none;
    border: none;
}

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

/* Archive */
#archive-modal .modal-content {
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
}

.archive-item {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: var(--space-4);
    margin-bottom: var(--space-3);
}

.archive-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-2);
    border-bottom: 1px solid var(--border-light);
    padding-bottom: var(--space-2);
}

.archive-q-box {
    font-size: 0.85rem;
    margin-top: var(--space-3);
}

.archive-q-item {
    background: var(--card-bg);
    padding: var(--space-3);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-2);
    border-right: 2px solid var(--secondary);
}

.archive-q-text { color: var(--text-muted); }
.archive-a-text { color: var(--success); font-weight: 600; }

/* === QUIZ MODAL === */
.quiz-modal {
    position: fixed;
    inset: 0;
    background: rgba(12, 12, 9, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
}

.quiz-content {
    background: var(--card-bg);
    padding: var(--space-8);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    direction: rtl;
}

.quiz-content h3 {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    color: var(--text);
}

.quiz-content p {
    color: var(--text);
    font-size: 0.95rem;
    line-height: 1.7;
}

.quiz-content input[type="text"] {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Open Sans', sans-serif;
    font-size: 0.95rem;
    background: var(--surface);
    color: var(--text);
    outline: none;
    transition: border-color var(--transition);
}

.quiz-content input[type="text"]:focus {
    border-color: var(--secondary);
}

.quiz-content button {
    padding: var(--space-3) var(--space-4);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-family: 'Open Sans', sans-serif;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.88rem;
    transition: opacity var(--transition);
    width: 100%;
}

.quiz-content button:hover { opacity: 0.9; }

/* === TOAST === */
.toast-notification {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: white;
    padding: var(--space-3) var(--space-6);
    border-radius: 100px;
    font-size: 0.88rem;
    font-weight: 500;
    z-index: 4000;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease-out;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* === FEATURE: DAILY STREAK === */
.streak-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    background: rgba(217, 119, 6, 0.08);
    color: var(--warning);
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
}

/* === FEATURE: FOCUS TIMER === */
.focus-timer-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
    text-align: center;
}

.timer-display {
    font-family: 'Inconsolata', monospace;
    font-size: 3rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.05em;
    margin: var(--space-4) 0;
}

.timer-controls {
    display: flex;
    gap: var(--space-3);
    justify-content: center;
}

.timer-btn {
    padding: var(--space-2) var(--space-6);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: 'Open Sans', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all var(--transition);
}

.timer-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.timer-btn.active {
    background: var(--secondary);
    color: white;
    border-color: var(--secondary);
}

/* === MOBILE SIDEBAR TOGGLE === */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: var(--space-4);
    right: var(--space-4);
    z-index: 200;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-2) var(--space-3);
    cursor: pointer;
    font-size: 1.2rem;
}

/* === PRINT === */
@media print {
    body * { visibility: hidden !important; }
    #print-section, #print-section * { visibility: visible !important; }
    #print-section {
        position: absolute;
        left: 0; top: 0;
        width: 100%;
        display: block !important;
        background: white !important;
        color: black !important;
        direction: rtl;
    }
    .sidebar, .sidebar-toggle, .modal, .reset-btn, #archive-modal { display: none !important; }
}

.print-only { display: none; }

/* === RESPONSIVE === */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(100%);
        transition: transform 0.3s ease;
        box-shadow: var(--shadow-lg);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-toggle {
        display: block;
        top: 56px;
    }
    .top-toolbar {
        right: 0;
        padding: 0 var(--space-3);
        gap: var(--space-2);
    }
    .toolbar-btn {
        padding: 5px 10px;
        font-size: 0.75rem;
    }
    .toolbar-btn .btn-icon {
        font-size: 0.9rem;
    }
    .main-content {
        margin-right: 0;
        padding: var(--space-6) var(--space-4);
        padding-top: 72px !important;
        max-width: 100%;
        overflow-x: hidden;
    }
    .metrics-row {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-3);
    }
    .metric-card {
        padding: var(--space-4);
    }
    .metric-value {
        font-size: 1.3rem;
    }
    .track-stats-grid {
        grid-template-columns: 1fr;
    }
    .section-card {
        padding: var(--space-4);
    }
    .page-header {
        margin-bottom: var(--space-6);
    }
    .page-header h1 {
        font-size: 1.3rem;
    }
}

@media (max-width: 500px) {
    .metrics-row {
        grid-template-columns: 1fr;
    }
    .page-header h1 {
        font-size: 1.15rem;
    }
    .metric-label {
        font-size: 0.7rem;
    }
    .metric-value {
        font-size: 1.1rem;
    }
    .top-toolbar {
        height: 44px;
        padding: 0 var(--space-2);
    }
    .toolbar-separator {
        display: none;
    }
    .plan-setup-card {
        padding: var(--space-4);
    }
}

/* Stats container fallback (used in HTML) */
.stats-container { display: none; }

/* ===== DARK MODE ===== */
[data-theme="dark"] {
    --primary: #F4F4F1;
    --secondary: #8B85E0;
    --success: #22C55E;
    --warning: #FBBF24;
    --danger: #F87171;
    --surface: #111113;
    --text: #E5E5E0;
    --text-muted: #9CA3AF;
    --text-light: #6B7280;
    --border: #2A2A2E;
    --border-light: #1F1F23;
    --card-bg: #18181B;
    --card-hover: #1F1F23;
    --accent-light: rgba(139, 133, 224, 0.12);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.4);
}

/* ===== TOP TOOLBAR ===== */
.top-toolbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 280px;
    height: 48px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 var(--space-6);
    gap: var(--space-3);
    z-index: 99;
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 0.8rem;
    font-weight: 500;
    font-family: 'Open Sans', sans-serif;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.toolbar-btn:hover {
    background: var(--accent-light);
    border-color: var(--secondary);
    color: var(--secondary);
}

.toolbar-btn .btn-icon {
    font-size: 1rem;
}

.toolbar-separator {
    width: 1px;
    height: 24px;
    background: var(--border);
}

/* Adjust main content for toolbar */
.main-content {
    padding-top: 80px !important;
}

@media (max-width: 900px) {
    .top-toolbar {
        right: 0;
    }
}

/* ===== AUTH / MULTI-USER ===== */
.auth-screen {
    position: fixed;
    inset: 0;
    background: var(--surface);
    z-index: 5000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--space-6);
}

.auth-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.auth-card h1 {
    font-family: 'Inter', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: var(--space-2);
}

.auth-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: var(--space-6);
}

.auth-card .logo-icon {
    font-size: 2.5rem;
    margin-bottom: var(--space-4);
    display: block;
}

.auth-input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Open Sans', sans-serif;
    font-size: 0.92rem;
    background: var(--surface);
    color: var(--text);
    outline: none;
    margin-bottom: var(--space-3);
    transition: border-color var(--transition);
    direction: ltr;
    text-align: right;
}

.auth-input:focus {
    border-color: var(--secondary);
}

.auth-btn {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: none;
    border-radius: var(--radius-sm);
    background: var(--secondary);
    color: white;
    font-family: 'Open Sans', sans-serif;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity var(--transition);
    margin-bottom: var(--space-3);
}

[data-theme="dark"] .auth-btn {
    background: #8B85E0;
    color: #111113;
}

.auth-btn:hover {
    opacity: 0.9;
}

.auth-btn.secondary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.auth-btn.secondary:hover {
    background: var(--accent-light);
    border-color: var(--secondary);
    color: var(--secondary);
}

.auth-switch {
    margin-top: var(--space-4);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.auth-switch a {
    color: var(--secondary);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
}

.auth-switch a:hover {
    text-decoration: underline;
}

.auth-error {
    color: var(--danger);
    font-size: 0.82rem;
    margin-bottom: var(--space-3);
    display: none;
}

/* User avatar for guest users */
.user-avatar-placeholder {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--accent-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--secondary);
    border: 3px solid var(--border);
    font-family: 'Inter', sans-serif;
}

/* Guest plan setup */
.plan-setup-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-6);
    margin-bottom: var(--space-4);
}

.plan-setup-card h3 {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    margin-bottom: var(--space-4);
}

.plan-input-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.plan-input-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}

.plan-input-group input,
.plan-input-group select {
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Open Sans', sans-serif;
    font-size: 0.9rem;
    background: var(--surface);
    color: var(--text);
    outline: none;
}

.plan-input-group input:focus,
.plan-input-group select:focus {
    border-color: var(--secondary);
}

.task-add-row {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.task-add-row input {
    flex: 1;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Open Sans', sans-serif;
    font-size: 0.88rem;
    background: var(--surface);
    color: var(--text);
    outline: none;
}

.task-add-row input:focus {
    border-color: var(--secondary);
}

/* ===== EXPANDABLE TASK DETAILS ===== */
.task-item {
    flex-wrap: wrap;
}

.task-expand-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    margin-right: auto;
    font-family: 'Open Sans', sans-serif;
}

.task-expand-btn:hover {
    background: var(--accent-light);
    color: var(--secondary);
}

.task-details-panel {
    width: 100%;
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border-light);
    display: none;
    animation: detailSlideIn 0.25s ease-out;
}

.task-details-panel.open {
    display: block;
}

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

.task-detail-row {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
    font-size: 0.82rem;
}

.task-detail-icon {
    flex-shrink: 0;
    width: 20px;
    text-align: center;
    font-size: 0.85rem;
    margin-top: 1px;
}

.task-detail-label {
    color: var(--text-muted);
    font-weight: 500;
    min-width: 60px;
    flex-shrink: 0;
}

.task-detail-value {
    color: var(--text);
    flex: 1;
    line-height: 1.5;
    word-break: break-word;
}

.task-detail-value a {
    color: var(--secondary);
    text-decoration: none;
    font-size: 0.82rem;
    word-break: break-all;
}

.task-detail-value a:hover {
    text-decoration: underline;
}

.task-actions {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-3);
    padding-top: var(--space-2);
    border-top: 1px dashed var(--border-light);
}

.task-action-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    cursor: pointer;
    font-family: 'Open Sans', sans-serif;
    transition: all var(--transition);
}

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

/* Detail Edit Modal */
.detail-modal {
    position: fixed;
    inset: 0;
    background: rgba(12, 12, 9, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3500;
}

.detail-modal-content {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
}

.detail-modal-content h3 {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    margin-bottom: var(--space-4);
    color: var(--text);
}

.detail-modal-content .plan-input-group {
    margin-bottom: var(--space-3);
}

.detail-modal-content .plan-input-group label {
    display: block;
    margin-bottom: var(--space-1);
}

.detail-modal-content textarea {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Open Sans', sans-serif;
    font-size: 0.9rem;
    background: var(--surface);
    color: var(--text);
    outline: none;
    resize: vertical;
}

.detail-modal-content textarea:focus,
.detail-modal-content input:focus {
    border-color: var(--secondary);
}

.detail-modal-btns {
    display: flex;
    gap: var(--space-3);
    margin-top: var(--space-4);
}

.detail-modal-btns button {
    flex: 1;
    padding: var(--space-3);
    border-radius: var(--radius-sm);
    font-family: 'Open Sans', sans-serif;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: opacity var(--transition);
    border: none;
}

.detail-modal-btns .save-btn {
    background: var(--secondary);
    color: white;
}

.detail-modal-btns .cancel-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
}

/* Resource badge */
.resource-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--accent-light);
    color: var(--secondary);
    padding: 2px 8px;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
}

.resource-badge:hover {
    background: var(--secondary);
    color: white;
}

/* Custom task color */
.task-item.custom-task { border-right: 3px solid var(--text-muted); }
.track-card.custom::before { background: var(--text-muted); }
.custom .track-bar-fill { background: var(--text-muted); }
