/*
   TimeReport's one stylesheet. No framework.

   The look: panels that float on a cool grey canvas, one ultramarine accent, the Geist
   typeface, figures large and tabular. Light by default, dark when the system or the owner
   says so (.impeccable.md). Colours are OKLCH and every one is a token below; the pages use
   the tokens and never a colour of their own.
*/

@font-face {
    font-family: "Geist";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("fonts/geist-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-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "Geist";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("fonts/geist-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;
}

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

:root {
    color-scheme: light dark;

    /* Surfaces, from the canvas up. */
    --canvas: light-dark(oklch(0.962 0.006 262), oklch(0.165 0.014 264));
    --surface: light-dark(oklch(0.995 0.002 262), oklch(0.212 0.016 264));
    --surface-2: light-dark(oklch(0.972 0.005 262), oklch(0.248 0.018 264));
    --surface-3: light-dark(oklch(0.945 0.008 262), oklch(0.29 0.02 264));
    --glass: light-dark(oklch(0.995 0.002 262 / 0.78), oklch(0.23 0.018 264 / 0.78));

    /* Text. */
    --ink: light-dark(oklch(0.21 0.022 264), oklch(0.965 0.004 264));
    --ink-2: light-dark(oklch(0.45 0.02 264), oklch(0.76 0.012 264));
    --ink-3: light-dark(oklch(0.52 0.018 264), oklch(0.69 0.014 264));

    /* Fainter than any text may be: for icons beside a heading and the nought in an empty field. */
    --ink-faint: light-dark(oklch(0.62 0.016 264), oklch(0.58 0.014 264));
    --line: light-dark(oklch(0.915 0.008 264), oklch(0.305 0.018 264));
    --line-strong: light-dark(oklch(0.84 0.012 264), oklch(0.4 0.02 264));

    /* The edge of a field: 3:1 against the panel, so an empty field can be found. */
    --field-line: light-dark(oklch(0.62 0.016 264), oklch(0.54 0.018 264));

    /* What is raised above a tray: the chosen segment, the buttons of a stepper. */
    --raised: light-dark(oklch(0.995 0.002 262), oklch(0.36 0.022 264));

    /* The one accent, and what is written on it. */
    --accent: light-dark(oklch(0.5 0.21 266), oklch(0.7 0.15 266));
    --accent-strong: light-dark(oklch(0.43 0.21 266), oklch(0.77 0.13 266));
    --accent-soft: light-dark(oklch(0.95 0.03 266), oklch(0.3 0.07 266));
    --accent-ink: light-dark(oklch(0.4 0.19 266), oklch(0.84 0.09 266));
    --on-accent: light-dark(oklch(0.99 0.005 266), oklch(0.17 0.03 266));

    /* The mark is the same in light and dark, and the same as the home-screen icon. */
    --mark: oklch(0.5 0.21 266);
    --on-mark: oklch(0.99 0.005 266);

    /* States. Colour supports the word and never replaces it. */
    --ok: light-dark(oklch(0.5 0.13 156), oklch(0.78 0.14 156));
    --ok-soft: light-dark(oklch(0.95 0.045 156), oklch(0.29 0.055 156));
    --wait: light-dark(oklch(0.5 0.11 70), oklch(0.82 0.13 80));
    --wait-soft: light-dark(oklch(0.955 0.05 85), oklch(0.3 0.05 75));
    --bad: light-dark(oklch(0.52 0.19 25), oklch(0.76 0.14 25));
    --bad-soft: light-dark(oklch(0.955 0.03 25), oklch(0.3 0.07 25));

    /* Depth: one light, from above, tinted with the ink. */
    --shadow-1: 0 0 0 1px light-dark(oklch(0.21 0.03 264 / 0.06), oklch(1 0 0 / 0.07)),
        0 1px 2px light-dark(oklch(0.21 0.03 264 / 0.04), oklch(0 0 0 / 0.3)),
        0 10px 28px -14px light-dark(oklch(0.21 0.03 264 / 0.16), oklch(0 0 0 / 0.6));
    --shadow-2: 0 0 0 1px light-dark(oklch(0.21 0.03 264 / 0.07), oklch(1 0 0 / 0.09)),
        0 2px 4px light-dark(oklch(0.21 0.03 264 / 0.05), oklch(0 0 0 / 0.35)),
        0 24px 48px -20px light-dark(oklch(0.21 0.03 264 / 0.28), oklch(0 0 0 / 0.7));

    /* A 4-point scale. */
    --s-1: 0.25rem;
    --s-2: 0.5rem;
    --s-3: 0.75rem;
    --s-4: 1rem;
    --s-5: 1.5rem;
    --s-6: 2rem;
    --s-7: 3rem;
    --s-8: 4rem;

    --r-sm: 0.625rem;
    --r-md: 0.875rem;
    --r-lg: 1.25rem;
    --r-xl: 1.75rem;
    --r-pill: 999px;

    --tap: 2.75rem;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

    /* Layers, in one place. */
    --z-bar: 30;
    --z-nav: 40;
    --z-over: 60;
}

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

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

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

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

html {
    font-size: 100%;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;

    /* A field that takes the focus is scrolled clear of the bars that float over the page. */
    scroll-padding-bottom: calc(10rem + env(safe-area-inset-bottom, 0px));
}

body {
    margin: 0;
    padding-inline: env(safe-area-inset-left, 0px) env(safe-area-inset-right, 0px);
    min-height: 100dvh;
    background: var(--canvas);
    color: var(--ink);
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.5;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "ss01", "cv11";
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* A faint light from the top of the canvas, so the page is not one flat grey. */
body::before {
    content: "";
    position: fixed;
    inset: 0 0 auto 0;
    height: 28rem;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(60rem 22rem at 18% -8rem, color-mix(in oklch, var(--accent) 13%, transparent), transparent 70%),
        radial-gradient(44rem 18rem at 92% -6rem, color-mix(in oklch, var(--accent) 7%, transparent), transparent 70%);
}

h1,
h2,
h3 {
    margin: 0;
    font-weight: 650;
    letter-spacing: -0.022em;
    line-height: 1.15;
    text-wrap: balance;
}

h1 {
    font-size: 1.75rem;
    letter-spacing: -0.03em;
}

/* The heading takes the focus when a page is shown, for the screen reader; it is not a control. */
h1:focus {
    outline: none;
}

h2 {
    font-size: 1.0625rem;
    letter-spacing: -0.012em;
}

h3 {
    font-size: 1rem;
}

p {
    margin: 0;
    text-wrap: pretty;
}

a {
    color: var(--accent-ink);
    text-decoration: none;
    text-underline-offset: 0.2em;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

button,
a,
summary,
[role="button"] {
    touch-action: manipulation;
}

button,
.button,
summary,
.app-nav a,
.week-day,
.cal-day,
.year-month,
.segmented a,
.day-step,
.lines > li > a.line-main {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* A link in running text is underlined: colour alone does not say it can be followed. */
p a:not(.button),
.lede a {
    text-decoration: underline;
    text-decoration-thickness: 1px;
}

code {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 0.875em;
    padding: 0.1em 0.4em;
    border-radius: 0.4em;
    background: var(--surface-3);
}

.icon {
    width: 1.25rem;
    height: 1.25rem;
    flex: none;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

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

.small {
    font-size: 0.875rem;
}

.figure {
    font-weight: 650;
    letter-spacing: -0.03em;
}

.right {
    text-align: right;
}

.eyebrow {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    color: var(--ink-2);
    font-size: 0.8125rem;
    font-weight: 550;
    letter-spacing: 0.01em;
}

.eyebrow a {
    color: var(--ink-2);
}

.lede {
    color: var(--ink-2);
    max-width: 62ch;
}

.row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--s-3);
}

.stack {
    display: grid;
    gap: var(--s-2);
}

.spread {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-3);
}

/* ---------- The shell: the bar on top, the tab bar on the phone, the page ---------- */

.app-header {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    width: min(70rem, 100% - 2rem);
    margin: 0 auto;
    padding: calc(var(--s-3) + env(safe-area-inset-top, 0px)) 0 var(--s-2);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
    color: var(--ink);
    font-weight: 650;
    letter-spacing: -0.02em;
    margin-right: auto;
}

.brand-mark {
    width: 2rem;
    height: 2rem;
    flex: none;
}

/* On the phone the menu is a bar that floats at the bottom, within reach of the thumb. */
.app-nav {
    position: fixed;
    z-index: var(--z-nav);
    left: calc(var(--s-3) + env(safe-area-inset-left, 0px));
    right: calc(var(--s-3) + env(safe-area-inset-right, 0px));
    bottom: calc(var(--s-3) + env(safe-area-inset-bottom, 0px));
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: var(--s-1);
    padding: var(--s-1);
    border-radius: 1.5rem;
    background: var(--glass);
    -webkit-backdrop-filter: blur(20px) saturate(1.6);
    backdrop-filter: blur(20px) saturate(1.6);
    box-shadow: var(--shadow-2);
}

.app-nav a {
    display: grid;
    justify-items: center;
    gap: 0.125rem;
    min-height: 3.25rem;
    padding: var(--s-2) var(--s-1) 0.375rem;
    border-radius: 1.25rem;
    color: var(--ink-2);
    font-size: 0.6875rem;
    font-weight: 550;
    transition: background-color 160ms var(--ease), color 160ms var(--ease), transform 120ms var(--ease);
}

.app-nav a .icon {
    width: 1.5rem;
    height: 1.5rem;
}

.app-nav a.active {
    background: var(--accent-soft);
    color: var(--accent-ink);
}

.app-nav a:active {
    transform: scale(0.96);
}

.app-account {
    display: flex;
    align-items: center;
    gap: var(--s-1);
}

.account-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
    min-height: var(--tap);
    padding: 0.25rem;
    border-radius: var(--r-pill);
    color: var(--ink-2);
    font-size: 0.875rem;
    font-weight: 500;
}

.avatar {
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.8rem;
    background: var(--surface);
    box-shadow: var(--shadow-1);
    color: var(--accent-ink);
    font-weight: 650;
    text-transform: uppercase;
}

/* On the phone the menu has no room for signing out; the page "Konto" has it. */
.signed-in-as,
.sign-out {
    display: none;
}

.sign-out {
    margin: 0;
}

.app-main {
    width: min(70rem, 100% - 2rem);
    margin: 0 auto;
    padding: var(--s-4) 0 calc(7.5rem + env(safe-area-inset-bottom, 0px));
    display: grid;
    gap: var(--s-5);
    align-content: start;
}

/* A page that is a form is a column, at the left edge that every page shares with the menu. */
.app-main:not(.wide):not(.auth) > * {
    width: 100%;
    max-width: 44rem;
}

/* Each block of a page comes in from below, once, one after the other. */
@media (prefers-reduced-motion: no-preference) {
    .app-main > * {
        animation: rise 520ms var(--ease) both;
    }

    .app-main > :nth-child(2) {
        animation-delay: 50ms;
    }

    .app-main > :nth-child(3) {
        animation-delay: 100ms;
    }

    .app-main > :nth-child(4) {
        animation-delay: 150ms;
    }

    .app-main > :nth-child(n + 5) {
        animation-delay: 200ms;
    }

    /* A page that comes back after its own form was posted stands still: saving is light. */
    .app-main.still > * {
        animation: none;
    }

    @keyframes rise {
        from {
            opacity: 0;
            transform: translateY(0.75rem);
        }
    }

    @keyframes bump {
        40% {
            transform: scale(1.12);
        }
    }
}

@media (min-width: 52rem) {
    h1 {
        font-size: 2.125rem;
    }

    html {
        scroll-padding-top: 5.5rem;
        scroll-padding-bottom: 5.5rem;
    }

    /* On the computer the bar is one island that floats at the top and stays there. */
    .app-header {
        position: sticky;
        top: calc(var(--s-3) + env(safe-area-inset-top, 0px));
        z-index: var(--z-nav);
        margin-top: var(--s-3);
        padding: 0.375rem 0.375rem 0.375rem var(--s-4);
        border-radius: var(--r-pill);
        background: var(--glass);
        -webkit-backdrop-filter: blur(20px) saturate(1.6);
        backdrop-filter: blur(20px) saturate(1.6);
        box-shadow: var(--shadow-1);
    }

    .brand {
        margin-right: var(--s-4);
    }

    .app-nav {
        position: static;
        display: flex;
        margin-right: auto;
        padding: 0;
        background: none;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
        box-shadow: none;
    }

    .app-nav a {
        display: inline-flex;
        align-items: center;
        gap: var(--s-2);
        min-height: 2.5rem;
        padding: 0 var(--s-4) 0 var(--s-3);
        border-radius: var(--r-pill);
        font-size: 0.9375rem;
    }

    .app-nav a .icon {
        width: 1.25rem;
        height: 1.25rem;
    }

    .signed-in-as {
        display: inline;
        max-width: 14rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        padding-right: var(--s-2);
    }

    .avatar {
        width: 2rem;
        height: 2rem;
        border-radius: 0.7rem;
        box-shadow: none;
        background: var(--accent-soft);
    }

    .sign-out {
        display: block;
    }

    .app-main {
        padding: var(--s-6) 0 var(--s-8);
        gap: var(--s-6);
    }
}

@media (hover: hover) and (pointer: fine) {
    a:hover {
        text-decoration: underline;
    }

    .app-nav a:hover,
    .brand:hover,
    .account-chip:hover,
    .button:hover,
    .week-day:hover,
    .cal-day:hover,
    .year-month:hover,
    .lines a:hover {
        text-decoration: none;
    }

    .app-nav a:not(.active):hover {
        background: var(--surface-3);
        color: var(--ink);
    }

    table.ledger button[name="Action"][value="delete"]:hover {
        background: var(--bad-soft);
    }

    .account-chip:hover {
        color: var(--ink);
    }
}

/* Signed out: one card in the middle of the page, under the mark. */
.auth-brand {
    display: grid;
    justify-items: center;
    gap: var(--s-3);
    margin-top: 12svh;
    font-weight: 650;
    font-size: 1.125rem;
    letter-spacing: -0.02em;
}

.auth-brand .brand-mark {
    width: 3.25rem;
    height: 3.25rem;
    filter: drop-shadow(0 12px 18px color-mix(in oklch, var(--accent) 35%, transparent));
}

.app-main.auth {
    width: min(26rem, 100% - 2rem);
    padding-top: var(--s-5);
    gap: var(--s-4);
    text-align: left;
}

.app-main.auth h1 {
    font-size: 1.5rem;
    text-align: center;
}

.app-main.auth section,
.app-main.auth > header,
.app-main.auth > .empty,
.app-main.auth > form {
    padding: var(--s-5);
    border-radius: var(--r-xl);
    background: var(--surface);
    box-shadow: var(--shadow-2);
}

.app-main.auth > header {
    display: grid;
    gap: var(--s-2);
    text-align: center;
}

.app-main.auth > .empty {
    border: 0;
}

/* ---------- Page head ---------- */

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-3);
}

