/* App styles on top of Pico CSS (static/pico/) */

/* Pico scales the font up to 131% on wide screens; keep it compact for tables */
:root {
    --pico-font-size: 100%;
    --pico-form-element-spacing-vertical: 0.5rem;
    --pico-form-element-spacing-horizontal: 0.75rem;
}

/* Colors: club colors black & white as the base (text, wordmark, white
   surfaces) plus one lively accent color for actions and links.
   Pico defines its colors with these selectors, so the same selectors are
   needed to override them. Green/red only where they carry meaning. */
[data-theme=light],
:root:not([data-theme=dark]) {
    /* navy as accent (buttons, header) */
    --tusli-accent: #1e3a5f;
    --tusli-accent-hover: #132840;
    --tusli-accent-soft: #eef3f9;
    /* links are lighter than the accent, so they stay visible next to
       black text */
    --tusli-link: #2563eb;
    --tusli-link-hover: var(--tusli-accent);
    /* header: navy with white text, light blue highlight */
    --tusli-header-highlight: #93c5fd;
    --tusli-header-stripe: #3b82f6;

    --tusli-black: #111827;
    --tusli-grey-dark: #374151;
    --tusli-grey: #6b7280;
    --tusli-grey-light: #e5e7eb;
    --tusli-page: #f6f7f9;

    --pico-background-color: var(--tusli-page);
    --pico-color: var(--tusli-black);
    --pico-muted-color: var(--tusli-grey);
    --pico-muted-border-color: var(--tusli-grey-light);
    --pico-text-selection-color: var(--tusli-accent-soft);

    --pico-primary: var(--tusli-accent);
    --pico-primary-background: var(--tusli-accent);
    --pico-primary-border: var(--tusli-accent);
    --pico-primary-underline: transparent;
    --pico-primary-hover: var(--tusli-accent-hover);
    --pico-primary-hover-background: var(--tusli-accent-hover);
    --pico-primary-hover-border: var(--tusli-accent-hover);
    --pico-primary-hover-underline: transparent;
    --pico-primary-focus: color-mix(in srgb, var(--tusli-accent) 30%, transparent);
    --pico-primary-inverse: #fff;

    --pico-secondary: var(--tusli-grey-dark);
    --pico-secondary-background: var(--tusli-grey-dark);
    --pico-secondary-border: #d1d5db;
    --pico-secondary-underline: transparent;
    --pico-secondary-hover: var(--tusli-black);
    --pico-secondary-hover-background: var(--tusli-black);
    --pico-secondary-hover-border: var(--tusli-grey);
    --pico-secondary-focus: rgba(55, 65, 81, 0.2);

    --pico-card-background-color: #fff;
    --pico-card-sectioning-background-color: #fff;
    --pico-card-border-color: var(--tusli-grey-light);
    --pico-card-box-shadow: 0 1px 3px rgba(17, 24, 39, 0.06), 0 6px 16px rgba(17, 24, 39, 0.05);
    --pico-border-radius: 0.5rem;

    --pico-table-border-color: var(--tusli-grey-light);
    --pico-form-element-background-color: #fff;
    --pico-form-element-border-color: #d1d5db;
    --pico-form-element-focus-color: var(--tusli-accent);
    --pico-del-color: #dc2626;
    --pico-ins-color: #16a34a;

    --pico-h1-color: var(--tusli-black);
    --pico-h2-color: var(--tusli-black);
    --pico-h3-color: var(--tusli-black);
    --pico-h4-color: var(--tusli-black);
    --pico-h5-color: var(--tusli-black);
    --pico-h6-color: var(--tusli-black);
}

/* tables use --pico-background-color for the cells: white inside cards */
article {
    --pico-background-color: var(--pico-card-background-color);
}

/* header bar: navy, white wordmark, light blue stripe */
.app-header {
    background: var(--tusli-accent);
    border-bottom: 3px solid var(--tusli-header-stripe);
    box-shadow: 0 1px 3px rgba(17, 24, 39, 0.1);
    margin-bottom: 0.75rem;
}

.app-header nav li {
    padding-block: 0.4rem;
}

.app-header a {
    color: #fff;
}

.app-header a:hover {
    color: var(--tusli-header-highlight);
}

.app-header .app-title {
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: -0.01em;
}

.app-header .app-title span {
    color: var(--tusli-header-highlight);
}

/* one width for every page: full screen width with a margin, capped for
   very large screens (instead of Pico's stepped breakpoints) */
.container {
    max-width: 1400px;
    padding-inline: max(var(--pico-spacing), 2vw);
}

main.container {
    padding-top: 0.5rem;
    padding-bottom: 3rem;
}

/* long breadcrumbs wrap instead of widening the page on phones */
nav[aria-label=breadcrumb] ul {
    flex-wrap: wrap;
}

nav[aria-label=breadcrumb] ul li {
    padding-block: 0.25rem;
    font-size: 0.9rem;
}

nav[aria-label=breadcrumb] a {
    color: var(--tusli-grey);
}

nav[aria-label=breadcrumb] a:hover {
    color: var(--tusli-link);
}

/* buttons only as wide as their text (Pico makes submit buttons full width) */
button,
button[type=submit],
[type=submit],
[role=button] {
    width: auto;
    margin-bottom: var(--pico-spacing);
    font-weight: 500;
}

/* links: link color, no underline */
a:not([role=button]) {
    --pico-text-decoration: none;
    --pico-color: var(--tusli-link);
    font-weight: 500;
}

