/*
 * Life OS design system (from the Claude Design kit, docs/SCREENS.md).
 * Calm neutral: ink on off-white. The five Bucket colours are the only hues; amber and red are kept for
 * Budget and due-date warnings. Light and dark follow the system.
 */

@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap;
    src: url("/fonts/inter-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap;
    src: url("/fonts/inter-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Space Grotesk"; font-style: normal; font-weight: 500 700; font-display: swap;
    src: url("/fonts/space-grotesk-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Space Grotesk"; font-style: normal; font-weight: 500 700; font-display: swap;
    src: url("/fonts/space-grotesk-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* ---------- Tokens ---------- */

:root {
    color-scheme: light dark;
    --ground: #F5F5F1;
    --surface: #FFFFFF;
    --surface-2: #FAFAF8;
    --sidebar: #FFFFFF;
    --field: #F2F2EE;
    --line: #E3E3DD;
    --line-soft: #EEEEE9;
    --outline: #D5D5CF;
    --seg: #E9E9E4;
    --nav-on: #EDEDE8;
    --soft: #EFEFEA;
    --ink: #17181B;
    --ink-2: #55585F;
    --ink-3: #686B73;
    --on-ink: #FFFFFF;
    --on-ink-2: #BDBFC5;
    --ink-raised: #2C2D31;
    --check: #B9BAB4;
    --dot-off: #C9CAC4;
    --step-off: #DCDCD6;

    --productive: #1A9A7A; --productive-tint: #DDF2EB; --productive-ink: #0B6650;
    --neutral: #98A2B3; --neutral-tint: #EAEDF2; --neutral-ink: #475266;
    --waste: #E8692C; --waste-tint: #FCE8DD; --waste-ink: #A2400F;
    --sleep: #4A4FC4; --sleep-tint: #E6E7FA; --sleep-ink: #3236A0; --sleep-button-ink: #2E3296;
    --untracked: repeating-linear-gradient(135deg, #CFCEC7 0 3px, #EAEAE5 3px 6px);
    --untracked-swatch: repeating-linear-gradient(135deg, #B9B8B1 0 2px, #EAEAE5 2px 4px);

    --warn: #E5A00D; --warn-ink: #8F5600;
    --over: #D64036; --over-ink: #B42318;

    --shadow-fab: 0 6px 18px rgba(23, 24, 27, 0.22);
    --scrim: rgba(17, 18, 20, 0.42);

    --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --display: "Space Grotesk", "Inter", ui-sans-serif, system-ui, sans-serif;
    --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --ground: #111214;
        --surface: #1A1B1E;
        --surface-2: #1A1B1E;
        --sidebar: #151618;
        --field: #232428;
        --line: #2A2B30;
        --line-soft: #26272B;
        --outline: #3A3B40;
        --seg: #232428;
        --nav-on: #2A2B30;
        --soft: #232428;
        --ink: #ECECE8;
        --ink-2: #A6A8AF;
        --ink-3: #8E9199;
        --on-ink: #111214;
        --on-ink-2: #45474D;
        --ink-raised: #D6D6D1;
        --check: #55575D;
        --dot-off: #4A4C52;
        --step-off: #2E2F34;

        --productive: #34C29C; --productive-tint: #12352C; --productive-ink: #7BE3C5;
        --neutral: #8792A6; --neutral-tint: #262B35; --neutral-ink: #C2CAD8;
        --waste: #F08043; --waste-tint: #3A2216; --waste-ink: #FFB089;
        --sleep: #7B80F0; --sleep-tint: #24264F; --sleep-ink: #B5B8FF; --sleep-button-ink: #B5B8FF;
        --untracked: repeating-linear-gradient(135deg, #4A4C52 0 3px, #232428 3px 6px);
        --untracked-swatch: repeating-linear-gradient(135deg, #6A6C72 0 2px, #232428 2px 4px);

        --warn: #E8B23A; --warn-ink: #F2C25B;
        --over: #F0645A; --over-ink: #FF8A80;

        --shadow-fab: none;
        --scrim: rgba(0, 0, 0, 0.6);
    }
}

/* ---------- Base ---------- */

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

html {
    background: var(--ground);
    color: var(--ink);
    font: 15px/1.4 var(--font);
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

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

a { color: var(--ink); text-underline-offset: 2px; }
a:hover { color: var(--ink); }

h1, h2, h3 { margin: 0; }

h1 { font-family: var(--display); font-size: 30px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; }

h2 {
    font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--ink-3); padding: 0 4px;
}

h3 { font-size: 15px; font-weight: 600; }

p { margin: 0; }

ul, ol { margin: 0; padding: 0; }

small { font-size: 13px; color: var(--ink-3); }

strong { font-weight: 600; }

hr { border: 0; border-top: 1px solid var(--line-soft); margin: 8px 0; }

svg.i { flex: none; display: block; }

[hidden] { display: none !important; }

.num, .duration, .elapsed, time { font-variant-numeric: tabular-nums; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------- Shell ---------- */

.app-main {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    padding: max(20px, env(safe-area-inset-top)) 16px calc(112px + env(safe-area-inset-bottom));
}

.app-main.wide { max-width: 1240px; }

.app-main.bare { padding-bottom: 32px; }

.tabbar {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: end;
    padding: 8px 8px calc(14px + env(safe-area-inset-bottom));
    background: var(--surface);
    border-top: 1px solid var(--line);
}

.tabbar a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: 52px; text-decoration: none; color: var(--ink-3); font-size: 11px; font-weight: 500;
}

.tabbar a > span { display: flex; padding: 4px 16px; border-radius: 999px; }

.tabbar a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.tabbar a[aria-current="page"] > span { background: var(--nav-on); }

.tabbar .fab-slot { display: flex; justify-content: center; }

.fab {
    width: 58px; height: 58px; margin-bottom: 8px; border-radius: 20px; border: 0;
    background: var(--ink); color: var(--on-ink);
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-fab); text-decoration: none;
}
.fab:hover { color: var(--on-ink); }

.sidebar { display: none; }

@media (min-width: 1024px) {
    .tabbar { display: none; }

    .sidebar {
        position: fixed; inset: 0 auto 0 0; z-index: 20;
        width: 240px; overflow-y: auto;
        display: flex; flex-direction: column; gap: 28px;
        padding: 28px 16px; background: var(--sidebar); border-right: 1px solid var(--line);
    }

    .sidebar .brand {
        display: flex; align-items: center; gap: 10px; padding: 0 8px;
        font-family: var(--display); font-size: 18px; font-weight: 600; letter-spacing: -0.01em;
        text-decoration: none;
    }

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

    .sidebar nav a {
        display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 12px; border-radius: 12px;
        color: var(--ink-2); font-size: 14px; font-weight: 500; text-decoration: none;
    }
    .sidebar nav a:hover { background: var(--soft); }
    .sidebar nav a[aria-current="page"] { background: var(--nav-on); color: var(--ink); font-weight: 600; }

    .sidebar .foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line-soft); }
    .sidebar .nav-logout {
        width: 100%; justify-content: flex-start; min-height: 40px; padding: 0 12px; border-radius: 12px;
        background: transparent; color: var(--ink-2); font-size: 14px; font-weight: 500;
    }
    .sidebar .nav-logout:hover { background: var(--soft); }

    body.has-nav .app-main { margin-left: max(240px, calc(120px + 50vw - 360px)); margin-right: auto; padding-top: 32px; padding-bottom: 48px; }
    body.has-nav .app-main.wide { margin-left: 240px; max-width: none; padding-left: 32px; padding-right: 32px; }
}

/* ---------- Page header and period navigation ---------- */

.page-head {
    display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
    padding: 20px 4px 0;
}

.page-head > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.page-head .sub, .sub { font-size: 13px; color: var(--ink-3); }

.page-head .actions { margin: 0; }

.close-link {
    width: 44px; height: 44px; margin-left: -12px;
    display: flex; align-items: center; justify-content: center; border-radius: 14px; color: var(--ink);
}

.day-nav, .period {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
}

.day-nav > a, .period > a {
    width: 44px; height: 44px; flex: none; display: flex; align-items: center; justify-content: center;
    border-radius: 14px; color: var(--ink); text-decoration: none;
}

.day-nav > a.dim, .period > a.dim { color: var(--check); }

.day-nav > div, .period > div { display: flex; flex-direction: column; align-items: center; gap: 1px; text-align: center; }

.day-nav h1 { font-size: 22px; letter-spacing: -0.01em; }
.period h1 { font-size: 22px; letter-spacing: -0.01em; }

.day-nav .sub, .period .sub { font-size: 13px; color: var(--ink-3); }

.strip {
    display: flex; gap: 2px; height: 10px; border-radius: 5px; overflow: hidden; background: var(--line-soft);
}
.strip > span { flex: 1 1 0; min-width: 2px; }

.strip-scale {
    display: flex; justify-content: space-between; margin-top: 6px;
    font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums;
}

/* ---------- Sections and cards ---------- */

section, .section { display: flex; flex-direction: column; gap: 10px; }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 4px; }
.section-head h2 { padding: 0; }
.section-head .count { font-size: 12px; font-weight: 600; color: var(--ink-3); }
.section-head > a, .section-head .link-action {
    display: inline-flex; align-items: center; gap: 4px; min-height: 44px; margin: -14px 0;
    font-size: 13px; font-weight: 500; color: var(--ink-2); text-decoration: none;
}
.section-head > a.strong { font-weight: 600; color: var(--ink); }

.card {
    display: flex; flex-direction: column; gap: 12px;
    padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
}

.card.hero { border-radius: 24px; padding: 18px; }

.card.list { gap: 0; padding: 4px 16px; }
.card.list > * + * { border-top: 1px solid var(--line-soft); }
.card.list > .sub-head + *, .card.list > * + .sub-head { border-top: 0; }

.card.rows { gap: 0; padding: 4px 8px 4px 4px; }
.card.habit-card { padding: 2px 4px 2px 2px; }
.card.task-card { gap: 0; padding: 6px 8px 8px 4px; }
.task-card .quick-add { margin: 8px 0 0 8px; }
.rows { list-style: none; display: flex; flex-direction: column; }
.rows > li + li, .rows > .item + .item { border-top: 1px solid var(--line-soft); margin-left: 12px; }
.rows > li + li > :first-child, .rows > .item + .item > :first-child { margin-left: -12px; }
.card > h2, .card .section-head h2 { padding: 0; }

.sub-head { padding: 10px 12px 2px; font-size: 13px; font-weight: 600; color: var(--ink); list-style: none; }
.sub-head.over { color: var(--over-ink); }

.list-row {
    display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 0;
    color: var(--ink); text-decoration: none;
}
.list-row > .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.list-row .title { font-size: 15px; font-weight: 500; }
.list-row .meta-line { font-size: 13px; color: var(--ink-3); }
.list-row .end { flex: none; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.list-row .chev { color: var(--ink-3); }

.split-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.split-2 > .card { min-width: 0; }

.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .label { font-size: 13px; color: var(--ink-3); }
.stat .value { font-family: var(--display); font-size: 26px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.stat .value.small { font-size: 20px; }

.divider-top { padding-top: 14px; border-top: 1px solid var(--line-soft); }

.empty { color: var(--ink-3); font-size: 14px; padding: 12px 4px; }
.card .empty { padding: 8px 0; }

/* ---------- Buttons ---------- */

button, .button, a.button {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 48px; padding: 0 18px; border-radius: 16px; border: 0;
    background: var(--ink); color: var(--on-ink);
    font: inherit; font-size: 15px; font-weight: 600; text-decoration: none; cursor: pointer;
    white-space: nowrap;
}
a.button:hover { color: var(--on-ink); }

button.secondary, .button.secondary, a.button.secondary {
    background: var(--surface); color: var(--ink); border: 1px solid var(--line);
}
a.button.secondary:hover { color: var(--ink); }

button.ghost, .button.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }

button.danger, .button.danger {
    background: transparent; color: var(--over-ink); border: 1px solid var(--line); font-weight: 500;
}

button.sleep, .button.sleep { background: var(--sleep-tint); color: var(--sleep-button-ink); }

button.big, .button.big { width: 100%; min-height: 56px; border-radius: 18px; font-size: 16px; }

button.block, .button.block { width: 100%; }

button.small, .button.small { min-height: 36px; padding: 0 14px; border-radius: 999px; font-size: 13px; }

button.link {
    min-height: 0; padding: 0; border: 0; background: none; color: var(--ink);
    font-size: inherit; font-weight: 500; text-decoration: underline; text-underline-offset: 2px;
}

button.plain-action {
    min-height: 44px; padding: 0 10px; border: 0; background: transparent; color: var(--ink);
    font-size: 13px; font-weight: 600; border-radius: 12px;
}

.icon-btn {
    width: 44px; height: 44px; min-height: 0; padding: 0; flex: none; border-radius: 50%;
    border: 1px solid var(--line); background: var(--surface); color: var(--ink);
    display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn.bare { border: 0; background: transparent; border-radius: 12px; }
.icon-btn.square { border-radius: 14px; }

.stop-btn {
    width: 64px; height: 64px; min-height: 0; padding: 0; flex: none; border-radius: 50%;
    background: var(--ink); color: var(--on-ink);
}
.stop-btn.medium { width: 56px; height: 56px; }

button:disabled { opacity: 0.5; cursor: default; }

form { margin: 0; }
form.inline { display: inline-flex; }

/* ---------- Badges and chips ---------- */

.badge, .rating {
    display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px;
    background: var(--soft); color: var(--ink-2); font-size: 12px; font-weight: 600; white-space: nowrap;
    vertical-align: middle;
}

.rating-productive, .badge.productive { background: var(--productive-tint); color: var(--productive-ink); }
.rating-neutral, .badge.neutral { background: var(--neutral-tint); color: var(--neutral-ink); }
.rating-waste, .badge.waste { background: var(--waste-tint); color: var(--waste-ink); }
.rating-sleep, .badge.sleep { background: var(--sleep-tint); color: var(--sleep-ink); }

.tag {
    display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 6px;
    background: var(--soft); color: var(--ink-2);
    font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap;
}
.tag.auto { background: var(--productive-tint); color: var(--productive-ink); }
.tag.outline {
    height: 22px; padding: 0 8px; border-radius: 999px; background: transparent; border: 1px solid var(--outline);
}

.chips {
    display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 2px 16px;
    scrollbar-width: none;
}
.chips.wrap { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
.chips::-webkit-scrollbar { display: none; }
.chips > form { flex: none; display: flex; }

.chip, a.chip, button.chip {
    flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px;
    border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink);
    font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap;
}
.chip .faint { font-weight: 400; color: var(--ink-3); }
.chip-on, a.chip-on, button.chip-on { background: var(--ink); border-color: var(--ink); color: var(--on-ink); font-weight: 600; }
.chip-on .faint { color: var(--on-ink-2); }
a.chip-on:hover { color: var(--on-ink); }

.chip.soft, a.chip.soft {
    min-height: 36px; padding: 0 12px; background: var(--soft); border: 0; color: var(--ink-2); font-size: 13px;
}

.dot-rating { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--neutral); }
.dot-productive { background: var(--productive); }
.dot-neutral { background: var(--neutral); }
.dot-waste { background: var(--waste); }
.dot-sleep { background: var(--sleep); }

/* ---------- Forms ---------- */

input, select, textarea {
    font: inherit; font-size: 15px; color: var(--ink);
    min-height: 48px; padding: 0 14px; border-radius: 16px;
    border: 1px solid var(--line); background: var(--surface);
    width: 100%; min-width: 0;
}
textarea { padding: 12px 14px; min-height: 120px; line-height: 1.5; resize: vertical; }
select {
    appearance: none; -webkit-appearance: none; padding-right: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23686B73' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
}
input::placeholder, textarea::placeholder { color: #8A8D94; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); }

input[type="checkbox"], input[type="radio"] {
    width: 22px; height: 22px; min-height: 0; padding: 0; margin: 0; flex: none; accent-color: var(--ink);
    appearance: auto; -webkit-appearance: auto; border: 0; border-radius: 4px; background: none;
}
input[type="file"] { padding: 10px 14px; }
input[type="color"] { padding: 4px; width: 64px; }
input[type="number"] { max-width: 9rem; }

label { font-size: 13px; color: var(--ink-3); }

.stack { display: flex; flex-direction: column; gap: 12px; }
.stack label, .row label { display: flex; flex-direction: column; gap: 6px; }
.stack label > input, .stack label > select, .stack label > textarea,
.row label > input, .row label > select, .row label > textarea { color: var(--ink); }

.stack label.check-line, .check-line {
    flex-direction: row; align-items: center; gap: 10px; font-size: 15px; color: var(--ink); min-height: 44px;
}

.row { display: flex; flex-wrap: wrap; gap: 10px; }
.row > label { flex: 1 1 10rem; min-width: 0; }

.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; }
.inline-form > input:not([type="hidden"]), .inline-form > select { flex: 1 1 10rem; width: auto; }
.inline-form > input[type="checkbox"] { flex: none; align-self: center; }

fieldset { margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 16px; min-width: 0; }
fieldset > legend { padding: 0 6px; font-size: 13px; color: var(--ink-3); }
fieldset.bare { padding: 0; border: 0; }
fieldset.bare > legend { padding: 0; margin-bottom: 8px; }

.weekdays { display: flex; flex-wrap: wrap; gap: 6px; }
.stack label.weekday, label.weekday {
    flex-direction: row; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px;
    border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
    font-size: 14px; color: var(--ink);
}
label.weekday input { width: 18px; height: 18px; }

/* A field with its label inside the box (New Transaction, past entry). */
.field {
    display: flex; flex-direction: column; justify-content: center; gap: 0;
    min-height: 56px; padding: 6px 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface);
}
.field > span:first-child { font-size: 12px; color: var(--ink-3); }
.field > input, .field > select {
    min-height: 26px; padding: 0; border: 0; border-radius: 0; background-color: transparent;
    font-size: 15px; font-weight: 500;
}
.field > select { padding-right: 24px; background-position: right 0 center; }
.field:focus-within { border-color: var(--ink); }

.field.inline { flex-direction: row; align-items: center; gap: 12px; min-height: 52px; }
.field.inline > span:first-child { flex: none; width: 64px; font-size: 13px; }
.field.inline > input { flex: 1; }

.quick-add {
    display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 6px 0 16px;
    border-radius: 16px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-3);
}
.quick-add.soft { min-height: 48px; border: 0; background: var(--field); border-radius: 14px; }
.quick-add input { flex: 1; min-height: 44px; padding: 0; border: 0; background: transparent; }
.quick-add button { min-height: 36px; padding: 0 14px; border-radius: 12px; font-size: 13px; }

/* Segmented control built from radio inputs: <div class="segmented"><label><input type=radio><span>..</span></label></div> */
.segmented {
    display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: 2px;
    padding: 3px; border-radius: 14px; background: var(--seg);
}
.segmented label { display: block; position: relative; margin: 0; color: inherit; font-size: inherit; }
.segmented input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.segmented span {
    display: flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 8px;
    border-radius: 11px; font-size: 14px; font-weight: 500; color: var(--ink-2); white-space: nowrap;
}
.segmented input:checked + span { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(23, 24, 27, 0.12); }
.segmented input:focus-visible + span { outline: 2px solid var(--ink); }
.segmented > .muted { display: none; }

/* 1–5 scale (mood, energy) */
.scale { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.scale label { position: relative; display: block; }
.scale input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.scale span {
    display: flex; align-items: center; justify-content: center; height: 52px; border-radius: 16px;
    border: 1px solid var(--line); background: var(--surface); color: var(--ink);
    font-family: var(--display); font-size: 18px; font-weight: 600;
}
.scale input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.scale input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }
.scale-ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-3); }

