:root {
    --bg: #0a0a0a;
    --surface: #141414;
    --border: #222;
    --border-hover: #333;
    --text: #e0e0e0;
    --text-dim: #888;
    --text-faint: #555;
    --green: #4ade80;
    --green-dim: rgba(74, 222, 128, 0.15);
    --green-border: rgba(74, 222, 128, 0.5);
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-weight: 300;
    -webkit-font-smoothing: antialiased;
}

.app-container {
    max-width: 780px;
    margin: 0 auto;
    padding: 3.5rem 1.5rem;
}

/* ── Header ── */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.logo-icon {
    width: 22px;
    height: 22px;
    border: 1.5px solid var(--text-dim);
    border-radius: 4px;
}

.logo h1 {
    font-size: 1.35rem;
    font-weight: 400;
    color: var(--text);
    letter-spacing: -0.01em;
}

.stat-pill {
    color: var(--text-dim);
    font-size: 0.9rem;
    font-weight: 400;
    letter-spacing: 0.04em;
}

/* ── Module Cards ── */
.modules-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.card:not(.locked):hover {
    border-color: var(--border-hover);
}

/* ── Module Header ── */
.module-header {
    display: flex;
    align-items: center;
    padding: 1.25rem 1.5rem;
    cursor: pointer;
    user-select: none;
}

.module-header .title {
    flex: 1;
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--text);
    transition: color 0.3s ease;
}

.toggle-icon {
    color: var(--text-faint);
    display: flex;
    align-items: center;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), color 0.3s ease;
}

.module.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.module.collapsed .tasks-container {
    display: none;
}

/* ── Tasks Container ── */
.tasks-container {
    padding: 0 1.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* ── Task Card ── */
.task {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    transition: border-color 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
}

.task-header {
    display: flex;
    align-items: center;
}

.task-header .title {
    flex: 1;
    font-size: 1rem;
    font-weight: 400;
    color: var(--text);
    transition: color 0.3s ease;
}

/* ── Subtask List ── */
.subtasks-container {
    list-style: none;
    margin-top: 0.625rem;
    padding-left: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0;
    border-left: 1px solid var(--border);
}

.subtask {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 0.6rem 0 0.6rem 0.85rem;
    border-bottom: 1px solid rgba(255,255,255,0.02);
}

.subtask:last-child {
    border-bottom: none;
}

.subtask .text {
    flex: 1;
    font-size: 0.95rem;
    color: var(--text-dim);
    line-height: 1.4;
    transition: color 0.25s ease, opacity 0.25s ease;
}

/* ── Checkbox (right-aligned, minimal) ── */
.custom-checkbox {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    cursor: pointer;
}

.custom-checkbox input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    cursor: pointer;
}

.checkmark {
    width: 20px;
    height: 20px;
    background: transparent;
    border: 1.5px solid var(--text-faint);
    border-radius: 4px;
    transition: all 0.2s ease;
    position: relative;
}

.custom-checkbox:hover input:not(:disabled) ~ .checkmark {
    border-color: var(--text-dim);
}

.custom-checkbox input:checked ~ .checkmark {
    border-color: var(--green);
    background: transparent;
}

.checkmark::after {
    content: "";
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid var(--green);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.custom-checkbox input:checked ~ .checkmark::after {
    display: block;
}

.custom-checkbox input:disabled ~ .checkmark {
    opacity: 0.25;
    cursor: not-allowed;
}

/* ── Subtask checked state ── */
.subtask:has(input:checked) .text {
    color: var(--green);
    opacity: 0.7;
    text-decoration: line-through;
}

/* ── Task completed (all subtasks done) ── */
.task.task-done {
    border-color: var(--green-border);
    background: var(--green-dim);
}

.task.task-done .task-header .title {
    color: var(--green);
}

/* ── Locked Module ── */
.module.locked {
    opacity: 0.35;
}

.module.locked .module-header {
    cursor: not-allowed;
}

.module.locked .module-header .title::after {
    content: " 🔒";
    font-size: 0.75rem;
    margin-left: 0.4rem;
}

/* ── Completed Module ── */
.module.completed {
    border-color: var(--green-border);
    box-shadow: 0 0 20px rgba(74, 222, 128, 0.04);
}

.module.completed .module-header .title {
    color: var(--green);
}

.module.completed .toggle-icon {
    color: var(--green);
}

/* ── Utility ── */
.custom-checkbox.readonly-check {
    pointer-events: none;
}
