:root {
    --bg: #f5f4f1;
    --surface: #fbfaf8;
    --surface-hover: #efeee9;

    --text: #181817;
    --muted: #77766f;
    --subtle: #999891;

    --line: #d9d8d2;
    --line-strong: #c1c0b9;

    --lavender: #9185c5;
    --lavender-soft: #ebe8f6;

    --danger: #aa595e;
}


/* ─────────────────────────
   Global
───────────────────────── */

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    margin: 0;
    min-height: 100vh;

    background: var(--bg);
    color: var(--text);

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Helvetica Neue",
        Helvetica,
        Arial,
        sans-serif;

    font-size: 16px;

    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--lavender);
    outline-offset: 3px;
}


/* ─────────────────────────
   Main layout
───────────────────────── */

.app {
    min-height: 100vh;

    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
}


/* ─────────────────────────
   Sidebar
───────────────────────── */

.sidebar {
    min-height: 100vh;

    display: flex;
    flex-direction: column;
    justify-content: space-between;

    padding: 40px 28px 28px;

    background: var(--surface);
    border-right: 1px solid var(--line);
}

.brand {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.28em;
}

.brand-line {
    width: 100%;
    height: 1px;

    margin: 28px 0 28px;

    background: var(--line);
}

nav {
    display: grid;
    gap: 5px;
}

.nav-item {
    width: 100%;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 13px 14px;

    border: 0;
    border-radius: 10px;

    background: transparent;
    color: var(--muted);

    font-size: 15px;

    text-align: left;

    transition:
        background 180ms ease,
        color 180ms ease;
}

.nav-item:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.nav-item.active {
    background: var(--lavender-soft);
    color: var(--text);
}

.nav-item span:last-child {
    color: var(--subtle);

    font-size: 13px;

    font-variant-numeric: tabular-nums;
}

.nav-item.active span:last-child {
    color: var(--lavender);
}

.sidebar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding-top: 25px;

    color: var(--subtle);

    font-size: 12px;
    letter-spacing: 0.09em;
}


/* ─────────────────────────
   Content
───────────────────────── */

.content {
    width: 100%;
    min-width: 0;

    padding:
        54px
        clamp(34px, 6vw, 110px)
        90px;
}

.topbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;

    gap: 40px;

    padding-bottom: 36px;

    border-bottom: 1px solid var(--line);
}

.eyebrow {
    margin: 0 0 13px;

    color: var(--muted);

    font-size: 11px;
    font-weight: 700;

    letter-spacing: 0.22em;
}


/* This intentionally stays restrained */

h1 {
    margin: 0;

    max-width: 760px;

    font-size: clamp(36px, 4vw, 56px);
    line-height: 0.98;

    font-weight: 500;

    letter-spacing: -0.055em;
}


/* ─────────────────────────
   Status
───────────────────────── */

.status-dot {
    display: flex;
    align-items: center;
    gap: 10px;

    padding-bottom: 8px;

    color: var(--muted);

    white-space: nowrap;
}

.status-dot span {
    width: 8px;
    height: 8px;

    border-radius: 50%;

    background: var(--lavender);

    box-shadow:
        0 0 0 5px var(--lavender-soft);
}

.status-dot small {
    font-size: 12px;
}


/* ─────────────────────────
   Composer
───────────────────────── */

.composer {
    display: grid;

    grid-template-columns:
        minmax(210px, 0.8fr)
        minmax(280px, 1.4fr)
        auto;

    gap: 12px;

    margin: 34px 0 48px;
}

.composer input {
    width: 100%;

    padding: 16px 17px;

    border: 1px solid var(--line);
    border-radius: 11px;

    outline: none;

    background: transparent;
    color: var(--text);

    font-size: 16px;

    transition:
        border-color 180ms ease,
        background 180ms ease,
        box-shadow 180ms ease;
}

.composer input::placeholder {
    color: var(--subtle);
}

.composer input:hover {
    border-color: var(--line-strong);
}

.composer input:focus {
    border-color: var(--lavender);

    background: var(--surface);

    box-shadow:
        0 0 0 4px var(--lavender-soft);
}

.composer-actions {
    display: flex;
    gap: 8px;
}

.primary,
.ghost {
    min-height: 50px;

    padding: 0 21px;

    border-radius: 11px;

    font-size: 15px;

    transition:
        transform 160ms ease,
        background 160ms ease,
        border-color 160ms ease;
}

.primary {
    border: 1px solid var(--text);

    background: var(--text);
    color: white;
}

.primary:hover {
    background: #30302f;
    transform: translateY(-1px);
}