.page-head h1::first-letter,
.day-title h1::first-letter {
    text-transform: uppercase;
}

/* ---------- Panels ---------- */

.panel-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-3);
}

.panel-head h2 {
    display: flex;
    align-items: center;
    gap: var(--s-2);
}

h2 > .icon {
    color: var(--ink-faint);
}

/* A section is a panel with its heading. */
.section {
    container-type: inline-size;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--s-4);
    padding: var(--s-5);
    border-radius: var(--r-xl);
    background: var(--surface);
    box-shadow: var(--shadow-1);
}

.section > h2 {
    display: flex;
    align-items: center;
    gap: var(--s-2);
}

.cols {
    display: grid;
    gap: var(--s-5);
    align-items: start;
}

@media (min-width: 60rem) {
    .cols {
        grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
        gap: var(--s-6);
    }

    .cols > .side {
        position: sticky;
        top: 5.5rem;
    }
}

.cols > * {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--s-5);
    align-content: start;
    min-width: 0;
}

/* The large figure of a page, in a tray of its own. */
.hero {
    display: grid;
    gap: var(--s-4);
    padding: 0.375rem;
    border-radius: calc(var(--r-xl) + 0.375rem);
    background: color-mix(in oklch, var(--surface) 55%, transparent);
    box-shadow: var(--shadow-1);
}

