/* ==========================================================================
   Grundlagen: Farben, Abstände, Typografie
   ========================================================================== */

:root {
    color-scheme: light;
    --background: #f3f5f8;
    --surface: #ffffff;
    --surface-muted: #f7f9fb;
    --surface-sunken: #eceff3;
    --text: #16202b;
    --muted: #5c6875;
    --border: #dfe4ea;
    --border-strong: #c3ccd6;
    --primary: #145a75;
    --primary-hover: #0e465c;
    --primary-soft: #e3eff4;
    --primary-contrast: #ffffff;
    --focus-ring: rgb(20 90 117 / 30%);
    --success-background: #e6f5ec;
    --success-text: #17633a;
    --warning-background: #fff4d6;
    --warning-text: #6e5200;
    --danger-background: #fdeeee;
    --danger-text: #8b1e1e;
    --danger-solid: #a12626;
    --danger-solid-hover: #7f1b1b;
    --neutral-background: #e8ecf0;
    --neutral-text: #47525c;
    --info-background: #e8f1f8;
    --info-border: #c7dceb;
    --info-text: #1c4a6b;
    --shadow-sm: 0 1px 2px rgb(16 24 40 / 5%);
    --shadow: 0 1px 3px rgb(16 24 40 / 6%), 0 6px 16px rgb(16 24 40 / 5%);
    --shadow-lg: 0 12px 32px rgb(16 24 40 / 16%);
    --radius: .75rem;
    --radius-sm: .5rem;
    --page-width: 82rem;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --background: #11171e;
        --surface: #19212a;
        --surface-muted: #1e2731;
        --surface-sunken: #242e39;
        --text: #e6ebf0;
        --muted: #98a5b2;
        --border: #2c3843;
        --border-strong: #3d4b58;
        --primary: #6cc0e3;
        --primary-hover: #8fd0ec;
        --primary-soft: #183442;
        --primary-contrast: #0b2530;
        --focus-ring: rgb(108 192 227 / 35%);
        --success-background: #123524;
        --success-text: #6bd39a;
        --warning-background: #3a2f0c;
        --warning-text: #e0b846;
        --danger-background: #3a1414;
        --danger-text: #f29a9a;
        --danger-solid: #b23a3a;
        --danger-solid-hover: #c94f4f;
        --neutral-background: #2a3540;
        --neutral-text: #b3bfc9;
        --info-background: #152838;
        --info-border: #24435a;
        --info-text: #a5d0ee;
        --shadow-sm: 0 1px 2px rgb(0 0 0 / 30%);
        --shadow: 0 1px 3px rgb(0 0 0 / 30%), 0 6px 16px rgb(0 0 0 / 20%);
        --shadow-lg: 0 12px 32px rgb(0 0 0 / 45%);
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --background: #11171e;
    --surface: #19212a;
    --surface-muted: #1e2731;
    --surface-sunken: #242e39;
    --text: #e6ebf0;
    --muted: #98a5b2;
    --border: #2c3843;
    --border-strong: #3d4b58;
    --primary: #6cc0e3;
    --primary-hover: #8fd0ec;
    --primary-soft: #183442;
    --primary-contrast: #0b2530;
    --focus-ring: rgb(108 192 227 / 35%);
    --success-background: #123524;
    --success-text: #6bd39a;
    --warning-background: #3a2f0c;
    --warning-text: #e0b846;
    --danger-background: #3a1414;
    --danger-text: #f29a9a;
    --danger-solid: #b23a3a;
    --danger-solid-hover: #c94f4f;
    --neutral-background: #2a3540;
    --neutral-text: #b3bfc9;
    --info-background: #152838;
    --info-border: #24435a;
    --info-text: #a5d0ee;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 30%);
    --shadow: 0 1px 3px rgb(0 0 0 / 30%), 0 6px 16px rgb(0 0 0 / 20%);
    --shadow-lg: 0 12px 32px rgb(0 0 0 / 45%);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--background);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    transition: background-color .15s ease, color .15s ease;
}

a { color: var(--primary); text-underline-offset: .15em; }
a:hover { color: var(--primary-hover); }

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

h1, h2, h3, p { margin-top: 0; }
h1 {
    margin-bottom: 0;
    font-size: clamp(1.55rem, 1.25rem + 1.1vw, 2rem);
    line-height: 1.15;
    letter-spacing: -.015em;
}
h2 { margin-bottom: .75rem; font-size: 1.2rem; letter-spacing: -.005em; }

.muted { color: var(--muted); }
.pre-line { white-space: pre-line; }

