/*
 * Doneso. Light or dark to match the device, with green as the accent.
 * Every colour and size used below is a token here; change them in one place.
 */

@font-face {
    font-family: "Geist";
    src: url("../fonts/Geist-Variable.woff2") format("woff2");
    font-weight: 100 900;
    font-display: swap;
}

@font-face {
    font-family: "Geist Mono";
    src: url("../fonts/GeistMono-Variable.woff2") format("woff2");
    font-weight: 100 900;
    font-display: swap;
}

/* Light is the default; dark is below. */
:root {
    color-scheme: light;

    --bg:          #f5f5f7;
    --bg-raised:   #ffffff;   /* sidebar */
    --surface:     #ffffff;   /* cards */
    --surface-2:   #f1f2f4;   /* inputs, hover */
    --line:        #e5e6ea;
    --line-strong: #d4d6db;
    --ring:        #c4c6cc;   /* an empty tick circle */

    --text:        #18181b;
    --text-2:      #3f3f46;
    --muted:       #6b6b76;   /* 5.2:1 on white */
    --text-strong: #000000;

    --accent:       #15803d;  /* Doneso green: buttons, the + button, ticked circles */
    --accent-hover: #166534;
    --accent-ink:   #ffffff;  /* text and icons on --accent */
    --accent-hi:    #15803d;  /* links, icons, focus rings */
    --accent-lo:    #166534;  /* text on --accent-wash */
    --accent-wash:  rgb(21 128 61 / 0.1);
    --accent-ring:  rgb(21 128 61 / 0.25);

    --danger:      #dc2626;
    --danger-text: #b91c1c;
    --danger-ink:  #ffffff;   /* text on --danger */
    --danger-wash: rgb(220 38 38 / 0.1);
    --warn:        #d97706;
    --warn-text:   #a16207;
    --warn-wash:   rgb(234 179 8 / 0.18);
    --good:        #16a34a;
    --good-text:   #166534;
    --good-wash:   rgb(22 163 74 / 0.1);
    --info-text:   #1d4ed8;   /* In progress */
    --info-wash:   rgb(37 99 235 / 0.1);

    /* Category colours (CATEGORY_COLORS in data.php). */
    --cat-orange: #ea580c;
    --cat-purple: #9333ea;
    --cat-blue:   #2563eb;
    --cat-pink:   #db2777;
    --cat-teal:   #0d9488;
    --cat-yellow: #ca8a04;
    --cat-red:    #dc2626;
    --cat-green:  #16a34a;

    --bar-bg:    rgb(255 255 255 / 0.92);   /* the tab bar on phones, under a blur */
    --overlay:   rgb(24 24 27 / 0.4);       /* behind pop-ups */
    --toast-bg:  #18181b;
    --toast-text:#fafafa;
    --kbd-bg:    rgb(255 255 255 / 0.2);
    --glow:      rgb(21 128 61 / 0.12);     /* behind the logo on the sign-in page */
    --shadow:    0 1px 2px rgb(0 0 0 / 0.04), 0 8px 24px -16px rgb(0 0 0 / 0.18);
    --shadow-lg: 0 24px 64px -12px rgb(0 0 0 / 0.25);

    --font: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "Geist Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

    --radius:    14px;
    --radius-sm: 9px;
    --sidebar:   232px;
    --tabbar:    64px;
}

/* Dark: when the person picks it (lightbulb or account page), or on Auto when the device is
   in dark mode. The two blocks must stay the same; CSS can't share one between them. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;

        --bg:          #0e1110;
        --bg-raised:   #121514;
        --surface:     #171a19;
        --surface-2:   #1f2322;
        --line:        #262b29;
        --line-strong: #343a38;
        --ring:        #4b514f;

        --text:        #eef1ef;
        --text-2:      #b3bab7;
        --muted:       #8a928f;   /* 5.4:1 on --surface */
        --text-strong: #ffffff;

        --accent:       #4ade80;
        --accent-hover: #86efac;
        --accent-ink:   #052e16;
        --accent-hi:    #4ade80;
        --accent-lo:    #86efac;
        --accent-wash:  rgb(74 222 128 / 0.13);
        --accent-ring:  rgb(74 222 128 / 0.3);

        --danger:      #f87171;
        --danger-text: #fca5a5;
        --danger-ink:  #1a0b0b;
        --danger-wash: rgb(248 113 113 / 0.13);
        --warn:        #fbbf24;
        --warn-text:   #fcd34d;
        --warn-wash:   rgb(251 191 36 / 0.13);
        --good:        #4ade80;
        --good-text:   #86efac;
        --good-wash:   rgb(74 222 128 / 0.12);
        --info-text:   #93c5fd;
        --info-wash:   rgb(96 165 250 / 0.14);

        --cat-orange: #fb923c;
        --cat-purple: #a78bfa;
        --cat-blue:   #60a5fa;
        --cat-pink:   #f472b6;
        --cat-teal:   #2dd4bf;
        --cat-yellow: #facc15;
        --cat-red:    #f87171;
        --cat-green:  #4ade80;

        --bar-bg:    rgb(18 21 20 / 0.92);
        --overlay:   rgb(0 0 0 / 0.6);
        --toast-bg:  #262b29;
        --toast-text:#eef1ef;
        --kbd-bg:    rgb(5 46 22 / 0.16);
        --glow:      rgb(74 222 128 / 0.1);
        --shadow:    0 1px 0 rgb(255 255 255 / 0.03) inset, 0 12px 32px -16px rgb(0 0 0 / 0.6);
        --shadow-lg: 0 24px 64px -12px rgb(0 0 0 / 0.75);
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;

    --bg:          #0e1110;
    --bg-raised:   #121514;
    --surface:     #171a19;
    --surface-2:   #1f2322;
    --line:        #262b29;
    --line-strong: #343a38;
    --ring:        #4b514f;

    --text:        #eef1ef;
    --text-2:      #b3bab7;
    --muted:       #8a928f;   /* 5.4:1 on --surface */
    --text-strong: #ffffff;

    --accent:       #4ade80;
    --accent-hover: #86efac;
    --accent-ink:   #052e16;
    --accent-hi:    #4ade80;
    --accent-lo:    #86efac;
    --accent-wash:  rgb(74 222 128 / 0.13);
    --accent-ring:  rgb(74 222 128 / 0.3);

    --danger:      #f87171;
    --danger-text: #fca5a5;
    --danger-ink:  #1a0b0b;
    --danger-wash: rgb(248 113 113 / 0.13);
    --warn:        #fbbf24;
    --warn-text:   #fcd34d;
    --warn-wash:   rgb(251 191 36 / 0.13);
    --good:        #4ade80;
    --good-text:   #86efac;
    --good-wash:   rgb(74 222 128 / 0.12);
    --info-text:   #93c5fd;
    --info-wash:   rgb(96 165 250 / 0.14);

    --cat-orange: #fb923c;
    --cat-purple: #a78bfa;
    --cat-blue:   #60a5fa;
    --cat-pink:   #f472b6;
    --cat-teal:   #2dd4bf;
    --cat-yellow: #facc15;
    --cat-red:    #f87171;
    --cat-green:  #4ade80;

    --bar-bg:    rgb(18 21 20 / 0.92);
    --overlay:   rgb(0 0 0 / 0.6);
    --toast-bg:  #262b29;
    --toast-text:#eef1ef;
    --kbd-bg:    rgb(5 46 22 / 0.16);
    --glow:      rgb(74 222 128 / 0.1);
    --shadow:    0 1px 0 rgb(255 255 255 / 0.03) inset, 0 12px 32px -16px rgb(0 0 0 / 0.6);
    --shadow-lg: 0 24px 64px -12px rgb(0 0 0 / 0.75);
}

