/*
 * KMpro OS: a light frame with the navigation on it, the work area as a floating canvas, and one
 * black display board per view whose figures glow, like a departure board.
 *
 * Brand core from the Kanzlei CI: black, white, text grey, brand yellow as the light, IBM Plex Sans
 * (self-hosted, SIL OFL, see assets/fonts/OFL-IBMPlexSans.txt, so no request leaves for a font CDN).
 * Extended with signal colors for status and a violet second accent. 4 px grid.
 *
 * Components use role tokens (--canvas, --fg-strong, --board, ...), which the dark scheme redefines.
 * The brand constants (--ink, --yellow, --white) stay fixed: text on yellow is always --ink.
 */
@font-face {
    font-family: "IBM Plex Sans";
    font-style: normal;
    font-display: swap;
    font-weight: 100 700;
    src: url("../fonts/ibm-plex-sans-latin-RssxsJZ.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "IBM Plex Sans";
    font-style: normal;
    font-display: swap;
    font-weight: 100 700;
    src: url("../fonts/ibm-plex-sans-latin-ext-6jrsEWt.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;
}

:root {
    /* Brand constants */
    --ink: #1c1c1c;
    --yellow: #dedc00;
    --white: #ffffff;
    --violet-fill: #5a4bff;

    /* Frame (behind everything), canvas (the work area) and text */
    --frame: #ebebea;
    --canvas: #ffffff;
    --surface: #ffffff;
    --field: #f3f3f2;
    --fg-strong: #1c1c1c;
    --fg: #323232;
    --fg-muted: #616161;
    --fg-subtle: #9a9a9a;
    --nav-fg: #4a4a4a;
    --line: #ececeb;
    --line-strong: #d2d2d0;
    --hover: #f6f6f5;
    --nav-hover: rgba(28, 28, 28, 0.05);
    --backdrop: rgba(28, 28, 28, 0.28);
    --canvas-shadow: 0 0 0 1px rgba(28, 28, 28, 0.05), 0 1px 2px rgba(28, 28, 28, 0.04), 0 12px 32px -16px rgba(28, 28, 28, 0.12);
    --raised-shadow: 0 0 0 1px rgba(28, 28, 28, 0.06), 0 1px 2px rgba(28, 28, 28, 0.08);

    /* Inverted elements: primary button, active filter, chips, tooltip */
    --inverse-bg: #1c1c1c;
    --inverse-hover: #383838;
    --inverse-fg: #ffffff;
    --inverse-muted: #b4b4b4;

    /* The display board: black in both schemes, figures lit in dots */
    --board: #1c1c1c;
    --board-edge: #1c1c1c;
    --board-raster: #2c2c2c;
    --board-fg: #f6f6f1;
    --board-muted: #a3a3a3;
    --board-line: rgba(255, 255, 255, 0.13);
    --board-hover: rgba(255, 255, 255, 0.04);
    --board-red: #ff6f62;

    /* Data; the yellow hero bar gets a darker edge, so it holds its shape on white. */
    --bar: #1c1c1c;
    --bar-hero-edge: #a9a700;
    --track: #ececeb;
    --axis: #9a9a9a;
    --switch-off: #d2d2d0;
    --switch-on: #1c1c1c;

    /* Signal colors and second accent; each text color reaches 4.5:1 on --canvas and on its soft tint. */
    --violet: #5a4bff;
    --violet-soft: #eeecff;
    --red: #c4261a;
    --red-fill: #d42d20;
    --red-soft: #fdebe9;
    --red-hatch: #f8d5d1;
    --green: #12804a;
    --green-fill: #17a35e;

    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%231c1c1c' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    --chevron-inverse: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23ffffff' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");

    --radius: 12px;
    --radius-board: 20px;
    --control-height: 32px;
    --font: "IBM Plex Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --frame: #0e0e0e;
        --canvas: #171717;
        --surface: #1f1f1f;
        --field: #232323;
        --fg-strong: #f2f2f2;
        --fg: #d4d4d4;
        --fg-muted: #9a9a9a;
        --fg-subtle: #6e6e6e;
        --nav-fg: #a6a6a6;
        --line: #262626;
        --line-strong: #3d3d3d;
        --hover: #1d1d1d;
        --nav-hover: rgba(255, 255, 255, 0.05);
        --backdrop: rgba(0, 0, 0, 0.55);
        --canvas-shadow: 0 0 0 1px #222222, 0 12px 32px -16px rgba(0, 0, 0, 0.6);
        --raised-shadow: 0 0 0 1px #2e2e2e, 0 1px 2px rgba(0, 0, 0, 0.4);

        --inverse-bg: #f2f2f2;
        --inverse-hover: #d4d4d4;
        --inverse-fg: #1c1c1c;
        --inverse-muted: #5a5a5a;

        --board: #0b0b0b;
        --board-edge: #2a2a2a;
        --board-raster: #1b1b1b;

        --bar: #a3a3a3;
        --bar-hero-edge: transparent;
        --track: #2a2a2a;
        --axis: #555555;
        --switch-off: #474747;
        --switch-on: #5a5a5a;

        --violet: #a59cff;
        --violet-soft: #25213f;
        --red: #ff7b6e;
        --red-fill: #d4352a;
        --red-soft: #341614;
        --red-hatch: #451d1a;
        --green: #4cc38a;
        --green-fill: #2fa86b;

        --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23f2f2f2' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
        --chevron-inverse: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%231c1c1c' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");

        color-scheme: dark;
    }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--frame);
    color: var(--fg);
    font: 14px/1.45 var(--font);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background: var(--yellow);
    color: var(--ink);
}

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

a {
    color: var(--fg-strong);
    text-decoration: underline;
    text-decoration-color: var(--line-strong);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

a:hover {
    text-decoration-color: var(--fg-strong);
}

h1 {
    margin: 0;
    color: var(--fg-strong);
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -0.035em;
    line-height: 1.15;
}

h2 {
    margin: 0;
    color: var(--fg-strong);
    font-size: 0.875rem;
    font-weight: 600;
}

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

/* Red is a problem, yellow needs attention. */
.text-danger {
    color: var(--red);
    font-weight: 500;
}

.text-warning {
    color: var(--fg-strong);
}

.text-warning::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 8px;
    border-radius: 50%;
    background: var(--yellow);
    box-shadow: 0 0 6px var(--yellow);
    vertical-align: 0.12em;
}

.icon {
    flex: none;
}

.turbo-progress-bar {
    height: 2px;
    background-color: var(--yellow);
}

/* Brand: the Kanzlei's logo, as on kmpro-muc.de, and the wordmark. The black disc would sink into a
   dark surface, so those carry the white one. */

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--fg-strong);
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    text-decoration: none;
}

.brand-mark {
    display: inline-block;
    flex: none;
    width: 30px;
    height: 30px;
    background: url("../images/kmpro-logo-black-QpseinC.svg") center / contain no-repeat;
}

@media (prefers-color-scheme: dark) {
    .brand-mark {
        background-image: url("../images/kmpro-logo-white-JKhY-Nq.svg");
    }
}

/* App shell: navigation on the frame, the page on a floating canvas that scrolls by itself */

body.has-shell {
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr);
    height: 100dvh;
    overflow: hidden;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 100dvh;
    padding: 16px 12px 12px;
    color: var(--nav-fg);
}

.sidebar .brand {
    padding: 4px 8px 8px;
}

.command-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    height: 34px;
    padding: 0 6px 0 10px;
    border: 0;
    border-radius: 10px;
    background: var(--canvas);
    box-shadow: var(--raised-shadow);
    color: var(--fg-muted);
    font: inherit;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: box-shadow 0.15s;
}

.command-trigger:hover {
    box-shadow: 0 0 0 1px var(--line-strong), 0 1px 2px rgba(28, 28, 28, 0.08);
}

kbd {
    padding: 1px 6px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--field);
    color: var(--fg-muted);
    font: 500 0.6875rem/1.5 var(--font);
}

.command-trigger kbd {
    margin-left: auto;
}

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

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 34px;
    padding: 0 10px;
    border-radius: 10px;
    color: var(--nav-fg);
    text-decoration: none;
    transition: color 0.15s, background-color 0.15s;
}

.sidebar-nav a:hover {
    background: var(--nav-hover);
    color: var(--fg-strong);
}

.sidebar-nav a[aria-current="page"] {
    background: var(--canvas);
    box-shadow: var(--raised-shadow);
    color: var(--fg-strong);
    font-weight: 500;
}

.sidebar-nav a.sidebar-admin {
    margin-top: 16px;
}

.today {
    margin-top: auto;
    padding: 0 10px;
    color: var(--fg-muted);
    font-size: 0.75rem;
    white-space: nowrap;
}

.account {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 4px 0 8px;
    border-top: 1px solid var(--line-strong);
}

.avatar {
    display: inline-grid;
    flex: none;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--violet-fill);
    color: var(--white);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.04em;
}

.account-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.35;
}

.account-name,
.account-email {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-name {
    color: var(--fg-strong);
    font-size: 0.8125rem;
    font-weight: 500;
}

.account-email {
    color: var(--fg-muted);
    font-size: 0.75rem;
}

.account-logout {
    display: inline-grid;
    flex: none;
    place-items: center;
    width: 30px;
    height: 30px;
    margin-left: auto;
    border-radius: 8px;
    color: var(--nav-fg);
}

.account-logout:hover {
    background: var(--nav-hover);
    color: var(--fg-strong);
}

.main {
    min-width: 0;
    height: calc(100dvh - 16px);
    margin: 8px 8px 8px 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-radius: 16px;
    background: var(--canvas);
    box-shadow: var(--canvas-shadow);
}

.page {
    width: 100%;
    max-width: 1376px;
    padding: 40px 48px 96px;
}

.page-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 32px;
}

.page-header p {
    max-width: 72ch;
    margin: 0;
    color: var(--fg-muted);
    font-size: 0.9375rem;
}

.breadcrumb {
    margin: -16px 0 12px;
    font-size: 0.8125rem;
}

.breadcrumb a {
    color: var(--fg-muted);
    text-decoration: none;
}

.breadcrumb a::before {
    content: "← ";
}

.breadcrumb a:hover {
    color: var(--fg-strong);
}

/* Command palette: a frosted sheet over the page */

.command-palette {
    width: min(580px, calc(100% - 32px));
    margin: 14vh auto auto;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 16px;
    background: color-mix(in srgb, var(--surface) 86%, transparent);
    box-shadow: 0 0 0 1px var(--line-strong), 0 32px 80px -24px rgba(0, 0, 0, 0.45);
    color: var(--fg);
    -webkit-backdrop-filter: blur(24px) saturate(1.6);
    backdrop-filter: blur(24px) saturate(1.6);
}

.command-palette[open] {
    animation: palette-in 0.16s cubic-bezier(0.2, 0.8, 0.3, 1);
}

@keyframes palette-in {
    from {
        opacity: 0;
        transform: translateY(-6px) scale(0.985);
    }
}

.command-palette::backdrop {
    background: var(--backdrop);
}

.command-search {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 56px;
    padding: 0 20px;
    border-bottom: 1px solid var(--line);
    color: var(--fg-muted);
}

.command-search input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--fg-strong);
    font: inherit;
    font-size: 1rem;
}

.command-list {
    max-height: 360px;
    margin: 0;
    padding: 8px;
    overflow-y: auto;
    list-style: none;
}

.command-list a {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 40px;
    padding: 0 12px;
    border-radius: 10px;
    color: var(--fg-strong);
    text-decoration: none;
}

.command-list li.is-selected a {
    background: var(--inverse-bg);
    color: var(--inverse-fg);
}