a:not([role=button]):is(:hover, :active, :focus) {
    --pico-color: var(--tusli-link-hover);
}

h3 {
    margin-top: 1rem;
}

/* page header: what the page is (h1), for whom/where below (p) */
.page-title {
    margin: 0.75rem 0 1.25rem;
}

.page-title h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 0.15rem;
}

.page-title p {
    color: var(--pico-muted-color);
    margin: 0;
}

/* cards (article) side by side, wrapping on small screens */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 24rem), 1fr));
    gap: 0 var(--pico-spacing);
    align-items: start;
}

/* card header/footer also when a form wraps the card content */
article > form > header,
article > form > footer {
    margin-right: calc(var(--pico-block-spacing-horizontal) * -1);
    margin-left: calc(var(--pico-block-spacing-horizontal) * -1);
    padding: calc(var(--pico-block-spacing-vertical) * 0.66) var(--pico-block-spacing-horizontal);
    background-color: var(--pico-card-sectioning-background-color);
}

article > form > header {
    margin-top: calc(var(--pico-block-spacing-vertical) * -1);
    margin-bottom: var(--pico-block-spacing-vertical);
    border-bottom: var(--pico-border-width) solid var(--pico-card-border-color);
    border-top-right-radius: var(--pico-border-radius);
    border-top-left-radius: var(--pico-border-radius);
}

article > form > footer {
    margin-top: var(--pico-block-spacing-vertical);
    margin-bottom: calc(var(--pico-block-spacing-vertical) * -1);
    border-top: var(--pico-border-width) solid var(--pico-card-border-color);
}

article footer > :is(button, [type=submit], [role=button]) {
    margin-bottom: 0;
}

article {
    border: var(--pico-border-width) solid var(--pico-card-border-color);
}

/* table head: small, muted, like a label */
th,
thead td {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--pico-muted-color);
}

thead th {
    border-bottom-width: var(--pico-border-width);
}

tbody tr:hover td {
    background-color: var(--tusli-accent-soft);
}

article > header h2,
article > form > header h2 {
    font-size: 1.125rem;
    margin: 0;
}

article > footer.actions,
.actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--pico-spacing);
    flex-wrap: wrap;
}

/* tables inside cards reach the card border */
article > table,
article > .overflow-auto {
    margin-bottom: 0;
}

.overflow-auto {
    white-space: nowrap;
}

/* compact form fields inside tables (e.g. trainings of an Abrechnung) */
td input:not([type=checkbox], [type=radio]),
td select {
    margin-bottom: 0;
    padding: 0.25rem 0.5rem;
    height: auto;
    min-width: 7rem;
}

/* label / value pairs; long words are hyphenated (German), long values
   like e-mail addresses wrap instead of leaving the card */
.data-info-grid {
    display: grid;
    /* label column: at least as wide as its longest word, otherwise 40% */
    grid-template-columns: minmax(min-content, 40%) minmax(0, 1fr);
    gap: 0.5rem 0.75rem;
    hyphens: auto;
}

.data-info-grid .item {
    overflow-wrap: break-word;
}

.item-bold {
    font-weight: bold;
}

/* list of links in a card */
.link-list a {
    display: block;
    padding: 0.5rem 0;
    border-bottom: var(--pico-border-width) solid var(--pico-muted-border-color);
}

.link-list a:last-child {
    border-bottom: none;
}

.error,
.errorlist {
    color: var(--pico-del-color);
}

.errorlist {
    list-style: none;
    padding: 0;
}

.button-centered {
    display: flex;
    justify-content: center;
}

/* Django forms rendered with form.as_p: label, field and help text per <p> */
form p > input:not([type=checkbox], [type=radio]),
form p > select,
form p > textarea {
    margin-bottom: 0;
}

/* simple forms don't need the full page width */
main > article:has(form p),
main > div > article:has(form p) {
    max-width: 40rem;
}

/* destructive actions (delete) */
button.danger {
    --pico-background-color: var(--pico-del-color);
    --pico-border-color: var(--pico-del-color);
}

/* status of an Abrechnung: done (green check) / open (grey) */
.status-done::before {
    content: "✓ ";
    color: var(--pico-ins-color);
    font-weight: bold;
}

.status-open {
    color: var(--pico-muted-color);
}

/* status badge of an Abrechnung (lists) */
.badge {
    display: inline-block;
    padding: 0.1rem 0.55rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    background: #f3f4f6;
    color: var(--tusli-grey-dark);
}

.badge-eingereicht {
    background: #fef3c7;
    color: #92400e;
}

.badge-freigegeben {
    background: #e0f2fe;
    color: #075985;
}

.badge-bestaetigt {
    background: #e0e7ff;
    color: #3730a3;
}

.badge-ueberwiesen {
    background: #dcfce7;
    color: #166534;
}

.badge-date {
    color: var(--pico-muted-color);
    font-size: 0.8rem;
}

/* form.as_p with a checkbox: checkbox in front of its label, help text below */
form p:has(> input[type=checkbox]) {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 0.5rem;
}

form p:has(> input[type=checkbox]) > label {
    order: 2;
    margin-bottom: 0;
}

form p:has(> input[type=checkbox]) > input[type=checkbox] {
    order: 1;
    margin: 0;
}

form p:has(> input[type=checkbox]) > .helptext {
    order: 3;
    flex-basis: 100%;
    padding-left: 1.75rem;
}

.helptext {
    display: block;
    color: var(--pico-muted-color);
    font-size: 0.85rem;
}

