:root {
    --bg: #f5f4ef;
    --surface: #fffefa;
    --surface-alt: #efeee7;
    --ink: #202420;
    --muted: #6d716c;
    --line: #dcded4;
    --accent: #356859;
    --accent-dark: #214c40;
    --coral: #ca624d;
    --shadow: 0 18px 45px rgb(41 50 43 / 8%);
}

:root.dark {
    --bg: #181c1a;
    --surface: #222824;
    --surface-alt: #2a312c;
    --ink: #f1f2ec;
    --muted: #afb5ab;
    --line: #3c463f;
    --accent: #8fd1b5;
    --accent-dark: #b6e8d2;
    --coral: #ee947d;
    --shadow: 0 18px 45px rgb(0 0 0 / 22%);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-width: 320px;
    background: var(--bg);
    color: var(--ink);
    font-family: "DM Sans", system-ui, sans-serif;
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.app-shell {
    max-width: 1180px;
    margin: auto;
    padding: 22px 28px 64px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 48px;
}

.brand {
    color: var(--ink);
    font-weight: 700;
    text-decoration: none;
    letter-spacing: -.04em;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 9px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    background: var(--accent);
    color: #fff;
    border-radius: 9px;
    font-size: .95rem;
}

.icon-button {
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: transparent;
    color: var(--ink);
    font-size: 1.15rem;
    display: grid;
    place-items: center;
    transition: .2s ease;
}

.icon-button:hover {
    background: var(--surface-alt);
    transform: translateY(-1px);
}

.icon-button.small {
    width: 31px;
    height: 31px;
    font-size: 1rem;
}

.danger:hover,
.delete-step:hover {
    color: var(--coral);
    border-color: var(--coral);
}

.hero {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    padding: 64px 4px 46px;
}

.eyebrow {
    margin: 0 0 8px;
    font-size: .69rem;
    letter-spacing: .13em;
    font-weight: 700;
    color: var(--accent);
}

.hero h1,
h2,
h3 {
    margin: 0;
    letter-spacing: -.055em;
}

.hero h1 {
    font-family: Fraunces, serif;
    font-size: clamp(2.9rem, 7vw, 5.4rem);
    line-height: .98;
    font-weight: 600;
}

.hero em {
    color: var(--accent);
}

.hero-copy {
    max-width: 390px;
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.65;
    margin: 20px 0 0;
}

.today-card {
    align-self: flex-start;
    min-width: 138px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    padding: 17px 19px;
    box-shadow: var(--shadow);
}

.today-card span {
    display: block;
    color: var(--muted);
    font-size: .82rem;
}

.today-card strong {
    display: block;
    margin-top: 4px;
    font-size: 1.4rem;
}

.dashboard {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border: 1px solid var(--line);
    border-radius: 18px;
    overflow: hidden;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.metric {
    padding: 20px 24px;
    border-right: 1px solid var(--line);
}

.metric:last-child {
    border: 0;
}

.metric span {
    display: block;
    color: var(--muted);
    font-size: .8rem;
}

.metric strong {
    display: block;
    font-size: 1.65rem;
    letter-spacing: -.05em;
    margin-top: 5px;
}

.mini-progress {
    height: 5px;
    border-radius: 99px;
    overflow: hidden;
    margin-top: 10px;
    background: var(--surface-alt);
}

.mini-progress span {
    display: block;
    width: 0;
    height: 100%;
    background: var(--accent);
    transition: width .3s;
}

.task-composer {
    margin-top: 50px;
    padding: 29px;
    border-radius: 21px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

h2 {
    font-size: 1.6rem;
}

.title-input {
    border: 0;
    border-bottom: 1px solid var(--line);
    padding: 13px 0;
    font-size: 1.2rem;
    font-weight: 600;
    background: transparent;
    color: var(--ink);
    width: 100%;
    outline: 0;
}

.title-input:focus {
    border-color: var(--accent);
}

textarea {
    display: block;
    width: 100%;
    background: transparent;
    color: var(--ink);
    border: 0;
    outline: 0;
    resize: vertical;
    padding: 14px 0 8px;
    color: var(--muted);
}

.composer-options {
    display: flex;
    gap: 14px;
    align-items: end;
    margin-top: 12px;
}

.composer-options label {
    color: var(--muted);
    font-size: .77rem;
}

.composer-options input,
.composer-options select,
.toolbar-actions select {
    display: block;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 10px;
    margin-top: 4px;
}

.composer-options .button {
    margin-left: auto;
}

.button {
    min-height: 39px;
    border: 1px solid transparent;
    border-radius: 9px;
    padding: 0 15px;
    font-weight: 700;
    transition: .2s ease;
}

.button-primary {
    background: var(--accent);
    color: white;
}

.button-primary:hover {
    background: var(--accent-dark);
    transform: translateY(-1px);
}

.button-quiet {
    background: transparent;
    color: var(--ink);
    border-color: var(--line);
}

.button-quiet:hover {
    background: var(--surface-alt);
}

.button-small {
    min-height: 34px;
    padding: 0 11px;
    font-size: .82rem;
}

.tasks-section {
    margin-top: 56px;
}

.tasks-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: end;
    margin-bottom: 20px;
}

.count {
    color: var(--muted);
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0;
}

.toolbar-actions {
    display: flex;
    gap: 9px;
    align-items: center;
}

.toolbar-actions select {
    margin: 0;
}

.search {
    display: flex;
    gap: 7px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    padding: 0 10px;
    color: var(--muted);
}

.search input {
    width: 138px;
    background: transparent;
    border: 0;
    outline: 0;
    color: var(--ink);
    padding: 9px 0;
}

.tasks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 17px;
}

.task-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 292px;
    padding: 19px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 5px 15px rgb(41 50 43 / 3%);
    transition: .2s ease;
}