.hero-core {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--s-4);
    padding: var(--s-5);
    border-radius: var(--r-xl);
    background: var(--surface);
    box-shadow: inset 0 1px 0 light-dark(oklch(1 0 0 / 0.9), oklch(1 0 0 / 0.06)), 0 0 0 1px var(--line);
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
    gap: var(--s-4) var(--s-5);
}

.stat {
    display: grid;
    gap: 0.125rem;
    align-content: start;
}

.stat-label {
    color: var(--ink-2);
    font-size: 0.8125rem;
    font-weight: 500;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 650;
    letter-spacing: -0.035em;
    line-height: 1.1;
}

.stat-value small {
    font-size: 0.9375rem;
    font-weight: 500;
    letter-spacing: 0;
    color: var(--ink-2);
}

.stat-sub {
    color: var(--ink-2);
    font-size: 0.8125rem;
}

.stat.big .stat-value {
    font-size: 3rem;
}

/* A tray with a meter: the label, the figure, the line under it and the meter each on a row
   that every figure of the tray shares, so the figures stand on one line. */
.stats:has(.meter) .stat {
    grid-template-rows: auto 1fr auto 1rem;
}

.stats:has(.meter) .stat-value,
.stats:has(.meter) .month-total {
    align-self: end;
}

.stat > .meter {
    align-self: end;
}

@media (max-width: 40rem) {
    .stats > .stat.big {
        grid-column: 1 / -1;
    }
}

.meter {
    height: 0.5rem;
    border-radius: var(--r-pill);
    background: var(--surface-3);
    overflow: hidden;
}

.meter > span {
    display: block;
    height: 100%;
    width: calc(var(--share, 0) * 100%);
    border-radius: inherit;
    background: var(--accent);
    transition: width 600ms var(--ease);
}

.empty {
    display: grid;
    justify-items: start;
    gap: var(--s-3);
    padding: var(--s-6) var(--s-5);
    border-radius: var(--r-xl);
    border: 1.5px dashed var(--line-strong);
    color: var(--ink-2);
}

.empty .icon {
    width: 1.75rem;
    height: 1.75rem;
    color: var(--ink-faint);
}

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

button,
.button,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--s-2);
    min-height: var(--tap);
    padding: 0 var(--s-5);
    border: 0;
    border-radius: var(--r-pill);
    background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--line-strong);
    color: var(--ink);
    font: inherit;
    font-weight: 600;
    letter-spacing: -0.005em;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 120ms var(--ease), background-color 160ms var(--ease), box-shadow 160ms var(--ease), color 160ms var(--ease);
}

button:active,
.button:active,
.btn:active {
    transform: scale(0.97);
}

button.primary,
.button.primary,
.btn-primary {
    background: var(--accent);
    box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.22), 0 8px 18px -8px color-mix(in oklch, var(--accent) 70%, transparent);
    color: var(--on-accent);
}

button.quiet,
.button.quiet,
.btn-link {
    background: transparent;
    box-shadow: none;
    color: var(--accent-ink);
    padding: 0 var(--s-3);
}