details { display: flex; flex-direction: column; }
details > summary {
    cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px;
    min-height: 44px; padding: 0 4px; font-size: 13px; font-weight: 600; color: var(--ink);
}
details > summary::-webkit-details-marker { display: none; }
details > summary::after {
    content: ""; width: 16px; height: 16px; flex: none;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
}
details[open] > summary::after { transform: rotate(180deg); }
details.card > summary { padding: 0; min-height: 24px; }
details.card[open] > summary { margin-bottom: 4px; }
details.danger-zone > summary { color: var(--over-ink); }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.actions.end { justify-content: flex-end; }
.save-bar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 8px; }
.save-bar > button { width: 100%; }

/* ---------- Messages ---------- */

.notice, .error {
    display: block; padding: 12px 16px; border-radius: 16px; font-size: 14px; list-style: none; margin: 0;
}
.notice { background: var(--productive-tint); color: var(--productive-ink); }
.error { background: color-mix(in srgb, var(--over) 14%, var(--surface)); color: var(--over-ink); }
ul.error { display: flex; flex-direction: column; gap: 4px; }
.notice a, .error a { color: inherit; font-weight: 600; }

.prompt {
    display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 20px;
    background: var(--ink); color: var(--on-ink); text-decoration: none;
}
.prompt:hover { color: var(--on-ink); }
.prompt .badge-icon {
    flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--ink-raised);
    display: flex; align-items: center; justify-content: center;
}
@media (prefers-color-scheme: dark) { .prompt .badge-icon { color: var(--on-ink); } }
.prompt .grow { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.prompt .grow > :first-child { font-size: 15px; font-weight: 600; }
.prompt .grow > :last-child { font-size: 13px; color: var(--on-ink-2); }
.prompt .pill {
    flex: none; display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border-radius: 999px;
    background: var(--on-ink); color: var(--ink); font-size: 14px; font-weight: 600;
}

/* ---------- Legacy text helpers ---------- */

.muted, .meta, .breadcrumbs { color: var(--ink-3); }
.meta { font-size: 13px; }
.breadcrumbs { font-size: 13px; padding: 0 4px; }
.breadcrumbs a { color: var(--ink-3); text-decoration: none; }
.notes { white-space: pre-wrap; }
.archived { opacity: 0.55; }
.overdue { color: var(--over-ink) !important; }
.narrow { width: 100%; max-width: 400px; margin: 0 auto; }
.secret { word-break: break-all; font-family: var(--mono); font-size: 13px; }
.qr { display: flex; justify-content: center; padding: 12px; background: #FFFFFF; border-radius: 16px; }
.qr svg { display: block; max-width: 100%; height: auto; }
.markdown { overflow-wrap: anywhere; line-height: 1.55; }
.markdown > * + * { margin-top: 0.7em; }
.markdown h1 { font-size: 22px; } .markdown h2 { font-size: 17px; text-transform: none; letter-spacing: 0; color: var(--ink); padding: 0; }
.markdown code { font-family: var(--mono); font-size: 13px; background: var(--soft); padding: 1px 5px; border-radius: 6px; }
.markdown blockquote { margin: 0; padding-left: 12px; border-left: 3px solid var(--line); color: var(--ink-2); }
.markdown ul, .markdown ol { padding-left: 1.3em; }
.tx-income, .positive { color: var(--productive-ink); }

/* Plain lists inside cards: rows with separators. */
.plain { list-style: none; display: flex; flex-direction: column; }
.card > .plain > li, .plain.lined > li { padding: 10px 0; }
.card > .plain > li + li, .plain.lined > li + li { border-top: 1px solid var(--line-soft); }
.plain > li { min-width: 0; }

.entries-row {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0;
}
.entries-row + .entries-row { border-top: 1px solid var(--line-soft); }

table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-3); padding: 8px 6px; }
table.data td { padding: 10px 6px; border-top: 1px solid var(--line-soft); vertical-align: top; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }

/* ---------- Area tree ---------- */

.tree { list-style: none; display: flex; flex-direction: column; }
.tree li {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 48px;
    padding: 6px 0 6px calc(var(--depth, 0) * 18px);
}
.tree li + li { border-top: 1px solid var(--line-soft); }
.tree li a { font-weight: 500; text-decoration: none; }
.tree li .badge, .tree li .rating { height: 20px; font-size: 11px; padding: 0 8px; }

/* ---------- Progress ---------- */

.budget { display: flex; flex-direction: column; gap: 8px; }
.budget + .budget { padding-top: 14px; border-top: 1px solid var(--line-soft); }
.budget-head { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.budget-head > :first-child { font-weight: 500; min-width: 0; }
.budget-head a { text-decoration: none; }
.budget-head .duration { font-variant-numeric: tabular-nums; text-align: right; }
.budget-head .of { color: var(--ink-3); }
.meter { position: relative; height: 8px; border-radius: 4px; background: var(--line-soft); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 4px; background: var(--ink); }
.meter > .pace { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--over-ink); border-radius: 1px; }
.budget-note { font-size: 13px; color: var(--ink-3); }
.budget-warning .meter > span { background: var(--warn); }
.budget-warning .budget-note { color: var(--warn-ink); font-weight: 500; }
.budget-over .meter > span { background: var(--over); }
.budget-over .budget-note, .budget-over .budget-head strong { color: var(--over-ink); font-weight: 500; }
.budget-ok .meter > span { background: var(--ink); }
.goal.behind .budget-note { color: var(--over-ink); font-weight: 500; }
.goal.achieved .budget-note { color: var(--productive-ink); font-weight: 500; }