/* Base */

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

[hidden] { display: none !important; }

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 400 15px/1.55 var(--font);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* No grey flash on tap; buttons have their own pressed states. */
    -webkit-tap-highlight-color: transparent;
}

h1, h2, h3 {
    margin: 0;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

h1 { font-size: 30px; letter-spacing: -0.03em; }
h2 { font-size: 18px; }

p { margin: 0; }

a { color: var(--accent-hi); text-decoration: none; }
a:hover { color: var(--accent-lo); }

:focus-visible {
    outline: 2px solid var(--accent-hi);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

::selection { background: var(--accent-ring); }

.muted { color: var(--muted); }

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

.icon {
    width: 20px;
    height: 20px;
    flex: none;
}

/* App shell: sidebar on the left, the page on the right. */

.shell {
    display: grid;
    grid-template-columns: var(--sidebar) minmax(0, 1fr);
    min-height: 100vh;
    min-height: 100dvh;
}

.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
    height: 100vh;
    height: 100dvh;
    padding: 20px 14px;
    background: var(--bg-raised);
    border-right: 1px solid var(--line);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px;
    color: var(--text);
    font-weight: 600;
    letter-spacing: -0.01em;
}

.brand:hover { color: var(--text); }

/* The logo is the icon and the wordmark in one SVG, so its width follows its height. */
.brand__logo {
    display: block;
    width: auto;
    height: 28px;
    flex: none;
}

/* The logo comes in both versions; show the one that suits the page. */
.logo { display: block; }
.logo-dark { display: none !important; }

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .logo-light { display: none !important; }
    :root:not([data-theme="light"]) .logo-dark { display: block !important; }
}

:root[data-theme="dark"] .logo-light { display: none !important; }
:root[data-theme="dark"] .logo-dark { display: block !important; }

.signin__logo { margin: 0; }
.signin__logo .logo img { display: block; width: auto; height: 56px; }

.nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav__link {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    border: 0;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--text-2);
    font: inherit;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
}

.nav__link:hover {
    background: var(--surface-2);
    color: var(--text);
}

.nav__link[aria-current="page"] {
    background: var(--accent-wash);
    color: var(--accent-lo);
}

.nav__link[aria-current="page"] .icon { color: var(--accent-hi); }

.nav__link--quiet { margin-top: 4px; color: var(--muted); font-size: 14px; }
.nav__link--quiet .icon { width: 18px; height: 18px; }

.nav__link--soon,
.nav__link--soon:hover {
    background: none;
    color: var(--muted);
    opacity: 0.55;
    cursor: default;
}

.nav__count {
    margin-left: auto;
    min-width: 22px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--accent-wash);
    color: var(--accent-lo);
    font: 500 12px/18px var(--mono);
    text-align: center;
}

.sidebar__foot {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.sidebar__foot .account-link { flex: 1; min-width: 0; }

/* The account menu. On a computer it opens just above the name at the bottom of the
   sidebar; that name is always in the same corner, so nothing needs measuring. It grows
   out of the button it came from. */
.account-menu {
    inset: auto auto 72px 14px;
    width: calc(var(--sidebar) - 28px);
    margin: 0;
    padding: 6px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: scale(0.9);
    transform-origin: bottom left;
    transition: opacity 0.16s, transform 0.16s cubic-bezier(0.2, 0.9, 0.3, 1.2),
        display 0.16s allow-discrete, overlay 0.16s allow-discrete;
}

.account-menu:popover-open { opacity: 1; transform: none; }

@starting-style {
    .account-menu:popover-open { opacity: 0; transform: scale(0.9); }
}

/* The name and email are right next to the menu on a computer, so only phones show them. */
.account-menu__head { display: none; }

.account-menu__item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    border: 0;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--text-2);
    font: inherit;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
}

.account-menu__item .icon { width: 18px; height: 18px; }

/* Rows only phones need, such as Recently deleted (computers have it in the sidebar). */
.account-menu__item--phone { display: none; }

@media (hover: hover) {
    .account-menu__item:hover { background: var(--surface-2); color: var(--text); }
}

/* On phones it drops from the badge in the top bar, in the style of an iOS menu: frosted,
   full-width rows split by thin lines, the label on the left and the icon on the right. */