button.danger,
.button.danger {
    background: transparent;
    box-shadow: none;
    color: var(--bad);
    padding: 0 var(--s-3);
}

button:disabled,
.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.btn-lg,
.w-100 {
    width: 100%;
}

.btn-lg {
    min-height: 3rem;
}

@media (hover: hover) and (pointer: fine) {
    button:not(:disabled):hover,
    .button:hover,
    .btn:not(:disabled):hover {
        background: var(--surface-2);
        box-shadow: inset 0 0 0 1px var(--ink-3);
    }

    button.primary:not(:disabled):hover,
    .button.primary:hover,
    .btn-primary:not(:disabled):hover {
        background: var(--accent-strong);
        box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.22), 0 10px 22px -8px color-mix(in oklch, var(--accent) 80%, transparent);
    }

    button.quiet:not(:disabled):hover,
    .button.quiet:hover,
    .btn-link:not(:disabled):hover {
        background: var(--accent-soft);
        box-shadow: none;
    }

    button.danger:not(:disabled):hover {
        background: var(--bad-soft);
        box-shadow: none;
    }
}

/* ---------- States and notices ---------- */

.state {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.1875rem 0.625rem 0.1875rem 0.5rem;
    border-radius: var(--r-pill);
    background: var(--surface-3);
    color: var(--ink-2);
    font-size: 0.8125rem;
    font-weight: 550;
    white-space: nowrap;
}

.state::before {
    content: "";
    width: 0.4375rem;
    height: 0.4375rem;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.7;
}

.state.ok {
    background: var(--ok-soft);
    color: var(--ok);
}

.state.waiting {
    background: var(--wait-soft);
    color: var(--wait);
}

.state.failed {
    background: var(--bad-soft);
    color: var(--bad);
}

.state.accent {
    background: var(--accent-soft);
    color: var(--accent-ink);
}

.notice,
.alert {
    padding: var(--s-3) var(--s-4);
    border-radius: var(--r-md);
    background: var(--accent-soft);
    color: var(--accent-ink);
    font-weight: 500;
}

.notice.ok,
.alert-success {
    background: var(--ok-soft);
    color: var(--ok);
}

.notice.waiting {
    background: var(--wait-soft);
    color: var(--wait);
}

.notice.failed,
.alert-danger {
    background: var(--bad-soft);
    color: var(--bad);
}

.notice a,
.alert a {
    color: inherit;
    text-decoration: underline;
}

.text-danger,
.validation-message {
    color: var(--bad);
}

.text-danger:not(h1, h2, h3),
.validation-message {
    font-size: 0.875rem;
}

ul.validation-errors,
.validation-summary-errors ul {
    margin: 0;
    padding-left: 1.1rem;
}

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

.form {
    display: grid;
    gap: var(--s-4);
}

.field,
.form-floating {
    display: grid;
    gap: 0.375rem;
}

.form-floating > label {
    order: -1;
}

.mb-3 {
    margin-bottom: var(--s-4);
}

.field > label,
.form-label {
    color: var(--ink-2);
    font-size: 0.8125rem;
    font-weight: 550;
}

.field .hint {
    color: var(--ink-3);
    font-size: 0.8125rem;
}

.fields-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--s-4);
    align-items: start;
}

input,
select,
textarea,
.form-control {
    width: 100%;
    min-height: var(--tap);
    padding: 0 var(--s-3);
    border: 0;
    border-radius: var(--r-md);
    background: var(--surface-2);
    box-shadow: inset 0 0 0 1px var(--field-line);
    color: var(--ink);
    font: inherit;
    font-size: 1rem;
    transition: box-shadow 160ms var(--ease), background-color 160ms var(--ease);
}

input::placeholder {
    color: var(--ink-3);
}

input:focus,
select:focus,
.form-control:focus {
    outline: none;
    background: var(--surface);
    box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 4px color-mix(in oklch, var(--accent) 18%, transparent);
}

input.invalid,
.form-control.invalid {
    box-shadow: inset 0 0 0 2px var(--bad);
}

input[type="hidden"] {
    display: none;
}

input[type="checkbox"] {
    width: 1.25rem;
    min-height: 1.25rem;
    height: 1.25rem;
    padding: 0;
    accent-color: var(--accent);
    box-shadow: none;
}

/* A checkbox draws no ring of its own from the rule for fields, so it gets the outline. */
input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.check {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    min-height: var(--tap);
}

.check input {
    flex: none;
}

/* ---------- Lists of things with a state beside them ---------- */

.lines {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
}

.lines > li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-2) var(--s-4);
    padding: var(--s-4) 0;
    border-top: 1px solid var(--line);
}

.lines > li:first-child {
    border-top: 0;
    padding-top: 0;
}

.lines > li:last-child {
    padding-bottom: 0;
}

.lines .line-main {
    display: grid;
    gap: 0.125rem;
    min-width: 0;
    flex: 1 1 14rem;
    color: var(--ink);
}

.lines .line-main > strong,
.lines .line-main > a {
    font-weight: 600;
    color: var(--ink);
}

.lines .line-side {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: var(--s-2) var(--s-3);
}

.lines .line-side .delivery {
    flex-basis: 100%;
    text-align: right;
    max-width: 24rem;
}

/* In a narrow column, and on the phone, the side goes under the line and reads from the left. */
@container (max-width: 30rem) {
    .lines > li > .line-side:not(.tight) {
        flex-basis: 100%;
        justify-content: flex-start;
    }

    .lines .line-side .delivery {
        order: 2;
        text-align: left;
    }
}

/* A line that is one link: the whole row answers, and what stands beside it stays beside it. */
.lines > li:has(> a.line-main) {
    position: relative;
}

/* A side that is only a state and an arrow stays on the line, also where the line is narrow. */
.lines > li:has(> .line-side.tight) {
    flex-wrap: nowrap;
}

.lines > li > .line-side.tight {
    flex: none;
}

.lines > li > a.line-main::after {
    content: "";
    position: absolute;
    inset: 0;
}

.lines > li > a.line-main:active {
    background: var(--surface-3);
}

.lines > li > a.line-main {
    margin: calc(var(--s-2) * -1) calc(var(--s-3) * -1);
    padding: var(--s-2) var(--s-3);
    border-radius: var(--r-md);
    transition: background-color 160ms var(--ease);
}

@media (hover: hover) and (pointer: fine) {
    .lines > li > a.line-main:hover {
        background: var(--surface-2);
    }
}

/* ---------- Tables of figures ---------- */