/* ---------- Buckets ---------- */

.bucket-productive { background: var(--productive); }
.bucket-neutral { background: var(--neutral); }
.bucket-waste { background: var(--waste); }
.bucket-sleep { background: var(--sleep); }
.bucket-untracked { background: var(--untracked); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.swatch.bucket-untracked { background: var(--untracked-swatch); }

.bar { display: flex; gap: 3px; height: 14px; }
.bar > span { border-radius: 4px; min-width: 3px; }

.totals { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.totals > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.totals .v { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.totals .k { font-size: 11px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; }

/* Timeline rows: time column, colour rail, label, duration. */
.timeline { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.timeline li { display: flex; align-items: stretch; gap: 12px; min-height: 58px; }
.timeline .times {
    flex: none; width: 42px; display: flex; flex-direction: column; justify-content: space-between; padding: 6px 0;
    font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums;
}
.timeline .rail { flex: none; width: 6px; margin: 4px 0; border-radius: 3px; }
.timeline .body { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.timeline .body > div { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.timeline .label { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); text-decoration: none; }
.timeline .label-meta { font-size: 13px; color: var(--ink-3); }
.timeline .gap .label { color: var(--ink-2); }
.timeline .duration { flex: none; font-size: 14px; font-weight: 600; }
.timeline .fill {
    flex: none; display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border-radius: 999px;
    border: 1px solid var(--outline); background: var(--surface); color: var(--ink);
    font-size: 13px; font-weight: 600; text-decoration: none;
}

/* ---------- Timers ---------- */

.live-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--neutral); box-shadow: 0 0 0 4px var(--neutral-tint); }
.live-dot.productive { background: var(--productive); box-shadow: 0 0 0 4px var(--productive-tint); }
.live-dot.waste { background: var(--waste); box-shadow: 0 0 0 4px var(--waste-tint); }

.timer-card { display: flex; flex-direction: column; gap: 16px; }
.timer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.timer-head .label {
    display: inline-flex; align-items: center; gap: 10px;
    font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3);
}
.timer-main { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.timer-main > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.timer-main .parent { font-size: 14px; color: var(--ink-3); }
.timer-main .leaf { font-size: 19px; font-weight: 600; color: var(--ink); text-decoration: none; }
.clock {
    font-family: var(--display); font-size: 52px; font-weight: 600; line-height: 1.05; letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
.timer-main .clock { margin-top: 6px; }
.bg-timer { display: flex; align-items: center; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.bg-timer .name { flex: 1; min-width: 0; font-size: 14px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.bg-timer .elapsed { font-size: 15px; font-weight: 600; }

/* ---------- Task rows ---------- */

/* Grid: check | title and meta | Due | Timer. On phones the Due badge drops under the meta line. */
.task {
    display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; column-gap: 4px; align-items: start;
    padding: 2px 0; list-style: none;
}
.task > form:first-child { display: flex; grid-row: 1 / span 2; }
.task-main { grid-column: 2; min-width: 0; display: flex; flex-direction: column; gap: 4px; padding: 12px 0 10px; }
.task-main > a { color: var(--ink); text-decoration: none; font-size: 15px; font-weight: 500; line-height: 1.3; }
.task-main .parent { color: var(--ink-3); font-weight: 400; }
.task-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--ink-3); }
.task-meta > span { display: inline-flex; align-items: center; gap: 4px; }
.task-meta .strong { color: var(--ink); font-weight: 500; }
.task-due {
    grid-column: 2; grid-row: 2; display: inline-flex; align-items: center; gap: 5px; margin: -6px 0 10px;
    font-size: 13px; font-weight: 500; color: var(--ink-2); white-space: nowrap;
}
.task-due.strong { color: var(--ink); font-weight: 600; }
.task-due.over { color: var(--over-ink); font-weight: 600; }
.task-actions { grid-column: 3; grid-row: 1 / span 2; display: flex; }
.task-actions .icon-btn { width: 44px; height: 46px; border: 0; background: transparent; border-radius: 12px; }
@media (min-width: 640px) {
    .task { grid-template-columns: 44px minmax(0, 1fr) auto auto; }
    .task-due { grid-column: 3; grid-row: 1; margin: 0; padding: 13px 8px 0; }
    .task-actions { grid-column: 4; }
}

/* The round check: its ring says the Importance, green with a tick once done. */
.check-btn {
    flex: none; width: 44px; height: 46px; min-height: 0; padding: 0; border: 0; background: transparent;
    display: flex; align-items: center; justify-content: center; border-radius: 12px;
}
.check-btn > span, span.check {
    width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--check);
    display: flex; align-items: center; justify-content: center; color: #FFFFFF;
    transition: background-color .2s ease, border-color .2s ease, transform .2s ease;
}
.check-btn > span svg { opacity: 0; stroke-dasharray: 24; stroke-dashoffset: 24; }
.check-btn:hover > span { border-color: var(--productive); }
.check-btn:active > span { transform: scale(.88); }
.check-btn.lg > span { width: 28px; height: 28px; }
.imp-low .check-btn > span { border-color: var(--neutral); }
.imp-medium .check-btn > span { border-color: var(--warn); }
.imp-high .check-btn > span { border-color: var(--over); }
.done .check-btn > span { background: var(--productive); border-color: var(--productive); }
.done .check-btn > span svg { opacity: 1; stroke-dashoffset: 0; }
span.check.checked { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }

/* Done Tasks are crossed out with a line drawn across the title, so ticking can animate it. */
.title-text { background: linear-gradient(currentColor, currentColor) no-repeat 0 58% / 0 1.5px; transition: background-size .35s ease, color .3s ease; }
.task.done .task-main > a { color: var(--ink-3); }
.task.done .title-text { background-size: 100% 1.5px; }
.done-at { color: var(--productive-ink); font-weight: 500; }
.done-head { display: inline-flex; align-items: center; gap: 6px; }
.done-head svg { color: var(--productive); }
h1.done { text-decoration: line-through; color: var(--ink-3); }

/* Ticking (app.js adds .completing, waits for the animation, then refreshes the list; .arrived marks the moved row). */
[data-task].completing .check-btn > span { animation: tick-pop .5s cubic-bezier(.3, 1.4, .5, 1) forwards; }
[data-task].completing .check-btn > span svg { animation: tick-draw .3s .12s ease-out forwards; }
[data-task].completing .title-text { background-size: 100% 1.5px; color: var(--ink-3); }
[data-task].completing .task-meta, [data-task].completing .task-due { transition: opacity .3s ease .2s; opacity: .5; }
[data-task].reopening .check-btn > span { background: transparent; border-color: var(--check); }
[data-task].reopening .check-btn > span svg { opacity: 0; }
[data-task].reopening .title-text { background-size: 0 1.5px; color: var(--ink); }
[data-task].arrived { animation: arrive .45s ease-out; }
@keyframes tick-pop {
    0% { transform: scale(1); }
    35% { transform: scale(.8); background: var(--productive); border-color: var(--productive); }
    65% { transform: scale(1.14); box-shadow: 0 0 0 6px var(--productive-tint); }
    100% { transform: scale(1); background: var(--productive); border-color: var(--productive); box-shadow: 0 0 0 10px transparent; }
}
@keyframes tick-draw { from { opacity: 1; stroke-dashoffset: 24; } to { opacity: 1; stroke-dashoffset: 0; } }
@keyframes arrive { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
    [data-task], [data-task] * { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}

/* Blocked Tasks: faded, with the reason on its own line. */
.task.blocked .task-main, .task.blocked .task-actions, .task.blocked .task-due { opacity: 0.55; }
.task-blocked { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.task-blocked > span { display: inline-flex; align-items: center; gap: 5px; }

/* ---------- Tasks list ---------- */

.task-lists { display: flex; flex-direction: column; gap: 24px; }

.quick-add .details-link {
    flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 10px; border-radius: 10px;
    color: var(--ink-2); font-size: 13px; font-weight: 500; text-decoration: none;
}
.quick-add .details-link:hover { background: var(--soft); color: var(--ink); }

/* Filters: "Where" and "Time I have" as segmented links, then the Inbox chip. */
.task-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.filter-group { display: flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; }
.filter-label { flex: none; display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--ink-3); white-space: nowrap; }
.seg-links {
    display: flex; gap: 2px; min-width: 0; padding: 3px; border-radius: 13px; background: var(--seg);
    overflow-x: auto; scrollbar-width: none;
}
.seg-links::-webkit-scrollbar { display: none; }
.seg-links a {
    flex: none; display: flex; align-items: center; min-height: 38px; padding: 0 12px; border-radius: 10px;
    color: var(--ink-2); font-size: 13px; font-weight: 500; text-decoration: none; white-space: nowrap;
}
.seg-links a[aria-current] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(23, 24, 27, 0.12); }
.task-filters .chip { min-height: 44px; }

details.earlier { gap: 10px; }
details.earlier > summary {
    justify-content: center; gap: 8px; min-height: 48px; border: 1px dashed var(--outline); border-radius: 16px;
    color: var(--ink-2); font-size: 14px; font-weight: 500;
}
details.earlier > summary:hover { color: var(--ink); }

/* ---------- Task form controls (fragments/task-form.html) ---------- */

.pill-select { width: auto; min-width: 10rem; max-width: 100%; min-height: 42px; border-radius: 12px; font-size: 14px; font-weight: 600; }

.segmented.importance { max-width: 440px; width: 100%; }
.segmented.importance span { gap: 7px; }
.imp-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--check); }
.imp-dot.imp-none { background: transparent; border: 1.5px solid var(--check); }
.imp-dot.imp-low { background: var(--neutral); }
.imp-dot.imp-medium { background: var(--warn); }
.imp-dot.imp-high { background: var(--over); }

/* Estimate chips: radio inputs styled as chips, plus a number field for "Custom". */
.estimate-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.estimate-chips label { position: relative; margin: 0; }
.estimate-chips input[type=radio] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.estimate-chips label > span {
    display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 999px;
    background: var(--surface); border: 1px solid var(--line); color: var(--ink); font-size: 14px; font-weight: 500;
}
.estimate-chips input[type=radio]:checked + span { background: var(--ink); border-color: var(--ink); color: var(--on-ink); font-weight: 600; }
.estimate-chips input[type=radio]:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }
.estimate-chips input[type=number] { width: 88px; min-height: 40px; border-radius: 999px; font-size: 14px; }