.eyebrow {
    margin-bottom: .3rem;
    color: var(--primary);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

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

/* ==========================================================================
   Kopfzeile und Hauptnavigation
   ========================================================================== */

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.navigation,
.page {
    width: 100%;
    max-width: var(--page-width);
    margin-inline: auto;
    padding-inline: 1.25rem;
}

.navigation {
    display: flex;
    min-height: 3.75rem;
    align-items: center;
    gap: .5rem 1.5rem;
}

.brand {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: .6rem;
    color: var(--text);
    font-size: 1.1rem;
    font-weight: 750;
    letter-spacing: -.01em;
    text-decoration: none;
}

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

.brand__mark {
    display: inline-flex;
    width: 2rem;
    height: 2rem;
    align-items: center;
    justify-content: center;
    border-radius: .55rem;
    background: var(--primary);
    color: var(--primary-contrast);
    font-size: 1rem;
    font-weight: 800;
}

.navigation__links {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    gap: .25rem;
    min-width: 0;
}

.navigation__link {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .45rem .75rem;
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.navigation__link:hover { background: var(--surface-sunken); color: var(--text); }
.navigation__link--active,
.navigation__link--active:hover { background: var(--primary-soft); color: var(--primary); }
.navigation__link .icon-button__icon { width: 1rem; height: 1rem; }
.navigation__link--create { margin-left: auto; border: 1px solid var(--border); color: var(--primary); }
.navigation__link--create:hover { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }

.navigation__tools {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: .4rem;
    margin-left: auto;
}

.navigation__links + .navigation__tools { margin-left: 0; }
.navigation__tools form { margin: 0; }
.navigation__tools .icon-button { width: 2.25rem; height: 2.25rem; }

.navigation__user {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding-right: .35rem;
    color: var(--text);
    font-size: .92rem;
    font-weight: 600;
}

.navigation__avatar {
    display: inline-flex;
    width: 2rem;
    height: 2rem;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: .78rem;
    font-weight: 750;
}

.theme-toggle__icon { width: 1.1rem; height: 1.1rem; }
.theme-toggle__icon--moon { display: none; }
:root[data-theme="dark"] .theme-toggle__icon--sun { display: none; }
:root[data-theme="dark"] .theme-toggle__icon--moon { display: block; }

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

.link-button {
    padding: 0;
    border: 0;
    background: none;
    color: var(--primary);
    cursor: pointer;
    font: inherit;
    text-decoration: underline;
    text-underline-offset: .15em;
}

.link-button--danger,
.link--danger { color: var(--danger-text); }

.portal-badge {
    display: inline-flex;
    align-items: center;
    padding: .3rem .7rem;
    border-radius: 999px;
    background: var(--neutral-background);
    color: var(--muted);
    font-size: .85rem;
    font-weight: 600;
}

/* ==========================================================================
   Seitenkopf mit Zurück-Link links oben
   ========================================================================== */

.page { padding-block: 1.75rem 4rem; }

.page-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem 1.5rem;
    margin-bottom: 1.5rem;
}

.page-heading__main { min-width: 0; }
.page-heading__title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem .75rem;
}
.page-heading__title h1 { overflow-wrap: anywhere; }
.page-heading > div > h1 + .status,
.page-heading > div > h1 + p { margin-top: .5rem; }

.back-link {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    margin: 0 0 .65rem -.45rem;
    padding: .25rem .6rem .25rem .45rem;
    border-radius: 999px;
    color: var(--muted);
    font-size: .9rem;
    font-weight: 600;
    text-decoration: none;
}

.back-link:hover { background: var(--primary-soft); color: var(--primary); }
.back-link .icon-button__icon { width: 1rem; height: 1rem; transition: transform .15s ease; }
.back-link:hover .icon-button__icon { transform: translateX(-2px); }

.heading-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.heading-actions form { margin: 0; }

/* Ausklappmenü ohne JavaScript-Abhängigkeit (details/summary). */
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu[open] > summary { border-color: var(--primary); color: var(--primary); }
.menu__panel {
    position: absolute;
    top: calc(100% + .4rem);
    right: 0;
    z-index: 30;
    display: grid;
    min-width: 15rem;
    padding: .35rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
}
.menu__panel form { margin: 0; }
.menu__item {
    display: flex;
    width: 100%;
    align-items: center;
    gap: .6rem;
    padding: .55rem .7rem;
    border: 0;
    border-radius: .4rem;
    background: none;
    color: var(--text);
    cursor: pointer;
    font: inherit;
    font-size: .94rem;
    text-align: left;
    text-decoration: none;
}
.menu__item:hover { background: var(--surface-sunken); color: var(--text); }
.menu__item .icon-button__icon { width: 1rem; height: 1rem; color: var(--muted); }

/* ==========================================================================
   Karten, Hinweise, Meldungen
   ========================================================================== */

.card {
    padding: 1.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.card > h2:first-child { margin-bottom: 1rem; }
.login-card h1,
.error-card h1 { margin-bottom: .6rem; }

.login-card {
    width: min(100%, 28rem);
    margin: 3.5rem auto;
    padding: 2rem;
    box-shadow: var(--shadow);
}

.login-card .button--primary { width: 100%; margin-top: .5rem; }

.error-card {
    width: min(100%, 38rem);
    margin: 3rem auto;
}

.notice {
    margin-bottom: 1rem;
    padding: .75rem 1rem;
    border: 1px solid var(--info-border);
    border-radius: var(--radius-sm);
    background: var(--info-background);
    color: var(--info-text);
}

.notice a { color: inherit; font-weight: 650; }

.messages { display: grid; gap: .5rem; margin-bottom: 1.25rem; }
.messages p {
    margin: 0;
    padding: .75rem 1rem;
    border: 1px solid color-mix(in srgb, var(--success-text) 30%, transparent);
    border-left: 4px solid var(--success-text);
    border-radius: var(--radius-sm);
    background: var(--success-background);
    color: var(--success-text);
    font-weight: 600;
}
.messages .message--error {
    border-color: color-mix(in srgb, var(--danger-text) 30%, transparent);
    border-left-color: var(--danger-text);
    background: var(--danger-background);
    color: var(--danger-text);
}

.empty-state { padding-block: 3.5rem; text-align: center; }
.empty-state p { color: var(--muted); }
.empty-state--small { padding-block: 2rem; }
.empty-state--small p { margin-bottom: 0; }
.empty-state--small p + .button { margin-top: 1rem; }

.section-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .75rem;
}