.command-list li.is-selected a::after {
    content: "";
    width: 6px;
    height: 6px;
    margin-left: auto;
    border-radius: 50%;
    background: var(--yellow);
    box-shadow: 0 0 8px var(--yellow);
}

.command-empty {
    margin: 0;
    padding: 24px;
    color: var(--fg-muted);
    text-align: center;
}

/* Controls */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 36px;
    padding: 0 16px;
    border: 0;
    border-radius: 10px;
    background: var(--canvas);
    box-shadow: var(--raised-shadow);
    color: var(--fg-strong);
    font: inherit;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s, box-shadow 0.15s;
}

.button:hover {
    box-shadow: 0 0 0 1px var(--line-strong), 0 1px 2px rgba(28, 28, 28, 0.1);
}

.button-primary {
    background: var(--inverse-bg);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 1px 2px rgba(0, 0, 0, 0.2);
    color: var(--inverse-fg);
}

.button-primary:hover {
    background: var(--inverse-hover);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 1px 2px rgba(0, 0, 0, 0.2);
}

.button-block {
    width: 100%;
    height: 44px;
}

.button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Filter bar: one row of soft pills; a pill that narrows the list is inverted */

.filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
}

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

.field-label {
    color: var(--fg-muted);
    font-size: 0.8125rem;
    white-space: nowrap;
}

.filters label.field {
    gap: 0;
    height: var(--control-height);
    padding-left: 12px;
    border-radius: 999px;
    background: var(--field);
    cursor: pointer;
    transition: background-color 0.15s, box-shadow 0.15s;
}

.filters label.field:hover {
    box-shadow: inset 0 0 0 1px var(--line-strong);
}

.filters label.field:focus-within {
    outline: 2px solid var(--fg-strong);
    outline-offset: 2px;
}

.filters select {
    appearance: none;
    height: 100%;
    max-width: 16rem;
    padding: 0 30px 0 6px;
    border: 0;
    border-radius: 999px;
    background: transparent var(--chevron) no-repeat right 12px center;
    color: var(--fg-strong);
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    text-overflow: ellipsis;
    cursor: pointer;
    /* As wide as the chosen option, not the longest one, where supported. */
    field-sizing: content;
}

.filters select:focus-visible {
    outline: none;
}

.filters select option {
    background: var(--surface);
    color: var(--fg-strong);
}

.filters label.field:has(option[value=""]):has(option:checked:not([value=""])) {
    background: var(--inverse-bg);
}

.filters label.field:has(option[value=""]):has(option:checked:not([value=""])) .field-label {
    color: var(--inverse-muted);
}

.filters label.field:has(option[value=""]):has(option:checked:not([value=""])) select {
    background-image: var(--chevron-inverse);
    color: var(--inverse-fg);
}

/* Checkbox drawn as a switch; the knob lights up yellow when on */

.checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    height: var(--control-height);
    padding: 0 8px;
    color: var(--fg-strong);
    font-size: 0.8125rem;
    cursor: pointer;
}

.checkbox input {
    appearance: none;
    position: relative;
    flex: none;
    width: 34px;
    height: 20px;
    margin: 0;
    border-radius: 999px;
    background: var(--switch-off);
    cursor: pointer;
    transition: background-color 0.18s;
}

.checkbox input::before {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--white);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s cubic-bezier(0.3, 0.7, 0.4, 1), background-color 0.18s, box-shadow 0.18s;
}

.checkbox input:checked {
    background: var(--switch-on);
}

.checkbox input:checked::before {
    background: var(--yellow);
    box-shadow: 0 0 8px var(--yellow);
    transform: translateX(14px);
}

/* Segmented control: a raised thumb on a soft track */

.segmented {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 3px;
    border-radius: 999px;
    background: var(--field);
}

.segmented label {
    position: relative;
}

.segmented input {
    position: absolute;
    inset: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.segmented span,
.segmented a {
    display: flex;
    align-items: center;
    height: 26px;
    padding: 0 14px;
    border-radius: 999px;
    color: var(--fg-muted);
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
    text-decoration: none;
    transition: background-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.segmented label:hover span,
.segmented a:hover {
    color: var(--fg-strong);
}

.segmented input:checked + span,
.segmented a[aria-current] {
    background: var(--canvas);
    box-shadow: var(--raised-shadow);
    color: var(--fg-strong);
}

@media (prefers-color-scheme: dark) {
    .segmented input:checked + span,
    .segmented a[aria-current] {
        background: #333333;
    }
}

.segmented input:focus-visible + span {
    outline: 2px solid var(--fg-strong);
    outline-offset: 2px;
}

.toolbar {
    margin: 0 0 16px;
}

/* A view switch next to its filter: [Jahr | Woche] [Jahr 2026 ▾] */
.toolbar-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    margin-bottom: 24px;
}

.toolbar-row .filters {
    margin-bottom: 0;
}

/* Messages: a lit dot carries the kind, so the text stays calm */

.flash,
.alert {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin: 0 0 24px;
    padding: 12px 16px;
    border-radius: var(--radius);
    background: var(--field);
    color: var(--fg-strong);
}

.flash::before,
.alert::before {
    content: "";
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green-fill);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--green-fill) 22%, transparent);
    transform: translateY(-1px);
}

.alert::before {
    background: var(--yellow);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--yellow) 30%, transparent), 0 0 8px var(--yellow);
}

.flash-error {
    background: var(--red-soft);
    color: var(--red);
}

.flash-error::before {
    background: var(--red-fill);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--red-fill) 22%, transparent);
}

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

.table .center {
    text-align: center;
}

.table .nowrap {
    white-space: nowrap;
}

.cell-secondary {
    display: block;
    color: var(--fg-muted);
    font-size: 0.8125rem;
}

/* Administration */

.role-tag {
    display: inline-flex;
    align-items: center;
    height: 22px;
    margin: 2px 4px 2px 0;
    padding: 0 9px;
    border-radius: 999px;
    background: var(--field);
    color: var(--fg-strong);
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.role-admin {
    background: var(--violet-soft);
    color: var(--violet);
}

.right-yes {
    color: var(--fg-strong);
}

.right-no {
    color: var(--line-strong);
}

.form-hint {
    max-width: 70ch;
    margin: 0 0 16px;
    font-size: 0.8125rem;
}

/* Right under a section title the hint belongs to it; after the fields it needs room. */
.chart-title + .form-hint {
    margin-top: -8px;
}

.role-options + .form-hint {
    margin: 16px 0 0;
}

.role-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
    gap: 12px;
}

.role-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border-radius: 14px;
    background: var(--canvas);
    box-shadow: var(--raised-shadow);
    cursor: pointer;
    transition: box-shadow 0.15s;
}

.role-option:hover {
    box-shadow: 0 0 0 1px var(--line-strong), 0 1px 2px rgba(28, 28, 28, 0.08);
}

.role-option:has(input:checked) {
    box-shadow: 0 0 0 2px var(--fg-strong);
}

.role-option input {
    flex: none;
    width: 16px;
    height: 16px;
    margin: 2px 0 0;
    accent-color: var(--fg-strong);
}

.role-option strong {
    display: block;
    margin-bottom: 2px;
    color: var(--fg-strong);
    font-weight: 600;
}

.role-option .muted {
    font-size: 0.8125rem;
}

.admin-form select {
    appearance: none;
    width: min(100%, 28rem);
    height: 38px;
    padding: 0 36px 0 12px;
    border: 0;
    border-radius: 10px;
    background: var(--canvas) var(--chevron) no-repeat right 14px center;
    box-shadow: var(--raised-shadow);
    color: var(--fg-strong);
    font: inherit;
}

.admin-form .chart-title label {
    font: inherit;
}

.admin-form .checkbox {
    width: fit-content;
    padding: 0;
    font-size: inherit;
}

.form-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

/* Admin status tiles: connection, last sync, actions */
.admin-status {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
    gap: 12px;
    margin-bottom: 40px;
}

.admin-status .kpi {
    padding: 20px;
    border-radius: 14px;
    background: var(--canvas);
    box-shadow: var(--raised-shadow);
}

.admin-status .kpi p {
    margin: 0;
}

.admin-status .status-line {
    margin: 14px 0 6px;
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

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

.check-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.check-mark {
    width: 16px;
    color: var(--green);
    font-weight: 600;
}

.check-list .is-failed .check-mark {
    color: var(--red);
}

/* Protokoll: one line per event, grouped under its day */
.audit td {
    padding-top: 9px;
    padding-bottom: 9px;
    vertical-align: baseline;
}

.audit .audit-day th {
    height: auto;
    padding: 24px 12px 8px;
    border-bottom: 1px solid var(--line-strong);
    color: var(--fg-strong);
    font-size: 0.8125rem;
    font-weight: 600;
    text-align: left;
}

.audit thead + tbody .audit-day th {
    padding-top: 12px;
}

.audit-time {
    width: 4rem;
    color: var(--fg-muted);
    font-variant-numeric: tabular-nums;
}

.audit-person {
    cursor: help;
}

.audit-detail {
    display: inline-block;
    margin-right: 12px;
    font-size: 0.8125rem;
}

.audit-details {
    min-width: 20rem;
}

/* Drill-down: each step is a chip that removes it again. */
.filter-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: var(--control-height);
    padding: 0 5px 0 12px;
    border-radius: 999px;
    background: var(--inverse-bg);
    color: var(--inverse-fg);
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}

.chip-dimension {
    color: var(--inverse-muted);
    font-weight: 400;
}

.chip-remove {
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: color-mix(in srgb, currentColor 16%, transparent);
    line-height: 1;
}

.chip:hover .chip-remove {
    background: var(--yellow);
    color: var(--ink);
}

.chip-clear {
    color: var(--fg-muted);
    font-size: 0.8125rem;
}

/* Clickable marks: bars, columns and readouts lead one level deeper. */
a.hbar,
a.cols-slot,
a.kpi-link {
    color: inherit;
    text-decoration: none;
}

/* Calendar week stepper: ‹ KW 43 19.–25.10.2026 › */
.week-nav {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: var(--control-height);
    padding: 0 3px;
    border-radius: 999px;
    background: var(--field);
    font-size: 0.8125rem;
}

.week-step {
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    color: var(--fg-strong);
    text-decoration: none;
}

.week-step:hover {
    background: var(--canvas);
    box-shadow: var(--raised-shadow);
}

.week-step.is-disabled {
    color: var(--line-strong);
}