/* Checkbox chips (Places, weekdays) and the "Anywhere" chip, on while nothing is ticked. */
.place-chips, .weekdays { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip-toggle { position: relative; display: inline-flex; margin: 0; }
.chip-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip-toggle > span, button.chip-toggle {
    display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 999px;
    background: var(--surface); border: 1px solid var(--line); color: var(--ink); font-size: 14px; font-weight: 500;
}
.chip-toggle input:checked + span, .place-chips:not(:has(input:checked)) .anywhere {
    background: var(--ink); border-color: var(--ink); color: var(--on-ink); font-weight: 600;
}
.chip-toggle input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }
.chip-toggle.small > span { min-height: 36px; padding: 0 12px; font-size: 13px; }
.place-chips .manage { margin-left: 4px; font-size: 13px; color: var(--ink-3); }

.repeat-fields, .block-fields { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.repeat-fields > label { display: flex; flex-direction: column; gap: 6px; }

.blocked-by { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.req-row {
    position: relative; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 8px 8px 14px;
    border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); cursor: pointer;
}
.req-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.req-row > svg { color: var(--warn-ink); }
.req-row.done > svg { color: var(--productive); }
.req-row .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.req-row .title { font-size: 14px; font-weight: 600; }
.req-row .meta-line { font-size: 12px; color: var(--ink-3); }
.req-row .remove { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 10px; color: var(--ink-3); }
.req-row:hover .remove { background: var(--soft); color: var(--ink); }
.req-row:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 2px; }
.req-row:has(input:not(:checked)) { opacity: .5; }
.req-row:has(input:not(:checked)) .title { text-decoration: line-through; }
.add-select {
    width: auto; align-self: flex-start; min-height: 42px; border: 1px dashed var(--outline); background-color: transparent;
    color: var(--ink-2); font-size: 14px; border-radius: 12px;
}