.task-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.task-card.is-complete {
    opacity: .72;
}

.task-card-top,
.card-actions,
.task-meta,
.task-footer,
.new-step {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-actions {
    gap: 5px;
}

.priority {
    display: inline-flex;
    text-transform: capitalize;
    padding: 4px 8px;
    border-radius: 99px;
    font-size: .7rem;
    font-weight: 700;
}

.priority-high {
    color: #a33f31;
    background: #f8ddd8;
}

.priority-medium {
    color: #7c641c;
    background: #f7edc5;
}

.priority-low {
    color: #326654;
    background: #dbeee5;
}

.dark .priority-high {
    color: #ffb4a5;
    background: #542f2a;
}

.dark .priority-medium {
    color: #f2d980;
    background: #504521;
}

.dark .priority-low {
    color: #9cddbd;
    background: #254638;
}

.task-card h3 {
    margin: 18px 0 7px;
    font-size: 1.24rem;
    line-height: 1.18;
    overflow-wrap: anywhere;
}

.task-description {
    margin: 0 0 14px;
    color: var(--muted);
    font-size: .9rem;
    line-height: 1.48;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.task-meta {
    margin-top: auto;
    color: var(--muted);
    font-size: .75rem;
}

.due-date.overdue {
    color: var(--coral);
    font-weight: 700;
}

.due-date.today {
    color: var(--accent);
    font-weight: 700;
}

.progress-track {
    height: 5px;
    background: var(--surface-alt);
    border-radius: 99px;
    margin: 12px 0;
    overflow: hidden;
}

.progress-track span {
    display: block;
    height: 100%;
    background: var(--accent);
    border-radius: 99px;
}

.steps-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 116px;
    overflow: auto;
}

.steps-list li {
    display: flex;
    gap: 8px;
    align-items: start;
    padding: 5px 0;
}

.steps-list label {
    flex: 1;
    display: flex;
    align-items: start;
    gap: 8px;
    color: var(--ink);
    font-size: .86rem;
    overflow-wrap: anywhere;
}

.steps-list input {
    accent-color: var(--accent);
    margin-top: 2px;
}

.steps-list input:checked+span {
    color: var(--muted);
    text-decoration: line-through;
}

.delete-step {
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 1.1rem;
    line-height: 1;
}

.new-step {
    gap: 8px;
    margin-top: 9px;
}

.step-input {
    min-width: 0;
    flex: 1;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: transparent;
    padding: 7px 2px;
    outline: 0;
    color: var(--ink);
    font-size: .85rem;
}

.step-input:focus {
    border-color: var(--accent);
}

.task-footer {
    margin: 15px -19px -19px;
    padding: 12px 19px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: .75rem;
}

.completion-button {
    border: 0;
    background: transparent;
    padding: 0;
    color: var(--accent);
    font-weight: 700;
}

.empty-state {
    grid-column: 1/-1;
    text-align: center;
    padding: 66px 20px;
    border: 1px dashed var(--line);
    border-radius: 16px;
    color: var(--muted);
}

.empty-state h2 {
    margin-top: 13px;
    color: var(--ink);
}

.empty-state p {
    margin: 8px 0 0;
}

.empty-illustration {
    display: grid;
    margin: auto;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: var(--surface-alt);
    color: var(--accent);
    font-size: 1.5rem;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width:760px) {
    .app-shell {
        padding: 16px 16px 42px;
    }

    .hero {
        padding: 43px 2px 35px;
    }

    .today-card {
        min-width: 100px;
        padding: 12px;
    }

    .dashboard {
        grid-template-columns: repeat(2, 1fr);
    }

    .metric:nth-child(2) {
        border-right: 0;
    }

    .metric:nth-child(-n+2) {
        border-bottom: 1px solid var(--line);
    }

    .metric {
        padding: 16px;
    }

    .task-composer {
        margin-top: 32px;
        padding: 20px;
    }

    .composer-options,
    .tasks-toolbar,
    .toolbar-actions {
        align-items: stretch;
        flex-wrap: wrap;
    }

    .composer-options label {
        flex: 1;
        min-width: 130px;
    }

    .composer-options input,
    .composer-options select {
        width: 100%;
    }

    .composer-options .button {
        margin-left: 0;
        flex: 1;
    }

    .tasks-toolbar {
        align-items: start;
    }

    .toolbar-actions {
        width: 100%;
    }

    .search {
        flex: 1;
    }

    .search input {
        width: 100%;
    }

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

@media (max-width:400px) {
    .hero {
        gap: 12px;
    }

    .hero h1 {
        font-size: 2.8rem;
    }

    .today-card {
        display: none;
    }

    .toolbar-actions>* {
        flex: 1;
    }

    .toolbar-actions .button {
        padding: 0 8px;
    }

    .toolbar-actions select {
        min-width: 0;
    }

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

    .metric,
    .metric:nth-child(2) {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .metric:last-child {
        border-bottom: 0;
    }
}