.section-heading h2 { margin-bottom: 0; }
.section-heading > span { color: var(--muted); font-size: .92rem; }

/* ==========================================================================
   Formulare
   ========================================================================== */

.field { margin-block: 0 1.1rem; }

.field label {
    display: block;
    margin-bottom: .35rem;
    font-size: .92rem;
    font-weight: 650;
}

.field input:not([type="checkbox"], [type="radio"]),
.field textarea,
.field select,
.inline-input input {
    width: 100%;
    min-height: 2.6rem;
    padding: .5rem .7rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    transition: border-color .12s ease, box-shadow .12s ease;
}

.field textarea { line-height: 1.45; resize: vertical; }

.field input:not([type="checkbox"], [type="radio"]):hover,
.field textarea:hover,
.field select:hover { border-color: var(--muted); }

.field input:focus,
.field textarea:focus,
.field select:focus,
.inline-input input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.field input:disabled,
.field textarea:disabled,
.field select:disabled {
    background: var(--surface-muted);
    color: var(--muted);
    cursor: not-allowed;
}

.field--invalid input:not([type="checkbox"], [type="radio"]),
.field--invalid textarea,
.field--invalid select { border-color: var(--danger-text); }

.field input[type="checkbox"],
.field input[type="radio"] { accent-color: var(--primary); }

.field--checkbox {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
}

.field--checkbox input { width: 1.05rem; height: 1.05rem; margin: 0; }
.field--checkbox label { margin-bottom: 0; font-weight: 500; }
.field--checkbox__help { flex-basis: 100%; margin: 0; }

.form-errors {
    margin-bottom: 1rem;
    padding: .75rem 1rem;
    border: 1px solid color-mix(in srgb, var(--danger-text) 35%, transparent);
    border-radius: var(--radius-sm);
    background: var(--danger-background);
    color: var(--danger-text);
}

.form-errors p { margin: 0; }
.field-error { margin: .35rem 0 0; color: var(--danger-text); font-size: .875rem; font-weight: 600; }
.help-text { margin: .35rem 0 0; color: var(--muted); font-size: .85rem; line-height: 1.4; }

.form-card { max-width: 44rem; }
.form-card--wide { max-width: 62rem; }
.form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem;
    margin-top: 1.25rem;
}
.form-actions__hint { color: var(--muted); font-size: .82rem; }
.form-actions__hint::before { content: "⌨ "; }

/* ==========================================================================
   Schaltflächen
   ========================================================================== */

.button {
    display: inline-flex;
    min-height: 2.5rem;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .5rem .95rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font: inherit;
    font-size: .95rem;
    font-weight: 650;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color .12s ease, border-color .12s ease, color .12s ease;
}

.button .icon-button__icon { width: 1rem; height: 1rem; }

.button--primary { background: var(--primary); color: var(--primary-contrast); }
.button--primary:hover { background: var(--primary-hover); color: var(--primary-contrast); }

.button--secondary { border-color: var(--border-strong); background: var(--surface); color: var(--text); }
.button--secondary:hover { border-color: var(--primary); background: var(--surface); color: var(--primary); }