/* notes in forms: hint (blue) / warning (red) */
.info {
    border-left: 4px solid var(--tusli-link);
    background: var(--tusli-accent-soft);
    border-radius: var(--pico-border-radius);
    padding: 0.75rem 1rem;
    margin-bottom: var(--pico-spacing);
}

.info p {
    margin-bottom: 0.5rem;
}

.info-warning {
    border-left-color: var(--pico-del-color);
    background: #fef2f2;
}

.info .hint,
.info .neu,
.info .warning {
    font-weight: 700;
    color: var(--tusli-link);
}

.info .neu,
.info .warning {
    color: var(--pico-del-color);
}

.info .button-centered {
    justify-content: flex-start;
}

.info [role=button] {
    margin-bottom: 0;
}



/* year switcher above the matrix */
.year-nav ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0;
    margin: 0 0 var(--pico-spacing) !important;
    list-style: none;
}

.year-nav li {
    list-style: none;
    margin: 0;
}

.year-nav a {
    display: block;
    padding: 0.2rem 0.7rem;
    border-radius: 999px;
    font-size: 0.9rem;
}

.year-nav a[aria-current=page] {
    background: var(--tusli-accent);
    color: #fff;
}

.matrix-summary small {
    display: block;
    color: var(--pico-muted-color);
}

/* matrix: compact numeric cells, name column stays visible while scrolling */
table.matrix {
    font-variant-numeric: tabular-nums;
}

table.matrix th,
table.matrix td {
    padding: 0.4rem 0.6rem;
    text-align: right;
}

table.matrix th:first-child,
table.matrix td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    text-align: left;
    background: var(--pico-card-background-color);
    box-shadow: inset -1px 0 0 var(--pico-muted-border-color);
}

table.matrix tbody tr:hover td:first-child {
    background: var(--tusli-accent-soft);
}

table.matrix td:last-child,
table.matrix tfoot td {
    font-weight: 600;
}

table.matrix tfoot td {
    border-top: 2px solid var(--tusli-black);
    border-bottom: none;
}

.amount-done {
    color: var(--pico-ins-color);
}

.amount-open {
    color: var(--pico-del-color);
}

.amount-none {
    color: var(--pico-muted-color);
}

/* phones: names may wrap so more month columns stay visible */
@media (max-width: 700px) {
    table.matrix th:first-child,
    table.matrix td:first-child {
        white-space: normal;
        min-width: 7rem;
        max-width: 8.5rem;
    }
}

/* collapsed archive below a table, e.g. expired Stundensätze */
details.archive {
    margin: var(--pico-spacing) 0 0;
    border-top: 1px solid var(--pico-muted-border-color);
    padding-top: calc(var(--pico-spacing) / 2);
}

details.archive summary {
    color: var(--pico-muted-color);
    font-size: 0.9rem;
}

details.archive .rate-list {
    color: var(--pico-muted-color);
}

/* compact list of Stundensätze: name and amount, validity below */
.rate-list {
    padding: 0;
    margin: 0;
}

.rate-list li {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr auto;
    column-gap: var(--pico-spacing);
    padding: 0.5rem 0;
    margin: 0;
    border-bottom: 1px solid var(--pico-muted-border-color);
}

.rate-list li:last-child {
    border-bottom: none;
}

.rate-list strong {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.rate-list small {
    grid-column: 1 / -1;
    color: var(--pico-muted-color);
}

/* Abrechnungen grouped by year, older years collapsed */
.year-groups details {
    margin: 0;
    border-bottom: 1px solid var(--pico-muted-border-color);
}

.year-groups details:last-child {
    border-bottom: none;
}

.year-groups summary {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.7rem 0;
}

.year-groups summary::after {
    order: 4;
}

.year-groups .year {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--tusli-black);
}

.year-groups .year-meta {
    color: var(--pico-muted-color);
    font-size: 0.875rem;
    flex: 1;
}

.year-groups .year-open {
    color: #b45309;
}