@media (max-width: 760px) {
    .account-menu {
        inset: calc(54px + env(safe-area-inset-top)) 12px auto auto;
        width: min(260px, calc(100% - 24px));
        padding: 0;
        overflow: hidden;
        border-color: var(--line);
        border-radius: 14px;
        background: var(--bar-bg);
        -webkit-backdrop-filter: blur(20px) saturate(1.8);
        backdrop-filter: blur(20px) saturate(1.8);
        transform-origin: top right;
    }

    .account-menu__head {
        display: grid;
        gap: 1px;
        padding: 12px 16px;
        border-bottom: 1px solid var(--line);
        font-size: 13px;
        line-height: 1.35;
    }

    .account-menu__name { color: var(--text); font-weight: 600; }

    .account-menu__name,
    .account-menu__email {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .account-menu__email { color: var(--muted); }

    .account-menu form,
    .account-menu [data-home-screen-open],
    .account-menu__item--phone { border-top: 1px solid var(--line); }

    .account-menu__item.account-menu__item--phone { display: flex; }

    .account-menu__item {
        flex-direction: row-reverse;
        justify-content: space-between;
        min-height: 46px;
        padding: 0 16px;
        border-radius: 0;
        color: var(--text);
        font-size: 16px;
        font-weight: 400;
    }

    .account-menu__item .icon { width: 20px; height: 20px; }
    .account-menu__item:active { background: var(--surface-2); }
}

.topbar__actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.theme-toggle { display: contents; }

/* The round badge with the person's initial. It opens the account page. */
.avatar {
    display: grid;
    flex: none;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-wash);
    color: var(--accent-hi);
    font-weight: 600;
    line-height: 1;
}

/* In the top bar on phones the badge is a button that opens the account menu. */
button.avatar {
    padding: 0;
    border: 0;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

@media (hover: hover) {
    a.avatar:hover,
    button.avatar:hover { color: var(--accent-lo); }
}

.avatar--sm { width: 28px; height: 28px; font-size: 13px; }
.avatar--lg { width: 56px; height: 56px; font-size: 22px; }

.account-link__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Only on phones: the brand and the account badge across the top. */
.topbar { display: none; }

.icon-btn {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--muted);
    cursor: pointer;
}

.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.main {
    width: 100%;
    max-width: 1080px;
    padding: 40px 48px 64px;
}

/* On a phone the menu becomes a tab bar along the bottom. */
@media (max-width: 760px) {
    .shell { display: block; }

    .topbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: calc(8px + env(safe-area-inset-top)) 12px 0 16px;
    }

    .topbar .brand { display: flex; padding: 0; }

    .nav__count {
        position: absolute;
        top: 4px;
        left: calc(50% + 6px);
        min-width: 18px;
        padding: 0 5px;
        font-size: 11px;
        line-height: 16px;
    }

    .sidebar__foot { display: none !important; }
    /* The tab bar keeps its four sections; phones reach Recently deleted from the account menu. */
    .sidebar .nav__link--quiet { display: none; }

    .sidebar {
        position: fixed;
        inset: auto 0 0 0;
        z-index: 10;
        flex-direction: row;
        gap: 0;
        height: auto;
        padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
        border-right: 0;
        border-top: 1px solid var(--line);
        background: var(--bar-bg);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }

    .sidebar .brand { display: none; }

    .nav {
        display: contents;
    }

    .nav__link {
        position: relative;
        flex: 1;
        flex-direction: column;
        justify-content: center;
        gap: 2px;
        min-height: 52px;
        padding: 6px 2px;
        font-size: 11px;
        text-align: center;
    }

    .main {
        /* Room at the bottom for the tab bar and the + button. */
        padding: 20px 16px calc(var(--tabbar) + 96px + env(safe-area-inset-bottom));
    }

    h1 { font-size: 26px; }
    .task__title { font-size: 16px; }

    .sidebar .new-task { display: none; }
}

/* "New task" at the top of the sidebar (computers). Phones get the round + button. */
.new-task {
    justify-content: flex-start;
    width: 100%;
    margin-bottom: -8px;
}

.new-task kbd {
    margin-left: auto;
    padding: 0 6px;
    border-radius: 4px;
    background: var(--kbd-bg);
    font: 500 11px/18px var(--mono);
}

/* Page heading */

.page-head {
    margin-bottom: 28px;
}

.page-head__eyebrow {
    margin-bottom: 6px;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* Cards and empty states */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.empty {
    display: grid;
    justify-items: center;
    gap: 10px;
    padding: 48px 24px;
    text-align: center;
}

.empty p { max-width: 46ch; }

.empty .btn { margin-top: 8px; }

.empty__icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    margin-bottom: 4px;
    border-radius: 14px;
    background: var(--accent-wash);
    color: var(--accent-hi);
}

.empty__icon .icon { width: 24px; height: 24px; }

/* Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 8px 16px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, transform 0.1s;
}

.btn:hover {
    border-color: var(--muted);
    color: var(--text);
}

.btn:active { transform: translateY(1px); }

.btn .icon { width: 18px; height: 18px; }

.btn--primary {
    border-color: transparent;
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 600;
}

.btn--primary:hover {
    border-color: transparent;
    background: var(--accent-hover);
    color: var(--accent-ink);
}

.btn--block { width: 100%; }

/* Form fields */

.field {
    display: grid;
    gap: 6px;
}

.field label {
    color: var(--text-2);
    font-size: 13px;
    font-weight: 500;
}

.input {
    width: 100%;
    min-height: 42px;
    padding: 9px 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.input:hover { border-color: var(--muted); }

.input:focus {
    outline: none;
    border-color: var(--accent-hi);
    box-shadow: 0 0 0 3px var(--accent-ring);
}

.field--error .input { border-color: var(--danger); }

.field__error {
    color: var(--danger);
    font-size: 13px;
}

.check {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    color: var(--text-2);
    font-size: 14px;
    cursor: pointer;
}

.check input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--accent);
}

.notice {
    color: var(--text-2);
}

.code {
    margin: 0;
    padding: 12px 14px;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--accent-lo);
    font: 13px/1.5 var(--mono);
}

/* Sign-in page */

.page-bare {
    min-height: 100vh;
    min-height: 100dvh;
    background:
        radial-gradient(600px 360px at 50% -80px, var(--glow), transparent 70%),
        var(--bg);
}

.bare-main {
    display: grid;
    place-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 24px 16px;
}

.signin {
    display: grid;
    gap: 24px;
    width: 100%;
    max-width: 360px;
}

.signin__brand {
    display: grid;
    justify-items: center;
    gap: 14px;
}


.signin__card {
    display: grid;
    gap: 16px;
    padding: 24px;
}

.signin__title { font-size: 18px; }

.signin__forgot {
    margin: -4px 0 0;
    text-align: center;
    font-size: 14px;
}

.signin__switch {
    margin: 0;
    color: var(--muted);
    text-align: center;
}