.primary:active {
    transform: translateY(0);
}

.ghost {
    border: 1px solid var(--line);

    background: transparent;
    color: var(--muted);
}

.ghost:hover {
    border-color: var(--line-strong);
    background: var(--surface-hover);
    color: var(--text);
}

.hidden {
    display: none;
}


/* ─────────────────────────
   Task header
───────────────────────── */

.task-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding-bottom: 14px;

    color: var(--muted);

    font-size: 11px;
    font-weight: 700;

    letter-spacing: 0.18em;
}

#taskCount {
    color: var(--subtle);

    font-size: 13px;

    font-variant-numeric: tabular-nums;
}


/* ─────────────────────────
   Task list
───────────────────────── */

.task-list {
    border-top: 1px solid var(--line);
}

.task {
    display: grid;

    grid-template-columns:
        30px
        minmax(0, 1fr)
        auto;

    gap: 17px;

    align-items: start;

    padding: 24px 6px 24px 0;

    border-bottom: 1px solid var(--line);

    cursor: pointer;

    transition:
        background 180ms ease,
        padding 180ms ease;
}

.task:hover {
    padding-left: 14px;
    padding-right: 14px;

    background: rgba(255, 255, 255, 0.4);
}

.task-main {
    min-width: 0;
}

.task-title {
    margin: 0;

    color: var(--text);

    font-size: 20px;
    line-height: 1.35;

    font-weight: 500;

    letter-spacing: -0.02em;
}

.task-description {
    max-width: 820px;

    margin: 7px 0 0;

    color: var(--muted);

    font-size: 15px;
    line-height: 1.55;
}


/* ─────────────────────────
   Completion button
───────────────────────── */

.check {
    position: relative;

    width: 23px;
    height: 23px;

    margin-top: 2px;

    padding: 0;

    border: 1px solid #a8a79f;
    border-radius: 50%;

    background: transparent;

    cursor: pointer;

    transition:
        border-color 180ms ease,
        background 180ms ease,
        transform 180ms ease;
}

.check:hover {
    border-color: var(--lavender);
    transform: scale(1.06);
}

.check.completed {
    border-color: var(--lavender);

    background: var(--lavender);
}

.check.completed::after {
    content: "";

    position: absolute;

    left: 7px;
    top: 3px;

    width: 6px;
    height: 11px;

    border:
        solid #fff;

    border-width:
        0
        1.5px
        1.5px
        0;

    transform: rotate(45deg);
}


/* ─────────────────────────
   Completed task
───────────────────────── */

.task.completed .task-title {
    color: var(--muted);

    text-decoration: line-through;
    text-decoration-thickness: 1px;
}

.task.completed .task-description {
    color: var(--subtle);
}


/* ─────────────────────────
   Task actions
───────────────────────── */

.task-actions {
    display: flex;
    gap: 3px;

    opacity: 0;

    transform: translateX(5px);

    transition:
        opacity 160ms ease,
        transform 160ms ease;
}

.task:hover .task-actions {
    opacity: 1;
    transform: translateX(0);
}

.task-actions button {
    padding: 6px 9px;

    border: 0;
    border-radius: 7px;

    background: transparent;

    color: var(--muted);

    font-size: 13px;

    cursor: pointer;

    transition:
        color 160ms ease,
        background 160ms ease;
}

.task-actions button:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.task-actions .delete:hover {
    color: var(--danger);
}


/* ─────────────────────────
   Empty state
───────────────────────── */

.empty-state {
    padding: 105px 20px;

    text-align: center;
}

.empty-state h2 {
    margin: 0 0 10px;

    color: var(--text);

    font-size: 25px;
    font-weight: 500;

    letter-spacing: -0.025em;
}

.empty-state p {
    margin: 0;

    color: var(--muted);

    font-size: 16px;
}


/* ─────────────────────────
   Task modal
───────────────────────── */

.modal-backdrop {
    position: fixed;

    inset: 0;

    z-index: 1000;

    display: flex;

    align-items: center;
    justify-content: center;

    padding: 24px;

    background:
        rgba(22, 21, 26, 0.3);

    backdrop-filter: blur(13px);
    -webkit-backdrop-filter: blur(13px);

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transition:
        opacity 200ms ease,
        visibility 200ms ease;
}

.modal-backdrop.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.task-modal {
    position: relative;

    width: min(700px, 100%);

    padding: 48px;

    border:
        1px solid
        rgba(255, 255, 255, 0.7);

    border-radius: 22px;

    background:
        rgba(250, 249, 247, 0.97);

    box-shadow:
        0 35px 100px rgba(20, 20, 20, 0.15),
        0 10px 30px rgba(20, 20, 20, 0.07);

    transform:
        translateY(15px)
        scale(0.98);

    transition:
        transform 220ms ease;
}

