:root {
    /* Light mode – soft, airy */
    --gray-50: #f5f5f7;
    --gray-100: #e8e8ed;
    --gray-200: #d2d2d6;
    --gray-300: #b0b0b8;
    --gray-400: #8e8e98;
    --gray-500: #6e6e77;
    --gray-600: #4e4e55;
    --gray-700: #3a3a40;
    --gray-800: #2c2c30;
    --gray-900: #1d1d1f;

    --accent: #0071e3;
    --accent-light: #3a8eff;
    --accent-subtle: rgba(0, 113, 227, 0.1);
    --accent-glow: rgba(0, 113, 227, 0.2);

    --bg-page: #ffffff;
    --bg-card: #ffffff;
    --bg-header: rgba(255, 255, 255, 0.8);
    --bg-code: #f5f5f7;
    --border-subtle: rgba(0, 0, 0, 0.05);

    --text-primary: #1d1d1f;
    --text-secondary: #6e6e77;
    --text-muted: #8e8e98;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.02);
    --shadow-lg: 0 20px 30px -10px rgba(0, 0, 0, 0.08);
    --shadow-focus: 0 0 0 4px var(--accent-subtle);
}

body.dark-mode {
    --gray-50: #1c1c1e;
    --gray-100: #2c2c2e;
    --gray-200: #3a3a3c;
    --gray-300: #48484a;
    --gray-400: #636366;
    --gray-500: #8e8e93;
    --gray-600: #aeaeb2;
    --gray-700: #c6c6c8;
    --gray-800: #e5e5ea;
    --gray-900: #f5f5f7;

    --accent: #0a84ff;
    --accent-light: #409cff;
    --accent-subtle: rgba(10, 132, 255, 0.15);
    --accent-glow: rgba(10, 132, 255, 0.25);

    --bg-page: #000000;
    --bg-card: #1c1c1e;
    --bg-header: rgba(0, 0, 0, 0.8);
    --bg-code: #2c2c2e;
    --border-subtle: rgba(255, 255, 255, 0.08);

    --text-primary: #f5f5f7;
    --text-secondary: #8e8e93;
    --text-muted: #636366;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 20px 30px -10px rgba(0, 0, 0, 0.5);
}

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

body {
    font-family: -apple-system, 'SF Pro Text', 'SF Pro Display', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 16px;
    transition: background-color 0.3s ease, color 0.2s ease;
    -webkit-font-smoothing: antialiased;
}

/* Header – blur glassmorphism */
.app-header {
    background: var(--bg-header);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 0.5px solid var(--border-subtle);
    padding: 1.2rem 2rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

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

.title-section h1 {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif;
    font-weight: 600;
    font-size: 1.75rem;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}

/* Dark mode toggle */
.dark-mode-toggle {
    background: var(--bg-card);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 40px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.dark-mode-toggle:hover {
    background: var(--gray-100);
    transform: scale(0.98);
}

/* Global progress – minimal card */
.global-progress {
    min-width: 200px;
    background: var(--bg-card);
    padding: 0.5rem 0.9rem;
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
}

.progress-track {
    height: 5px;
    background: var(--gray-200);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 0.25rem;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width 0.4s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    border-radius: 5px;
}

.progress-text {
    font-size: 0.7rem;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    font-family: 'SF Mono', monospace;
    color: var(--text-secondary);
}

.accent-text {
    color: var(--accent);
    font-weight: 600;
}

/* Search – subtle */
.search-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.search-toggle {
    background: none;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 40px;
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: background 0.2s;
}

.search-toggle:hover {
    background: var(--gray-100);
}

.search-collapsible.hidden {
    display: none;
}

#searchInput {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 40px;
    font-size: 0.85rem;
    width: 260px;
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s;
}

#searchInput:focus {
    outline: none;
    box-shadow: var(--shadow-focus);
}

/* Phases container – vertical stack, airy */
.phases-grid {
    max-width: 880px;
    margin: 0 auto;
    padding: 2.5rem 1.8rem;
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
}

/* Phase card – borderless, card-like */
.phase-card {
    background: var(--bg-card);
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    overflow: hidden;
}

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

.phase-header {
    padding: 1.2rem 1.5rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 590;
    font-size: 1.05rem;
    background: transparent;
    transition: background 0.2s;
}

.phase-header:hover {
    background: var(--gray-50);
}

.phase-header strong {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

.progress-badge {
    background: var(--gray-100);
    padding: 0.2rem 0.65rem;
    border-radius: 30px;
    font-size: 0.7rem;
    font-weight: 500;
    font-family: monospace;
    color: var(--text-secondary);
}

.phase-progress-bar {
    height: 3px;
    background: var(--gray-200);
    margin: 0 1.5rem;
    border-radius: 3px;
    overflow: hidden;
}

.phase-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--accent);
    transition: width 0.4s ease;
    border-radius: 3px;
}

.phase-content {
    padding: 1.2rem 1.5rem 1.5rem;
    border-top: none;
    animation: fadeIn 0.2s ease;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.phase-content h4 {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
    color: var(--accent);
    margin: 1rem 0 0.7rem 0;
}

.phase-content h4:first-of-type {
    margin-top: 0;
}

.task-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.55rem 0;
    font-size: 0.9rem;
    border-bottom: 0.5px solid var(--border-subtle);
}

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

.task-item input {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--accent);
    cursor: pointer;
    margin: 0;
}

.task-item span {
    flex: 1;
    color: var(--text-primary);
    transition: color 0.2s;
}

.task-item.completed span {
    text-decoration: line-through;
    color: var(--text-muted);
}

.empty-message {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
    padding: 1rem 0;
    font-style: italic;
}

/* Footer – minimal */
.app-footer {
    text-align: center;
    padding: 1.8rem;
    border-top: 0.5px solid var(--border-subtle);
    margin-top: 1.5rem;
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Responsive */
@media (max-width: 640px) {
    .app-header {
        padding: 1rem;
    }

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

    .header-actions {
        width: 100%;
        justify-content: space-between;
    }

    .global-progress {
        width: 100%;
    }

    .phases-grid {
        padding: 1.2rem;
        gap: 1.2rem;
    }

    #searchInput {
        width: 100%;
    }

    .phase-header {
        padding: 1rem;
    }

    .phase-content {
        padding: 0.8rem 1rem 1.2rem;
    }
}

.task-item {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    padding: 0.55rem 0;
    border-bottom: 0.5px solid var(--border-subtle);
    flex-wrap: wrap;
}

.task-item span {
    flex: 1;
}

.applies-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-left: auto;
}

.badge {
    background: var(--gray-100);
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}