.year-groups .year-sum {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.year-groups details[open] > summary {
    margin-bottom: 0;
}

.year-groups details[open] > summary:not([role]):not(:focus) {
    color: var(--tusli-black);
}

.year-groups .year-open {
    white-space: nowrap;
}

.year-groups td:nth-child(2),
.year-groups th:nth-child(2) {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.year-groups td:nth-child(2) {
    padding-right: 1.5rem;
}

/* phones: the badge says enough, the date makes the table too wide */
@media (max-width: 700px) {
    .year-groups .badge-date {
        display: none;
    }
}

/* whole table row is clickable (app.js opens the row's link). No link overlay with
   position: relative on the row: Safari ignored that, and every row opened the last row's link */
table.row-link tbody tr:has(a) {
    cursor: pointer;
}

table.row-link tbody tr:has(a):hover td {
    background-color: var(--tusli-accent-soft);
}

/* buttons side by side in a card header */
.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.button-row > * {
    margin-bottom: 0;
}

/* secondary information below the main content of a page */
.details-section {
    margin-top: calc(var(--pico-spacing) * 2.5);
}

.details-section > h2 {
    font-size: 1.1rem;
    color: var(--pico-muted-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--pico-spacing);
}

/* total over all years below the year groups */
.year-total {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.7rem 0 0;
    margin-top: 0.25rem;
    border-top: 2px solid var(--tusli-black);
    /* align the sum with the year sums (which leave room for the chevron) */
    padding-right: 2.25rem;
}

/* ---- user menu in the header ---- */
.app-header nav details.dropdown.user-menu > summary:not([role]) {
    color: #fff;
    font-weight: 500;
    background: transparent;
    border: none;
    box-shadow: none;
    white-space: nowrap;
}

.app-title {
    white-space: nowrap;
}

@media (max-width: 576px) {
    .user-menu-lastname {
        display: none;
    }
}

.app-header .user-menu > summary::after {
    filter: brightness(0) invert(1);
}

.app-header .user-menu > ul {
    min-width: 14rem;
}

.app-header .user-menu > ul li {
    direction: ltr;
    text-align: left;
}

.app-header .user-menu a {
    color: var(--tusli-black);
}

.app-header .user-menu .user-menu-info {
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid var(--pico-muted-border-color);
    padding-top: 0.25rem;
    padding-bottom: 0.6rem;
    margin-bottom: 0.25rem;
}

.app-header .user-menu .user-menu-info small {
    color: var(--pico-muted-color);
    overflow-wrap: anywhere;
}

/* logout is a POST form but looks like the other menu entries */
.app-header .user-menu form {
    margin: 0;
}

.app-header .user-menu form button {
    all: unset;
    display: block;
    width: 100%;
    cursor: pointer;
    color: var(--pico-del-color);
}

.app-header .user-menu form button:hover {
    text-decoration: underline;
}

/* account page: logout form next to the buttons */
footer.actions form,
footer.actions form button {
    margin: 0;
}

/* single card pages (e.g. Mein Konto) */
article.narrow {
    max-width: 40rem;
}

/* Django password rules below the field */
form ul:not(.errorlist, .tr-errors):has(> li) {
    font-size: 0.875rem;
    color: var(--pico-muted-color);
    padding-left: 1.25rem;
}

form ul:not(.errorlist, .tr-errors):has(> li) li {
    list-style: disc;
    margin-bottom: 0.15rem;
}

/* start page: entry points with counters */
.task-list {
    padding: 0;
    margin: 0;
}

.task-list li {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--pico-spacing);
    padding: 0.5rem 0;
    margin: 0;
    border-bottom: 1px solid var(--pico-muted-border-color);
    position: relative;
}

.task-list li:last-child {
    border-bottom: none;
}

/* the whole line is clickable */
.task-list li a::after {
    content: "";
    position: absolute;
    inset: 0;
}

.task-list li:hover {
    background: var(--tusli-accent-soft);
}

.count {
    min-width: 1.75rem;
    padding: 0.1rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    background: #f3f4f6;
    color: var(--pico-muted-color);
}

.count-todo {
    background: #fef3c7;
    color: #92400e;
}

/* review queue (Zu prüfen / Zu bestätigen): collapsed entries, opened inline via htmx */
.queue-counter {
    display: inline-flex;
    align-items: baseline;
    gap: 0.75rem;
}

.queue-counter-sum {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.queue-list details {
    margin: 0;
    padding: 0;
    border: none;
}

.queue-list summary {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0;
}

.queue-list summary::after {
    order: 4;
}

.queue-list details[open] > summary {
    margin-bottom: 0;
}

.queue-list details[open] > summary:not([role]):not(:focus) {
    color: var(--tusli-black);
}

/* name on top, month / waiting time below */
.queue-main {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.queue-who {
    font-weight: 600;
}

.queue-when {
    color: var(--pico-muted-color);
    font-size: 0.8125rem;
}

.queue-age {
    white-space: nowrap;
}

.queue-age-long {
    color: #b45309;
}

.queue-sum {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.queue-warning {
    color: var(--pico-del-color);
    font-weight: 600;
}

.queue-body {
    padding: 0 0 1rem;
}

.queue-body[aria-busy=true] {
    min-height: 2.5rem;
}

.queue-meta {
    color: var(--pico-muted-color);
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

.queue-satz h3 {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.25rem 0.75rem;
    font-size: 1rem;
    margin: 0 0 0.25rem;
}

.queue-satz h3 small {
    font-weight: 400;
    color: var(--pico-muted-color);
}

/* trainings inside a queue entry: the rows of the trainer page, a bit smaller */
.training-list-kompakt {
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

.training-list-kompakt .training {
    padding: 0.3rem 0.5rem;
}

.form-warning.ueberschneidungen {
    font-size: 0.875rem;
}

.queue-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.queue-actions button,
.queue-actions p {
    margin: 0;
}

.queue-detail-link {
    margin-left: auto;
    font-size: 0.875rem;
}

.queue-done {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.7rem 0;
    color: var(--pico-muted-color);
}

.queue-done-message {
    color: var(--pico-ins-color);
    font-weight: 600;
}

.queue-done-message::before {
    content: "✓ ";
}

button.queue-undo {
    all: unset;
    cursor: pointer;
    color: var(--pico-primary);
    font-size: 0.875rem;
    text-decoration: underline;
}

.queue-empty {
    color: var(--pico-muted-color);
    margin: 0;
    padding: var(--pico-spacing);
    background: var(--pico-card-background-color);
    border: 1px solid var(--pico-card-border-color);
    border-radius: var(--pico-border-radius);
}

.back-link {
    font-size: 0.875rem;
}

/* tabs of an Abteilung (separate pages, the current one marked with aria-current) */
nav.tabs {
    margin-bottom: var(--pico-spacing);
    border-bottom: 1px solid var(--pico-muted-border-color);
    overflow-x: auto;
    scrollbar-width: none;
}

nav.tabs ul {
    display: flex;
    gap: 0.25rem;
    margin: 0 !important;
    padding: 0;
}

nav.tabs li {
    list-style: none;
    margin: 0;
    padding: 0;
}

nav.tabs a {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    padding: 0.55rem 0.9rem;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    color: var(--pico-muted-color);
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
}

nav.tabs a:hover {
    color: var(--tusli-black);
}

nav.tabs a[aria-current=page] {
    color: var(--tusli-black);
    border-bottom-color: var(--tusli-accent);
}

nav.tabs .count {
    font-size: 0.75rem;
}

/* key figures */
dl.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
    gap: var(--pico-spacing);
    margin: 0;
}

dl.stats div {
    margin: 0;
}

dl.stats dt {
    color: var(--pico-muted-color);
    font-size: 0.8125rem;
    font-weight: 400;
}

dl.stats dd {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

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

/* The queue is no single card: every entry carries the card background, consecutive
   entries join into one block. An opened entry splits the list, the page background
   shows above and below it. */
.queue {
    margin-bottom: var(--pico-block-spacing-vertical);
}

.queue-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--pico-spacing);
    margin-bottom: 0.5rem;
}

.queue-header h2 {
    margin: 0;
    font-size: 1.125rem;
}

.queue > footer.actions {
    margin-top: var(--pico-spacing);
}

.queue-list {
    padding: 0;
    margin: 0;
}

.queue-list > li {
    --queue-border: 1px solid var(--pico-card-border-color);
    list-style: none;
    margin: 0;
    padding: 0 var(--pico-spacing);
    background: var(--pico-card-background-color);
    border-left: var(--queue-border);
    border-right: var(--queue-border);
    border-bottom: 1px solid var(--pico-muted-border-color);
}

/* start of a block: first entry, the opened one, the one after it */
.queue-list > li:first-child,
.queue-list > li:has(> details[open]),
.queue-list > li:has(> details[open]) + li {
    border-top: var(--queue-border);
    border-top-left-radius: var(--pico-border-radius);
    border-top-right-radius: var(--pico-border-radius);
}

/* end of a block: last entry, the opened one, the one before it */
.queue-list > li:last-child,
.queue-list > li:has(> details[open]),
.queue-list > li:has(+ li > details[open]) {
    border-bottom: var(--queue-border);
    border-bottom-left-radius: var(--pico-border-radius);
    border-bottom-right-radius: var(--pico-border-radius);
    box-shadow: var(--pico-card-box-shadow);
}

.queue-list > li:has(> details[open]) {
    margin: var(--pico-spacing) 0;
}

.queue-list > li:has(> details[open]):first-child {
    margin-top: 0;
}

.queue-list > li:has(> details[open]):last-child {
    margin-bottom: 0;
}

.queue-list > li.queue-done {
    padding: 0.7rem var(--pico-spacing);
}

@media (max-width: 576px) {
    nav.tabs ul {
        gap: 0;
    }

    nav.tabs a {
        padding: 0.55rem 0.45rem;
        font-size: 0.85rem;
        gap: 0.25rem;
    }

    nav.tabs .count {
        padding: 0 0.35rem;
    }

    /* trainer tab: the "seit" column is the least important one on phones */
    .trainer-table .col-seit {
        display: none;
    }
}

/* GS dashboard */
dl.stats dd small {
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--pico-muted-color);
}

.sort-links {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    font-size: 0.875rem;
}

.sort-links small {
    color: var(--pico-muted-color);
}

.sort-links a[aria-current] {
    color: var(--tusli-black);
    font-weight: 700;
    text-decoration: none;
}

.abteilungen-table td:nth-child(n+2),
.abteilungen-table th:nth-child(n+2) {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.export-form [role=group] {
    margin-bottom: 0;
}

/* a whole key figure is clickable: the link in its label covers the block */
dl.stats .stat-link {
    position: relative;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
    transition: background-color 0.15s, border-color 0.15s;
}

dl.stats .stat-link:hover {
    background: var(--tusli-accent-soft);
    border-color: var(--tusli-accent);
}

dl.stats .stat-link a {
    font-size: 0.875rem;
    font-weight: 600;
}

dl.stats .stat-link a::after {
    content: "";
    position: absolute;
    inset: 0;
}

dl.stats .stat-link dt::after {
    content: " →";
    color: var(--pico-primary);
}

/* value with a second, smaller line below (e.g. name + "seit 01/2014") */
.item-stacked {
    display: flex;
    flex-direction: column;
}

/* Verlauf: one-sided timeline, a line on the left, a dot per event */
.timeline .tl-list {
    position: relative;
    margin: 0.25rem 0 1rem;
    padding: 0 0 0 1.5rem;
}

.timeline .tl-list::before {
    content: "";
    position: absolute;
    left: 0.45rem;
    top: 0.4rem;
    bottom: 0.4rem;
    width: 2px;
    background: var(--pico-muted-border-color);
}

.timeline .tl-event {
    position: relative;
    list-style: none;
    display: grid;
    grid-template-columns: 6.5rem 1fr;
    gap: 0 0.75rem;
    align-items: baseline;
    margin: 0;
    padding: 0.45rem 0.5rem;
    border-radius: var(--pico-border-radius);
}

.timeline .tl-event::before {
    content: "";
    position: absolute;
    left: -1.5rem;
    top: 0.85rem;
    width: 0.8rem;
    height: 0.8rem;
    margin-left: 0.1rem;
    border-radius: 50%;
    background: var(--pico-card-background-color);
    border: 2px solid var(--pico-muted-color);
}

.timeline .tl-trainer_neu::before {
    background: #16a34a;
    border-color: #16a34a;
}

.timeline .tl-trainer_weg::before {
    border-color: #9ca3af;
}

.timeline .tl-abtl_neu::before {
    background: var(--tusli-accent);
    border-color: var(--tusli-accent);
}

.timeline .tl-abtl_weg::before {
    border-color: var(--tusli-accent);
}

.timeline time {
    color: var(--pico-muted-color);
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
}

.timeline .tl-text {
    display: flex;
    flex-direction: column;
}

.timeline .tl-text small {
    color: var(--pico-muted-color);
}

.timeline .tl-trainer_weg .tl-text a {
    color: var(--pico-muted-color);
}

/* whole event is clickable when it has a link */
.timeline .tl-event:has(a) {
    cursor: pointer;
}

.timeline .tl-event:has(a):hover {
    background: var(--tusli-accent-soft);
}

.timeline .tl-event a::after {
    content: "";
    position: absolute;
    inset: 0;
}

.tl-meta-neu {
    color: #15803d;
}

.tl-meta-abtl {
    color: var(--tusli-accent);
    font-weight: 600;
}

@media (max-width: 576px) {
    .timeline .tl-event {
        grid-template-columns: 1fr;
    }
}

/* Abrechnung page: trainings per Stundensatz, edited row by row */
.abr-total {
    margin: 0;
    font-size: 1.75rem;
    font-variant-numeric: tabular-nums;
}

.abr-summary footer.actions {
    justify-content: flex-start;
}

.abr-summary footer.actions .muted {
    margin: 0;
    font-size: 0.875rem;
}

article.satz > header h2 small {
    font-weight: 400;
    color: var(--pico-muted-color);
    font-size: 0.875rem;
}

.satz-summe {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.training-list {
    padding: 0;
    margin: 0;
}

.training-list > li {
    list-style: none;
    margin: 0;
}

.training-list:has(> li.training) > .training-empty {
    display: none;
}

.training-empty {
    color: var(--pico-muted-color);
    padding: 0.5rem 0;
}

.training,
.training-edit form {
    display: grid;
    grid-template-columns: 6.5rem 7.5rem 4.5rem 1fr auto;
    gap: 0.5rem 0.75rem;
    align-items: center;
}

.training {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid var(--pico-muted-border-color);
    font-variant-numeric: tabular-nums;
}

.training[hx-get] {
    cursor: pointer;
    border-radius: var(--pico-border-radius);
}

.training[hx-get]:hover,
.training[hx-get]:focus-visible {
    background: var(--tusli-accent-soft);
}

.tr-tag {
    display: inline-block;
    width: 1.6rem;
    color: var(--pico-muted-color);
}

.tr-dauer {
    text-align: right;
}

.tr-beschreibung {
    color: var(--pico-muted-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tr-actions {
    display: flex;
    gap: 0.15rem;
    justify-content: flex-end;
}

button.icon-button {
    all: unset;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: var(--pico-border-radius);
    color: var(--pico-muted-color);
    cursor: pointer;
    font-size: 1rem;
}

button.icon-button:hover,
button.icon-button:focus-visible {
    background: var(--pico-card-sectioning-background-color, #eef1f6);
    color: var(--tusli-black);
}

button.icon-button.icon-danger:hover {
    color: var(--pico-del-color);
}

button.icon-button.icon-ok {
    color: #fff;
    background: var(--tusli-accent);
}

/* edit row: the inputs take the place of the read cells; the form is the grid */
.training.training-edit {
    display: block;
    padding: 0.4rem 0.5rem;
    background: var(--tusli-accent-soft);
    border-radius: var(--pico-border-radius);
    border-bottom: 1px solid var(--pico-muted-border-color);
}

.training-edit form {
    grid-template-columns: 9.5rem 6.5rem 6.5rem 1fr auto;
    margin: 0;
}

.training-edit input {
    margin: 0;
    height: 2.4rem;
    padding: 0.3rem 0.5rem;
}

.tr-errors {
    grid-column: 1 / -1;
    margin: 0;
    padding: 0;
    color: var(--pico-del-color);
    font-size: 0.8125rem;
}

.tr-errors li {
    list-style: none;
}

.training-deleted {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    color: var(--pico-muted-color);
    border-bottom: 1px solid var(--pico-muted-border-color);
}

.training-deleted form {
    margin: 0;
}

/* the deleted row disappears after a while; hovering or focusing "Rückgängig" holds it */
.training.training-deleted {
    display: flex;
    animation: tr-ausblenden 0.6s ease-in 5s forwards;
}

.training.training-deleted:hover,
.training.training-deleted:focus-within {
    animation-play-state: paused;
}

@keyframes tr-ausblenden {
    to {
        opacity: 0;
        height: 0;
        padding-block: 0;
        border-width: 0;
    }
}

article.satz > footer button {
    margin: 0;
}

@media (max-width: 576px) {
    /* read row: date + time, duration right, description below */
    .training {
        grid-template-columns: auto 1fr auto;
        gap: 0.1rem 0.6rem;
    }

    .tr-dauer {
        grid-column: 3;
        grid-row: 1;
    }

    .tr-beschreibung {
        grid-column: 1 / 3;
        grid-row: 2;
        font-size: 0.875rem;
    }

    .training .tr-actions {
        grid-column: 3;
        grid-row: 2;
    }

    .training-edit form {
        grid-template-columns: 1fr 1fr;
    }

    .tr-f-datum,
    .tr-f-beschreibung {
        grid-column: 1 / -1;
    }

    .training-edit .tr-actions {
        grid-column: 1 / -1;
        grid-row: auto;
    }

    .training-edit .tr-actions .icon-button {
        width: 2.6rem;
        height: 2.4rem;
    }
}

/* the row just saved lights up briefly */
.training.tr-gespeichert {
    animation: tr-gespeichert 1.6s ease-out;
}

@keyframes tr-gespeichert {
    from {
        background: #dcfce7;
    }

    to {
        background: transparent;
    }
}

/* two trainings at the same time on one day */
.tr-konflikt-hinweis {
    display: block;
    color: #b45309;
    font-size: 0.8125rem;
    white-space: normal;
}

.training.tr-konflikt .tr-zeit {
    color: #b45309;
    font-weight: 600;
}

/* new Abrechnung */
.monat-jahr {
    grid-template-columns: 2fr 1fr;
}

.form-error,
.form-warning {
    padding: 0.6rem 0.8rem;
    border-radius: var(--pico-border-radius);
    font-size: 0.9rem;
}

.form-error {
    background: #fee2e2;
    color: #991b1b;
}

.form-warning {
    background: #fef3c7;
    color: #92400e;
}

/* training week: same rows as the Abrechnung; the weekday select is wider than a date */
.woche-intro {
    margin-top: -0.5rem;
}

.woche-satz-name {
    display: block;
    font-size: 0.8125rem;
}

.woche-f-satz {
    grid-column: 1 / -1;
    margin: 0;
    font-size: 0.875rem;
}

.woche-f-satz select {
    margin: 0.25rem 0 0;
}

.training-edit select {
    margin: 0;
    height: 2.4rem;
    padding-block: 0.3rem;
}

/* navigation at the end of a page (e.g. training week: back / next step) */
.page-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: var(--pico-spacing);
}

/* training week: archived entries (e.g. the other season) */
.woche-archiv details.archive {
    margin: 0;
    border-top: none;
    padding-top: 0;
}

.woche-archiv-hinweis {
    font-size: 0.875rem;
    margin: 0.5rem 0;
}

.training.woche-archiviert .tr-datum,
.training.woche-archiviert .tr-zeit,
.training.woche-archiviert .tr-dauer {
    color: var(--pico-muted-color);
}

/* delete confirmation in place of the actions of an Abrechnung */
footer.abr-loeschen {
    background: #fef2f2;
}

footer.abr-loeschen p {
    flex-basis: 100%;
    margin: 0;
    font-size: 0.9rem;
}

footer.abr-loeschen form,
footer.abr-loeschen button {
    margin: 0;
}

/* confirmation inside the page (static/app.js), in place of the button that asked */
.inline-confirm {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    flex-basis: 100%;
    padding: 0.6rem 0.75rem;
    border-radius: var(--pico-border-radius);
    background: var(--tusli-accent-soft);
    animation: inline-confirm-ein 0.15s ease-out;
}

.inline-confirm.inline-confirm-danger {
    background: #fef2f2;
}

.inline-confirm p {
    flex-basis: 100%;
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
}

.inline-confirm button {
    margin: 0;
    width: auto;
}

@keyframes inline-confirm-ein {
    from {
        opacity: 0;
        transform: translateY(-2px);
    }
}

/* status of an Abrechnung as a flow: done steps, then the next open one.
   Dot and line are elements of their own: Pico's tooltip ([data-tooltip]) uses ::before/::after. */
.ablauf {
    margin: 0;
    padding: 0 0 0 2rem;
}

.ablauf-schritt {
    position: relative;
    list-style: none;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0.45rem 0.5rem;
    border-radius: var(--pico-border-radius);
}

/* dot: 1.2rem, its centre 1.15rem below the top of the step */
.ablauf-punkt {
    position: absolute;
    z-index: 1;
    left: -1.75rem;
    top: 0.55rem;
    width: 1.2rem;
    height: 1.2rem;
    box-sizing: border-box;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
}

/* line from this dot's centre to the centre of the next one */
.ablauf-linie {
    position: absolute;
    left: calc(-1.15rem - 1px);
    top: 1.15rem;
    bottom: -1.15rem;
    border-left: 2px solid var(--tusli-accent);
}

.ablauf-erledigt:has(+ .ablauf-offen) .ablauf-linie {
    border-left-style: dashed;
    border-left-color: #d97706;
}

.ablauf-erledigt .ablauf-punkt {
    background: var(--tusli-accent);
    color: #fff;
}

.ablauf-offen .ablauf-punkt {
    background: var(--pico-card-background-color);
    border: 2px dashed #d97706;
}

.ablauf-offen .ablauf-label {
    color: #92400e;
    font-weight: 600;
}

.ablauf-seit {
    color: var(--pico-muted-color);
    font-size: 0.8125rem;
}

/* Pico tooltips: no dotted underline on the steps, a light highlight instead */
.ablauf-schritt[data-tooltip] {
    border-bottom: none;
    cursor: help;
}

.ablauf-schritt[data-tooltip]:hover,
.ablauf-schritt[data-tooltip]:focus-visible {
    background: var(--tusli-accent-soft);
}

/* login: button and "Passwort vergessen?" in one row */
.login-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1.25rem;
}

.login-actions button {
    margin-bottom: 0;
}

/* mail preview (development only) */
.mail-vorschau {
    display: grid;
    grid-template-columns: 17rem 1fr;
    gap: 1.5rem;
    align-items: start;
}

/* Pico lays out nav lists in a row: here a column */
.mail-liste,
.mail-liste ul {
    display: block;
    padding: 0;
    margin: 0;
}

.mail-liste li {
    display: block;
    list-style: none;
    margin: 0 0 0.25rem;
    padding: 0;
}

.mail-liste a {
    margin: 0;
}

.mail-liste a {
    display: block;
    padding: 0.4rem 0.6rem;
    border-radius: var(--pico-border-radius);
    text-decoration: none;
}

.mail-liste a[aria-current] {
    background: var(--tusli-accent-soft);
    font-weight: 600;
}

.mail-liste small {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.15rem;
    font-weight: 400;
}

.mail-tag {
    font-size: 0.75rem;
    padding: 0 0.4rem;
    border-radius: 1rem;
    background: var(--pico-muted-border-color);
    color: var(--pico-muted-color);
}

.mail-tag.mail-aktiv {
    background: #dcfce7;
    color: #166534;
}

.mail-tag.mail-eigen {
    background: var(--tusli-accent-soft);
    color: var(--pico-primary);
}

.mail-ansicht {
    width: auto;
    margin: 0;
}

.mail-ansicht a {
    font-size: 0.875rem;
    padding: 0.35rem 0.75rem;
}

.mail-kopf {
    margin-bottom: 1rem;
}

.mail-text {
    white-space: pre-wrap;
    word-break: break-word;
    padding: 1rem;
    font-size: 0.875rem;
}

.mail-quelltext mark {
    background: #fef3c7;
    color: #92400e;
    padding: 0 0.1rem;
}

.mail-vorlage-name {
    font-size: 0.9375rem;
    margin: 1rem 0 0.35rem;
}

.mail-vorlage-name small {
    display: block;
    font-weight: 400;
    font-size: 0.75rem;
    word-break: break-all;
}

.mail-html {
    width: 100%;
    min-height: 40rem;
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
}

@media (max-width: 768px) {
    .mail-vorschau {
        grid-template-columns: 1fr;
    }
}

/* notification setting on Mein Konto */
.benachrichtigung-option {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.benachrichtigung-option input {
    margin-top: 0.3rem;
    flex-shrink: 0;
}

.benachrichtigung-option small {
    display: block;
    color: var(--pico-muted-color);
}

#benachrichtigungen legend {
    margin-bottom: 0.75rem;
    font-size: 0.9375rem;
}

.benachrichtigung-pflicht {
    margin: 0;
    color: var(--pico-muted-color);
}

.benachrichtigung-gespeichert {
    color: #166534;
    margin: 0;
    font-size: 0.875rem;
}

/* rejecting with a reason: the button opens a small form on its own line */
details.ablehnen {
    margin: 0;
}

details.ablehnen > summary {
    margin: 0;
}

details.ablehnen > summary::after {
    display: none;
}

details.ablehnen[open] {
    flex-basis: 100%;
    order: 10;
}

details.ablehnen[open] > summary {
    display: none;
}

details.ablehnen form {
    margin-top: 0.5rem;
    padding: 0.75rem;
    border: 1px solid #f59e0b;
    border-radius: var(--pico-border-radius);
    background: #fffbeb;
}

details.ablehnen textarea {
    margin-bottom: 0.25rem;
}

/* Pico pulls helper text up under inputs; here it belongs below the textarea */
details.ablehnen label small {
    display: block;
    margin-top: 0;
    color: var(--pico-muted-color);
}

.ablehnen-aktionen {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.ablehnen-aktionen button {
    margin: 0;
}

.ablehnen-senden {
    background: #b91c1c;
    border-color: #b91c1c;
}

/* rejected Abrechnung: badge and step in the status flow */
.badge.badge-abgelehnt {
    background: #fef3c7;
    color: #92400e;
}

.ablauf-abgelehnt .ablauf-punkt {
    background: #d97706;
    border-color: #d97706;
}

.ablauf-grund {
    margin: 0.25rem 0 0;
    padding: 0.4rem 0.6rem;
    background: #fef3c7;
    border-radius: var(--pico-border-radius);
    font-size: 0.875rem;
    color: #78350f;
}

/* messages: counter in the user menu, hint on the start page, list */
.nachrichten-zaehler {
    display: inline-block;
    min-width: 1.25rem;
    padding: 0 0.35rem;
    border-radius: 1rem;
    background: #d97706;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.25rem;
    text-align: center;
}

.nachrichten-hinweis {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--pico-border-radius);
    background: #fef3c7;
    color: #78350f;
    text-decoration: none;
    grid-column: 1 / -1;
    margin-bottom: var(--pico-block-spacing-vertical);     /* .cards has no row gap: like the articles */
}

.nachrichten {
    padding: 0;
    margin: 0;
}

.nachricht {
    list-style: none;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--pico-muted-border-color);
}

.nachricht:last-child {
    border-bottom: 0;
}

/* date above the title, "neu" on the same line on the right */
.nachricht-kopf {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.6rem;
}

.nachricht-titel {
    display: block;
}

.nachricht-neu-marke {
    font-size: 0.75rem;
    padding: 0 0.4rem;
    border-radius: 1rem;
    background: #fef3c7;
    color: #92400e;
}

.nachricht-text {
    margin: 0.4rem 0;
    padding: 0.4rem 0.6rem;
    background: var(--pico-card-sectioning-background-color, #f8fafc);
    border-radius: var(--pico-border-radius);
}

.nachricht-neu {
    border-left: 3px solid #d97706;
    padding-left: 0.75rem;
}