.modal-backdrop.open .task-modal {
    transform:
        translateY(0)
        scale(1);
}

.modal-close {
    position: absolute;

    top: 17px;
    right: 19px;

    width: 38px;
    height: 38px;

    display: grid;
    place-items: center;

    border: 0;
    border-radius: 50%;

    background: transparent;

    color: var(--muted);

    font-size: 29px;
    font-weight: 300;
    line-height: 1;

    transition:
        background 160ms ease,
        color 160ms ease;
}

.modal-close:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.modal-eyebrow {
    margin: 0 0 13px;

    color: var(--lavender);

    font-size: 11px;
    font-weight: 700;

    letter-spacing: 0.2em;
}

#modalTitle {
    margin: 0;

    max-width: 590px;

    color: var(--text);

    font-size: clamp(34px, 5vw, 52px);
    line-height: 1.02;

    font-weight: 500;

    letter-spacing: -0.045em;
}

.modal-description {
    margin: 20px 0 38px;

    color: var(--muted);

    font-size: 17px;
    line-height: 1.7;
}

.modal-meta {
    display: grid;

    grid-template-columns:
        repeat(3, 1fr);

    gap: 24px;

    padding: 22px 0;

    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.modal-meta div {
    display: flex;
    flex-direction: column;

    gap: 8px;
}

.modal-meta span {
    color: var(--subtle);

    font-size: 10px;
    font-weight: 700;

    letter-spacing: 0.17em;
}

.modal-meta strong {
    color: var(--text);

    font-size: 14px;
    font-weight: 500;
}

.modal-actions {
    display: flex;

    justify-content: flex-end;

    gap: 9px;

    margin-top: 30px;
}

.modal-primary,
.modal-secondary {
    min-height: 48px;

    padding: 0 20px;

    border-radius: 11px;

    font-size: 14px;

    transition:
        transform 160ms ease,
        background 160ms ease;
}

.modal-primary {
    border: 1px solid var(--text);

    background: var(--text);
    color: white;
}

.modal-primary:hover {
    transform: translateY(-1px);
    background: #30302f;
}

.modal-secondary {
    border: 1px solid var(--line);

    background: transparent;

    color: var(--text);
}

.modal-secondary:hover {
    background: var(--surface-hover);
}


/* ─────────────────────────
   Responsive
───────────────────────── */

@media (max-width: 1000px) {

    .app {
        grid-template-columns: 220px minmax(0, 1fr);
    }

    .content {
        padding:
            44px
            40px
            70px;
    }

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

    .composer-actions {
        grid-column: 1 / -1;

        justify-content: flex-end;
    }
}


@media (max-width: 760px) {

    .app {
        display: block;
    }

    .sidebar {
        min-height: auto;

        padding: 24px 20px;

        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .brand-line {
        margin: 20px 0;
    }

    nav {
        grid-template-columns:
            repeat(3, 1fr);
    }

    .sidebar-footer {
        display: none;
    }

    .content {
        padding:
            38px
            20px
            60px;
    }

    .topbar {
        align-items: flex-start;

        flex-direction: column;
    }

    .status-dot {
        padding-bottom: 0;
    }

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

    .composer-actions {
        grid-column: auto;
    }

    .task {
        grid-template-columns:
            29px
            minmax(0, 1fr);
    }

    .task-actions {
        grid-column: 2;

        opacity: 1;
        transform: none;

        margin-top: 5px;
    }

    .modal-meta {
        grid-template-columns: 1fr;
    }

    .modal-actions {
        flex-direction: column-reverse;
    }

    .modal-primary,
    .modal-secondary {
        width: 100%;
    }
}


@media (max-width: 520px) {

    h1 {
        font-size: 38px;
    }

    nav {
        grid-template-columns: 1fr;
    }

    .nav-item {
        padding: 11px 12px;
    }

    .task {
        padding-top: 21px;
        padding-bottom: 21px;
    }

    .task:hover {
        padding-left: 0;
        padding-right: 0;

        background: transparent;
    }

    .task-title {
        font-size: 19px;
    }

    .task-description {
        font-size: 14px;
    }

    .empty-state {
        padding:
            75px
            10px;
    }

    .task-modal {
        padding:
            36px
            24px;
    }

    #modalTitle {
        font-size: 36px;
    }

    .modal-description {
        font-size: 15px;
    }
}


@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        transition: none !important;
    }
}