.week-label {
    padding: 0 8px;
    color: var(--fg-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.week-label strong {
    margin-right: 6px;
    color: var(--fg-strong);
    font-weight: 500;
}

/* Nothing to show */
.empty {
    margin: 0;
    padding: 72px 24px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-board);
    color: var(--fg-muted);
    text-align: center;
}

/* Tables: quiet header, hairlines only; text lines up with the section title */

.table-wrap {
    /* Positioned, so hidden labels (.visually-hidden) in a wide table scroll with it instead of
       widening the page on a phone. */
    position: relative;
    margin: 0 -12px;
    overflow-x: auto;
}

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

.table th,
.table td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

.table thead th {
    height: 36px;
    padding-top: 0;
    padding-bottom: 0;
    border-bottom-color: var(--line-strong);
    background: var(--canvas);
    color: var(--fg-muted);
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.table tbody tr {
    transition: background-color 0.1s;
}

.table tbody tr:hover {
    background: var(--hover);
}

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

/* Client names get room before they wrap; very long ones ("Eheleute …") may take two lines. */
.table td:has(> .client-number) {
    min-width: 15rem;
}

/* Client above, order below, one line each; long names end in "…", the full ones are in the tooltip. */
.cell-what {
    min-width: 15rem;
}

.clip {
    display: block;
    max-width: 24rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.client-number {
    margin-right: 8px;
    color: var(--fg-subtle);
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.matrix td {
    white-space: nowrap;
}

.matrix td span + span {
    margin-left: 6px;
}

/* A missing responsibility is tinted and hatched, so the gap also shows without color. */
.cell-gap {
    background: repeating-linear-gradient(135deg, var(--red-soft) 0 6px, var(--red-hatch) 6px 8px);
}

/* Badges: red is a problem, yellow needs attention */

.tag {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 9px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
}

.tag-danger {
    background: var(--red-soft);
    color: var(--red);
}

.tag-warning {
    background: var(--yellow);
    color: var(--ink);
}

.tag-neutral {
    background: var(--field);
    color: var(--fg);
}

/*
 * Deadlines: the date as it is, and under it how far off it is, behind a light: red once it has
 * passed, yellow within 14 days. So a page of overdue orders reads as a list, not as an alarm.
 */
.deadline {
    display: inline-block;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.deadline small {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 500;
}

.deadline small::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.deadline-overdue small {
    color: var(--red);
}

.deadline-overdue small::before {
    background: var(--red-fill);
}

.deadline-due-soon small {
    color: var(--fg-strong);
}

.deadline-due-soon small::before {
    background: var(--yellow);
    box-shadow: 0 0 6px var(--yellow);
}

/* Status as a status light: dashed ring = open, violet = in progress, green = done */

.status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--fg-strong);
    white-space: nowrap;
}

.status::before {
    content: "";
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--fg-strong);
}

.status-open::before {
    width: 10px;
    height: 10px;
    border: 1.5px dashed var(--fg-subtle);
    background: none;
}

.status-in_progress::before {
    background: var(--violet);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--violet) 22%, transparent), 0 0 8px color-mix(in srgb, var(--violet) 60%, transparent);
}

.status-completed {
    color: var(--fg-muted);
}

.status-completed::before {
    background: var(--green-fill);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--green-fill) 20%, transparent);
}

.budget {
    display: block;
    width: 100%;
    min-width: 5rem;
    height: 3px;
    margin-top: 6px;
    border-radius: 2px;
    background: var(--track);
    overflow: hidden;
}

.budget span {
    display: block;
    height: 100%;
    background: var(--bar);
}

.budget-over span {
    background: var(--red-fill);
}

/* The display board: black, a faint raster of unlit dots, yellow light bleeding in from the lower left. */

.kpi-row,
.summary-grid {
    position: relative;
    display: grid;
    margin-bottom: 40px;
    overflow: hidden;
    border-radius: var(--radius-board);
    background-color: var(--board);
    background-image:
        radial-gradient(90% 140% at 0% 100%, color-mix(in srgb, var(--yellow) 13%, transparent), transparent 55%),
        radial-gradient(circle closest-side, var(--board-raster) 55%, transparent 75%);
    background-size: auto, 8px 8px;
    box-shadow: inset 0 0 0 1px var(--board-edge), inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 1px 2px rgba(0, 0, 0, 0.18);
    color: var(--board-fg);
}

.kpi-row {
    grid-template-columns: 2fr 1fr 1fr;
}

/* Updates waiting for the MV join the person's board as a fourth figure. */
@media (min-width: 1101px) {
    .kpi-row.has-updates {
        grid-template-columns: 2fr 1fr 1fr 1fr;
    }
}

.summary-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.kpi,
.summary-card {
    position: relative;
    min-width: 0;
    padding: 28px 32px 32px;
}

.kpi-row > * + *,
.summary-grid > * + * {
    border-left: 1px dashed var(--board-line);
}

.kpi-row a.kpi-link,
.summary-grid a {
    transition: background-color 0.15s;
}

.kpi-row a.kpi-link:hover {
    background: var(--board-hover);
}

/* A figure that narrows the list below is lit along its foot while it does. */
.kpi-row a.kpi-link[aria-current] {
    background: var(--board-hover);
    box-shadow: inset 0 -2px 0 var(--yellow);
}

.order-board {
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
}

.order-chips {
    margin: -24px 0 24px;
}

.kpi-label,
.summary-card h2 {
    margin: 0;
    color: var(--board-muted);
    font-size: 0.8125rem;
    font-weight: 500;
}

.kpi-value,
.summary-value {
    display: block;
    margin: 20px 0 0;
    color: var(--board-fg);
    font-size: 3.25rem;
    font-weight: 500;
    letter-spacing: -0.045em;
    line-height: 1;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 28px rgba(255, 255, 255, 0.14);
    animation: board-on 0.5s ease-out both;
}

/* The board lights up once when the page opens. */
@keyframes board-on {
    from {
        opacity: 0.2;
        filter: blur(3px);
    }
}

.kpi-hero .kpi-value,
.summary-value {
    margin-top: 24px;
    font-size: clamp(3.5rem, 6.2vw, 6rem);
}

.kpi-unit {
    color: var(--yellow);
    text-shadow: 0 0 22px color-mix(in srgb, var(--yellow) 70%, transparent);
}

.kpi-delta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    margin: 24px 0 0;
    color: var(--board-muted);
    font-size: 0.8125rem;
}

.kpi-delta .muted,
.kpi-row .muted {
    color: var(--board-muted);
}

.balance {
    font-weight: 500;
    color: var(--fg-strong);
}

.delta-value {
    font-weight: 600;
}

.kpi-hero .delta-value {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    background: var(--yellow);
    box-shadow: 0 0 16px color-mix(in srgb, var(--yellow) 45%, transparent);
    color: var(--ink);
}

.kpi-hero .delta-down .delta-value {
    background: var(--red-fill);
    box-shadow: none;
    color: var(--white);
}

/* The arrow carries the direction as well, so color is never the only cue. */
.delta-up {
    color: var(--green);
}

.delta-down {
    color: var(--red);
}

.kpi-row .delta-up,
.kpi-row .delta-down {
    color: var(--board-muted);
}

/* Responsibility areas on the board: gaps light up red. */
.summary-card p {
    margin: 0;
    color: var(--board-muted);
    font-size: 0.8125rem;
}

.summary-card .summary-gaps {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 0 0 20px;
}

.summary-card .summary-value {
    margin-top: 24px;
}

.summary-gaps.text-danger .summary-value {
    color: var(--board-red);
    text-shadow: 0 0 22px color-mix(in srgb, var(--board-red) 60%, transparent);
}

.summary-card .text-warning {
    color: var(--board-fg);
}

.summary-card a {
    color: var(--board-fg);
    text-decoration-color: var(--board-line);
}

.summary-card a:hover {
    text-decoration-color: var(--board-fg);
}

a.summary-gaps {
    color: var(--board-muted);
    font-size: 0.8125rem;
    font-weight: 400;
    text-decoration: none;
}

a.summary-gaps span:last-child {
    color: var(--board-red);
}

a.summary-gaps:hover span:last-child {
    text-decoration: underline;
}

/* Pagination */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 24px;
    color: var(--fg-muted);
    font-size: 0.8125rem;
}

.pagination a {
    display: inline-flex;
    align-items: center;
    height: 32px;
    padding: 0 14px;
    border-radius: 999px;
    background: var(--canvas);
    box-shadow: var(--raised-shadow);
    color: var(--fg-strong);
    font-weight: 500;
    text-decoration: none;
}

.pagination a:hover {
    box-shadow: 0 0 0 1px var(--line-strong), 0 1px 2px rgba(28, 28, 28, 0.08);
}

/* Login: the board with the paragraph sign beside a canvas with the sign-in */

.login {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 8px;
    min-height: 100dvh;
    padding: 8px;
}

.login-brand {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 32px;
    padding: 40px;
    border-radius: var(--radius-board);
    background-color: var(--board);
    background-image:
        radial-gradient(70% 60% at 20% 100%, color-mix(in srgb, var(--yellow) 14%, transparent), transparent 70%),
        radial-gradient(60% 50% at 100% 0%, color-mix(in srgb, var(--violet-fill) 16%, transparent), transparent 70%);
    box-shadow: inset 0 0 0 1px var(--board-edge);
    color: var(--white);
}

.login-brand .brand {
    color: var(--white);
    font-size: 1.0625rem;
}

.login-brand .brand-mark {
    background-image: url("../images/kmpro-logo-white-JKhY-Nq.svg");
}

.login-art {
    align-self: center;
    width: min(100%, 460px);
    height: auto;
}

.login-claim {
    max-width: 28ch;
    margin: 0;
    color: var(--board-muted);
    font-size: 1.25rem;
    font-weight: 400;
    letter-spacing: -0.01em;
    line-height: 1.4;
}

.login-panel {
    display: grid;
    place-items: center;
    border-radius: var(--radius-board);
    background: var(--canvas);
    box-shadow: var(--canvas-shadow);
}

.login-form {
    width: min(100%, 380px);
    padding: 48px 24px;
}

.login-form p {
    margin: 12px 0 32px;
}

/* Demo server: the people to sign in as, one below the other, then the shared password */
.demo-login .role-options {
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 0 0 24px;
    padding: 0;
    border: 0;
}

.demo-login .role-option {
    padding: 12px 14px;
}

.microsoft-logo {
    box-sizing: content-box;
    padding: 3px;
    border-radius: 3px;
    background: var(--white);
}

/* Sections: separated by a hairline, not boxed, because the canvas already is the card */

.chart-card {
    position: relative;
    margin: 0 0 48px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

.chart-title {
    margin: 0 0 24px;
    color: var(--fg-strong);
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.chart-title .muted {
    font-weight: 400;
}

.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr));
    gap: 0 48px;
}

.chart-empty {
    margin: 0;
    color: var(--fg-muted);
}

.table-view {
    margin-top: 16px;
}

.table-view summary {
    width: fit-content;
    color: var(--fg-muted);
    font-size: 0.75rem;
    cursor: pointer;
}

.table-view summary:hover {
    color: var(--fg-strong);
}

.table-view .table {
    margin-top: 8px;
}

/* Bars: dark marks from one baseline, the largest or picked one in yellow */

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

.hbar {
    display: grid;
    grid-template-columns: minmax(7rem, 12rem) 1fr auto;
    align-items: center;
    gap: 16px;
    padding: 6px 8px;
    border-radius: 8px;
    outline: none;
}

.hbar:hover,
.hbar.is-active {
    background: var(--hover);
}

.hbar:focus-visible {
    box-shadow: inset 0 0 0 2px var(--fg-strong);
}

.hbar[aria-current] {
    background: var(--field);
}