table.ledger {
    width: 100%;
    border-collapse: collapse;
}

table.ledger th,
table.ledger td {
    padding: var(--s-3) var(--s-2);
    border-top: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

table.ledger thead th {
    border-top: 0;
    padding-top: 0;
    color: var(--ink-2);
    font-size: 0.8125rem;
    font-weight: 550;
}

table.ledger tbody th {
    color: var(--ink-2);
    font-weight: 500;
    width: 40%;
}

table.ledger th:first-child,
table.ledger td:first-child {
    padding-left: 0;
}

table.ledger th:last-child,
table.ledger td:last-child {
    padding-right: 0;
}

table.ledger .num {
    text-align: right;
    white-space: nowrap;
}

table.ledger tfoot th {
    color: var(--ink-2);
    font-weight: 500;
    text-align: right;
}

table.ledger tfoot tr:first-child > * {
    border-top: 1px solid var(--line-strong);
}

table.ledger tfoot tr + tr > * {
    border-top: 0;
    padding-top: 0;
}

table.ledger tfoot tr.total > * {
    padding-top: var(--s-2);
    color: var(--ink);
    font-weight: 650;
}

table.ledger tfoot tr.total .figure {
    font-size: 1.375rem;
}

/* A row's actions stand at its end, and the one that removes is red. */
table.ledger td:has(> form) {
    width: 1%;
    text-align: right;
    white-space: nowrap;
    vertical-align: middle;
}

table.ledger td form {
    display: inline-flex;
    gap: var(--s-1);
}

table.ledger button[name="Action"][value="delete"] {
    color: var(--bad);
}

/* In a narrow panel a label stands over its value, and actions go under the name. */
@container (max-width: 22rem) {
    table.ledger tbody tr:has(> th[scope="row"]) {
        display: block;
        padding: var(--s-3) 0;
        border-top: 1px solid var(--line);
    }

    table.ledger tbody tr:has(> th[scope="row"]):first-child {
        border-top: 0;
        padding-top: 0;
    }

    table.ledger tbody th[scope="row"],
    table.ledger tbody th[scope="row"] + td {
        display: block;
        width: auto;
        padding: 0;
        border: 0;
    }

    table.ledger tbody th[scope="row"] {
        font-size: 0.8125rem;
    }

    table.ledger tbody th[scope="row"] + td {
        overflow-wrap: anywhere;
    }

    table.ledger tr:has(> td > form) {
        display: grid;
    }

    table.ledger td:has(> form) {
        width: auto;
        text-align: left;
        border-top: 0;
        padding-top: 0;
    }
}

@media (max-width: 34rem) {
    /* On the phone an invoice line keeps its text on a row of its own. */
    table.invoice-lines thead {
        display: none;
    }

    /* The table gives up its columns, so that no line can make the panel wider than the phone. */
    table.invoice-lines,
    table.invoice-lines tbody,
    table.invoice-lines tfoot {
        display: block;
    }

    table.invoice-lines tfoot tr {
        display: flex;
        align-items: baseline;
    }

    table.invoice-lines tfoot th {
        flex: 1;
        text-align: left;
    }

    table.invoice-lines tbody tr {
        display: grid;
        grid-template-columns: auto auto minmax(0, 1fr);
        column-gap: var(--s-4);
        padding: var(--s-3) 0;
        border-top: 1px solid var(--line);
    }

    table.invoice-lines tbody tr:first-child {
        border-top: 0;
        padding-top: 0;
    }

    table.invoice-lines tbody td {
        padding: 0;
        border: 0;
        color: var(--ink-2);
        font-size: 0.875rem;
    }

    table.invoice-lines tbody td:first-child {
        grid-column: 1 / -1;
        color: var(--ink);
        font-size: 1rem;
        font-weight: 550;
        padding-bottom: 0.125rem;
    }

    table.invoice-lines tbody td.num:nth-child(2) {
        text-align: left;
    }

    table.invoice-lines tbody td.num:nth-child(3) {
        text-align: left;
    }

    table.invoice-lines tbody td.num:nth-child(3)::before {
        content: "à ";
    }

    table.invoice-lines tbody td.num:last-child {
        color: var(--ink);
        font-weight: 600;
    }
}

/* ---------- The day ---------- */

.day-head {
    display: flex;
    align-items: center;
    gap: var(--s-3);
}

.day-title {
    flex: 1;
    min-width: 0;
    display: grid;
    gap: 0.125rem;
}

.day-step {
    display: grid;
    place-items: center;
    width: var(--tap);
    height: var(--tap);
    flex: none;
    border-radius: 50%;
    background: var(--surface);
    box-shadow: var(--shadow-1);
    color: var(--ink-2);
    transition: transform 120ms var(--ease), color 160ms var(--ease);
}

.day-step:active {
    transform: scale(0.94);
}

/* The way back to today: a link by its colour, and tall enough for a finger. */
.day-title .eyebrow a {
    color: var(--accent-ink);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    padding-block: var(--s-3);
    margin-block: calc(var(--s-3) * -1);
}

@media (hover: hover) and (pointer: fine) {
    .day-step:hover {
        color: var(--ink);
        text-decoration: none;
    }
}

/* The week: seven days to step between, each with its hours. */
.week {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: var(--s-1);
    padding: var(--s-1);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--shadow-1);
}

.week-day {
    display: grid;
    justify-items: center;
    gap: 0.0625rem;
    padding: var(--s-2) 0 0.4375rem;
    border-radius: calc(var(--r-lg) - var(--s-1));
    color: var(--ink-2);
    transition: background-color 160ms var(--ease), transform 120ms var(--ease);
}

.week-day:active {
    transform: scale(0.95);
}

.week-day .wd {
    font-size: 0.6875rem;
    font-weight: 550;
    text-transform: capitalize;
}

.week-day .dn {
    color: var(--ink);
    font-size: 1.0625rem;
    font-weight: 650;
    letter-spacing: -0.02em;
}

.week-day .hrs {
    min-height: 1rem;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--accent-ink);
}

.week-day.weekend .dn {
    color: var(--ink-3);
}

/* Today wears a ring, whichever day is chosen. */
.week-day.is-today:not(.is-selected) {
    box-shadow: inset 0 0 0 1.5px var(--accent);
}

.week-day.is-today .dn {
    color: var(--accent-ink);
}

.week-day.is-selected {
    background: var(--accent);
    box-shadow: 0 8px 16px -8px color-mix(in oklch, var(--accent) 70%, transparent);
}

.week-day.is-selected .wd,
.week-day.is-selected .dn,
.week-day.is-selected .hrs {
    color: var(--on-accent);
}