.subtask-inputs { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.subtask-inputs input { min-height: 42px; border-radius: 12px; font-size: 14px; }

/* A date with an optional time: the picker app.js builds around the two fields. */
.when { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
.when > input { flex: 1 1 9rem; width: auto; }
.when.ready > input { display: none; }
.when-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; width: 100%; }
.when-toggle {
    min-height: 42px; padding: 0 12px 0 14px; border-radius: 12px; border: 1px solid var(--line);
    background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 600; gap: 8px;
}
.when-toggle.empty { color: var(--ink-2); font-weight: 500; }
.when-toggle[aria-expanded="true"] { border-color: var(--ink); }
.when-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.when-quick { min-height: 36px; padding: 0 10px; border-radius: 10px; background: transparent; color: var(--ink-2); font-size: 13px; font-weight: 500; }
.when-quick:hover { background: var(--soft); }
.when-quick[aria-pressed="true"] { background: var(--nav-on); color: var(--ink); font-weight: 600; }
.when-clear { margin-left: auto; width: 36px; height: 36px; min-height: 0; padding: 0; border-radius: 10px; background: transparent; color: var(--ink-3); }
.when-clear:hover { background: var(--soft); color: var(--ink); }
.when-panel {
    container-type: inline-size; width: 100%; display: flex; flex-direction: column; gap: 14px;
    padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2);
}
.when.inline .when-panel { padding: 0; border: 0; background: transparent; }
.when-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.when-pick {
    flex-direction: column; align-items: flex-start; gap: 0; min-height: 0; padding: 7px 12px; border-radius: 12px;
    border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 600;
}
.when-pick small { font-size: 12px; font-weight: 400; color: var(--ink-3); }
.when-pick[aria-pressed="true"] { border-color: var(--ink); background: var(--nav-on); }
.when-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@container (min-width: 440px) { .when-body { grid-template-columns: minmax(0, 1fr) 180px; } }
.when-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.when-cal-head strong { font-size: 14px; }
.when-cal-head span { display: flex; gap: 2px; }
.when-cal-head button { width: 34px; height: 34px; min-height: 0; padding: 0; border-radius: 9px; background: transparent; color: var(--ink-2); }
.when-cal-head button:hover { background: var(--soft); color: var(--ink); }
.when-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; text-align: center; }
.when-grid .wd { padding: 4px 0; font-size: 11px; font-weight: 600; color: var(--ink-3); }
.when-grid button {
    position: relative; height: 36px; min-height: 0; padding: 0; border-radius: 10px; background: transparent;
    color: var(--ink); font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums;
}
.when-grid button:hover { background: var(--soft); }
.when-grid button.past { color: var(--ink-3); font-weight: 400; }
.when-grid button.today { font-weight: 700; }
.when-grid button.today::after { content: ""; position: absolute; left: 50%; bottom: 4px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: currentColor; }
.when-grid button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); font-weight: 700; }
.when-times h3 { margin-bottom: 8px; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.when-time-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
@container (min-width: 440px) { .when-time-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.when-time-grid button {
    min-height: 38px; padding: 0; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
    color: var(--ink); font-size: 13px; font-weight: 600;
}
.when-time-grid button[aria-pressed="true"] { border-color: var(--ink); background: var(--nav-on); }
.when-other { margin-top: 6px; min-height: 38px; border-radius: 10px; font-size: 13px; }
.when-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.when-sum { flex: 1 1 12rem; font-size: 13px; font-weight: 600; }
.when-sum small { font-size: 13px; font-weight: 400; }
.when-foot button { min-height: 36px; padding: 0 14px; border-radius: 10px; font-size: 13px; }
.when-foot button.clear { background: transparent; color: var(--ink-2); }

/* ---------- New task (task-new.html, also shown in the overlay) ---------- */

.app-main > .task-new { background: var(--surface); border: 1px solid var(--line); border-radius: 24px; overflow: hidden; }
.tn-form { display: flex; flex-direction: column; }
.tn-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 0 24px; }
.kicker { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.tn-form > .error { margin: 8px 24px 0; }
.tn-title {
    min-height: 0; padding: 4px 24px; border: 0; border-radius: 0; background: transparent;
    font-family: var(--display); font-size: 24px; font-weight: 600; letter-spacing: -0.01em;
}
.tn-notes, .te-notes {
    min-height: 0; padding: 4px 24px 16px; border: 0; border-radius: 0; background: transparent; resize: none;
    font-size: 14px; line-height: 1.5; color: var(--ink-2);
}
.tn-rows { display: flex; flex-direction: column; gap: 8px; padding: 16px 24px 20px; border-top: 1px solid var(--line-soft); }
.tn-row { display: grid; grid-template-columns: 124px minmax(0, 1fr); gap: 12px; align-items: start; }
.tn-row > :nth-child(2) { min-height: 44px; align-content: center; }
.tn-label { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; color: var(--ink-2); }
.tn-label svg { color: var(--ink-3); }
.tn-row.tn-more { margin-top: 4px; padding-top: 10px; border-top: 1px dashed var(--line); }
.more-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chip-add {
    min-height: 36px; padding: 0 12px; gap: 6px; border-radius: 999px; border: 1px dashed var(--outline);
    background: transparent; color: var(--ink-2); font-size: 13px; font-weight: 500;
}
.chip-add:hover { color: var(--ink); border-color: var(--ink-3); }
.tn-foot {
    position: sticky; bottom: 0; display: flex; align-items: center; gap: 10px; padding: 14px 24px;
    border-top: 1px solid var(--line-soft); background: var(--surface);
}
.tn-foot .keys { display: none; margin-right: auto; font-size: 12px; color: var(--ink-3); }
.tn-foot > a.button { margin-left: auto; }
.tn-foot .keys + a.button { margin-left: 0; }
.tn-foot .button, .tn-foot button { min-height: 44px; }
kbd { padding: 2px 6px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-2); font: 600 11px var(--font); color: var(--ink-2); }
@media (min-width: 1024px) { .tn-foot .keys { display: inline; } }
@media (max-width: 560px) {
    .tn-row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
    .tn-label { min-height: 30px; }
    .tn-row > :nth-child(2) { min-height: 0; }
}

dialog.sheet.modal { max-width: 680px; padding: 0; }
@media (min-width: 1024px) { dialog.sheet.modal { padding: 0; border-radius: 24px; max-height: 90vh; } }

/* ---------- Task page (task.html): the Task on the left, Details and Schedule on the right ---------- */

.app-main.mid { max-width: 1080px; }
.breadcrumbs { display: flex; align-items: center; gap: 8px; }
.breadcrumbs a { display: inline-flex; align-items: center; gap: 4px; }
.breadcrumbs .here { color: var(--ink-2); }
.task-edit { display: flex; flex-direction: column; gap: 28px; }
.te-main { display: flex; flex-direction: column; gap: 28px; min-width: 0; }
.te-title { display: flex; align-items: flex-start; gap: 4px; }
.te-title > form { display: flex; padding-top: 2px; }
.te-title .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.te-title-input {
    min-height: 0; padding: 6px 0 2px; border: 0; border-radius: 0; background: transparent;
    font-family: var(--display); font-size: 28px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2;
}
.te-notes { padding: 4px 0; font-size: 15px; }
.te-title.done .te-title-input { text-decoration: line-through; color: var(--ink-3); }
.te-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: -16px; padding-left: 48px; font-size: 14px; }
.te-facts:not(:has(*)) { display: none; }
.te-blocked { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-weight: 500; }
.te-section { gap: 12px; }
.te-section .sub { padding: 2px 4px 0; }
.te-section .subtask-inputs input { border-color: transparent; background: transparent; }
.te-section .subtask-inputs input:focus { border-color: var(--ink); background: var(--surface); }
.subtasks { display: flex; flex-direction: column; gap: 10px; }
.progress { height: 4px; margin: 0 4px; border-radius: 2px; background: var(--line-soft); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 2px; background: var(--productive); transition: width .4s ease; }
.te-side { display: flex; flex-direction: column; gap: 24px; }
.card.frows { gap: 0; padding: 0; overflow: hidden; }
.frow + .frow { border-top: 1px solid var(--line-soft); }
.frow > summary { justify-content: flex-start; gap: 12px; min-height: 52px; padding: 0 14px; font-size: 14px; font-weight: 500; }
.frow > summary > svg:first-child { color: var(--ink-3); }
.frow > summary::after { display: none; }
.frow > summary .label { flex: 1; color: var(--ink-2); }
.frow > summary .value { max-width: 62%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--ink); text-align: right; }
.frow > summary > svg:last-child { color: var(--ink-3); transition: transform .2s ease; }
.frow[open] > summary > svg:last-child { transform: rotate(90deg); }
.frow-body { display: flex; flex-direction: column; gap: 10px; padding: 2px 14px 16px; }
.frow-body .pill-select { width: 100%; }
.te-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 16px; border-top: 1px solid var(--line); }
button.danger.bare { border: 0; padding: 0 12px; }
@media (min-width: 1024px) {
    body.has-nav .app-main.mid { max-width: min(1080px, calc(100vw - 240px)); margin-left: max(240px, calc(120px + 50vw - 540px)); }
    .task-edit { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 48px; align-items: start; }
}

