:root {
    color-scheme: light;
    --ink: #241a34;
    --muted: #6d6179;
    --surface: rgba(255, 255, 255, 0.88);
    --surface-solid: #ffffff;
    --line: rgba(80, 54, 120, 0.13);
    --pink: #ff5fa2;
    --pink-soft: #ffe2ef;
    --sun: #ffc145;
    --sun-soft: #fff0bf;
    --mint: #20c997;
    --mint-soft: #d9faef;
    --sky: #4da3ff;
    --sky-soft: #def0ff;
    --violet: #8057ff;
    --violet-soft: #ede7ff;
    --red: #e34f6f;
    --red-soft: #ffe4eb;
    --shadow: 0 22px 70px rgba(74, 48, 120, 0.18);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at 12% 8%, rgba(255, 193, 69, 0.58), transparent 21rem),
        radial-gradient(circle at 88% 12%, rgba(255, 95, 162, 0.48), transparent 22rem),
        radial-gradient(circle at 80% 76%, rgba(77, 163, 255, 0.42), transparent 24rem),
        linear-gradient(135deg, #fff8e5 0%, #fff0f7 44%, #eaf7ff 100%);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.32) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.32) 1px, transparent 1px);
    background-size: 38px 38px;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent 68%);
}

a {
    color: inherit;
}

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

button,
a,
input,
select,
textarea {
    -webkit-tap-highlight-color: transparent;
}

.shell {
    position: relative;
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 34px 0 92px;
}

.compact-shell {
    padding-top: 24px;
}

.brandbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border-radius: 8px;
    padding: 8px 12px 8px 8px;
    background: rgba(255, 255, 255, 0.55);
    box-shadow: 0 14px 34px rgba(74, 48, 120, 0.1);
    text-decoration: none;
}

.brand img {
    display: block;
    width: 42px;
    height: 42px;
    border-radius: 12px;
}

.brand span {
    color: var(--ink);
    font-size: 1.4rem;
    font-weight: 950;
    letter-spacing: 0;
}

.topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 22px;
    align-items: end;
    margin-bottom: 22px;
}

.eyebrow {
    display: inline-flex;
    margin: 0 0 12px;
    border-radius: 999px;
    padding: 7px 12px;
    background: rgba(255, 255, 255, 0.72);
    color: #7a3cff;
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    box-shadow: 0 10px 30px rgba(128, 87, 255, 0.12);
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    max-width: 760px;
    margin-bottom: 12px;
    font-size: clamp(2.25rem, 6vw, 5.3rem);
    line-height: 0.96;
    letter-spacing: 0;
}

.intro {
    max-width: 650px;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 1.08rem;
}