@media (hover: hover) and (pointer: fine) {
    .week-day:not(.is-selected):hover {
        background: var(--surface-2);
    }
}

.day-form {
    display: grid;
    gap: var(--s-4);
}

.entries {
    display: grid;
    padding: var(--s-2) var(--s-5);
    border-radius: var(--r-xl);
    background: var(--surface);
    box-shadow: var(--shadow-1);
}

.entry {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--s-2) var(--s-4);
    padding: var(--s-4) 0;
    border-top: 1px solid var(--line);
}

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

.entry-what {
    display: grid;
    gap: 0.0625rem;
    min-width: 0;
}

.entry-what .muted {
    text-wrap: balance;
}

.entry-project {
    font-weight: 600;
    letter-spacing: -0.01em;
    overflow-wrap: anywhere;
}

.stepper {
    display: grid;
    grid-template-columns: var(--tap) 3.5rem var(--tap);
    align-items: center;
    padding: 0.1875rem;
    border-radius: var(--r-pill);
    background: var(--surface-2);
    box-shadow: inset 0 0 0 1px var(--line);
}

.stepper button {
    width: var(--tap);
    min-height: var(--tap);
    padding: 0;
    border-radius: 50%;
    background: var(--raised);
    box-shadow: var(--shadow-1);
    color: var(--ink);
}

.stepper input {
    min-height: var(--tap);
    padding: 0;
    background: transparent;
    box-shadow: none;
    text-align: center;
    font-size: 1.625rem;
    font-weight: 650;
    letter-spacing: -0.03em;
}

.stepper input:focus {
    background: transparent;
    box-shadow: none;
}

.stepper input::placeholder {
    color: var(--ink-faint);
}

.stepper:focus-within {
    box-shadow: inset 0 0 0 2px var(--accent);
}

.stepper input.bump {
    animation: bump 260ms var(--ease);
}

/* Under the stepper, the buttons that set a whole number; beside them, the note. An open
   note takes a row of its own, and the buttons stay under the figure they set. */
.presets {
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
    display: flex;
    gap: var(--s-2);
}

.chip {
    position: relative;
    min-height: 2rem;
    min-width: 3rem;
    padding: 0 var(--s-3);
    border-radius: var(--r-pill);
    background: var(--surface-2);
    box-shadow: inset 0 0 0 1px var(--line);
    color: var(--ink-2);
    font-size: 0.8125rem;
    font-weight: 600;
}

/* What the finger hits is larger than what is drawn. */
.chip::after,
.entry-note summary::after {
    content: "";
    position: absolute;
    inset: -0.375rem 0;
}

details.entry-note {
    grid-column: 1;
    grid-row: 2;
    align-self: center;
    min-width: 0;
}

details.entry-note[open] {
    grid-column: 1 / -1;
    grid-row: 3;
}

p.entry-note {
    grid-column: 1 / -1;
}

.entry-note summary {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    min-height: 2rem;
    padding: 0 var(--s-2);
    margin-left: calc(var(--s-2) * -1);
    border-radius: var(--r-pill);
    color: var(--ink-2);
    font-size: 0.8125rem;
    font-weight: 550;
    cursor: pointer;
    list-style: none;
}

.entry-note summary::-webkit-details-marker {
    display: none;
}

.entry-note summary .icon {
    width: 1rem;
    height: 1rem;
}

.entry-note[open] summary {
    margin-bottom: var(--s-2);
}

.entry-note summary:active {
    background: var(--surface-3);
}

.entry-note:not(details) {
    color: var(--ink-2);
    font-size: 0.875rem;
}

.entry-locked {
    display: flex;
    align-items: center;
    gap: var(--s-3);
}

.entry-figure {
    font-size: 1.625rem;
}

.entry-figure.none {
    color: var(--ink-faint);
    font-weight: 400;
}

/* The day's sum and the button that saves it stay within reach while the page scrolls. */
.day-foot {
    position: sticky;
    bottom: calc(5.25rem + env(safe-area-inset-bottom, 0px));
    z-index: var(--z-bar);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-4);
    padding: var(--s-2) var(--s-2) var(--s-2) var(--s-5);
    border-radius: var(--r-pill);
    background: var(--glass);
    -webkit-backdrop-filter: blur(20px) saturate(1.6);
    backdrop-filter: blur(20px) saturate(1.6);
    box-shadow: var(--shadow-2);
}

.day-total {
    display: flex;
    align-items: baseline;
    gap: var(--s-2);
}

.day-total .figure {
    font-size: 1.75rem;
}

.day-foot button {
    min-width: 8rem;
    min-height: 3rem;
}

.day-links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-2);
}

@media (min-width: 52rem) {
    .day-foot {
        bottom: calc(var(--s-4) + env(safe-area-inset-bottom, 0px));
    }
}

/* While a field is being typed in on a touch screen, the menu steps aside: the keyboard has
   taken half the screen, and what is left belongs to the form. */
@media (max-width: 51.99rem) and (pointer: coarse) {
    body:has(:is(input:not([type="checkbox"]), select, textarea):focus) .app-nav {
        visibility: hidden;
    }

    body:has(:is(input:not([type="checkbox"]), select, textarea):focus) .day-foot {
        bottom: var(--s-3);
    }
}

/* ---------- The month ---------- */

.month-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-3);
}

.month-head h1::first-letter {
    text-transform: uppercase;
}

.month-total {
    display: flex;
    align-items: baseline;
    gap: var(--s-2);
}

.month-total .figure {
    font-size: 3rem;
    line-height: 1;
}

/* The year: twelve bars, one for each month's hours, each a way to that month. */
.year-strip {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    align-items: end;
    gap: 0;
    padding-top: var(--s-4);
    border-top: 1px solid var(--line);
}

.year-month {
    display: grid;
    justify-items: center;
    gap: 0.25rem;
    padding: 0.25rem 2px;
    border-radius: var(--r-sm);
    color: var(--ink-3);
    font-size: 0.6875rem;
    font-weight: 550;
    text-transform: capitalize;
}

.year-month .bar {
    display: flex;
    align-items: flex-end;
    width: 100%;
    max-width: 1.75rem;
    height: 3rem;
}

.year-month .bar > span {
    width: 100%;
    height: max(0.3125rem, calc(var(--share, 0) * 100%));
    border-radius: 0.375rem;
    background: var(--surface-3);
    transition: height 600ms var(--ease), background-color 160ms var(--ease);
}