.field__hint {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

/* Account page */

.account-head {
    display: flex;
    align-items: center;
    gap: 16px;
}

.account-head h1 { overflow-wrap: anywhere; }
.account-head .page-head__lede { margin-top: 2px; overflow-wrap: anywhere; }

/* The green tick inside the email box once it's confirmed. */
.input-badge { position: relative; }
.input-badge .input { padding-right: 44px; }
.input-badge.is-edited .verified { display: none; }

.verified {
    position: absolute;
    top: 50%;
    right: 14px;
    display: flex;
    transform: translateY(-50%);
}

.verified circle { fill: var(--accent); }
.verified path { fill: none; stroke: var(--accent-ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.account-card {
    max-width: 520px;
    padding: 20px;
}

/* A new email waiting to be confirmed. */
.pending-email {
    display: grid;
    gap: 12px;
    margin-bottom: 12px;
    background: var(--warn-wash);
    border-color: transparent;
}

.pending-email p { margin: 0; overflow-wrap: anywhere; }
.pending-email__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pending-email__actions .btn { min-height: 40px; }

.btn--danger-solid {
    border-color: transparent;
    background: var(--danger);
    color: var(--danger-ink);
}

@media (hover: hover) {
    .btn--danger-solid:hover { background: var(--danger-text); color: var(--danger-ink); }
}

/* Page parts: breadcrumbs, headings with chips, messages, sections */

.crumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 13px;
}

.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent-lo); }

.page-head__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.page-head__lede {
    max-width: 60ch;
    margin-top: 6px;
    color: var(--muted);
}

.flash {
    margin-bottom: 20px;
    padding: 10px 14px;
    border: 1px solid var(--good-wash);
    border-radius: var(--radius-sm);
    background: var(--good-wash);
    color: var(--good-text);
    font-size: 14px;
}

/* After a delete: the message with an Undo button at the end. */
.flash--undo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-right: 6px;
}

.flash__action {
    flex: none;
    min-height: 32px;
    padding: 4px 12px;
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--good-text);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.flash--error {
    border-color: var(--danger-wash);
    background: var(--danger-wash);
    color: var(--danger-text);
}

/* Until the email is confirmed: a quiet reminder above every page, with "Send it again". */
.verify-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    margin-bottom: 20px;
    padding: 10px 10px 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--warn-wash);
    color: var(--text);
    font-size: 14px;
}

.verify-bar p { margin: 0; overflow-wrap: anywhere; }
.verify-bar .btn { min-height: 40px; background: var(--surface); }

.section { margin-top: 28px; }

.section__title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: var(--text);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.count {
    color: var(--muted);
    font: 400 12px var(--mono);
}

.list-empty {
    padding: 28px 16px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
    color: var(--muted);
    text-align: center;
}

.empty__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.stack {
    display: grid;
    gap: 14px;
}

.field-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.form-actions .btn--danger { margin-left: auto; }

textarea.input {
    min-height: 84px;
    resize: vertical;
    line-height: 1.5;
}

select.input { cursor: pointer; }


.input--sm {
    width: auto;
    min-height: 36px;
    padding: 6px 10px;
    font-size: 14px;
}

.btn--sm {
    min-height: 36px;
    padding: 6px 14px;
    font-size: 14px;
}

.btn--quiet {
    border-color: transparent;
    background: none;
    color: var(--text-2);
}

.btn--quiet:hover {
    border-color: transparent;
    background: var(--surface-2);
}

.btn--danger { color: var(--danger); }
.btn--danger:hover { background: var(--danger-wash); color: var(--danger); }

/* Folding panels: "Edit project", the done list */

.edit-panel { margin-bottom: 20px; }

.edit-panel > summary,
.done-list > summary {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 16px;
    color: var(--text-2);
    font-size: 14px;
    font-weight: 500;
    list-style: none;
    cursor: pointer;
    user-select: none;
}

.edit-panel > summary::-webkit-details-marker,
.done-list > summary::-webkit-details-marker,
.task__summary::-webkit-details-marker { display: none; }

.edit-panel > summary::before,
.done-list > summary::before {
    content: "";
    width: 7px;
    height: 7px;
    margin: 0 4px 0 2px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(-45deg);
    transition: transform 0.15s;
}

.edit-panel[open] > summary::before,
.done-list[open] > summary::before { transform: rotate(45deg); }

.edit-panel > summary:hover,
.done-list > summary:hover { color: var(--text); }

.edit-panel > form {
    padding: 4px 16px 16px;
}

.done-list { margin-top: 20px; }
.done-list > summary { padding-left: 4px; }

/* Chips: priority, due date, status */

.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text-2);
    font-size: 12px;
    font-weight: 500;
    line-height: 20px;
    white-space: nowrap;
}

.prio--urgent { background: var(--danger-wash); color: var(--danger-text); }
.prio--high   { background: var(--warn-wash);   color: var(--warn-text); }
.prio--low    { background: none; color: var(--muted); padding-left: 0; padding-right: 0; }

.due { background: none; padding-left: 0; padding-right: 0; color: var(--muted); font-family: var(--mono); font-size: 12px; }
.due--today { background: var(--accent-wash); color: var(--accent-lo); padding: 1px 8px; }
.due--late  { background: var(--danger-wash); color: var(--danger-text); padding: 1px 8px; }

.chip--doing { background: var(--info-wash); color: var(--info-text); }
.chip--hold  { background: var(--surface-2); color: var(--muted); }

/* A task on hold reads as set aside: its title steps back a little in lists. */
.task:has(.chip--hold) .task__title { color: var(--text-2); }


/* "Add a task" bar */

.add-task,
.add-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    padding: 8px 8px 8px 14px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.add-task:focus-within,
.add-row:focus-within {
    border-color: var(--accent-hi);
    box-shadow: 0 0 0 3px var(--accent-ring), var(--shadow);
}

.add-task__icon { display: flex; color: var(--accent-hi); }

.add-task__title {
    flex: 1 1 200px;
    min-width: 0;
    min-height: 40px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--text);
    font: inherit;
    font-size: 15px;
}

.add-task__title:focus { outline: none; }
.add-task__title::placeholder { color: var(--muted); }