.hbar-label {
    overflow: hidden;
    color: var(--fg-strong);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hbar-plot {
    display: flex;
    align-items: center;
    height: 20px;
}

.hbar-fill,
.cols-bar {
    position: relative;
    display: block;
    background: var(--bar);
}

.hbar-fill {
    height: 20px;
    border-radius: 0 3px 3px 0;
}

.hbar.is-hero .hbar-fill,
.cols-slot.is-hero .cols-bar {
    background: var(--yellow);
    box-shadow: inset 0 0 0 1px var(--bar-hero-edge);
}

/* The summed rest has no bar: it is not one more person on the same scale. */
.hbar-rest {
    border-top: 1px solid var(--line);
    border-radius: 0;
}

.hbar-rest .hbar-label,
.hbar-rest .hbar-value {
    color: var(--fg-muted);
    font-weight: 400;
}

.hbar-value {
    min-width: 7.5rem;
    color: var(--fg-strong);
    font-weight: 500;
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.hbar-value .muted {
    margin-left: 4px;
    font-weight: 400;
}

/* Columns: one bar per month, solid horizontal gridlines */

.cols {
    --axis-gutter: 4.5rem;
}

.cols-plot {
    position: relative;
    height: 260px;
    margin: 8px 0 0 var(--axis-gutter);
    border-bottom: 1px solid var(--axis);
}

.cols-gridline {
    position: absolute;
    left: 0;
    right: 0;
    border-top: 1px solid var(--line);
}

.cols-gridline:first-child {
    border-top: 0;
}

.cols-tick {
    position: absolute;
    right: calc(100% + 12px);
    transform: translateY(-50%);
    color: var(--fg-muted);
    font-size: 0.75rem;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.cols-bars {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
}

.cols-slot {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    border-radius: 8px 8px 0 0;
    outline: none;
}

.cols-slot:hover,
.cols-slot.is-active {
    background: var(--hover);
}

.cols-slot:focus-visible {
    box-shadow: inset 0 0 0 2px var(--fg-strong);
}

.cols-bar {
    width: 62%;
    border-radius: 3px 3px 0 0;
}

.cols.has-selection .cols-slot:not(.is-selected) .cols-bar {
    opacity: 0.3;
}

.cols-label {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    color: var(--fg-strong);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.cols-xlabels {
    display: grid;
    /* Same columns as .cols-bars, so labels stay under their bars even when the text is wider. */
    grid-template-columns: repeat(12, minmax(0, 1fr));
    margin: 8px 0 0 var(--axis-gutter);
    color: var(--fg-muted);
    font-size: 0.75rem;
}

.cols-xlabels span {
    display: flex;
    justify-content: center;
    white-space: nowrap;
}

/* Tooltip: a small piece of the board, value first, label second */

.chart-tooltip {
    position: absolute;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 12px;
    transform: translate(-50%, calc(-100% - 10px));
    border-radius: 10px;
    background: var(--board);
    box-shadow: inset 0 0 0 1px var(--board-edge), 0 8px 24px -8px rgba(0, 0, 0, 0.4);
    color: var(--board-fg);
    font-size: 0.75rem;
    white-space: nowrap;
    pointer-events: none;
}

.chart-tooltip[hidden] {
    display: none;
}

.chart-tooltip strong {
    font-size: 0.875rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.chart-tooltip span {
    color: var(--board-muted);
}

/* Sub-navigation of a view */

.subnav {
    display: flex;
    gap: 28px;
    margin: -12px 0 32px;
    border-bottom: 1px solid var(--line);
}

.subnav a {
    padding: 10px 0;
    margin-bottom: -1px;
    border-bottom: 2px solid transparent;
    color: var(--fg-muted);
    text-decoration: none;
}

.subnav a:hover {
    color: var(--fg-strong);
}

.subnav a[aria-current="page"] {
    border-bottom-color: var(--fg-strong);
    color: var(--fg-strong);
    font-weight: 500;
}

/* The tab bar's line already separates the first section; a second line right below it is noise. */
.subnav + .chart-card {
    padding-top: 0;
    border-top: 0;
}

/* More tabs than fit on a phone: they scroll sideways, each on one line. The baseline is a shadow
   inside the bar, so scrolling doesn't clip the current tab's underline. */
@media (max-width: 640px) {
    .subnav {
        gap: 20px;
        overflow-x: auto;
        border-bottom: 0;
        box-shadow: inset 0 -1px 0 var(--line);
        scrollbar-width: none;
    }

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

    .subnav a {
        flex-shrink: 0;
        margin-bottom: 0;
        white-space: nowrap;
    }
}

/* Tables with a thin bar next to the value */

.bar-cell {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    min-width: 14rem;
}

.inline-bar {
    flex: 1;
    display: flex;
    align-items: center;
    height: 4px;
    border-radius: 2px;
    background: var(--track);
}

.inline-bar span {
    display: block;
    height: 4px;
    border-radius: 2px;
    background: var(--bar);
}

.bar-cell-value {
    min-width: 6.5rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* Revenue by person: solid bars as in the overview, the largest share in yellow. */
.responsibility-revenue .inline-bar,
.responsibility-revenue .inline-bar span {
    height: 10px;
    border-radius: 0 3px 3px 0;
}

.responsibility-revenue tr.is-hero .inline-bar span {
    background: var(--yellow);
    box-shadow: inset 0 0 0 1px var(--bar-hero-edge);
}

.table tfoot th,
.table tfoot td {
    border-top: 1px solid var(--fg-strong);
    border-bottom: 0;
    color: var(--fg-strong);
    font-weight: 600;
}

/* The selected person: name marked in yellow, like with a highlighter. */
.table tr.is-selected td:first-child {
    background: var(--yellow);
}

.table tr.is-selected td:first-child,
.table tr.is-selected td:first-child a {
    color: var(--ink);
}

.note {
    max-width: 80ch;
    margin: 16px 0 0;
    font-size: 0.75rem;
}

/* ABC analysis: A is the highlight class */

.abc-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 32px;
}

.abc-group {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--fg-strong);
}

.abc-badge {
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: var(--field);
    color: var(--fg-muted);
    font-size: 0.75rem;
    font-weight: 600;
}

.abc-a {
    background: var(--yellow);
    color: var(--ink);
}

.abc-b {
    background: var(--violet-soft);
    color: var(--violet);
}

.abc-note {
    margin: 12px 0 24px;
    font-size: 0.75rem;
}

/* A page header with actions on the right */

.page-header-row {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px 24px;
}

.page-header-text {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* The intro wraps before the actions do, so they stay beside the title. */
.page-header-row .page-header-text {
    flex: 1 1 20rem;
}

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

.count-badge {
    min-width: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--violet-soft);
    color: var(--violet);
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
}

.section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 24px;
    margin-bottom: 16px;
}

.section-head .chart-title,
.section-head .filters {
    margin: 0;
}

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

.filters input[type="date"],
.filters input[type="search"] {
    height: 100%;
    padding: 0 12px 0 6px;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--fg-strong);
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
}

.filters label.field-search {
    padding-left: 6px;
}

.filters input[type="search"] {
    width: 15rem;
}

/* On the board: over 100 % lights up red; the change against DATEV is the plan's violet. */
.kpi-value.is-alarm {
    color: var(--board-red);
    text-shadow: 0 0 28px color-mix(in srgb, var(--board-red) 55%, transparent);
}

.kpi-value.is-alarm .kpi-unit {
    color: inherit;
    text-shadow: none;
}

.kpi-hero .delta-plan {
    background: var(--violet-fill);
    box-shadow: none;
    color: var(--white);
}

/*
 * The team across the board: one solid bar per week under a dashed 100 % line, grey while there
 * is room, yellow from 85 %, red above 100 %. Each bar opens the orders of its week.
 */

.cap-board > .cap-strip {
    grid-column: 1 / -1;
    padding: 20px 32px 22px;
    border-top: 1px dashed var(--board-line);
    border-left: 0;
}

.cap-strip-plot {
    position: relative;
    display: grid;
    grid-template-columns: repeat(var(--periods), minmax(0, 1fr));
    height: 76px;
    margin-top: 12px;
    border-bottom: 1px solid var(--board-line);
}

.cap-strip-full {
    position: absolute;
    left: 0;
    right: 0;
    height: 0;
    border-top: 1px dashed color-mix(in srgb, var(--board-fg) 32%, transparent);
    pointer-events: none;
}

.cap-strip-full span {
    position: absolute;
    right: 0;
    bottom: 4px;
    color: var(--board-muted);
    font-size: 0.6875rem;
    line-height: 1;
}

.cap-strip-slot {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    border-radius: 4px 4px 0 0;
    outline: none;
}

.cap-strip-slot:hover,
.cap-strip-slot.is-active {
    background: var(--board-hover);
}

.cap-strip-slot:focus-visible {
    box-shadow: inset 0 0 0 2px var(--board-fg);
}

.cap-strip-bar {
    display: block;
    width: 62%;
    max-width: 40px;
    min-height: 2px;
    border-radius: 2px 2px 0 0;
    background: color-mix(in srgb, var(--board-fg) 40%, transparent);
    animation: board-on 0.5s ease-out both;
}

.cap-strip-slot.is-high .cap-strip-bar {
    background: var(--yellow);
    box-shadow: 0 0 16px -4px var(--yellow);
}

.cap-strip-slot.is-over .cap-strip-bar {
    background: var(--board-red);
    box-shadow: 0 0 16px -4px var(--board-red);
}

.cap-strip-slot.is-picked .cap-strip-bar {
    outline: 1px solid var(--board-fg);
    outline-offset: 2px;
}

.cap-strip-labels {
    display: grid;
    grid-template-columns: repeat(var(--periods), minmax(0, 1fr));
    margin-top: 8px;
    color: var(--board-muted);
    font-size: 0.6875rem;
    font-variant-numeric: tabular-nums;
}

.cap-strip-labels span {
    display: flex;
    justify-content: center;
    white-space: nowrap;
}

/* This week is lit, as in the matrix head. */
.cap-strip-labels .is-current {
    color: var(--board-fg);
}

.cap-strip-labels .is-current:not(:empty)::after {
    content: "";
    width: 5px;
    height: 5px;
    margin: 0.35em 0 0 4px;
    border-radius: 50%;
    background: var(--yellow);
    box-shadow: 0 0 6px var(--yellow);
}

/*
 * Capacity matrix: one tile per person and week, the darker the fuller. Yellow (attention) from
 * 85 %, solid red above 100 %; the figure says the rest, so there is no extra mark.
 */

.cap-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 24px;
    margin: -8px 0 12px;
    color: var(--fg-muted);
    font-size: 0.75rem;
}

.cap-legend p {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin: 0;
}

.cap-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.cap-legend i {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.cap-legend i.is-normal {
    background: color-mix(in srgb, var(--fg-strong) 12%, var(--canvas));
}

.cap-legend i.is-high {
    background: var(--yellow);
    box-shadow: inset 0 0 0 1px var(--bar-hero-edge);
}

.cap-legend i.is-over {
    background: var(--red-fill);
}

.cap-scroll {
    max-height: min(72vh, 760px);
    margin: 0 -12px;
    overflow: auto;
    overscroll-behavior: contain;
}

.cap-matrix {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.cap-matrix th,
.cap-matrix td {
    padding: 2px;
}

.cap-matrix thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 4px 2px 8px;
    border-bottom: 1px solid var(--line);
    background: var(--canvas);
    color: var(--fg-muted);
    font-size: 0.75rem;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
}

.cap-matrix thead th span {
    display: block;
    color: var(--fg-strong);
    font-weight: 600;
}

.cap-matrix thead th small {
    display: block;
    color: var(--fg-subtle);
    font-size: 0.6875rem;
    font-variant-numeric: tabular-nums;
}

/* This week is lit. */
.cap-matrix thead th.is-current span::after {
    content: "";
    display: inline-block;
    width: 5px;
    height: 5px;
    margin-left: 4px;
    border-radius: 50%;
    background: var(--yellow);
    box-shadow: 0 0 6px var(--yellow);
    vertical-align: 0.15em;
}

.cap-matrix tbody tr:first-child > * {
    padding-top: 8px;
}

.cap-matrix .cap-name {
    position: sticky;
    left: 0;
    z-index: 1;
    min-width: 200px;
    max-width: 240px;
    padding: 3px 16px 3px 12px;
    border-right: 1px solid var(--line);
    background: var(--canvas);
    text-align: left;
    vertical-align: middle;
}

.cap-matrix thead .cap-name {
    z-index: 3;
    vertical-align: bottom;
}

.cap-person {
    display: block;
    overflow: hidden;
    color: var(--fg-strong);
    font-weight: 500;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

a.cap-person:hover {
    text-decoration: underline;
}

.cap-name small,
.cap-total small {
    display: block;
    overflow: hidden;
    color: var(--fg-muted);
    font-size: 0.6875rem;
    font-weight: 400;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cap-matrix tr.is-picked .cap-name {
    box-shadow: inset 3px 0 0 var(--yellow);
}

.cap-matrix tr.is-unassigned .cap-person {
    color: var(--fg-muted);
}

.cap-matrix .cap-total {
    position: sticky;
    right: 0;
    z-index: 1;
    padding: 3px 12px 3px 16px;
    border-left: 1px solid var(--line);
    background: var(--canvas);
    color: var(--fg-strong);
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}

.cap-matrix thead .cap-total {
    z-index: 3;
    vertical-align: bottom;
}

.cap-total > span {
    font-weight: 600;
}

/* Share and free hours side by side, so a row stays one tile high. */
.cap-matrix .cap-total small {
    display: inline;
    margin-left: 8px;
}

.cap-matrix tfoot > tr > * {
    position: sticky;
    bottom: 0;
    padding-top: 8px;
    padding-bottom: 8px;
    border-top: 1px solid var(--line-strong);
    background: var(--canvas);
}

.cap-matrix tfoot .cap-name,
.cap-matrix tfoot .cap-total {
    z-index: 2;
}

.cap-cell {
    position: relative;
    isolation: isolate;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 28px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 5px;
    color: var(--fg);
    font-size: 0.75rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    text-decoration: none;
    white-space: nowrap;
}

/* The shade behind the figure: the fuller the week, the darker. */
.cap-cell::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--fg-strong);
    opacity: calc(0.035 + var(--fill, 0) * 0.15);
}

.cap-cell.is-high {
    background: var(--yellow);
    box-shadow: inset 0 0 0 1px var(--bar-hero-edge);
    color: var(--ink);
}

.cap-cell.is-over {
    background: var(--red-fill);
    color: var(--white);
    font-weight: 600;
}

.cap-cell.is-hours {
    box-shadow: inset 0 0 0 1px var(--line-strong);
    color: var(--fg-muted);
}

.cap-cell.is-empty {
    color: var(--fg-subtle);
}

.cap-cell:is(.is-high, .is-over, .is-hours, .is-empty)::before {
    content: none;
}

a.cap-cell:hover,
a.cap-cell.is-active {
    outline: 2px solid var(--line-strong);
    outline-offset: 1px;
}

a.cap-cell.is-picked {
    outline: 2px solid var(--fg-strong);
    outline-offset: 1px;
}

/* Order table of the plan: fields in the cells, planned deviations in violet */

.cap-chips {
    margin: -4px 0 16px;
}

.bulk-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin: 0 0 16px;
    padding: 10px 14px;
    border-radius: 14px;
    background: var(--violet-soft);
    color: var(--violet);
}

.bulk-bar[hidden] {
    display: none;
}

.bulk-bar strong {
    margin-right: 8px;
    font-weight: 600;
}

.bulk-bar .field {
    gap: 8px;
}

.bulk-bar .field-label {
    color: var(--violet);
}

.bulk-bar .button {
    height: 30px;
    padding: 0 12px;
}

.cell-strong {
    color: var(--fg-strong);
    font-weight: 500;
}

span.cell-strong {
    display: block;
}

.cell-input {
    height: 30px;
    padding: 0 8px;
    border: 0;
    border-radius: 8px;
    background-color: var(--field);
    color: var(--fg-strong);
    font: inherit;
    font-size: 0.8125rem;
}

select.cell-input {
    appearance: none;
    max-width: 12rem;
    padding-right: 28px;
    background-image: var(--chevron);
    background-position: right 10px center;
    background-repeat: no-repeat;
    text-overflow: ellipsis;
}

input[type="date"].cell-input {
    width: 8.75rem;
}

/* Hours are typed, not clicked up and down: no spinner. */
.cell-hours {
    width: 5.5rem;
    appearance: textfield;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.cell-input:hover {
    box-shadow: inset 0 0 0 1px var(--line-strong);
}

.cell-input:focus-visible {
    outline: 2px solid var(--fg-strong);
    outline-offset: 1px;
}

.cell-input.is-planned {
    background-color: var(--violet-soft);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--violet) 35%, transparent);
    color: var(--violet);
    font-weight: 500;
}