.calendar-link,
.primary-button,
.actions button:not(.icon-button),
.ghost-button,
.close-button,
.fab {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    padding: 0 16px;
    cursor: pointer;
    font-weight: 900;
    text-decoration: none;
    white-space: nowrap;
    transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

.calendar-link {
    background: linear-gradient(135deg, var(--violet), var(--pink));
    color: #fff;
    box-shadow: 0 18px 34px rgba(128, 87, 255, 0.28);
}

.calendar-link:hover,
.primary-button:hover,
.actions button:not(.icon-button):hover,
.ghost-button:hover,
.fab:hover {
    transform: translateY(-2px);
    filter: saturate(1.06);
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

.stats article {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.76);
    border-radius: 8px;
    padding: 18px;
    background: var(--surface);
    box-shadow: 0 18px 44px rgba(74, 48, 120, 0.1);
}

.stats article::after {
    content: "";
    position: absolute;
    right: -18px;
    top: -18px;
    width: 86px;
    height: 86px;
    border-radius: 999px;
    background: var(--pink-soft);
}

.stats article:first-child::after {
    background: var(--sun-soft);
}

.stats article:nth-child(2)::after {
    background: var(--mint-soft);
}

.stats span {
    position: relative;
    z-index: 1;
    display: block;
    margin-bottom: 2px;
    font-size: 2.35rem;
    font-weight: 950;
    line-height: 1;
}

.stats p {
    position: relative;
    z-index: 1;
    margin: 0;
    color: var(--muted);
    font-weight: 800;
}

.view-switch {
    display: inline-flex;
    gap: 8px;
    margin-bottom: 18px;
    border-radius: 999px;
    padding: 6px;
    background: rgba(255, 255, 255, 0.62);
    box-shadow: 0 14px 34px rgba(74, 48, 120, 0.1);
}

.app-footer {
    display: flex;
    justify-content: center;
    padding: 26px 0 0;
}

.app-footer a {
    border-radius: 999px;
    padding: 9px 13px;
    background: rgba(255, 255, 255, 0.55);
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 900;
    text-decoration: none;
}

.app-footer a:hover {
    background: rgba(255, 255, 255, 0.82);
}

.view-switch a {
    border-radius: 999px;
    padding: 9px 14px;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 900;
    text-decoration: none;
}

.view-switch a.is-active {
    background: linear-gradient(135deg, var(--violet), var(--pink));
    color: #fff;
}

.task-list {
    display: grid;
    gap: 14px;
}

.task-card,
.empty-state,
.task-form {
    border: 1px solid rgba(255, 255, 255, 0.75);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.task-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 18px;
    padding: 16px 18px;
    border-left: 9px solid var(--mint);
}

.task-card.overdue {
    border-left-color: var(--sun);
    background: linear-gradient(90deg, rgba(255, 240, 191, 0.94), rgba(255, 255, 255, 0.86) 32%);
}

.task-card.today {
    border-left-color: var(--pink);
    background: linear-gradient(90deg, rgba(255, 226, 239, 0.96), rgba(255, 255, 255, 0.86) 34%);
}

.task-card.deleted-card {
    border-left-color: var(--violet);
    opacity: 0.86;
    background: linear-gradient(90deg, rgba(237, 231, 255, 0.96), rgba(255, 255, 255, 0.86) 34%);
}

.task-main h2 {
    margin-bottom: 7px;
    font-size: 1.38rem;
    line-height: 1.16;
    overflow-wrap: anywhere;
}

.status-pill {
    display: inline-flex;
    margin-bottom: 12px;
    border-radius: 999px;
    padding: 6px 12px;
    background: var(--mint-soft);
    color: #0c8f69;
    font-size: 0.78rem;
    font-weight: 950;
}

.overdue .status-pill {
    background: #fff7d7;
    color: #a05b00;
}

.today .status-pill {
    background: #ffe0f0;
    color: #c42e78;
}

.meta,
.notes {
    color: var(--muted);
}

.meta {
    margin-bottom: 0;
    font-weight: 700;
}

.notes {
    margin: 12px 0 0;
    padding-top: 12px;
    border-top: 1px dashed rgba(80, 54, 120, 0.18);
}

.actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    align-content: start;
}

.actions form {
    margin: 0;
}

.primary-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.done-form button,
.postpone-toggle,
.postpone-form button,
.ghost-button {
    width: 100%;
}

.done-form button {
    background: linear-gradient(135deg, var(--mint), #7be66c);
    color: #073b2d;
    box-shadow: 0 12px 24px rgba(32, 201, 151, 0.23);
}

.done-form button,
.postpone-toggle {
    min-height: 46px;
    font-size: 1rem;
}

.postpone-toggle {
    background: var(--sky-soft);
    color: #1f65ad;
}

.postpone-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 96px;
    gap: 8px;
    align-items: end;
}

.postpone-form[hidden] {
    display: none;
}

.done-note-form {
    display: grid;
    gap: 8px;
}

.done-note-form[hidden] {
    display: none;
}

.done-note-form textarea {
    min-height: 74px;
    padding: 10px 12px;
}

.done-note-form button {
    background: var(--mint-soft);
    color: #0c704f;
}

.postpone-form button {
    background: var(--sky-soft);
    color: #1f65ad;
}

.inline-date {
    margin: 0;
    gap: 5px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
}

.inline-date input {
    min-height: 44px;
    padding: 9px 10px;
}

.ghost-button {
    background: var(--violet-soft);
    color: #5834c5;
}

.quiet-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
    padding-top: 2px;
}

.quiet-actions form {
    display: inline-flex;
}

.icon-button {
    display: inline-flex !important;
    flex: 0 0 42px;
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;
    min-height: 42px !important;
    max-height: 42px !important;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px !important;
    padding: 0 !important;
    background: rgba(255, 255, 255, 0.5);
    color: var(--muted);
    cursor: pointer;
    text-decoration: none;
    white-space: normal;
}

.icon-button:hover {
    background: rgba(255, 255, 255, 0.78);
}

.icon-button svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.45;
}

.icon-note svg,
.icon-history svg,
.icon-delete svg {
    width: 25px;
    height: 25px;
}

.icon-note {
    color: #8a4fd3;
}

.icon-history {
    color: #3768b7;
}

.icon-edit {
    color: #6c6078;
}

.icon-delete {
    color: var(--red);
}

.danger-icon {
    color: var(--red);
}

.inline-history {
    grid-column: 1 / -1;
    border-radius: 8px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.56);
}

.inline-history[hidden] {
    display: none;
}

.inline-history p,
.inline-history ol {
    margin: 0;
}