.add-task__route {
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--accent-wash);
    color: var(--accent-lo);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.add-task__extra {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.add-task__extra .input {
    width: auto;
    min-height: 36px;
    padding: 6px 10px;
    font-size: 14px;
}

.add-task__extra select.input { max-width: 220px; }

@media (max-width: 760px) {
    .add-task__extra { flex: 1 1 100%; }
    .add-task__extra .btn { margin-left: auto; }
}

/* Task list */

.tasks {
    margin: 16px 0 0;
    padding: 0;
    list-style: none;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.task {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    align-items: start;
    border-top: 1px solid var(--line);
    scroll-margin: 96px;
}

.task:first-child { border-top: 0; }

/* The task a form just saved or added flashes briefly. */
.task:target,
.task--arrived { animation: arrived 1.6s ease-out; }

@keyframes arrived {
    from { background: var(--accent-wash); }
    to   { background: transparent; }
}

.task__tick {
    display: grid;
    place-items: center;
    height: 48px;
    padding-left: 6px;
}

.tick {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
}

/* The ring itself is drawn with ::before so the button keeps a 36px tap area. */
.tick::before {
    content: "";
    grid-area: 1 / 1;
    width: 22px;
    height: 22px;
    border: 2px solid var(--ring);
    border-radius: 50%;
    transition: background-color 0.15s, border-color 0.15s;
}

.tick svg {
    grid-area: 1 / 1;
    width: 13px;
    height: 13px;
    fill: none;
    stroke: var(--accent-ink);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0;
    transition: opacity 0.15s;
}

/* Hover hints only where there is a mouse; on a phone a tapped circle would stay "half ticked". */
@media (hover: hover) {
    .tick:hover::before { border-color: var(--accent-hi); background: var(--accent-wash); }
    .tick:hover svg { opacity: 0.5; stroke: var(--accent-lo); }
}

.tick:active::before { transform: scale(0.88); }

.prio-ring--urgent::before { border-color: var(--danger); }
.prio-ring--high::before   { border-color: var(--warn); }

.is-done .tick::before { border-color: var(--accent); background: var(--accent); }
.is-done .tick svg { opacity: 1; stroke: var(--accent-ink); }

.task__summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 12px;
    min-height: 48px;
    padding: 12px 16px 12px 2px;
    list-style: none;
    cursor: pointer;
}

.task__title {
    flex: 1 1 220px;
    min-width: 0;
    overflow-wrap: anywhere;
}

.task__summary:hover .task__title { color: var(--text-strong); }

/* The list clips its corners, so draw the focus ring inside the row. */
.task__summary:focus-visible { outline-offset: -2px; }

.task__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
}

.task__meta:empty { display: none; }

/* A task's category: its coloured dot and name. */
.cat-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
}

.cat-dot {
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--cat);
}

.cat--orange { --cat: var(--cat-orange); }
.cat--purple { --cat: var(--cat-purple); }
.cat--blue   { --cat: var(--cat-blue); }
.cat--pink   { --cat: var(--cat-pink); }
.cat--teal   { --cat: var(--cat-teal); }
.cat--yellow { --cat: var(--cat-yellow); }
.cat--red    { --cat: var(--cat-red); }
.cat--green  { --cat: var(--cat-green); }

.task__has-notes { display: flex; color: var(--muted); }
.task__has-notes .icon { width: 16px; height: 16px; }

.is-done .task__title {
    color: var(--muted);
    text-decoration: line-through;
    text-decoration-color: var(--line-strong);
}

/* Both share the first row. An open task's panel widens under the tick button. */
.task__tick { position: relative; z-index: 1; grid-area: 1 / 1; }
.task__body { grid-area: 1 / 2; }
.task__body[open] { grid-column: 1 / -1; background: var(--surface-2); }
.task__body[open] > .task__summary { padding-left: 46px; }
.task__body[open] .task__title { color: var(--text-strong); }

.task__edit {
    display: grid;
    gap: 14px;
    padding: 4px 16px 16px 46px;
}

.task__edit .input { background: var(--bg); }

@media (max-width: 760px) {
    .task__edit { padding-left: 16px; }
}

.notes-view {
    margin-top: 4px;
    color: var(--text-2);
    font-size: 14px;
    overflow-wrap: anywhere;
}

.notes-view--lede {
    max-width: 70ch;
    margin-top: 10px;
}

.notes-view a { text-decoration: underline; text-decoration-color: var(--accent-ring); text-underline-offset: 2px; }

/* Rows: the list of categories */

.rows {
    margin: 0;
    padding: 0;
    list-style: none;
    overflow: hidden;
}

.rows li + li { border-top: 1px solid var(--line); }

.add-row + .rows,
.add-row + .list-empty { margin-top: 16px; }

.row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 16px;
    min-height: 56px;
    padding: 12px 16px;
    color: var(--text);
}

.row:hover { background: var(--surface-2); color: var(--text); }

.row__main {
    display: grid;
    gap: 1px;
    min-width: 0;
}

.row__title { font-weight: 500; overflow-wrap: anywhere; }

.row__main--dot {
    display: flex;
    align-items: center;
    gap: 12px;
}

.row__main--dot .cat-dot { width: 12px; height: 12px; }

.row__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
}

.row__count {
    color: var(--muted);
    font-size: 13px;
}

/* Today */

.section__note {
    margin-left: 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0;
}

.today-section--overdue .section__title { color: var(--danger-text); }

.section__more {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    margin-top: 6px;
    padding: 0 4px;
    color: var(--muted);
    font-size: 13px;
}

.section__more::after { content: "→"; margin-left: 6px; }

@media (hover: hover) {
    .section__more:hover { color: var(--accent-lo); }
}

.empty--compact { padding: 32px 24px; margin-bottom: 8px; }

.page-head--split {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 16px;
}

/* Board */

.board-filter {
    display: flex;
    gap: 8px;
}

.board-filter select { max-width: 260px; }

.board-tabs { display: none; }

.board {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
}

.board-col {
    min-height: 240px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg-raised);
    transition: border-color 0.15s, background-color 0.15s;
}

.board-col.is-target {
    border-color: var(--accent-hi);
    background: var(--accent-wash);
}

.board-col__head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 4px 12px;
    color: var(--text-2);
    font-size: 13px;
    font-weight: 500;
}

.board-col__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--muted);
}

.board-col--doing .board-col__dot { background: var(--info-text); box-shadow: 0 0 0 3px var(--info-wash); }
.board-col--done .board-col__dot { background: var(--good); }

.board-col__note {
    margin-left: auto;
    color: var(--muted);
    font-size: 12px;
    font-weight: 400;
}