.chart-count {
    margin-left: 8px;
    color: var(--fg-muted);
    font-weight: 400;
}

.cap-orders td {
    padding-top: 5px;
    padding-bottom: 5px;
}

/* The status as a small light before the order; violet glow is kept for the plan's changes here. */
.cap-orders .cell-what .status {
    margin-right: 7px;
    vertical-align: 0.05em;
}

.cap-orders .cell-what .status::before {
    width: 6px;
    height: 6px;
    box-shadow: none;
}

.cap-orders .cell-what .status-open::before {
    width: 7px;
    height: 7px;
}

.cap-spent .cell-secondary {
    font-size: 0.75rem;
}

.cap-reset {
    width: 28px;
    height: 28px;
    color: var(--violet);
}

.cap-reset:hover {
    background: var(--violet-soft);
    color: var(--violet);
}

/*
 * The fields read like the values they hold until the row is pointed at or a field has focus;
 * a value the plan changed keeps its violet.
 */
.cap-orders .cell-input:not(.is-planned) {
    background-color: transparent;
}

.cap-orders select.cell-input:not(.is-planned) {
    background-image: none;
}

.cap-orders tr:hover .cell-input:not(.is-planned),
.cap-orders .cell-input:not(.is-planned):focus-visible {
    background-color: var(--field);
}

.cap-orders tr:hover select.cell-input:not(.is-planned),
.cap-orders select.cell-input:not(.is-planned):focus-visible {
    background-image: var(--chevron);
}

/* An empty start means "from today"; the browser fills in today's date, which must not read as set. */
.cap-orders input[type="date"][value=""]:not(:focus) {
    color: var(--fg-subtle);
}

.cell-hours::-webkit-inner-spin-button,
.cell-hours::-webkit-outer-spin-button {
    margin: 0;
    appearance: none;
}

/* Where the deadline comes from, under it: "Regel", "Standard", "eigene". */
.cap-due {
    white-space: nowrap;
}

.due-source {
    display: block;
    color: var(--fg-muted);
    font-size: 0.75rem;
    cursor: help;
}

.cap-due .cell-input + .due-source {
    margin-left: 8px;
}

.cap-orders tr.is-changed td:first-child {
    box-shadow: inset 3px 0 0 var(--violet);
}

.cap-select {
    width: 36px;
}

.cap-select input,
.cap-orders thead input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--fg-strong);
}

.table thead th a {
    color: inherit;
    text-decoration: none;
}

.table thead th a:hover {
    color: var(--fg-strong);
}

.table thead th a[aria-sort]::after {
    content: " ↓";
}

.table thead th a[aria-sort="ascending"]::after {
    content: " ↑";
}

.link-button {
    padding: 4px 6px;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--violet);
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
}

.link-button:hover {
    background: var(--violet-soft);
}

.table-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    margin: 16px 0 0;
    color: var(--fg-muted);
    font-size: 0.8125rem;
}

.cap-checks {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    margin-bottom: 8px;
}

.cap-checks > .field-label {
    min-width: 4rem;
}

.change-line {
    display: block;
}

.change-old {
    color: var(--fg-subtle);
}

.change-new {
    color: var(--violet);
    font-weight: 500;
}

/*
 * Fragen an KMpro OS. The canvas splits in two: earlier conversations on a column tinted like the
 * frame, the conversation on the right at reading width. Questions are quiet, answers carry the
 * logo. The field is a small black display board; its key lights up yellow once there is a
 * question to send, and a yellow full stop marks where the answer is writing.
 */

/* The canvas holds the chat edge to edge: the conversation scrolls by itself, the field stays put. */
.main:has(.page-chat) {
    overflow: hidden;
}

.page-chat {
    display: flex;
    flex-direction: column;
    max-width: none;
    height: 100%;
    padding: 0;
}

.page-chat > .flash {
    margin: 16px 16px 0;
}

.chat {
    display: grid;
    flex: 1;
    grid-template-columns: 248px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    min-height: 0;
}

.chat-side {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 20px 12px;
    overflow-y: auto;
    border-right: 1px solid var(--line);
    background: color-mix(in srgb, var(--frame) 40%, var(--canvas));
}

.chat-new {
    display: flex;
    flex: none;
    align-items: center;
    gap: 10px;
    height: 34px;
    padding: 0 10px;
    border-radius: 10px;
    background: var(--canvas);
    box-shadow: var(--raised-shadow);
    color: var(--fg-strong);
    font-weight: 500;
    text-decoration: none;
    transition: box-shadow 0.15s;
}

.chat-new:hover {
    box-shadow: 0 0 0 1px var(--line-strong), 0 1px 2px rgba(28, 28, 28, 0.08);
}

.chat-history-label {
    margin: 20px 0 4px;
    padding: 0 10px;
    color: var(--fg-subtle);
    font-size: 0.75rem;
    font-weight: 500;
}

/* One column as wide as the side, or long titles widen it instead of ending in "…". */
.chat-history ul {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Like the main navigation: the open conversation is the raised one. */
.chat-history a {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 12px;
    padding: 7px 10px;
    border-radius: 8px;
    color: var(--nav-fg);
    font-size: 0.8125rem;
    text-decoration: none;
}

.chat-history-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-history time {
    color: var(--fg-subtle);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
}

.chat-history a:hover {
    background: var(--nav-hover);
    color: var(--fg-strong);
}

.chat-history a[aria-current] {
    background: var(--canvas);
    box-shadow: var(--raised-shadow);
    color: var(--fg-strong);
    font-weight: 500;
}

.chat-history-empty {
    margin: 16px 10px;
    color: var(--fg-subtle);
    font-size: 0.8125rem;
}

.chat-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

.chat-head {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    height: 56px;
    padding: 0 16px 0 32px;
    border-bottom: 1px solid var(--line);
}

/* A new conversation has no title yet, and no line under the empty bar. */
.chat-head:has(.chat-title.visually-hidden) {
    border-bottom-color: transparent;
}

.chat-title {
    overflow: hidden;
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.icon-button {
    display: inline-grid;
    flex: none;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--fg-muted);
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}

.icon-button:hover {
    background: var(--field);
    color: var(--fg-strong);
}

.chat-scroll {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    padding: 32px 32px 24px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* Reading width: about 75 characters beside the K tile. */
.chat-messages,
.chat-composer > * {
    width: 100%;
    max-width: 42rem;
    margin-inline: auto;
}

.chat-messages {
    display: flex;
    flex: 1 0 auto;
    flex-direction: column;
    gap: 28px;
}

.chat-welcome {
    margin-block: auto;
    padding: 16px 0;
}

.chat-welcome-lead {
    margin: 0 0 8px;
    color: var(--fg-strong);
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -0.035em;
    line-height: 1.15;
}

.chat-welcome-text {
    max-width: 52ch;
    margin: 0 0 24px;
    color: var(--fg-muted);
    font-size: 0.9375rem;
}

/* The examples, each with the icon of the area it reads. */
.chat-examples {
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--line);
    list-style: none;
}

.chat-examples li {
    border-bottom: 1px solid var(--line);
}

.chat-example {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 13px 4px;
    border: 0;
    background: none;
    color: var(--fg-strong);
    font: inherit;
    font-size: 0.9375rem;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.15s;
}

.chat-example .icon {
    color: var(--fg-subtle);
    transition: color 0.15s;
}

.chat-example:hover {
    background: var(--hover);
}

.chat-example:hover .icon {
    color: var(--fg-strong);
}

.chat-welcome-note {
    max-width: 62ch;
    margin: 20px 0 0;
    color: var(--fg-subtle);
    font-size: 0.75rem;
    line-height: 1.55;
}

.chat-question {
    align-self: flex-end;
    max-width: min(80%, 34rem);
    margin: 0;
    padding: 10px 14px;
    border-radius: 14px 14px 4px 14px;
    background: var(--field);
    color: var(--fg-strong);
    font-size: 0.9375rem;
    line-height: 1.5;
    white-space: pre-line;
    overflow-wrap: anywhere;
    animation: chat-in 0.18s ease-out;
}

.chat-answer {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    scroll-margin-top: 24px;
}

.chat-body {
    color: var(--fg);
    font-size: 0.9375rem;
    line-height: 1.65;
    overflow-wrap: anywhere;
}

.chat-body strong {
    color: var(--fg-strong);
    font-weight: 600;
}

.chat-body > :first-child {
    margin-top: 0;
}

.chat-body > :last-child {
    margin-bottom: 0;
}

.chat-body p,
.chat-body ul,
.chat-body ol {
    margin: 0 0 12px;
}

.chat-body ul,
.chat-body ol {
    padding-left: 22px;
}

.chat-body li + li {
    margin-top: 4px;
}

.chat-body li::marker {
    color: var(--fg-subtle);
}

.chat-body h1,
.chat-body h2,
.chat-body h3,
.chat-body h4 {
    margin: 20px 0 8px;
    color: var(--fg-strong);
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: 0;
}

.chat-body code {
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--field);
    font-size: 0.875em;
}