.button--danger { background: var(--danger-solid); color: #fff; }
.button--danger:hover { background: var(--danger-solid-hover); color: #fff; }

.button--danger-outline,
.button--secondary.button--danger-outline { color: var(--danger-text); }
.button--danger-outline:hover,
.button--secondary.button--danger-outline:hover { border-color: var(--danger-text); background: var(--danger-background); color: var(--danger-text); }

.button--disabled { background: var(--neutral-background); color: var(--muted); cursor: default; }
.button--small { min-height: 2.1rem; padding: .3rem .7rem; gap: .35rem; font-size: .88rem; }

.icon-button {
    display: inline-flex;
    flex: 0 0 auto;
    width: 2rem;
    height: 2rem;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: .45rem;
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    text-decoration: none;
    transition: background-color .12s ease, border-color .12s ease, color .12s ease;
}

.icon-button:hover { border-color: var(--primary); color: var(--primary); }
.icon-button__icon { width: 1.05rem; height: 1.05rem; }

.icon-button--ghost { border-color: transparent; background: transparent; }
.icon-button--ghost:hover { border-color: transparent; background: var(--surface-sunken); color: var(--text); }

.icon-button--danger:hover {
    border-color: var(--danger-solid);
    background: var(--danger-background);
    color: var(--danger-text);
}

.inline-icon-link { display: inline-flex; align-items: center; gap: .3rem; font-weight: 600; }
.inline-icon-link .icon-button__icon { width: .95rem; height: .95rem; }

/* ==========================================================================
   Status und Kennzeichnungen
   ========================================================================== */

.status {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .2rem .6rem;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 700;
    white-space: nowrap;
}

.status::before {
    width: .45rem;
    height: .45rem;
    border-radius: 50%;
    background: currentColor;
    content: "";
}

.status--active { background: var(--success-background); color: var(--success-text); }
.status--completed { background: var(--warning-background); color: var(--warning-text); }
.status--archived { background: var(--neutral-background); color: var(--neutral-text); }
.status--overdue { background: var(--danger-background); color: var(--danger-text); }

.type-badge {
    display: inline-flex;
    padding: .1rem .5rem;
    border-radius: .35rem;
    background: var(--neutral-background);
    color: var(--neutral-text);
    font-size: .8rem;
    font-weight: 650;
    white-space: nowrap;
}

.type-badge--additional_cost,
.type-badge--surcharge { background: var(--warning-background); color: var(--warning-text); }
.type-badge--discount,
.type-badge--deduction { background: var(--success-background); color: var(--success-text); }
.type-badge--payment { background: var(--primary-soft); color: var(--primary); }

.amount--negative { color: var(--danger-text); font-weight: 750; }

/* ==========================================================================
   Projektreiter und Kennzahlen
   ========================================================================== */

.tabs {
    display: flex;
    gap: .15rem;
    margin-bottom: 1.5rem;
    overflow: auto hidden;
    box-shadow: inset 0 -1px 0 var(--border);
    scrollbar-width: none;
}

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

.tabs__item {
    padding: .7rem .9rem;
    border-bottom: 2px solid transparent;
    color: var(--muted);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.tabs__item:hover { border-bottom-color: var(--border-strong); color: var(--text); }
.tabs__item--active,
.tabs__item--active:hover { border-bottom-color: var(--primary); color: var(--primary); }
.tabs__item--disabled { opacity: .65; }

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.summary-grid--compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.billing-summary { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.summary-card { display: grid; align-content: start; gap: .3rem; padding: 1.1rem 1.25rem; }
.summary-card__label {
    color: var(--muted);
    font-size: .78rem;
    font-weight: 650;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.summary-card strong {
    font-size: 1.45rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: -.01em;
}

.project-information { margin-top: 0; }

.definition-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 1rem 2rem;
    margin: 0 0 2rem;
}

.definition-list div { min-width: 0; }
.definition-list dt { color: var(--muted); font-size: .82rem; }
.definition-list dd { margin: .15rem 0 0; font-weight: 650; overflow-wrap: anywhere; }

.status-management {
    display: flex;
    max-width: 44rem;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.status-management h2 { margin-bottom: .35rem; }
.status-management p:last-child { margin-bottom: 0; color: var(--muted); }
.status-management form { margin: 0; }
.status-management__actions { display: flex; flex: 0 0 auto; align-items: stretch; gap: .6rem; }

.billing-view-settings { max-width: 44rem; margin-top: 1rem; }
.billing-view-settings > p { color: var(--muted); }
.billing-view-password-form { max-width: 24rem; margin-block: 1rem; }
.billing-view-settings__actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.billing-view-settings__actions form { margin: 0; }

.copy-field { display: flex; align-items: stretch; gap: .5rem; max-width: 32rem; }
.copy-field input { flex: 1 1 auto; font-family: ui-monospace, monospace; }
.copy-field .icon-button { width: 2.6rem; height: auto; }

.danger-card { border-color: var(--danger-text); }
.danger-card h2 { color: var(--danger-text); }
.danger-card__actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-top: 1.5rem; }
.danger-card__actions form { margin: 0; }

/* ==========================================================================
   Tabellen
   ========================================================================== */

.table-card { padding: 0; overflow: hidden; container-type: inline-size; }
.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

th,
td {
    padding: .8rem 1rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

th {
    background: var(--surface-muted);
    color: var(--muted);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
}

tbody tr:last-child td { border-bottom: 0; }

.data-table td { vertical-align: top; }
.data-table tbody tr { transition: background-color .1s ease; }
.data-table tbody tr:hover { background: var(--surface-muted); }
.data-table tfoot th,
.data-table tfoot td {
    border-top: 2px solid var(--border);
    border-bottom: 0;
    background: var(--surface);
    color: var(--text);
    font-size: .92rem;
    letter-spacing: 0;
    text-transform: none;
}

.col-date { width: 1%; white-space: nowrap; font-variant-numeric: tabular-nums; }
.col-date small { display: block; color: var(--muted); font-size: .78rem; }
.col-time { width: 1%; white-space: nowrap; font-variant-numeric: tabular-nums; }
.col-num { width: 1%; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.col-person,
.col-shrink { width: 1%; white-space: nowrap; }
.col-actions { width: 1%; }
.col-text { min-width: 16rem; white-space: normal; overflow-wrap: anywhere; }

.entry-activity { display: block; font-weight: 600; white-space: pre-line; }
.entry-comment {
    display: block;
    margin-top: .3rem;
    padding-left: .6rem;
    border-left: 2px solid var(--border-strong);
    color: var(--muted);
    font-size: .88rem;
    white-space: pre-line;
}
.entry-comment--internal {
    border-left-color: var(--warning-text);
}
.entry-comment__label {
    display: inline-flex;
    align-items: center;
    gap: .2rem;
    margin-right: .35rem;
    color: var(--warning-text);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
    vertical-align: .05em;
}
.entry-comment__label .icon-button__icon { width: .8rem; height: .8rem; }

.project-link { color: var(--text); font-weight: 700; text-decoration: none; }
.project-link:hover { color: var(--primary); text-decoration: underline; }

.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: .3rem; }
.row-actions form { margin: 0; }
/* Untereinander statt nebeneinander, damit die Textspalte mehr Platz bekommt. */
.row-actions--stacked {
    display: grid;
    grid-template-columns: repeat(2, 2rem);
    justify-content: end;
}

.cell-wrap { white-space: normal; overflow-wrap: break-word; }
.table-comment { min-width: 12rem; white-space: normal; }

.table-row-toggle { display: none; }
.table-row-toggle .icon-button__icon { transition: transform .15s ease; }
.table-row-toggle[aria-expanded="true"] .icon-button__icon { transform: rotate(180deg); }

@container (max-width: 60rem) {
    .table-collapsible thead,
    .table-collapsible tfoot { display: none; }

    .table-collapsible,
    .table-collapsible tbody,
    .table-collapsible tr {
        display: block;
        width: 100%;
    }

    .table-collapsible tbody tr {
        display: flex;
        flex-wrap: wrap;
        align-items: flex-start;
        gap: .35rem .85rem;
        padding: .85rem 1rem;
        border-bottom: 1px solid var(--border);
        cursor: pointer;
    }

    .table-collapsible tbody tr:last-child { border-bottom: 0; }

    .table-collapsible td {
        display: none;
        width: auto;
        min-width: 0;
        padding: 0;
        border: 0;
        text-align: left;
        white-space: normal;
    }

    .table-collapsible td.col-essential { display: block; }
    .table-collapsible td.col-grow { flex: 1 1 12rem; order: -1; flex-basis: 100%; }
    .table-collapsible td.col-actions { margin-left: auto; flex: 0 0 auto; }
    .table-collapsible td.col-date small { display: inline; margin-left: .3rem; }
    .table-collapsible tr:not(.is-expanded) .entry-comment { display: none; }

    .table-collapsible tr.is-expanded td { display: block; width: 100%; }
    .table-collapsible tr.is-expanded td.col-actions { width: auto; }

    .table-collapsible td[data-label]:not(.col-essential)::before {
        content: attr(data-label) ": ";
        color: var(--muted);
        font-weight: 700;
    }

    .table-collapsible .row-actions--stacked { display: flex; }
    .table-row-toggle { display: inline-flex; }
}

/* ==========================================================================
   Zeiterfassung, Material, Buchungen
   ========================================================================== */

.time-entry-create,
.transaction-create { margin-bottom: 2rem; }
.time-entry-section,
.transaction-section { margin-bottom: 2rem; }

.time-entry-grid {
    display: grid;
    grid-template-columns: minmax(9rem, 11rem) minmax(7rem, 8.5rem) minmax(7rem, 8.5rem) minmax(8rem, 11rem) minmax(0, 1fr);
    grid-template-areas:
        "date start end duration user"
        "activity activity activity activity activity";
    gap: 0 1rem;
}

.time-entry-grid .field--date { grid-area: date; }
.time-entry-grid .field--start_time { grid-area: start; }
.time-entry-grid .field--end_time { grid-area: end; }
.time-entry-grid .field--duration_minutes { grid-area: duration; }
.time-entry-grid .field--user { grid-area: user; }
.time-entry-grid .field--user select { max-width: 22rem; }
.time-entry-grid .field--activity { grid-area: activity; }

.time-entry-notes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 1rem;
}

.time-entry-grid textarea,
.time-entry-notes textarea,
.transaction-grid textarea {
    min-height: 4.4rem;
    field-sizing: content;
    max-height: 22rem;
}

.current-receipt {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .35rem .75rem;
    margin-bottom: 1.25rem;
    padding: .75rem 1rem;
    border-radius: var(--radius-sm);
    background: var(--surface-sunken);
}

.current-receipt small { width: 100%; color: var(--muted); }

.invoice-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.invoice-information { margin-bottom: 2rem; }
.invoice-information .definition-list { margin-bottom: 0; }
.invoice-information .definition-list + p { margin: 1.25rem 0 0; }
.adjustment-section { margin-bottom: 1rem; }
.adjustment-create { margin-top: 1rem; }

.adjustment-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 0 1rem;
}

.transaction-grid {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr 1.5fr;
    gap: 0 1rem;
}

.transaction-grid .field--comment { grid-column: 1 / -1; }

/* ==========================================================================
   Abrechnung (Bildschirm und Druck)
   ========================================================================== */

.statement-customer { margin: .4rem 0 0; color: var(--muted); }
.statement-intro {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem 2rem;
    margin-bottom: 2rem;
}

.statement-intro > div { display: grid; align-content: start; gap: .2rem; }
.statement-label { color: var(--muted); font-size: .8rem; }
.statement-description { grid-column: 1 / -1; }
.statement-description p { margin: 0; }
.statement-section { margin-bottom: 2rem; }
.statement-table { white-space: normal; }
.statement-table td { vertical-align: top; }
.statement-table td small {
    display: block;
    margin-top: .15rem;
    color: var(--muted);
}
.statement-table .pre-line { white-space: pre-line; }
.statement-table .statement-person { white-space: nowrap; }

.statement-table .amount-column {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.statement-table td:first-child { white-space: nowrap; font-variant-numeric: tabular-nums; }

.statement-table tfoot th {
    border-top: 2px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: .92rem;
    letter-spacing: 0;
    text-transform: none;
}

.statement-main-row td { padding-top: 1.1rem; }
.statement-sub-row td { background: var(--surface-muted); }
.statement-sub-row td:nth-child(2) { padding-left: 2rem; }
.statement-subtotal td {
    border-bottom: 2px solid var(--border);
    font-weight: 700;
}

.statement-subtotal td:first-child { text-align: right; }
.statement-empty { padding-block: 1.25rem; color: var(--muted); }
.statement-totals {
    width: min(100%, 38rem);
    margin-left: auto;
}

.statement-totals dl { margin: 0; }
.statement-totals dl > div {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    padding-block: .4rem;
}

.statement-totals dt { color: var(--muted); }
.statement-totals dd { margin: 0; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.statement-totals .statement-total {
    margin-top: .5rem;
    padding-top: .9rem;
    border-top: 2px solid var(--border);
    font-weight: 700;
}

.statement-totals .statement-total dt { color: var(--text); }
.statement-totals .statement-open {
    margin-top: .5rem;
    padding-top: .9rem;
    border-top: 3px double var(--text);
    font-size: 1.25rem;
    font-weight: 800;
}

.statement-totals .statement-open dt { color: var(--text); }
.statement-disclaimer {
    margin: 1.5rem 0 0;
    color: var(--muted);
    font-size: .85rem;
    text-align: right;
}

/* Aufgaben / Kanban */
.inline-input {
    display: flex;
    align-items: center;
    gap: .4rem;
}

.inline-input input {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 2.25rem;
    padding: .4rem .6rem;
    border: 1px solid var(--border);
    border-radius: .4rem;
    background: var(--surface);
    color: var(--text);
    font: inherit;
}

.inline-input input:focus {
    border-color: var(--primary);
    outline: 3px solid rgb(20 90 117 / 16%);
}

.column-settings { margin-bottom: 1rem; padding-block: 1rem; }
.column-settings summary { cursor: pointer; font-weight: 700; }
.column-settings[open] summary { margin-bottom: 1rem; }
.column-settings__list { margin: 0 0 1rem; padding: 0; list-style: none; }
.column-settings__item {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem 1rem;
    padding-block: .5rem;
    border-bottom: 1px solid var(--border);
}
.column-settings__item .row-actions { padding-bottom: .35rem; }
.column-settings__form {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: .5rem 1rem;
}
.column-settings__form .field { margin-block: 0; }
.column-settings__form .field--checkbox { min-height: 2.65rem; }
.column-settings__form--new { padding-top: .5rem; }

.kanban {
    display: flex;
    align-items: flex-start;
    gap: .85rem;
    padding-bottom: .5rem;
    overflow-x: auto;
}

.kanban-column {
    display: flex;
    flex: 1 0 17rem;
    flex-direction: column;
    gap: .6rem;
    max-width: min(24rem, 85vw);
    padding: .75rem;
    border: 1px solid var(--border);
    border-radius: .75rem;
    background: var(--surface-muted);
}

.kanban-column__header {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.kanban-column__header h3 {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    font-size: 1rem;
    overflow-wrap: break-word;
}

.kanban-column__flag {
    color: var(--success-text);
    font-size: .78rem;
    font-weight: 700;
}

.kanban-column__count {
    min-width: 1.6rem;
    padding: .05rem .45rem;
    border-radius: 999px;
    background: var(--neutral-background);
    color: var(--neutral-text);
    font-size: .8rem;
    font-weight: 700;
    text-align: center;
}

.kanban-column__cards {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    min-height: 3rem;
    border-radius: .5rem;
    transition: background-color .1s ease;
}

.kanban-column__cards:not(:has(.kanban-card))::before {
    content: "Keine Aufgaben";
    padding: .75rem;
    border: 1px dashed var(--border);
    border-radius: .5rem;
    color: var(--muted);
    font-size: .88rem;
    text-align: center;
}

.kanban-column__cards.is-drop-target { background: var(--neutral-background); }

.kanban-card {
    display: grid;
    gap: .4rem;
    padding: .65rem .75rem;
    border: 1px solid var(--border);
    border-radius: .5rem;
    background: var(--surface);
    box-shadow: 0 1px 3px rgb(23 32 42 / 6%);
}

.kanban-card[draggable="true"] { cursor: grab; }
.kanban-card.is-dragging { opacity: .45; }

.kanban-card__title {
    color: var(--text);
    font-weight: 650;
    overflow-wrap: anywhere;
    text-decoration: none;
}

.kanban-card__title:hover { color: var(--primary); text-decoration: underline; }
.kanban-column--done .kanban-card__title { color: var(--muted); text-decoration: line-through; }

.kanban-card__description {
    margin: 0;
    color: var(--muted);
    font-size: .88rem;
    overflow-wrap: anywhere;
    white-space: pre-line;
}

.kanban-card__meta { display: flex; flex-wrap: wrap; gap: .3rem; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .1rem .45rem;
    border-radius: .3rem;
    background: var(--neutral-background);
    color: var(--neutral-text);
    font-size: .78rem;
    font-weight: 600;
}

.badge .icon-button__icon { width: .85rem; height: .85rem; }
.badge--overdue { background: var(--danger-background); color: var(--danger-text); }
.badge--complete { background: var(--success-background); color: var(--success-text); }
.badge--mine { background: var(--primary); color: var(--primary-contrast); }
.filter-toggle { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }

/* In Erledigt-Spalten zählt ein vergangenes Fälligkeitsdatum nicht als überfällig. */
.kanban-column--done .badge--overdue { background: var(--neutral-background); color: var(--neutral-text); }
.kanban-column--done .badge__overdue-text { display: none; }

.kanban-card__actions { display: flex; justify-content: space-between; }
.kanban-card__move { margin: 0; }
.kanban-card__move .icon-button { width: 1.75rem; height: 1.75rem; }
.kanban > .kanban-column:first-of-type .kanban-card__move--left,
.kanban > .kanban-column:last-of-type .kanban-card__move--right { visibility: hidden; }

.kanban-column__add .field-error { margin-top: .35rem; }
.kanban-hint { margin-top: .25rem; }

.kanban-lanes { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; margin-bottom: 1rem; }
.kanban-lane { padding: 1rem; }
.kanban-lane__header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .25rem 1rem;
    margin-bottom: .75rem;
}
.kanban-lane__header h2 { display: inline; margin: 0 .5rem 0 0; font-size: 1.15rem; }

.todo-detail {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    align-items: start;
    gap: 1rem;
}

.todo-form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0 1rem;
}

.todo-form-grid .field--title,
.todo-form-grid .field--description { grid-column: 1 / -1; }
.todo-form-grid .field--column { grid-column: span 2; }
.todo-detail__delete { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }


.subtask-list { margin: 0 0 1rem; padding: 0; list-style: none; }
.subtask {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding-block: .45rem;
    border-bottom: 1px solid var(--border);
}
.subtask form { margin: 0; }
.subtask__title { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.subtask--done .subtask__title { color: var(--muted); text-decoration: line-through; }
.subtask__toggle[aria-pressed="true"] { color: var(--success-text); }
.subtask__state { display: inline-flex; width: 2rem; justify-content: center; }
.subtask__state .icon-button__icon { width: 1.05rem; height: 1.05rem; }

/* Testanmeldung */
.dev-banner {
    padding: .45rem 1rem;
    background: var(--warning-background);
    color: var(--warning-text);
    font-size: .85rem;
    font-weight: 650;
    text-align: center;
}
.dev-login { margin-top: 1.75rem; padding-top: 1.25rem; border-top: 1px dashed var(--border); }
.dev-login:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.dev-login h2 { margin-bottom: .25rem; font-size: 1.05rem; }
.dev-login__users { display: grid; gap: .5rem; }
.dev-login__users form { margin: 0; }
.dev-login__users .button { width: 100%; }

/* Verrechnung */
.settlement-filter { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .25rem 1rem; margin-bottom: 1.5rem; padding-block: .75rem; }
.settlement-filter .field { margin-block: .25rem; }
.settlement-filter__actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-block: .25rem; }

/* Rollen und Freigaben */

.role-badge {
    display: inline-flex;
    align-items: center;
    padding: .15rem .55rem;
    border: 1px solid currentColor;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 700;
    white-space: nowrap;
}
.role-badge--owner { background: var(--primary); border-color: var(--primary); color: var(--primary-contrast); }
.role-badge--editor { background: var(--success-background); color: var(--success-text); }
.role-badge--todos { background: var(--warning-background); color: var(--warning-text); }
.role-badge--viewer { background: var(--neutral-background); color: var(--neutral-text); }

.member-list { display: grid; gap: .75rem; margin: 0 0 1.5rem; padding: 0; list-style: none; }
.member-card {
    display: grid;
    /* Feste Spalten, damit die Karten untereinander wie eine Tabelle fluchten. */
    grid-template-columns: 2.75rem minmax(9rem, 14rem) minmax(0, 1fr) 15.5rem 14.5rem;
    align-items: center;
    gap: 1rem 1.25rem;
    padding: 1rem 1.25rem;
}
.member-card__avatar {
    display: inline-flex;
    width: 2.75rem;
    height: 2.75rem;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--neutral-background);
    color: var(--neutral-text);
    font-weight: 750;
    letter-spacing: .02em;
}
.member-card__avatar--owner { background: var(--primary); color: var(--primary-contrast); }
.member-card__avatar--editor { background: var(--success-background); color: var(--success-text); }
.member-card__avatar--todos { background: var(--warning-background); color: var(--warning-text); }
.member-card__person { display: flex; flex-wrap: wrap; align-items: center; gap: .1rem .45rem; min-width: 0; }
.member-card__username { flex-basis: 100%; color: var(--muted); font-size: .85rem; }
.member-card__role { display: grid; justify-items: start; gap: .25rem; }
.member-card__role-description { color: var(--muted); font-size: .85rem; }
.member-card__facts { display: flex; gap: 1.25rem; margin: 0; }
.member-card__facts dt { color: var(--muted); font-size: .78rem; white-space: nowrap; }
.member-card__facts dd { margin: 0; font-weight: 650; white-space: nowrap; }
.member-card__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .4rem; }
.member-card__actions form { margin: 0; }

.role-picker { min-width: 0; margin-inline: 0; padding: 0; border: 0; }
.role-picker legend { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin-bottom: .5rem; padding: 0; font-weight: 650; }
.role-picker__help { display: inline-flex; align-items: center; gap: .3rem; font-size: .88rem; font-weight: 500; }
.role-picker__help .icon-button__icon { width: 1rem; height: 1rem; }
.role-picker__options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; }
.role-option {
    display: flex;
    gap: .6rem;
    align-items: flex-start;
    margin: 0;
    padding: .75rem .85rem;
    border: 1px solid var(--border);
    border-radius: .55rem;
    background: var(--surface);
    cursor: pointer;
}
.field .role-option { display: flex; margin-bottom: 0; font-weight: 500; }
.role-option:hover { border-color: var(--primary); }
.role-option:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary) inset; background: var(--surface-muted); }
.role-option:has(input:focus-visible) { outline: 3px solid rgb(20 90 117 / 25%); outline-offset: 2px; }
.field .role-option input { width: auto; min-height: 0; margin: .2rem 0 0; accent-color: var(--primary); }
.role-option__body { display: grid; justify-items: start; gap: .3rem; }
.role-option__description { color: var(--muted); font-size: .85rem; line-height: 1.35; }