.board-col__list {
    display: grid;
    gap: 8px;
    min-height: 48px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.board-col__empty {
    display: none;
    margin-top: -48px;
    padding: 14px 10px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-size: 13px;
    text-align: center;
    pointer-events: none;
}

.board-col.is-empty .board-col__empty { display: block; }

.bcard {
    display: grid;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: var(--shadow);
    cursor: grab;
}

.bcard.is-dragging { opacity: 0.35; }

.bcard--arrived { animation: arrived 1.4s ease-out; }

.bcard__title {
    color: var(--text);
    font-weight: 500;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.bcard__title:hover { color: var(--text-strong); }

.bcard.is-done .bcard__title {
    color: var(--muted);
    text-decoration: line-through;
    text-decoration-color: var(--line-strong);
}

.bcard__foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.bcard__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    min-width: 0;
}

.bcard__meta .cat-tag { font-size: 12px; }

.bcard__status {
    display: flex;
    gap: 6px;
    margin-left: auto;
}

/* The card's status menu: a small pill in the status's own colour, with our own arrow. */
.status-select {
    height: 28px;
    padding: 0 26px 0 10px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%238c849a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 8px center / 12px;
    color: var(--text-2);
    font: 500 12px/1 var(--font);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: border-color 0.15s, background-color 0.15s;
}

.status-select:focus-visible {
    outline: 2px solid var(--accent-hi);
    outline-offset: 2px;
}

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

.status-select--doing { border-color: var(--info-wash); background-color: var(--info-wash); color: var(--info-text); }
.status-select--done  { border-color: var(--good-wash); background-color: var(--good-wash); color: var(--good-text); }
.status-select--hold  { color: var(--muted); }

@media (hover: hover) {
    .status-select:hover { border-color: var(--muted); }
}

/* On hold: a quiet folded line under the board, only there when something is on hold. */

.board-hold { margin-top: 20px; }

.board-hold > summary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    padding: 8px 10px 8px 4px;
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
    list-style: none;
    cursor: pointer;
    user-select: none;
}

.board-hold > summary::-webkit-details-marker { display: none; }

.board-hold > summary::before {
    content: "";
    width: 6px;
    height: 6px;
    margin: 0 4px 0 4px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(-45deg);
    transition: transform 0.15s;
}

.board-hold[open] > summary::before { transform: rotate(45deg); }

@media (hover: hover) {
    .board-hold > summary:hover { color: var(--text-2); }
}

.board-hold__list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 8px;
    margin: 4px 0 0;
    padding: 0;
    list-style: none;
}

.board-hold .bcard { cursor: default; opacity: 0.8; }
.board-hold .bcard:hover { opacity: 1; }

/* Phone: one column per screen, swiped sideways, with tabs to jump between them. */
@media (max-width: 760px) {
    .board-filter { flex: 1 1 100%; }
    .board-filter select { flex: 1; max-width: none; }

    .board-tabs {
        position: sticky;
        /* Opened from the home screen the page runs under the status bar; stay below it. */
        top: env(safe-area-inset-top);
        z-index: 5;
        display: flex;
        gap: 6px;
        margin: 0 -16px 4px;
        padding: 8px 16px;
        background: var(--bar-bg);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }

    .board-tab {
        display: flex;
        flex: 1;
        align-items: center;
        justify-content: center;
        gap: 6px;
        min-height: 40px;
        border: 1px solid var(--line);
        border-radius: 999px;
        background: var(--surface);
        color: var(--text-2);
        font-size: 13px;
        font-weight: 500;
        white-space: nowrap;
    }

    .board-tab[aria-current] {
        border-color: var(--accent-ring);
        background: var(--accent-wash);
        color: var(--accent-lo);
    }

    .board {
        display: flex;
        gap: 12px;
        margin: 0 -16px;
        padding: 8px 16px;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scroll-snap-type: x mandatory;
        scroll-padding: 0 16px;
        scrollbar-width: none;
    }

    .board::-webkit-scrollbar { display: none; }

    /* A sliver of the next column shows, so it's clear there is more to swipe to. */
    .board-col {
        flex: 0 0 calc(100% - 28px);
        min-height: 55vh;
        scroll-snap-align: start;
    }

    .bcard { padding: 12px 12px 12px 14px; cursor: default; }

    /* Details on the left, the status menu beside them, so a card stays short.
       16px text in the menu, or iPhones zoom in when it's tapped. */
    .bcard__foot { flex-wrap: nowrap; align-items: flex-end; }
    .bcard__meta { flex: 1; }
    .status-select { height: 40px; padding: 0 30px 0 14px; font-size: 16px; background-position: right 11px center; }
}

/* Quick add: the + button and the panel */

.fab { display: none; }

@media (max-width: 760px) {
    .fab {
        position: fixed;
        right: 16px;
        bottom: calc(var(--tabbar) + 16px + env(safe-area-inset-bottom));
        z-index: 11;
        display: grid;
        place-items: center;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: var(--accent);
        color: var(--accent-ink);
        box-shadow: 0 10px 28px -8px var(--accent), 0 2px 6px rgb(0 0 0 / 0.2);
    }

    .fab:hover { color: var(--accent-ink); }
    .fab:active { transform: scale(0.94); }
    .fab .icon { width: 26px; height: 26px; stroke-width: 2.2; }
}

.sheet {
    width: min(560px, calc(100% - 32px));
    max-width: none;
    margin-top: 14vh;
    padding: 0;
    border: 1px solid var(--line-strong);
    border-radius: 16px;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-lg);
}

.sheet[open] { animation: sheet-in 0.18s ease-out; }

@keyframes sheet-in {
    from { opacity: 0; transform: translateY(12px); }
}

.sheet::backdrop {
    background: var(--overlay);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.sheet__form,
.sheet__body {
    display: grid;
    gap: 14px;
    padding: 12px 18px 18px;
}

.sheet__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-right: -8px;
}

.sheet__head h2 {
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* iOS gives text boxes rounded corners of its own, which curled the end of this underline,
   and with no room on the left its cursor sat on the edge. */
.sheet__title {
    width: 100%;
    padding: 2px 2px 6px;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    -webkit-appearance: none;
    appearance: none;
    background: none;
    color: var(--text);
    font: 500 19px/1.35 var(--font);
}

.sheet__title:focus { outline: none; border-bottom-color: var(--accent); }
.sheet__title::placeholder { color: var(--muted); font-weight: 400; }

.sheet__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.date-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 6px 14px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text-2);
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.date-chip .icon { width: 16px; height: 16px; }