.year-month.has-hours .bar > span {
    background: color-mix(in oklch, var(--accent) 65%, var(--surface-3));
}

.year-month.is-current {
    color: var(--accent-ink);
    font-weight: 700;
}

.year-month:active .bar > span {
    background: var(--accent-strong);
}

/* On the phone a month is too narrow for a thumb in one row of twelve: two rows of six. */
@media (max-width: 34rem) {
    .year-strip {
        grid-template-columns: repeat(6, minmax(0, 1fr));
        row-gap: var(--s-3);
    }

    .year-month .bar {
        height: 2rem;
    }
}

.year-month.is-current .bar > span {
    background: var(--accent);
}

@media (hover: hover) and (pointer: fine) {
    .year-month:hover {
        color: var(--ink);
    }

    .year-month:hover .bar > span {
        background: var(--accent-strong);
    }
}

/* Two ways to see the month, side by side. */
.segmented {
    display: inline-flex;
    padding: 0.1875rem;
    border-radius: var(--r-pill);
    background: var(--surface-3);
}

.segmented a {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    min-height: 2.25rem;
    padding: 0 var(--s-4);
    border-radius: var(--r-pill);
    color: var(--ink-2);
    font-size: 0.875rem;
    font-weight: 600;
}

.segmented a .icon {
    width: 1.125rem;
    height: 1.125rem;
}

.segmented a.is-on {
    background: var(--raised);
    box-shadow: var(--shadow-1);
    color: var(--ink);
}

.segmented a:not(.is-on):active {
    background: var(--surface-2);
}

@media (pointer: coarse) {
    .segmented a,
    .theme-choice button {
        min-height: var(--tap);
    }
}

@media (hover: hover) and (pointer: fine) {
    .segmented a:hover {
        text-decoration: none;
        color: var(--ink);
    }
}

/* The month as a calendar: each day a square with its hours, and a way to the day. */
.cal {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: var(--s-1);
}

.cal-wd {
    padding-bottom: var(--s-1);
    color: var(--ink-3);
    font-size: 0.6875rem;
    font-weight: 550;
    text-align: center;
    text-transform: capitalize;
}

.cal-day {
    display: grid;
    grid-template-rows: auto 1fr;
    justify-items: center;
    aspect-ratio: 1 / 1.08;
    padding: 0.3125rem 0 0.25rem;
    border-radius: var(--r-md);
    background: var(--surface-2);
    color: var(--ink-2);
    transition: transform 120ms var(--ease), background-color 160ms var(--ease);
}

.cal-day:active {
    transform: scale(0.94);
}

.cal-day .dn {
    font-size: 0.6875rem;
    font-weight: 550;
}

.cal-day .hrs {
    align-self: center;
    color: var(--ink);
    font-size: 1.125rem;
    font-weight: 650;
    letter-spacing: -0.03em;
}

.cal-day.weekend {
    background: transparent;
    color: var(--ink-3);
}

.cal-day.has-hours {
    background: var(--accent-soft);
    color: var(--accent-ink);
}

.cal-day.has-hours .hrs {
    color: var(--accent-ink);
}

.cal-day.is-today {
    box-shadow: inset 0 0 0 2px var(--accent);
}

@media (hover: hover) and (pointer: fine) {
    .cal-day:hover {
        background: var(--surface-3);
    }

    .cal-day.has-hours:hover {
        background: color-mix(in oklch, var(--accent) 20%, var(--surface));
    }
}

/* The month as a sheet, on the computer: days down, a column for each kind of hour. */
.sheet-wrap {
    overflow-x: auto;
    overscroll-behavior-x: contain;
    margin: 0 calc(var(--s-5) * -1);
    padding: 0 var(--s-5) 0 0;
}

table.sheet {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

table.sheet th,
table.sheet td {
    padding: 0.1875rem var(--s-2);
    border-top: 1px solid var(--line);
    text-align: left;
    white-space: nowrap;
}

table.sheet thead th {
    padding: 0 var(--s-2) var(--s-2);
    border-top: 0;
    vertical-align: bottom;
    font-weight: 600;
}

/* On the computer the page scrolls and the headings stay under the menu: the names of the
   columns are what tells one column of hours from the next. A sheet with many columns takes
   the page's whole width, and one with more than the page holds scrolls sideways instead. */
@media (min-width: 60rem) {
    .cols.stacked {
        grid-template-columns: minmax(0, 1fr);
    }

    .cols.stacked > .side {
        position: static;
    }

    .sheet-wrap:not(.scrolls) {
        overflow: visible;
    }

    .sheet-wrap:not(.scrolls) thead th {
        position: sticky;
        top: 4.75rem;
        z-index: 2;
        padding-top: var(--s-2);
        background: var(--surface);

        /* A rule under the headings, and the panel's own white above them up to the top of
           the window, so that no row shows between the headings and the menu. */
        box-shadow: 0 1px 0 var(--line-strong), 0 -4.75rem 0 var(--surface);
    }
}

.sheet-project,
.sheet-rate {
    display: block;
}

.sheet-rate {
    color: var(--ink-2);
    font-size: 0.75rem;
    font-weight: 500;
}

table.sheet .num {
    text-align: right;
}

/* The day stays in place while the columns scroll sideways under it. */
table.sheet .sheet-day {
    position: sticky;
    left: 0;
    z-index: 1;
    width: calc(6.5rem + var(--s-5));
    padding-left: var(--s-5);
    background: var(--surface);
    font-weight: 500;
}

table.sheet .sheet-day a {
    display: inline-flex;
    align-items: baseline;
    gap: var(--s-2);
    color: var(--ink);
}

table.sheet .sheet-day .figure {
    display: inline-block;
    min-width: 1.5rem;
}

table.sheet .sheet-sum {
    width: 5rem;
    padding-right: 0;
    font-weight: 650;
}

table.sheet tr.weekend > * {
    background: var(--surface-2);
}


table.sheet tr.weekend > :last-child {
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
}

table.sheet tr.weekend .sheet-day a,
table.sheet tr.weekend .sheet-day .muted {
    color: var(--ink-3);
}

table.sheet tr.today .sheet-day a {
    color: var(--accent-ink);
}

table.sheet tr.today .sheet-day .muted {
    color: var(--accent-ink);
    font-weight: 650;
}

/* Today has a bar in the margin: a mark that is there also for an eye that does not tell the blues apart. */
table.sheet tr.today > .sheet-day::before {
    content: "";
    position: absolute;
    left: var(--s-2);
    top: 0.375rem;
    bottom: 0.375rem;
    width: 3px;
    border-radius: 3px;
    background: var(--accent);
}

/* A cell that is typed in keeps its figure in line with the sums and the cells that are not. */
table.sheet td:has(> input) {
    padding-inline: 0;
}

table.sheet td.locked {
    color: var(--ink-2);
}

table.sheet td input {
    width: 100%;
    min-width: 4rem;
    min-height: 2.125rem;
    padding: 0 var(--s-2);
    border-radius: var(--r-sm);
    background: transparent;
    box-shadow: inset 0 0 0 1px var(--line);
    text-align: right;
    font-weight: 550;
}

table.sheet tr.weekend td input:not(:focus) {
    box-shadow: none;
}

table.sheet td input:focus {
    background: var(--surface);
    box-shadow: inset 0 0 0 2px var(--accent);
}

@media (hover: hover) and (pointer: fine) {
    table.sheet td input:not(:focus):hover,
    table.sheet tr.weekend td input:not(:focus):hover {
        box-shadow: inset 0 0 0 1px var(--field-line);
    }
}

table.sheet td.has-note {
    position: relative;
}

table.sheet td.has-note::after {
    content: "";
    position: absolute;
    top: 0.375rem;
    right: 0.25rem;
    width: 0.375rem;
    height: 0.375rem;
    border-radius: 50%;
    background: var(--accent);
}

table.sheet tfoot th,
table.sheet tfoot td {
    padding-top: var(--s-3);
    border-top: 1px solid var(--line-strong);
    font-weight: 650;
}

/* ---------- Fakturera ---------- */

.steps {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    list-style: none;
    margin: 0;
    padding: 0;
    color: var(--ink-3);
    font-size: 0.8125rem;
    font-weight: 600;
}

.steps li {
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
}

.steps li + li::before {
    content: "";
    width: 1.5rem;
    height: 2px;
    border-radius: 2px;
    background: var(--line-strong);
}

.steps .n {
    display: grid;
    place-items: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: var(--surface-3);
    font-size: 0.75rem;
}

.steps .is-done {
    color: var(--ink-2);
}

.steps .is-done .n {
    background: var(--ok-soft);
    color: var(--ok);
}

.steps .n .icon {
    width: 0.875rem;
    height: 0.875rem;
}

.steps .is-now {
    color: var(--ink);
}

.steps .is-now .n {
    background: var(--accent);
    color: var(--on-accent);
}

.steps li.is-done + li::before {
    background: var(--ok);
}

/* The invoice, as a sheet of paper. */
.paper {
    container-type: inline-size;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--s-4);
    padding: var(--s-5);
    border-radius: var(--r-lg);
    background: light-dark(oklch(1 0 0), var(--surface));
    box-shadow: var(--shadow-2);
}