.inline-history ol {
    display: grid;
    gap: 6px;
    padding: 0;
    list-style: none;
}

.inline-history li {
    color: var(--muted);
    font-weight: 800;
}

.inline-history strong {
    color: var(--ink);
}

.inline-history span::before {
    content: " - ";
}

.inline-history em {
    color: var(--muted);
    font-style: normal;
}

.inline-history em::before {
    content: " - ";
}

.empty-state {
    padding: 42px;
    text-align: center;
}

.empty-state h2 {
    margin-bottom: 8px;
    font-size: 1.6rem;
}

.empty-state p {
    margin-bottom: 0;
    color: var(--muted);
}

.fab {
    position: fixed;
    right: 26px;
    bottom: 26px;
    z-index: 30;
    width: 68px;
    height: 68px;
    border-radius: 999px;
    padding: 0;
    background: linear-gradient(135deg, var(--pink), var(--sun));
    color: #fff;
    font-size: 2.4rem;
    line-height: 1;
    box-shadow: 0 22px 44px rgba(255, 95, 162, 0.34);
}

.form-drawer {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: none;
}

.form-open .form-drawer,
.form-drawer.is-open {
    display: block;
}

.drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(36, 26, 52, 0.34);
    backdrop-filter: blur(8px);
}

.task-form {
    position: absolute;
    right: max(18px, calc((100vw - 1120px) / 2));
    bottom: 22px;
    width: min(440px, calc(100% - 28px));
    max-height: calc(100vh - 44px);
    overflow: auto;
    padding: 22px;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(255, 246, 252, 0.94)),
        #fff;
}

.panel-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.panel-title h2 {
    margin: 0;
    font-size: 1.45rem;
}

.subtle-link,
.close-button {
    background: var(--violet-soft);
    color: #5834c5;
    font-size: 0.9rem;
}

label {
    display: grid;
    gap: 8px;
    margin-bottom: 15px;
    color: #5d4f6f;
    font-size: 0.93rem;
    font-weight: 900;
}

input,
select,
textarea {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 13px 14px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--ink);
    outline: none;
    box-shadow: inset 0 0 0 1px rgba(80, 54, 120, 0.12);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--pink);
    box-shadow: 0 0 0 5px rgba(255, 95, 162, 0.16);
}

textarea {
    resize: vertical;
}

.rhythm-card {
    margin-bottom: 15px;
    border-radius: 8px;
    padding: 14px;
    background: linear-gradient(135deg, var(--sun-soft), var(--sky-soft));
}

.recurrence-choice {
    grid-template-columns: auto 1fr;
    align-items: center;
    border-radius: 8px;
    padding: 13px 14px;
    background: var(--violet-soft);
    color: #5834c5;
}

.recurrence-choice input {
    width: 20px;
    height: 20px;
    box-shadow: none;
}

.rhythm-card p {
    margin-bottom: 10px;
    color: #5d4f6f;
    font-weight: 950;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-items: end;
}

.rhythm-card label {
    margin-bottom: 0;
    min-width: 0;
}

.rhythm-card input,
.rhythm-card select {
    height: 56px;
    width: 0;
    min-width: 100%;
    max-width: 100%;
}

.primary-button {
    width: 100%;
    background: linear-gradient(135deg, var(--violet), var(--pink));
    color: #fff;
    box-shadow: 0 18px 34px rgba(128, 87, 255, 0.25);
}

.errors {
    border-radius: 8px;
    margin-bottom: 14px;
    padding: 12px;
    background: var(--red-soft);
    color: var(--red);
    font-weight: 800;
}

.errors p {
    margin: 0;
}

@media (max-width: 900px) {
    .topbar {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .calendar-link {
        justify-self: start;
    }

    .task-card {
        grid-template-columns: 1fr;
    }

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

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

    .quiet-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }
}

@media (max-width: 620px) {
    .shell {
        width: min(100% - 20px, 1120px);
        padding-top: 22px;
    }

    h1 {
        font-size: 2.35rem;
    }

    .intro {
        font-size: 1rem;
    }

    .stats,
    .actions,
    .primary-actions,
    .postpone-form,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .calendar-link,
    .actions button,
    .ghost-button {
        width: 100%;
    }

    .task-card,
    .stats article,
    .task-form {
        padding: 16px;
    }

    .fab {
        right: 18px;
        bottom: 18px;
        width: 62px;
        height: 62px;
    }

    .task-form {
        right: 14px;
        bottom: 14px;
        max-height: calc(100vh - 28px);
    }

    .view-switch {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
        border-radius: 8px;
    }

    .view-switch a {
        text-align: center;
    }

    .brand {
        width: 100%;
        justify-content: center;
    }
}