.date-chip[aria-pressed="true"],
.date-chip--pick.has-date {
    border-color: var(--accent-ring);
    background: var(--accent-wash);
    color: var(--accent-lo);
}

.date-chip--pick { position: relative; }

/* Invisible but covering the whole pill, so the tap reaches it. 16px stops iOS zooming in. */
.date-chip--pick input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    -webkit-appearance: none;
    appearance: none;
    background: none;
    font-size: 16px;
    opacity: 0;
    cursor: pointer;
}

/* A date box from app.js (setUpDates): "Pick date" or the date, the real box invisible on top. */
.date-field {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.input.date-field:not(.input--sm) { display: flex; }
.date-field.is-empty { color: var(--muted); }
.date-field .icon { width: 16px; height: 16px; color: var(--muted); }
.date-field__text { white-space: nowrap; }

.date-field__input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    -webkit-appearance: none;
    appearance: none;
    background: none;
    font-size: 16px;
    opacity: 0;
    cursor: pointer;
}

.date-field:focus-within {
    border-color: var(--accent-hi);
    box-shadow: 0 0 0 3px var(--accent-ring);
}

.date-chip--pick:focus-within {
    outline: 2px solid var(--accent-hi);
    outline-offset: 2px;
}

.sheet__row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.sheet__row .input { background: var(--bg); }

.sheet__actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.sheet__hint {
    color: var(--muted);
    font-size: 12px;
}

@media (max-width: 760px) {
    /* A bottom sheet resting on the keyboard (app.js sets --keyboard). */
    .sheet {
        width: 100%;
        max-height: calc(100dvh - var(--keyboard, 0px) - 24px);
        margin: auto 0 0;
        bottom: var(--keyboard, 0px);
        overflow-y: auto;
        border-bottom: 0;
        border-radius: 20px 20px 0 0;
    }

    .sheet__form,
    .sheet__body { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
    .sheet__hint { display: none; }
    .sheet__actions .btn { flex: 1; min-height: 48px; }
}

/* Notifications on the account page */
.devices {
    display: grid;
    margin: 0;
    padding: 0;
    list-style: none;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
}

.device {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 6px 6px 12px;
}

.device + .device { border-top: 1px solid var(--line); }
.device__name { min-width: 0; overflow-wrap: anywhere; font-size: 14px; }
.device__this { color: var(--muted); }
.section-card { margin-top: 12px; }
.input--narrow { max-width: 180px; }

/* Recently deleted */
.deleted-head { justify-content: space-between; align-items: flex-start; }

.deleted {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    padding: 12px 16px;
}

.deleted__main {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.deleted__main .row__title { overflow-wrap: anywhere; }

.deleted__when {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
    color: var(--muted);
    font-size: 13px;
}

.deleted__actions {
    display: flex;
    gap: 6px;
}

.deleted__actions .btn { min-height: 40px; }

/* "Add Doneso to your Home Screen" (app/partials/home-screen.php) */
.home-screen__intro {
    display: flex;
    align-items: center;
    gap: 14px;
}

.home-screen__icon {
    flex: none;
    width: 56px;
    height: 56px;
    border-radius: 13px;
    box-shadow: var(--shadow);
}

.home-screen__title { font-size: 18px; }

.home-screen__lede {
    margin-top: 4px;
    color: var(--text-2);
    font-size: 14px;
}

.home-screen__steps {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.home-screen__steps li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text-2);
    font-size: 15px;
    line-height: 1.4;
}

.home-screen__steps strong { color: var(--text); font-weight: 600; }

/* The button to look for, drawn the way the phone shows it. */
.home-screen__key {
    display: grid;
    flex: none;
    place-items: center;
    min-width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface);
    color: var(--info-text);
}

.home-screen__key .icon { width: 20px; height: 20px; }

.home-screen__key--text {
    padding: 0 10px;
    font-size: 14px;
    font-weight: 600;
}

/* A short message from app.js, such as "Moved to Done" */

.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 20;
    margin: 0;
    padding: 10px 16px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: var(--toast-bg);
    color: var(--toast-text);
    font-size: 14px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translate(-50%, 8px);
    transition: opacity 0.18s, transform 0.18s;
    pointer-events: none;
}

.toast.is-shown { opacity: 1; transform: translate(-50%, 0); }

/* A message with a button (Undo) can be tapped while it shows. */
.toast--action {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 6px 6px 6px 16px;
    white-space: nowrap;
}

.toast--action.is-shown { pointer-events: auto; }

.toast__action {
    min-height: 34px;
    padding: 0 14px;
    border: 0;
    border-radius: 999px;
    background: var(--accent-wash);
    color: var(--accent-lo);
    font: 600 14px var(--font);
    cursor: pointer;
}

@media (hover: hover) {
    .toast__action:hover { background: var(--accent-ring); color: var(--toast-text); }
}

@media (max-width: 760px) {
    .toast { bottom: calc(var(--tabbar) + 24px + env(safe-area-inset-bottom)); }

    /* 16px or larger, or iPhones zoom the page in when a field is tapped. */
    .input,
    .input--sm,
    .add-task__title,
    .add-task__extra .input,
    .sheet__title,
    .date-chip--pick input { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

/* Categories: the add form, the colour swatches, the page title with its dot */

.new-category {
    display: grid;
    gap: 16px;
    max-width: 560px;
    padding: 20px;
}

.title-with-dot {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow-wrap: anywhere;
}

.title-with-dot .cat-dot { width: 14px; height: 14px; }

.swatches {
    margin: 0;
    padding: 0;
    border: 0;
}

.swatches legend {
    margin-bottom: 8px;
    padding: 0;
    color: var(--text-2);
    font-size: 13px;
    font-weight: 500;
}

.swatches__row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* The radio buttons are hidden; each round label is the visible choice (40px to tap). */
.swatch__input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.swatch {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
}

.swatch::before {
    content: "";
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--cat);
    transition: transform 0.12s;
}

.swatch__input:checked + .swatch {
    box-shadow: inset 0 0 0 2px var(--cat);
}

.swatch__input:focus-visible + .swatch {
    outline: 2px solid var(--accent-hi);
    outline-offset: 1px;
}

@media (hover: hover) {
    .swatch:hover::before { transform: scale(1.1); }
}

/* A question in a pop-up, such as "Delete this category?". It's a popover, which the
   browser opens and closes from button attributes, so it needs no JavaScript. */
.prompt {
    width: calc(100% - 32px);
    max-width: 420px;
    margin: auto;
    padding: 20px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow);
}