.paper-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--s-3);
    padding-bottom: var(--s-4);
    border-bottom: 1px solid var(--line);
}

.paper-head h2 {
    font-size: 1.25rem;
}

.confirm {
    box-shadow: inset 0 0 0 1.5px color-mix(in oklch, var(--accent) 45%, transparent), var(--shadow-1);
}

.confirm.warn {
    box-shadow: inset 0 0 0 1.5px color-mix(in oklch, var(--wait) 50%, transparent), var(--shadow-1);
}

/* ---------- Things that fold out, and the choice of light or dark ---------- */

details > summary {
    cursor: pointer;
}

details > summary.button {
    display: inline-flex;
    justify-self: start;
    width: fit-content;
    list-style: none;
    margin-left: calc(var(--s-3) * -1);
}

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

details[open] > summary.button {
    margin-bottom: var(--s-3);
}

.theme-choice {
    display: inline-flex;
    flex-wrap: wrap;
    gap: var(--s-1);
    padding: 0.1875rem;
    border-radius: var(--r-lg);
    background: var(--surface-3);
    justify-self: start;
}

.theme-choice button {
    min-height: 2.5rem;
    padding: 0 var(--s-4);
    background: transparent;
    box-shadow: none;
    color: var(--ink-2);
    font-size: 0.875rem;
}

.theme-choice button[aria-pressed="true"] {
    background: var(--raised);
    box-shadow: var(--shadow-1);
    color: var(--ink);
}

@media (max-width: 34rem) {
    .theme-choice {
        display: grid;
        grid-template-columns: 1.4fr 1fr 1fr;
        width: 100%;
    }

    .theme-choice button {
        padding: 0 var(--s-2);
    }

    .theme-choice .icon {
        display: none;
    }
}

/* ---------- Rates on a project ---------- */

.rate-type {
    display: grid;
    gap: var(--s-3);
    padding: var(--s-4) 0;
    border-top: 1px solid var(--line);
}

.rate-type:first-of-type {
    border-top: 0;
    padding-top: 0;
}

.rate-type table.ledger td {
    vertical-align: middle;
}

.rate-type table.ledger td:first-child {
    white-space: nowrap;
}

.rate-type table.ledger td button {
    padding: 0 var(--s-2);
}

.rate-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--s-3);
}

.rate-form .field {
    flex: 1 1 8rem;
}

/* ---------- A press is answered, also where a link is the control ---------- */

.account-chip:active .avatar,
.brand:active .brand-mark {
    transform: scale(0.94);
}

.eyebrow a:active,
a.small:active {
    opacity: 0.6;
}

/* ---------- The framework's own pieces ---------- */

#blazor-error-ui {
    display: none;
    position: fixed;
    z-index: var(--z-over);
    left: var(--s-3);
    right: var(--s-3);
    bottom: calc(6rem + env(safe-area-inset-bottom, 0px));
    padding: var(--s-3) var(--s-4);
    border-radius: var(--r-md);
    background: var(--bad-soft);
    box-shadow: var(--shadow-2);
    color: var(--bad);
    font-weight: 500;
}

#blazor-error-ui .reload {
    color: inherit;
    text-decoration: underline;
}

#blazor-error-ui .dismiss {
    float: right;
    cursor: pointer;
}

.blazor-error-boundary {
    padding: var(--s-3) var(--s-4);
    border-radius: var(--r-md);
    background: var(--bad-soft);
    color: var(--bad);
}

.blazor-error-boundary::after {
    content: "Ett oväntat fel har inträffat.";
}

.d-flex {
    display: flex;
}

.flex-column {
    flex-direction: column;
}

.mx-auto {
    margin-inline: auto;
}

.col-lg-6 {
    width: 100%;
}

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

@media print {
    .app-header,
    .day-foot {
        display: none;
    }

    body {
        background: #fff;
    }
}