/* ---------- Habit rows ---------- */

.habit { display: flex; align-items: center; gap: 6px; padding: 6px 0; list-style: none; }
.habit > form { display: flex; align-items: center; }
.habit-btn {
    flex: none; width: 52px; height: 52px; min-height: 0; padding: 0; border: 0; background: transparent;
    display: flex; align-items: center; justify-content: center; border-radius: 12px;
}
.habit-box {
    width: 30px; height: 30px; border-radius: 10px; border: 2px solid var(--check);
    display: flex; align-items: center; justify-content: center; color: var(--on-ink);
}
.habit-box.on { background: var(--ink); border-color: var(--ink); }
.habit-box.off { background: var(--soft); border-color: var(--soft); color: var(--ink-3); }
.habit-amount { display: flex; align-items: center; gap: 4px; padding-left: 4px; }
.habit-amount input { width: 64px; min-height: 40px; padding: 0 8px; border-radius: 12px; text-align: center; }
.habit-amount button { width: 40px; height: 40px; min-height: 0; padding: 0; border-radius: 12px; }
.habit-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.habit-main > a { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 500; color: var(--ink); text-decoration: none; }
.habit-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 13px; color: var(--ink-3); }
.habit-meta .strong { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.habit-rate { flex: none; display: flex; flex-direction: column; align-items: flex-end; padding-right: 8px; }
.habit-rate > :first-child { font-family: var(--display); font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.habit-rate > :last-child { font-size: 11px; color: var(--ink-3); }

.dots { display: inline-flex; gap: 4px; align-items: center; }
.dot { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--dot-off); display: inline-block; }
.dot.on { background: var(--ink); border-color: var(--ink); }
.dot.today { border-style: dashed; border-color: var(--ink); }

.history { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 4px; }
.history li {
    height: 34px; display: flex; align-items: center; justify-content: center; border-radius: 10px;
    font-size: 11px; font-weight: 600; background: var(--surface); border: 1.5px solid var(--dot-off); color: var(--ink-3);
}
.history li.on { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.history li.open { border-style: dashed; border-color: var(--ink); color: var(--ink); }

/* ---------- Money ---------- */

.transactions { list-style: none; display: flex; flex-direction: column; }
.day-head { padding: 12px 0 4px; font-size: 13px; font-weight: 600; color: var(--ink); list-style: none; }
.day-head .muted { font-weight: 400; }
a.tx {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 8px 0;
    color: var(--ink); text-decoration: none; border-top: 1px solid var(--line-soft);
}
.tx-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.tx-main > :first-child { font-size: 15px; font-weight: 500; }
.tx-main small { font-size: 12px; }
a.tx > .duration { flex: none; font-weight: 600; }
.tx-transfer > .duration { color: var(--ink-3); }

.amount-field { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0 2px; color: var(--ink-3); font-size: 13px; }
.amount-field > span:last-child {
    display: flex; align-items: baseline; justify-content: center; gap: 6px; padding: 0 12px 4px; border-bottom: 2px solid var(--ink);
}
.amount-field .currency { font-family: var(--display); font-size: 34px; font-weight: 500; color: var(--ink-3); }
.amount-field input {
    width: 190px; min-height: 0; border: 0; border-radius: 0; background: transparent; padding: 0;
    font-family: var(--display); font-size: 64px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.05;
    font-variant-numeric: tabular-nums; color: var(--ink);
}
label.amount input { font-size: 28px; font-family: var(--display); font-weight: 600; }

.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

.split { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; }
.split + .split { border-top: 1px solid var(--line-soft); }
.split.row { flex-direction: row; }

/* ---------- Sleep ---------- */

.asleep {
    display: flex; flex-direction: column; align-items: center; gap: 22px;
    padding: 32px 20px 20px; border-radius: 28px; background: var(--surface); border: 1px solid var(--line); text-align: center;
}
.asleep .moon {
    width: 64px; height: 64px; border-radius: 22px; background: var(--sleep-tint); color: var(--sleep-ink);
    display: flex; align-items: center; justify-content: center;
}
.asleep .since { font-size: 15px; color: var(--ink-2); }
.asleep .clock { font-size: 56px; }
.asleep form { width: 100%; }
.asleep .wake {
    width: 100%; min-height: 64px; border-radius: 20px; font-size: 17px; font-weight: 700;
}
.asleep .fix { display: inline-flex; align-items: center; min-height: 44px; margin: -10px 0 -6px; font-size: 14px; color: var(--ink-2); text-decoration: none; }

.sleeps > li { display: flex; flex-direction: column; gap: 6px; }
.sleeps .actions { margin: 0; }

/* ---------- Quick log sheet and More ---------- */

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tiles.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tile, button.tile {
    display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 14px;
    height: 104px; padding: 14px; border: 0; border-radius: 20px;
    background: var(--field); color: var(--ink); text-decoration: none; text-align: left;
    white-space: normal; font-weight: inherit;
}
.tile:hover { color: var(--ink); }
.tile > span { display: flex; flex-direction: column; min-width: 0; max-width: 100%; }
.tile .name { font-size: 16px; font-weight: 600; }
.tile .status { font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile.ink { background: var(--ink); color: var(--on-ink); }
.tile.ink .status { color: var(--on-ink-2); }
.tile.sleep { background: var(--sleep-tint); color: var(--sleep-button-ink); }
.tile.sleep .status { color: var(--sleep-ink); }
.tiles > form { display: flex; }
.tiles > form > .tile { width: 100%; }

.tiles.three .tile { height: 88px; padding: 12px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); gap: 10px; }
.tiles.three .tile .name { font-size: 14px; }

.check-chip {
    flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px 0 10px;
    border-radius: 14px; background: var(--surface); border: 1px solid var(--line); color: var(--ink);
    font-size: 14px; font-weight: 500;
}
.check-chip > .box { width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--check); }

dialog.sheet {
    position: fixed; inset: auto 0 0 0; width: 100%; max-width: 560px; max-height: 92vh; margin: 0 auto;
    padding: 10px 16px calc(20px + env(safe-area-inset-bottom)); border: 0; border-radius: 28px 28px 0 0;
    background: var(--surface); color: var(--ink); overflow-y: auto;
}
dialog.sheet::backdrop { background: var(--scrim); }
dialog.sheet .grabber { display: block; width: 36px; height: 4px; margin: 0 auto 16px; border-radius: 2px; background: var(--outline); }
.sheet-body { display: flex; flex-direction: column; gap: 20px; }
@media (min-width: 1024px) {
    dialog.sheet { inset: 0; margin: auto; border-radius: 28px; max-height: 86vh; padding: 20px; }
    dialog.sheet .grabber { display: none; }
}

/* ---------- Check-in ---------- */

.steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.steps > span { height: 4px; border-radius: 2px; background: var(--step-off); }
.steps > span.on { background: var(--ink); }
.step-head { display: flex; align-items: center; gap: 12px; padding: 0 4px; }
.step-head .n {
    flex: none; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--dot-off); color: var(--ink-3);
    display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700;
}
.step-head .n.on { border-color: var(--ink); color: var(--ink); }
.step-head h2 { flex: 1; font-size: 16px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--ink); padding: 0; }
.step-head .sub { font-size: 13px; color: var(--ink-3); }
.sleep-icon {
    flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--sleep-tint); color: var(--sleep-ink);
    display: flex; align-items: center; justify-content: center;
}