.modal {
    width: min(100% - 2rem, 46rem);
    max-height: calc(100% - 2rem);
    margin: auto;
    padding: 1.5rem;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: .75rem;
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 20px 50px rgb(0 0 0 / 30%);
}
.modal::backdrop { background: rgb(15 22 30 / 55%); }
.modal__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.modal__header h2 { margin: 0; }
.role-legend { display: grid; gap: .45rem; margin: 0 0 1.25rem; padding: 0; list-style: none; }
.role-legend li { display: grid; grid-template-columns: 10.5rem 1fr; align-items: center; gap: .75rem; }
.role-legend .role-badge { justify-self: start; }
.permission-table th,
.permission-table td { padding: .55rem .7rem; }
.permission-table thead th { text-align: center; white-space: normal; }
.permission-table tbody th { background: none; color: var(--text); font-size: .9rem; font-weight: 500; letter-spacing: 0; white-space: normal; }
.permission-table__cell { text-align: center; color: var(--muted); }
.permission-table__cell .icon-button__icon { width: 1.1rem; height: 1.1rem; }
.permission-table__cell--yes { color: var(--success-text); }
.permission-table tbody tr:last-child th { border-bottom: 0; }
.modal .help-text { margin-bottom: 0; }

/* Mittlere Breiten: Navigation kompakter, Kennzahlen zweispaltig */
@media (max-width: 64rem) {
    .navigation__user-name { display: none; }
    .billing-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .time-entry-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        grid-template-areas:
            "date start end duration"
            "user user user user"
            "activity activity activity activity";
    }
    .time-entry-grid:not(.time-entry-grid--with-user) {
        grid-template-areas:
            "date start end duration"
            "activity activity activity activity";
    }
}

