/* ── CSS Variables ─────────────────────────────────────── */
:root {
    --bg: #111013;
    --surface: #18161b;
    --surface2: #201e24;
    --border: #2c2930;
    --border-hover: #3f3b45;
    --accent: #4f8ef7;
    --text: #ede9e3;
    --text-dim: #6b6573;
    --text-mid: #9e97a8;
    --high: #e05c5c;
    --med: #d4924a;
    --low: #5bbf8a;
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    border-radius: 0 !important;
}

/* ── Base ──────────────────────────────────────────────── */
body {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding: 48px 20px;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

/* ── Container ─────────────────────────────────────────── */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 40px;
}

/* ── Header ────────────────────────────────────────────── */
header {
    margin-bottom: 36px;
}

.eyebrow {
    display: block;
    font-family: 'DM Sans', sans-serif;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 10px;
}

h1 {
    font-family: 'DM Serif Display', serif;
    font-size: 38px;
    font-weight: 400;
    color: var(--text);
    line-height: 1.1;
    margin-bottom: 20px;
}

.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 0;
}

/* ── Form Grid ─────────────────────────────────────────── */
form {
    margin: 28px 0 0 0;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 160px 140px 1fr 120px;
    gap: 8px;
    align-items: stretch;
}

/* ── Inputs & Selects ──────────────────────────────────── */
input, select {
    font-family: 'DM Sans', sans-serif;
    font-weight: 300;
    font-size: 13px;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 10px 12px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
}

input::placeholder {
    color: var(--text-dim);
}

input:focus, select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(79, 142, 247, 0.2);
}

select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%236b6573' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 28px;
}

select option {
    background: var(--surface);
    color: var(--text);
}

/* ── Buttons ───────────────────────────────────────────── */
button {
    font-family: 'DM Sans', sans-serif;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    border: 1px solid transparent;
    padding: 10px 16px;
    transition: all 0.15s;
    white-space: nowrap;
}

/* Add Task */
form button[type="submit"] {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

form button[type="submit"]:hover {
    background: #3a7ae8;
    border-color: #3a7ae8;
}

/* Ghost base */
.btn-undo, .btn-edit {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-mid);
}

.btn-undo:hover, .btn-edit:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Done */
.btn-complete {
    background: transparent;
    border: 1px solid rgba(91, 191, 138, 0.3);
    color: var(--low);
}

.btn-complete:hover {
    background: rgba(91, 191, 138, 0.07);
    border-color: var(--low);
}

/* Delete */
.btn-delete {
    background: transparent;
    border: 1px solid rgba(224, 92, 92, 0.2);
    color: #884040;
}

.btn-delete:hover {
    border-color: var(--high);
    color: var(--high);
}

/* ── Filters ───────────────────────────────────────────── */
.filters {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    margin-bottom: 32px;
}

.filters input {
    flex: 1;
}

.filters select {
    width: 160px;
    flex-shrink: 0;
}

/* ── Section Label ─────────────────────────────────────── */
.section-label {
    font-family: 'DM Sans', sans-serif;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

/* ── Task List ─────────────────────────────────────────── */
#taskList {
    list-style: none;
}

.task {
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--border);
    padding: 16px 16px 16px 20px;
    position: relative;
    transition: background 0.1s;
}

.task:hover {
    background: rgba(255,255,255,0.015);
}

/* Priority color bar */
.task::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
}

.task.priority-High::before  { background: var(--high); }
.task.priority-Medium::before { background: var(--med); }
.task.priority-Low::before   { background: var(--low); }

.task.complete {
    opacity: 0.5;
}

.task.complete .task-name {
    text-decoration: line-through;
    color: var(--text-dim);
}

/* ── Task Info ─────────────────────────────────────────── */
.task-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    min-width: 0;
}

.task-name {
    font-size: 14px;
    font-weight: 400;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.priority-label {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.priority-label.High   { color: var(--high); }
.priority-label.Medium { color: var(--med); }
.priority-label.Low    { color: var(--low); }

.task-notes {
    font-size: 12px;
    font-style: italic;
    font-weight: 300;
    color: var(--text-dim);
}

.date-badge {
    font-size: 10px;
    color: var(--text-mid);
    background: var(--surface2);
    border: 1px solid var(--border);
    padding: 2px 8px;
}

/* ── Task Actions ──────────────────────────────────────── */
.task-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

/* ── Task Top Row ─────────────────────────────────────── */
.task-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    width: 100%;
}

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

.subtask-count {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.05em;
    color: var(--text-dim);
    background: var(--surface2);
    border: 1px solid var(--border);
    padding: 2px 7px;
}

/* ── Subtask Panel ─────────────────────────────────────── */
.subtask-panel {
    width: 100%;
    border-top: 1px solid var(--border);
    margin-top: 12px;
    padding-top: 12px;
    padding-left: 20px;
}

.subtask-list {
    list-style: none;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.subtask {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-mid);
    font-weight: 300;
}

.subtask.subtask-done .subtask-name {
    text-decoration: line-through;
    color: var(--text-dim);
}

.subtask-check {
    cursor: pointer;
    font-size: 12px;
    color: var(--text-dim);
    width: 16px;
    text-align: center;
    flex-shrink: 0;
    transition: color 0.15s;
}

.subtask.subtask-done .subtask-check {
    color: var(--low);
}

.subtask-check:hover {
    color: var(--low);
}

.subtask-name {
    flex: 1;
}

.btn-subtask-delete {
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 10px;
    cursor: pointer;
    padding: 2px 6px;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
    letter-spacing: 0;
    text-transform: none;
    font-weight: 400;
}

.subtask:hover .btn-subtask-delete {
    opacity: 1;
}

.btn-subtask-delete:hover {
    color: var(--high);
}

.subtask-add {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.subtask-input {
    flex: 1;
    font-size: 12px;
    padding: 7px 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    font-weight: 300;
}

.subtask-input::placeholder {
    color: var(--text-dim);
}

.subtask-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(79, 142, 247, 0.2);
    outline: none;
}

.btn-subtask-add {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-mid);
    font-size: 11px;
    padding: 7px 14px;
}

.btn-subtask-add:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Subtasks button */
.btn-subtask {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 11px;
    padding: 6px 12px;
}

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

/* ── Empty State ───────────────────────────────────────── */
.empty {
    text-align: center;
    color: var(--text-dim);
    padding: 40px 20px;
    font-style: italic;
    font-size: 13px;
    font-weight: 300;
    border-top: 1px solid var(--border);
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 720px) {
    .container {
        padding: 0 16px;
    }

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

    .form-grid input:first-child {
        grid-column: 1 / -1;
    }

    .form-grid button {
        grid-column: 1 / -1;
    }

    .filters {
        flex-direction: column;
    }

    .filters select {
        width: 100%;
    }

    h1 {
        font-size: 28px;
    }
}