/* Tables like the others in KMpro OS: light head, hairlines, figures right-aligned in even columns. */
.chat-table {
    margin: 4px 0 14px;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 10px;
}

.chat-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
    line-height: 1.45;
}

.chat-table th,
.chat-table td {
    padding: 8px 12px;
    text-align: left;
    vertical-align: top;
    overflow-wrap: normal;
}

.chat-table thead th {
    border-bottom: 1px solid var(--line-strong);
    color: var(--fg-muted);
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.chat-table tbody td {
    color: var(--fg-strong);
}

.chat-table tbody tr + tr td {
    border-top: 1px solid var(--line);
}

.chat-table .is-number {
    text-align: right;
    white-space: nowrap;
}

.chat-table .is-center {
    text-align: center;
}

/* A link alone in its paragraph leads to the view behind the answer. */
.chat-jump a {
    display: inline-flex;
    align-items: center;
    height: 30px;
    padding: 0 12px;
    border-radius: 8px;
    background: var(--canvas);
    box-shadow: var(--raised-shadow);
    color: var(--fg-strong);
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    transition: box-shadow 0.15s;
}

.chat-jump a:hover {
    box-shadow: 0 0 0 1px var(--line-strong), 0 1px 2px rgba(28, 28, 28, 0.1);
}

/* The answer grows: a yellow full stop at its end, in a list after the last item. */
.chat-answer.is-writing .chat-body > :last-child:not(ul, ol, .chat-table)::after,
.chat-answer.is-writing .chat-body > :is(ul, ol):last-child > li:last-child::after {
    content: "";
    display: inline-block;
    width: 0.5em;
    height: 0.5em;
    margin-left: 4px;
    background: var(--yellow);
    box-shadow: inset 0 0 0 1px var(--bar-hero-edge);
    animation: chat-blink 1s steps(2) infinite;
}

@keyframes chat-blink {
    50% {
        opacity: 0;
    }
}

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

/* Before the first words: what it is doing, behind a lit dot. */
.chat-status {
    display: none;
    align-items: center;
    gap: 10px;
    min-height: 30px;
    margin: 0;
    color: var(--fg-muted);
    font-size: 0.875rem;
}

.chat-status::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--yellow);
    box-shadow: 0 0 8px var(--yellow);
    animation: ask-pulse 0.9s ease-in-out infinite alternate;
}

@keyframes ask-pulse {
    from {
        opacity: 0.25;
    }
}

.chat-answer.is-pending .chat-status,
.chat-answer.is-stopped .chat-status,
.chat-answer.is-failed .chat-status {
    display: flex;
}

.chat-answer.is-stopped .chat-status::before,
.chat-answer.is-failed .chat-status::before {
    animation: none;
    background: var(--fg-subtle);
    box-shadow: none;
}

.chat-answer.is-failed .chat-status {
    color: var(--red);
}

.chat-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 6px 0 0 -2px;
    color: var(--fg-subtle);
    font-size: 0.75rem;
}

.chat-meta > span {
    padding-left: 2px;
}

.chat-copy {
    width: 28px;
    height: 28px;
}

.chat-copy .icon {
    width: 14px;
    height: 14px;
}

.chat-copy .icon + .icon,
.chat-copy.is-done .icon:first-child {
    display: none;
}

.chat-copy.is-done .icon + .icon {
    display: block;
    color: var(--green);
}

.client-ref {
    color: var(--fg-strong);
    font-weight: 500;
    white-space: nowrap;
}

.client-ref .client-number {
    margin-right: 4px;
}

.chat-composer {
    flex: none;
    padding: 12px 32px 16px;
}

/* The board: black in both schemes, as the boards on the other pages. */
.ask-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 8px;
    padding: 8px;
    border-radius: 16px;
    background: var(--board);
    box-shadow: inset 0 0 0 1px var(--board-edge), 0 14px 28px -20px rgba(0, 0, 0, 0.6);
    transition: box-shadow 0.15s;
}

.ask-form:focus-within {
    box-shadow: inset 0 0 0 1px var(--yellow), 0 14px 28px -20px rgba(0, 0, 0, 0.6);
}

.ask-form textarea {
    min-height: 40px;
    max-height: 12rem;
    padding: 10px 8px 10px 10px;
    border: 0;
    outline: none;
    resize: vertical;
    background: transparent;
    color: var(--board-fg);
    caret-color: var(--yellow);
    font: inherit;
    font-size: 0.9375rem;
    line-height: 1.35;
    field-sizing: content;
}

.ask-form textarea::placeholder {
    color: var(--board-muted);
}

/* Where the field grows with its text, a handle to drag it bigger is only in the way. */
@supports (field-sizing: content) {
    .ask-form textarea {
        resize: none;
    }
}