@media (max-width: 48rem) {
    .navigation { flex-wrap: wrap; padding-block: .5rem 0; }
    .navigation__links {
        order: 3;
        flex-basis: 100%;
        margin-inline: -1.25rem;
        padding: .25rem 1.25rem .5rem;
        overflow-x: auto;
        scrollbar-width: none;
    }
    .navigation__links::-webkit-scrollbar { display: none; }
    .navigation__link--create { margin-left: 0; }
    .navigation__links + .navigation__tools { margin-left: auto; }
}

@media (max-width: 42rem) {
    .navigation,
    .page { padding-inline: 1rem; }
    .navigation__links { margin-inline: -1rem; padding-inline: 1rem; }
    .navigation__link--create { padding-inline: .6rem; }
    .navigation__link--create span {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
    }
    .page { padding-block: 1.25rem 3rem; }
    .page-heading { align-items: stretch; flex-direction: column; }
    .card { padding: 1.15rem; }
    .table-card { padding: 0; }
    .login-card { margin-block: 1rem; padding: 1.5rem; }
    .heading-actions { align-items: stretch; flex-direction: column; }
    .heading-actions .button,
    .heading-actions form,
    .heading-actions form .button,
    .heading-actions .menu,
    .heading-actions .menu > summary { width: 100%; }
    .menu__panel { right: auto; left: 0; width: 100%; }
    .form-actions .button { flex: 1 1 auto; }
    .form-actions__hint { display: none; }
    .summary-grid,
    .billing-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .summary-card strong { font-size: 1.2rem; }
    .definition-list { grid-template-columns: 1fr; }
    .status-management { align-items: stretch; flex-direction: column; }
    .status-management__actions { flex-direction: column; }
    .status-management__actions form .button,
    .status-management__actions .button { width: 100%; }
    .danger-card__actions { align-items: stretch; flex-direction: column; }
    .danger-card__actions form,
    .danger-card__actions .button { width: 100%; }
    .time-entry-grid,
    .time-entry-grid:not(.time-entry-grid--with-user) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-areas:
            "date date"
            "start end"
            "duration duration"
            "user user"
            "activity activity";
    }
    .time-entry-notes { grid-template-columns: 1fr; }
    .invoice-summary { grid-template-columns: 1fr; }
    .adjustment-grid { grid-template-columns: 1fr; }
    .transaction-grid { grid-template-columns: 1fr; }
    .todo-detail { grid-template-columns: 1fr; }
    .todo-form-grid { grid-template-columns: 1fr; }
    .column-settings__item { align-items: stretch; flex-direction: column; }
    .column-settings__form { align-items: stretch; flex-direction: column; }
    .kanban-column { flex: 0 0 16rem; }
    .statement-intro { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .statement-table-card { overflow-x: auto; }
    .statement-table { min-width: 38rem; }
    .statement-totals { width: 100%; }
    .member-card { grid-template-columns: 2.75rem minmax(0, 1fr); }
    .member-card__role,
    .member-card__facts,
    .member-card__actions { grid-column: 1 / -1; }
    .member-card__actions { justify-content: flex-start; }
    .role-picker__options { grid-template-columns: 1fr; }
    .role-legend li { grid-template-columns: 1fr; gap: .2rem; }
    .settlement-filter { align-items: stretch; flex-direction: column; }
}

@media print {
    @page { margin: 14mm; }

    :root {
        --background: #fff;
        --surface: #fff;
        --surface-muted: #f3f3f3;
        --text: #000;
        --muted: #444;
        --border: #aaa;
        --danger-text: #000;
    }

    body { font-size: 10pt; }
    .site-header,
    .dev-banner,
    .messages,
    .back-link,
    .statement-page .tabs,
    .statement-page .print-actions { display: none; }
    .page { width: 100%; max-width: none; padding: 0; }
    .statement-heading { margin-bottom: 8mm; }
    .statement-heading h1 { font-size: 20pt; }
    .statement-page .card {
        border-color: #aaa;
        border-radius: 0;
        box-shadow: none;
    }
    .statement-intro,
    .statement-totals { break-inside: avoid; }
    .statement-section { margin-bottom: 7mm; }
    .statement-section h2 { break-after: avoid; }
    .statement-table-card { overflow: visible; }
    .statement-table { min-width: 0; }
    .statement-table thead { display: table-header-group; }
    .statement-table tr { break-inside: avoid; }
    .statement-disclaimer { margin-top: 7mm; }
}