.prompt::backdrop { background: var(--overlay); }

.prompt__title { font-size: 18px; overflow-wrap: anywhere; }

.prompt__text {
    margin: 8px 0 18px;
    color: var(--text-2);
}

.prompt__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

@media (max-width: 480px) {
    .prompt__actions .btn { width: 100%; }
}
/* Phones: all eight swatches on one row (8 × 40px), still 40px each to tap. */
@media (max-width: 480px) {
    .new-category { padding: 16px; }
    .swatches__row { gap: 0; }
}

/* Auto / Light / Dark on the account page: radio buttons drawn as one segmented control. */
.segmented {
    display: inline-flex;
    margin: 0;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-2);
}

.segmented__input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.segmented__option {
    display: grid;
    place-items: center;
    min-width: 76px;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 9px;
    color: var(--text-2);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.segmented__input:checked + .segmented__option {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow);
}

.segmented__input:focus-visible + .segmented__option {
    outline: 2px solid var(--accent-hi);
    outline-offset: 1px;
}

/* The public site: homepage and privacy page. Same tokens as the app, wider layout. */

.page-site {
    background:
        radial-gradient(900px 480px at 50% -160px, var(--glow), transparent 70%),
        var(--bg);
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid var(--line);
    background: var(--bar-bg);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}

.site-header__inner,
.site-footer__inner,
.site-main {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding-right: 24px;
    padding-left: 24px;
}

.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: calc(12px + env(safe-area-inset-top));
    padding-bottom: 12px;
}

.site-header__brand .logo img { display: block; width: auto; height: 30px; }

.site-header__actions {
    display: flex;
    gap: 8px;
}

.btn--lg {
    min-height: 48px;
    padding: 0 22px;
    font-size: 16px;
}

/* Screenshots of the app, framed like a window. */
.shot img {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
}

.shot--phone img { border-radius: 28px; }

.hero {
    padding: 72px 0 24px;
    text-align: center;
}

.hero__title {
    font-size: clamp(38px, 7vw, 62px);
    letter-spacing: -0.04em;
    line-height: 1.05;
}

.hero__lede {
    max-width: 56ch;
    margin: 20px auto 0;
    color: var(--text-2);
    font-size: 18px;
}

.hero__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 28px;
}

.hero__small {
    margin-top: 14px;
    color: var(--muted);
    font-size: 14px;
}

/* The phone sits over the corner of the computer. */
.hero__shots {
    position: relative;
    margin: 56px 40px 0 0;
}

.hero__shots .shot--phone {
    position: absolute;
    right: -40px;
    bottom: -40px;
    width: 23%;
}

.feature {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    align-items: center;
    gap: 56px;
    padding: 72px 0;
}

.feature:first-of-type { margin-top: 48px; }

.feature--flip { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.feature--flip .feature__text { order: 2; }

.feature__label {
    color: var(--accent-hi);
    font-size: 14px;
    font-weight: 600;
}

.feature__title {
    margin-top: 8px;
    font-size: clamp(26px, 3.6vw, 34px);
    letter-spacing: -0.03em;
}

.feature__body {
    margin-top: 14px;
    color: var(--text-2);
    font-size: 17px;
}

.perks {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    padding: 40px 0;
}

.perk {
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.perk__title { font-size: 16px; }
.perk p { margin-top: 6px; color: var(--text-2); }

.closing {
    padding: 72px 0 96px;
    text-align: center;
}

.closing__title {
    font-size: clamp(28px, 5vw, 40px);
    letter-spacing: -0.03em;
}

.closing__lede {
    margin: 10px 0 24px;
    color: var(--text-2);
    font-size: 17px;
}

.site-footer { border-top: 1px solid var(--line); }

.site-footer__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 28px;
    padding-top: 28px;
    padding-bottom: calc(28px + env(safe-area-inset-bottom));
}

.site-footer__brand .logo img { display: block; width: auto; height: 22px; }

.site-footer__links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
}

.site-footer__links a { color: var(--text-2); }

.site-footer__small {
    margin-left: auto;
    color: var(--muted);
    font-size: 14px;
}

/* Long-form text: the privacy page. */
.prose {
    max-width: 680px;
    margin: 0 auto;
    padding: 56px 0 80px;
    color: var(--text-2);
    font-size: 16px;
    line-height: 1.65;
}

.prose h1 {
    color: var(--text);
    font-size: clamp(32px, 5vw, 40px);
}

.prose__updated {
    margin-top: 8px;
    color: var(--muted);
    font-size: 14px;
}

.prose h2 {
    margin: 36px 0 10px;
    color: var(--text);
    font-size: 20px;
}

.prose p + p { margin-top: 12px; }
.prose ul { margin: 0; padding-left: 20px; }
.prose li + li { margin-top: 8px; }
.prose strong { color: var(--text); font-weight: 600; }

@media (max-width: 760px) {
    .site-header__inner,
    .site-footer__inner,
    .site-main {
        padding-right: 16px;
        padding-left: 16px;
    }

    .site-header__inner {
        padding-top: calc(10px + env(safe-area-inset-top));
        padding-bottom: 10px;
    }

    .site-header__brand .logo img { height: 26px; }

    .hero { padding-top: 48px; }
    .hero__lede { font-size: 17px; }

    /* A computer screenshot is too small to read on a phone, so phones see the phone one. */
    .hero__shots { margin: 40px 0 0; }
    .hero__shots .shot--desktop { display: none; }

    .hero__shots .shot--phone {
        position: static;
        width: min(300px, 82%);
        margin: 0 auto;
    }

    .feature {
        grid-template-columns: minmax(0, 1fr);
        gap: 24px;
        padding: 40px 0;
    }

    .feature:first-of-type { margin-top: 24px; }
    .feature--flip { grid-template-columns: minmax(0, 1fr); }
    .feature--flip .feature__text { order: 0; }

    /* Phone screenshots are tall, so they don't need the full width. */
    .feature .shot { width: min(320px, 88%); margin: 0 auto; }
    .feature .shot img { border-radius: 24px; }

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

    .closing { padding: 56px 0 72px; }

    .site-footer__small { margin-left: 0; width: 100%; }

    .prose { padding: 40px 0 64px; }
}