/* The key: unlit while the field is empty, yellow once there is something to send. */
.ask-key {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: var(--board-raster);
    color: var(--board-muted);
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.ask-key .icon {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

.ask-key:hover {
    color: var(--board-fg);
}

.ask-key:focus-visible {
    outline: 2px solid var(--yellow);
}

.ask-form:has(textarea:not(:placeholder-shown)) .ask-key:not(.is-stop) {
    background: var(--yellow);
    box-shadow: 0 0 16px -4px var(--yellow);
    color: var(--ink);
}

.ask-key[hidden] {
    display: none;
}

.chat-note {
    margin-top: 8px;
    color: var(--fg-subtle);
    font-size: 0.75rem;
    text-align: center;
}

/* Handbuch: a list of documents, each one read like a page of text. */
.filters label.handbook-search {
    gap: 2px;
    height: 44px;
    padding-left: 14px;
    color: var(--fg-muted);
}

.filters .handbook-search input[type="search"] {
    width: min(32rem, 70vw);
    font-size: 0.9375rem;
    font-weight: 400;
}

.handbook-list {
    max-width: 52rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

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

.handbook-list a {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0 -12px;
    padding: 14px 12px;
    border-radius: 10px;
    color: var(--fg-strong);
    font-size: 0.9375rem;
    text-decoration: none;
}

.handbook-list a:hover {
    background: var(--hover);
}

.handbook-hit-passage {
    color: var(--fg-muted);
    font-size: 0.8125rem;
}

/* Mandanten-Update: Meldungen */
.news-list {
    max-width: 52rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.news-item {
    padding: 16px 0;
}

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

.news-item p {
    margin: 0 0 6px;
    line-height: 1.55;
}

.news-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    font-size: 0.8125rem;
}

.news-title {
    margin: 0 0 6px;
    font-size: 1rem;
    line-height: 1.4;
}

.news-title a {
    color: var(--fg-strong);
    text-decoration: none;
}

.news-title a:hover {
    text-decoration: underline;
}

.news-citation,
.news-reached {
    font-size: 0.8125rem;
}

/* One Meldung */
.news-heading {
    max-width: 52rem;
    margin: 8px 0 16px;
}

.news-detail {
    max-width: 60rem;
}

.news-summary {
    max-width: 52rem;
    margin: 0 0 8px;
    font-size: 1rem;
    line-height: 1.6;
}

.news-fulltext summary {
    margin: 0;
    cursor: pointer;
}

.news-fulltext p {
    max-width: 52rem;
    margin: 16px 0 0;
    line-height: 1.65;
}

details.news-reached summary {
    cursor: pointer;
}

details.news-reached p {
    margin-top: 6px;
}

/* Mandanten-Update: a client's page */
.profile-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

@media (max-width: 960px) {
    .profile-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

.profile-grid .chart-card {
    margin: 0;
}

.profile-form textarea,
.review-side textarea,
.entry-edit textarea {
    padding: 10px 12px;
    line-height: 1.5;
}

/* A status next to a page title, e.g. a client's update: set like the tags elsewhere, not like the title. */
.page-header h1 .tag {
    margin-left: 6px;
    letter-spacing: normal;
    vertical-align: middle;
}

/* On a phone the list keeps what matters: who, where it stands, what waits. */
@media (max-width: 640px) {
    .client-update-table th:nth-child(2),
    .client-update-table td:nth-child(2),
    .client-update-table th:nth-child(3),
    .client-update-table td:nth-child(3),
    .client-update-table td:nth-child(5) .muted {
        display: none;
    }
}

/* Verwaltung → Mandanten-Update: switch a source off or remove it, in its row */
.source-actions {
    white-space: nowrap;
    text-align: right;
}

.source-actions form {
    display: inline-block;
    margin-left: 6px;
}

/* Mandanten-Update: the review of one update, preview on the right as the client gets it */
.review-grid {
    display: grid;
    grid-template-columns: minmax(16rem, 22rem) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

@media (max-width: 960px) {
    .review-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

.review-side {
    display: grid;
    gap: 16px;
}

.review-side .chart-card {
    margin: 0;
}

.review-side .chart-card > * + * {
    margin-top: 12px;
}

/* A sent update has nothing beside it. */
.review-grid-single {
    grid-template-columns: minmax(0, 52rem);
}

/* The e-mail looks the same in dark mode, so the tools inside it keep the light colours too. */
.review-preview {
    --canvas: #ffffff;
    --surface: #ffffff;
    --field: #f3f3f2;
    --fg-strong: #1c1c1c;
    --fg: #323232;
    --fg-muted: #616161;
    --fg-subtle: #9a9a9a;
    --line: #ececeb;
    --line-strong: #d2d2d0;
    --hover: #f6f6f5;
    --raised-shadow: 0 0 0 1px rgba(28, 28, 28, 0.06), 0 1px 2px rgba(28, 28, 28, 0.08);
    color-scheme: light;
    border-radius: 16px;
    overflow: hidden;
}

/* Below a Meldung: "Text bearbeiten" opens across the width, "Herausnehmen" stays top right. */
.entry-tools {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px dashed var(--line-strong);
    border-radius: 10px;
    font-family: inherit;
}

.entry-edit {
    flex: 1 1 100%;
    min-width: 0;
}

.entry-tools > form {
    position: absolute;
    top: 8px;
    right: 12px;
}

.entry-edit form .button {
    justify-self: start;
}

.entry-edit summary {
    cursor: pointer;
    font-size: 0.8125rem;
    color: var(--fg-muted);
    line-height: 30px;
}

.entry-edit form {
    display: grid;
    gap: 10px;
    margin-top: 8px;
}

.left-out {
    display: grid;
    gap: 14px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.875rem;
}

.left-out li {
    display: grid;
    gap: 4px;
    justify-items: start;
}

.left-out a {
    color: var(--fg-strong);
    font-weight: 500;
}

/* Public page where a client unsubscribes */
.unsubscribe {
    max-width: 28rem;
    margin: 12vh auto 0;
    padding: 40px;
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--canvas-shadow);
}

@media (max-width: 640px) {
    .unsubscribe {
        margin: 8vh 16px 0;
        padding: 28px;
    }
}

.unsubscribe h1 {
    margin: 24px 0 8px;
    font-size: 1.5rem;
}

.unsubscribe p {
    margin: 0 0 20px;
    color: var(--fg-muted);
    line-height: 1.55;
}

.handbook-hit-passage mark {
    border-radius: 2px;
    background: var(--yellow);
    color: var(--ink);
}

/* Markdown, in the document and in the editor's preview */
.handbook-text > * {
    max-width: 68ch;
    margin: 10px 0 0;
}

.handbook-text ul,
.handbook-text ol {
    padding-left: 1.25rem;
}

.handbook-text li + li {
    margin-top: 2px;
}

.handbook-text li > p {
    margin: 0;
}

.handbook-text :is(h1, h2, h3, h4, h5, h6) {
    color: var(--fg-strong);
    letter-spacing: -0.01em;
    scroll-margin-top: 24px;
}

.handbook-text h1,
.handbook-text h2 {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
    font-size: 1.25rem;
}

.handbook-text h3 {
    margin-top: 28px;
    font-size: 1.0625rem;
}

.handbook-text :is(h4, h5, h6) {
    margin-top: 20px;
    font-size: 0.9375rem;
}

.handbook-text > :first-child {
    margin-top: 0;
}

.handbook-text > :is(h1, h2):first-child {
    padding-top: 0;
    border-top: 0;
}

.handbook-text blockquote {
    padding-left: 12px;
    border-left: 2px solid var(--line-strong);
    color: var(--fg-muted);
}

.handbook-text code {
    padding: 1px 4px;
    border-radius: 4px;
    background: var(--field);
    font-size: 0.8125rem;
}

.handbook-text a[target="_blank"]::after {
    content: " ↗";
    color: var(--fg-muted);
}

.handbook-document {
    font-size: 0.9375rem;
    line-height: 1.6;
}

/* Table of contents from the headings, beside the text; the section being read is marked. */
.handbook-page.has-outline {
    display: grid;
    grid-template-columns: 16rem minmax(0, 1fr);
    gap: 48px;
    align-items: start;
}

.handbook-outline {
    position: sticky;
    top: 24px;
    max-height: calc(100dvh - 64px);
    overflow-y: auto;
    overscroll-behavior: contain;
    font-size: 0.8125rem;
}

.handbook-outline h2 {
    margin: 0 0 8px 12px;
    color: var(--fg-muted);
    font-size: 0.75rem;
    font-weight: 500;
}

.handbook-outline ol {
    margin: 0;
    padding: 0;
    list-style: none;
}

.handbook-outline a {
    display: block;
    padding: 4px 10px;
    border-left: 2px solid var(--line);
    color: var(--nav-fg);
    line-height: 1.35;
    text-decoration: none;
}

.handbook-outline .depth-1 a {
    padding-left: 22px;
    color: var(--fg-muted);
    font-size: 0.75rem;
}

.handbook-outline a:hover {
    color: var(--fg-strong);
}

.handbook-outline a[aria-current] {
    border-left-color: var(--fg-strong);
    color: var(--fg-strong);
    font-weight: 600;
}

@media (max-width: 900px) {
    .handbook-page.has-outline {
        grid-template-columns: minmax(0, 1fr);
        gap: 24px;
    }

    .handbook-outline {
        position: static;
        max-height: none;
    }

    .handbook-outline .depth-1 {
        display: none;
    }
}

/* Editor: one Markdown field; the toolbar sits on it like a lid, the preview takes its place. */
.edit-form {
    max-width: 60rem;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 20px;
}

.form-field > label {
    color: var(--fg-strong);
    font-size: 0.8125rem;
    font-weight: 500;
}

.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="url"],
.form-field input[type="password"],
.form-field textarea,
.review-side textarea {
    width: 100%;
    min-height: 38px;
    padding: 0 12px;
    border: 0;
    border-radius: 10px;
    background: var(--canvas);
    box-shadow: var(--raised-shadow);
    color: var(--fg-strong);
    font: inherit;
}

.form-field input::placeholder {
    color: var(--fg-subtle);
}

.form-field-hint {
    margin: 0;
    color: var(--fg-muted);
    font-size: 0.8125rem;
}

.form-field > ul,
.edit-form > ul {
    margin: 0;
    padding: 0;
    color: var(--red);
    font-size: 0.8125rem;
    list-style: none;
}

.form-field.has-error input {
    box-shadow: 0 0 0 1px var(--red), var(--raised-shadow);
}

.md-editor {
    border-radius: 10px;
    background: var(--canvas);
    box-shadow: var(--raised-shadow);
}

.md-editor:focus-within {
    outline: 2px solid var(--fg-strong);
    outline-offset: 2px;
}

.md-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    padding: 6px;
    border-bottom: 1px solid var(--line);
}

.md-tool {
    height: 28px;
    min-width: 30px;
    padding: 0 9px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--fg);
    font: inherit;
    font-size: 0.8125rem;
    cursor: pointer;
}

.md-tool:hover {
    background: var(--hover);
    color: var(--fg-strong);
}

.md-tool[aria-pressed="true"] {
    background: var(--field);
    color: var(--fg-strong);
    font-weight: 600;
}

.md-tool:disabled {
    opacity: 0.35;
    cursor: default;
}

.md-tool:disabled:hover {
    background: transparent;
}

.form-field > .form-label {
    color: var(--fg-strong);
    font-size: 0.8125rem;
    font-weight: 500;
}

/* The writing area looks like the document it becomes. */
.wysiwyg {
    min-height: 24rem;
    max-height: 70vh;
    padding: 16px 20px 24px;
    overflow-y: auto;
    color: var(--fg);
    font-size: 0.9375rem;
    line-height: 1.6;
    outline: none;
}

.wysiwyg[hidden] {
    display: none;
}

.md-mode {
    margin-left: auto;
}

.form-field .md-editor textarea {
    display: block;
    padding: 12px;
    border-radius: 0 0 10px 10px;
    box-shadow: none;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.8125rem;
    line-height: 1.6;
    resize: vertical;
}

.form-field .md-editor textarea:focus-visible {
    outline: none;
}

.form-field .md-editor [hidden] {
    display: none;
}

.handbook-delete {
    margin-top: 48px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

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

.button-danger:hover {
    background: var(--red-soft);
}

/*
 * Checklists: one row per point with a box for its state, the text linking into the Handbuch,
 * and its actions underneath. Done points step back; points that must wait are faded.
 */
.cell-what a.clip {
    color: var(--fg-strong);
    text-decoration: none;
}

.cell-what a.clip:hover {
    text-decoration: underline;
}

.tag-quiet {
    background: var(--field);
    color: var(--fg-muted);
}

.tag-role {
    background: var(--violet-soft);
    color: var(--violet);
}

/* A point that holds up the work after it. */
.tag-rule {
    background: var(--inverse-bg);
    color: var(--inverse-fg);
}

.button-small {
    gap: 6px;
    height: 28px;
    padding: 0 10px;
    border-radius: 8px;
    font-size: 0.8125rem;
}

.checklist-progress {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 24px;
    margin-bottom: 20px;
}

.checklist-months {
    margin-bottom: 24px;
}

.checklist-months .done {
    color: var(--green);
}

.checklist-heading {
    margin: 28px 0 8px;
    color: var(--fg-strong);
    font-size: 0.9375rem;
    font-weight: 600;
}

.checklist-heading.level-3,
.checklist-heading.level-4 {
    margin-top: 18px;
    color: var(--fg-muted);
    font-size: 0.8125rem;
}

.checklist-note {
    margin-bottom: 8px;
    color: var(--fg-muted);
}

.checklist-items {
    margin: 0;
    padding: 0;
    list-style: none;
}

.checklist-item {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 4px;
    padding: 10px 0;
    border-top: 1px solid var(--line);
    scroll-margin-top: 24px;
}

.checklist-item:target {
    background: linear-gradient(90deg, color-mix(in srgb, var(--yellow) 22%, transparent), transparent 60%);
}

.check-box {
    width: 18px;
    height: 18px;
    margin-top: 1px;
    border: 1.5px dashed var(--line-strong);
    border-radius: 5px;
}

.status-done .check-box {
    border: 0;
    background: var(--green-fill) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") no-repeat center / 12px;
}

.status-na .check-box {
    border: 1.5px solid var(--line-strong);
    background: linear-gradient(135deg, transparent 45%, var(--fg-subtle) 45% 55%, transparent 55%);
}

.status-clarify .check-box {
    border: 0;
    background: var(--yellow);
}

.checklist-text {
    margin: 0;
    color: var(--fg-strong);
}

.checklist-text .tag {
    margin-left: 4px;
}

.checklist-text a {
    text-decoration-color: var(--line-strong);
}

.status-done .checklist-text,
.status-na .checklist-text {
    color: var(--fg-muted);
}

.status-na .checklist-text {
    text-decoration: line-through;
    text-decoration-color: var(--fg-subtle);
}

.is-waiting {
    opacity: 0.55;
}

.checklist-hint {
    color: var(--fg-muted);
    font-size: 0.8125rem;
}

.checklist-hint > * {
    margin-top: 4px;
}

.checklist-meta {
    margin: 2px 0 0;
    color: var(--fg-muted);
    font-size: 0.8125rem;
}

.check-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.check-actions form {
    display: contents;
}

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

/* Start page: the person's board, then where the orders stand per Auftragsart. */
.dashboard-board {
    grid-template-columns: 1.5fr 1fr 1fr;
}

.phase-bars .hbar,
.section-bars .hbar {
    color: inherit;
    text-decoration: none;
}

/* A partner's own figures: a quiet line above the Kanzlei's board, a due review lit yellow. */
.mine-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0 0 20px;
}

.mine-strip-title {
    margin-right: 4px;
    color: var(--fg-muted);
    font-size: 0.8125rem;
}

.mine-figure {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--fg);
    font-size: 0.8125rem;
    text-decoration: none;
    transition: background-color 0.15s;
}

.mine-figure strong {
    color: var(--fg-strong);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.mine-figure:hover {
    background: var(--hover);
}

.mine-figure.is-due {
    border-color: transparent;
    background: var(--yellow);
    color: var(--ink);
}

.mine-figure.is-due strong {
    color: var(--ink);
}

.mine-figure[aria-current] {
    border-color: var(--fg-strong);
    box-shadow: inset 0 0 0 1px var(--fg-strong);
}

.overview-board {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    margin-top: 20px;
}

.overview-board .kpi {
    padding: 24px 24px 28px;
}

.overview-board .kpi-value {
    font-size: clamp(2.25rem, 3.4vw, 3.25rem);
}

/* Numbers in tables that open the orders behind them. */
.cell-link {
    display: inline-block;
    min-width: 2ch;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    text-decoration: none;
}

.cell-link:hover {
    text-decoration: underline;
}

.cell-link[aria-current] {
    padding: 0 6px;
    border-radius: 4px;
    background: var(--yellow);
    color: var(--ink);
}

.cell-link.is-alarm,
.is-overdue {
    color: var(--red);
}

.is-overdue .cell-secondary {
    color: var(--red);
}

/* Where the orders stand: a count per phase, and the same as one stacked bar. */
.phase-matrix td {
    vertical-align: middle;
}

.phase-matrix .matrix-dist {
    width: 26%;
    min-width: 10rem;
}

.stack {
    display: flex;
    gap: 2px;
    height: 14px;
    overflow: hidden;
    border-radius: 3px;
}

.stack-part {
    min-width: 3px;
    transition: opacity 0.15s;
}

.stack:hover .stack-part:not(:hover) {
    opacity: 0.45;
}

.stack-part.phase-neu,
.stack-legend .phase-neu {
    background: var(--line-strong);
}

.stack-part.phase-bearbeitung,
.stack-legend .phase-bearbeitung {
    background: var(--violet);
}

.stack-part.phase-klaerung,
.stack-legend .phase-klaerung {
    background: var(--yellow);
}

.stack-part.phase-review,
.stack-legend .phase-review {
    background: var(--inverse-bg);
}

.stack-part.phase-fertig,
.stack-legend .phase-fertig {
    background: var(--green-fill);
}

.stack-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 20px;
    margin: 12px 0 0;
    color: var(--fg-muted);
    font-size: 0.75rem;
}

.stack-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.stack-legend i {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

.section-bars-title {
    margin: 0 0 8px;
    color: var(--fg-strong);
    font-size: 0.875rem;
    font-weight: 600;
}

.section-bars .hbars {
    margin-bottom: 32px;
}

.section-bars .hbar {
    grid-template-columns: minmax(7rem, 17rem) 1fr auto;
}

.section-bars .hbar-value {
    min-width: 3rem;
}

/* Long client names give way, the date and the phase stay whole. */
.due-table {
    table-layout: fixed;
}

.due-table th:first-child {
    width: 7.5rem;
}

.due-table th:last-child {
    width: 9.5rem;
}

.due-table .cell-what {
    max-width: none;
}

.overview-split {
    align-items: start;
}

/* Meine Woche: hours against the Soll beside the capacity plan's next weeks. */
.my-week .chart-title {
    margin-bottom: 16px;
}

.my-week-grid {
    display: grid;
    grid-template-columns: minmax(16rem, 1fr) minmax(0, 1.4fr);
    gap: 24px 48px;
    align-items: start;
}

.my-week-label {
    display: block;
    margin-bottom: 10px;
    color: var(--fg-muted);
    font-size: 0.8125rem;
}

.my-week-hours {
    display: block;
    margin: -8px;
    padding: 8px;
    border-radius: 8px;
    color: inherit;
    text-decoration: none;
}

.my-week-hours:hover {
    background: var(--hover);
}

.my-week-value {
    display: block;
    color: var(--fg-strong);
    font-size: 1.75rem;
    font-weight: 500;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}

.my-week-value .muted {
    font-size: 0.9375rem;
    font-weight: 400;
    letter-spacing: 0;
}

.my-week-hours .budget {
    display: block;
    width: 100%;
    margin: 12px 0;
}

.my-week-notes {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 20px;
    color: var(--fg-muted);
    font-size: 0.8125rem;
}

.my-week-notes strong {
    color: var(--fg-strong);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.my-week-notes strong.is-short {
    color: var(--red);
}

.my-week-cols {
    display: grid;
    grid-template-columns: repeat(var(--periods), minmax(0, 1fr));
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.my-week-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 0;
    border-radius: 8px;
    color: inherit;
    text-decoration: none;
    outline: none;
}

.my-week-col:hover,
.my-week-col.is-active {
    background: var(--hover);
}

.my-week-col:focus-visible {
    box-shadow: inset 0 0 0 2px var(--fg-strong);
}

/* The dashed line marks 100 %, two thirds up a scale that reaches 150 %. */
.my-week-plot {
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    width: 100%;
    height: 64px;
    border-bottom: 1px solid var(--axis);
    background: linear-gradient(to top, transparent calc(66.67% - 0.5px), var(--line-strong) calc(66.67% - 0.5px), var(--line-strong) calc(66.67% + 0.5px), transparent calc(66.67% + 0.5px));
}

.my-week-bar {
    display: block;
    width: 44%;
    max-width: 32px;
    min-height: 2px;
    border-radius: 3px 3px 0 0;
    background: var(--bar);
}

.my-week-col.is-high .my-week-bar {
    background: var(--yellow);
    box-shadow: inset 0 0 0 1px var(--bar-hero-edge);
}

.my-week-col.is-over .my-week-bar {
    background: var(--red-fill);
}

.my-week-col.is-empty .my-week-bar {
    background: var(--line-strong);
}

.my-week-percent {
    color: var(--fg-strong);
    font-size: 0.8125rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.my-week-col.is-over .my-week-percent {
    color: var(--red);
}

.my-week-kw {
    color: var(--fg-muted);
    font-size: 0.75rem;
}

.my-week-kw.is-current {
    color: var(--fg-strong);
    font-weight: 600;
}

@media (max-width: 760px) {
    .my-week-grid {
        grid-template-columns: 1fr;
    }
}

/* Twelve weeks of Plan-Enden: small columns, no axis, the count over each. */
.cols-weeks {
    --axis-gutter: 0px;
}

.cols-weeks .cols-plot {
    height: 140px;
    margin-top: 24px;
}

.cols-weeks .cols-label {
    font-weight: 500;
}

.cols-weeks .cols-xlabels span::before {
    content: "KW\00a0";
    color: var(--fg-muted);
}

.phase-tag.phase-neu {
    background: var(--field);
    color: var(--fg-muted);
}

.phase-tag.phase-bearbeitung {
    background: var(--violet-soft);
    color: var(--violet);
}

.phase-tag.phase-klaerung {
    background: var(--yellow);
    color: var(--ink);
}

.phase-tag.phase-review {
    background: var(--inverse-bg);
    color: var(--inverse-fg);
}

.phase-tag.phase-fertig,
.tag-success {
    background: color-mix(in srgb, var(--green-fill) 16%, transparent);
    color: var(--green);
}

@media (max-width: 1100px) {
    .dashboard-board {
        grid-template-columns: 1fr;
    }

    .dashboard-board > * + * {
        border-top: 1px dashed var(--board-line);
        border-left: 0;
    }

    .overview-board {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .overview-board > :nth-child(3n + 1) {
        border-left: 0;
    }

    .overview-board > :nth-child(n + 4) {
        border-top: 1px dashed var(--board-line);
    }
}

@media (max-width: 640px) {
    .overview-board {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .overview-board > * {
        border-left: 1px dashed var(--board-line);
        border-top: 1px dashed var(--board-line);
    }

    .overview-board > :nth-child(odd) {
        border-left: 0;
    }

    .overview-board > :nth-child(-n + 2) {
        border-top: 0;
    }
}

/* Verwaltung: the Markdown beside its syntax, the release separate from saving. */
.check-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
}

.checklist-editor {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 20rem;
    gap: 32px;
    align-items: start;
}

.form-field textarea.code-input {
    padding: 12px;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.8125rem;
    line-height: 1.6;
    resize: vertical;
}

.checklist-syntax {
    padding: 16px 18px;
    border-radius: var(--radius);
    background: var(--field);
    font-size: 0.8125rem;
}

.checklist-syntax h2 {
    margin-bottom: 8px;
}

.checklist-syntax pre {
    margin: 0 0 12px;
    white-space: pre-wrap;
}

.checklist-syntax dl {
    margin: 0;
}

.checklist-syntax dt {
    margin-top: 8px;
}

.checklist-syntax dd {
    margin: 0;
    color: var(--fg-muted);
}

.discard-form {
    margin-top: 24px;
}

@media (max-width: 900px) {
    .checklist-editor {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 1100px) {
    .kpi-row {
        grid-template-columns: 1fr 1fr;
    }

    .kpi-hero {
        grid-column: 1 / -1;
    }

    .kpi-row > .kpi-hero + * {
        border-top: 1px dashed var(--board-line);
        border-left: 0;
    }

    .kpi-row > .kpi-hero + * + * {
        border-top: 1px dashed var(--board-line);
    }

    .kpi-row > .kpi-hero + * + * + .kpi {
        border-left: 0;
    }
}

@media (max-width: 900px) {
    body.has-shell {
        display: block;
        height: auto;
        overflow: visible;
    }

    .sidebar {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 0 12px;
        height: auto;
        padding: 12px 16px 0;
    }

    .sidebar .brand {
        padding: 0;
    }

    .command-trigger {
        order: 4;
        margin: 4px 0 12px;
    }

    .command-trigger kbd,
    .today {
        display: none;
    }

    .sidebar-nav {
        order: 3;
        flex-direction: row;
        gap: 4px;
        width: calc(100% + 32px);
        margin: 12px -16px 0;
        padding: 2px 16px 10px;
        overflow-x: auto;
    }

    .sidebar-nav a {
        flex: none;
    }

    .sidebar-nav a.sidebar-admin {
        margin-top: 0;
    }

    .account {
        margin: 0 0 0 auto;
        padding: 0;
        border: 0;
    }

    .account-text {
        display: none;
    }

    .main {
        height: auto;
        margin: 0;
        overflow: visible;
        border-radius: 16px 16px 0 0;
    }

    .page {
        padding: 28px 16px 64px;
    }

    h1 {
        font-size: 1.75rem;
    }

    .kpi-row {
        grid-template-columns: 1fr;
    }

    .kpi-row > * + *,
    .summary-grid > * + * {
        border-top: 1px dashed var(--board-line);
        border-left: 0;
    }

    .kpi,
    .summary-card {
        padding: 22px 20px 24px;
    }

    .kpi-hero .kpi-value {
        font-size: clamp(2.5rem, 12vw, 3.5rem);
    }

    .kpi-value,
    .summary-value {
        font-size: 2.5rem;
    }

    .cols {
        --axis-gutter: 3.25rem;
    }

    .cap-matrix .cap-name {
        min-width: 140px;
        max-width: 160px;
    }

    /* The page scrolls as a whole: the chat first, the field at the bottom, earlier conversations below. */
    .main:has(.page-chat) {
        overflow: visible;
    }

    .page-chat {
        height: auto;
    }

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

    .chat-side {
        order: 2;
        padding: 20px 16px 32px;
        overflow: visible;
        border-top: 1px solid var(--line);
        border-right: 0;
    }

    .chat-head {
        padding: 0 8px 0 16px;
    }

    .chat-scroll {
        padding: 16px;
        overflow: visible;
    }

    .chat-welcome-lead {
        font-size: 1.75rem;
    }

    .chat-composer {
        position: sticky;
        bottom: 0;
        padding: 8px 12px 12px;
        background: var(--canvas);
    }

    .chat-question {
        max-width: 88%;
    }

    .cap-scroll {
        margin: 0 -16px;
    }

    /* Every other month label, so they don't run into each other. */
    .cols-xlabels span:nth-child(even) {
        visibility: hidden;
    }

    /* Under the team bars, every fourth week. */
    .cap-strip-labels span:not(:nth-child(4n + 1)) {
        visibility: hidden;
    }

    .cap-board > .cap-strip {
        padding: 20px 20px 22px;
    }

    .hbar {
        grid-template-columns: 1fr auto;
    }

    .hbar-plot {
        grid-column: 1 / -1;
        grid-row: 2;
    }

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

    .login-brand {
        padding: 24px;
    }

    .login-art {
        width: min(60%, 220px);
    }
}

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