/* ---------- Today (desktop columns) ---------- */

.today-cols { display: flex; flex-direction: column; gap: 24px; }
.today-cols > .col { display: contents; }
.o-1 { order: 1; } .o-2 { order: 2; } .o-3 { order: 3; } .o-4 { order: 4; } .o-5 { order: 5; } .o-6 { order: 6; } .o-7 { order: 7; }

@media (min-width: 1024px) {
    .today-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; align-items: start; }
    .today-cols > .col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
    .today-head { flex-direction: row !important; align-items: center; justify-content: space-between; }
    .today-head .strip-wrap { display: none; }
    .today-head .day-nav { justify-content: flex-start; }
    .today-head .day-nav > div { align-items: flex-start; text-align: left; }
    .today-head .day-nav h1 { font-size: 28px; }
    .today-head .quick { display: flex !important; }
    .desktop-only { display: flex !important; }
    .mobile-only { display: none !important; }
}
.today-head { display: flex; flex-direction: column; gap: 14px; }
.today-head .quick { display: none; flex-wrap: wrap; gap: 8px; }
.today-head .quick button, .today-head .quick a.button { min-height: 44px; border-radius: 14px; font-size: 14px; }
.desktop-only { display: none !important; }
.desktop-inline { display: none; }
@media (min-width: 1024px) { .desktop-inline { display: inline; } }

.events-row { display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 8px 0; }
.events-row .times { flex: none; width: 48px; display: flex; flex-direction: column; font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.events-row .times .start { color: var(--ink); font-weight: 600; }
.events-row.past .times .start { color: var(--ink-3); font-weight: 400; }
.events-row .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.events-row .grow a { font-size: 15px; font-weight: 500; text-decoration: none; }
.events-row.past .grow a { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--dot-off); }
.events-row .grow small { font-size: 13px; }

/* ---------- Login ---------- */

.auth { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; gap: 24px; padding: 32px 20px; max-width: 420px; margin: 0 auto; }
.auth .brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-size: 20px; font-weight: 600; }

/* New Transaction: the To Account only matters for Transfers. */
.tx-form .transfer-only { display: none; }
.tx-form:has(input[name="kind"][value="TRANSFER"]:checked) .transfer-only { display: flex; }
.split .field { min-width: 0; }

.button.compact, button.compact { min-height: 44px; padding: 0 16px; border-radius: 14px; font-size: 14px; }
.split-2 > :only-child { grid-column: 1 / -1; }

/* ---------- Generic screens: content blocks become cards ---------- */

.stats-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
ul.card.transactions { padding: 0 16px 6px; gap: 0; }
.transactions > li:first-child .day-head { padding-top: 14px; }
.sleep-item { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; }
.sleep-item > .list-row { min-height: 0; padding: 0; }
.sleep-item > .actions { padding-left: 52px; }
.sleep-icon.nap { background: var(--soft); color: var(--ink-3); }

/* Top-level lists, trees, tables and forms on the plainer screens. */
.app-main > ul.plain, .app-main > ol.plain, .app-main > section > ul.plain, .app-main > section > ol.plain,
.app-main > .tree, .app-main > section > .tree,
.app-main > table.data, .app-main > section > table.data,
.app-main > details:not(.card), .app-main > section > details:not(.card),
.app-main > form.stack, .app-main > section > form.stack {
    background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
}
.app-main > ul.plain, .app-main > ol.plain, .app-main > section > ul.plain, .app-main > section > ol.plain,
.app-main > .tree, .app-main > section > .tree { padding: 4px 16px; }
.app-main > ul.plain > li, .app-main > ol.plain > li, .app-main > section > ul.plain > li, .app-main > section > ol.plain > li { padding: 10px 0; }
.app-main > ul.plain > li + li, .app-main > ol.plain > li + li,
.app-main > section > ul.plain > li + li, .app-main > section > ol.plain > li + li { border-top: 1px solid var(--line-soft); }
.app-main > table.data, .app-main > section > table.data { border-collapse: separate; border-spacing: 0; padding: 4px 10px; }
.app-main > details:not(.card), .app-main > section > details:not(.card),
.app-main > form.stack, .app-main > section > form.stack { padding: 16px; }
.app-main > details:not(.card) > summary, .app-main > section > details:not(.card) > summary { padding: 0; min-height: 24px; }
details[open] > summary + * { margin-top: 12px; }
.app-main > h1 { padding: 20px 4px 0; }
.app-main > .breadcrumbs + h1 { padding-top: 0; margin-top: -16px; }
.app-main > .breadcrumbs { padding-top: 20px; }
.app-main > p.meta, .app-main > p.muted { padding: 0 4px; margin-top: -14px; }
.app-main > section > p.muted, .app-main > section > p.meta { padding: 0 4px; }

.app-main ul.plain:not(:has(li)), .app-main ol.plain:not(:has(li)) { display: none; }
select[multiple] { height: auto; min-height: 120px; padding: 8px 10px; background-image: none; }
select[multiple] option { padding: 4px 6px; border-radius: 8px; }

@media (min-width: 1024px) {
    body.has-nav .app-main.wide { width: auto; }
    ol.card.timeline { display: block; column-count: 2; column-gap: 32px; }
    ol.card.timeline > li { break-inside: avoid; }
}

@media (min-width: 1024px) {
    .today-cols .chips { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
    .awake-actions { grid-template-columns: 1fr; }
}

/* ---------- Calendar ---------- */

/* Month grid: weekday labels, then whole weeks (Monday first). Dots say how much is on a date; red if overdue. */
.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; padding: 8px; margin-bottom: 20px; }
.month-grid .wd { text-align: center; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3); padding: 4px 0 6px; }
.month-grid .day {
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 4px;
    min-height: 48px; padding: 6px 0 4px; border-radius: 12px; color: var(--ink); text-decoration: none;
}
.month-grid .day .n { font-family: var(--display); font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.month-grid .day.out { color: var(--ink-3); opacity: 0.6; }
.month-grid .day.today .n { border: 2px solid var(--ink); }
.month-grid .day.selected .n { background: var(--ink); color: var(--on-ink); }
.month-grid .day .dots { display: flex; gap: 3px; height: 5px; }
.month-grid .day .dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--ink-3); }
.month-grid .day.overdue .dots i:first-child { background: var(--over); }
.month-grid .day:hover { background: var(--soft); }

/* Agenda rows: the time on the left, then the title. */
.agenda-row .when { flex: none; width: 92px; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.agenda-row .when.over { color: var(--over-ink); }
.agenda-row .when.strong { color: var(--ink); }
.agenda-row.kind-block .title { color: var(--ink-2); }
