/* CLM-Bundle: Farben lassen sich über die Variablen anpassen */
:where(.clm-tabelle, .clm-spieltage) {
    --clm-primaer: #182e7a;
    --clm-primaer-text: #fff;
    --clm-akzent: #c8102e;
    --clm-eigene: #e8edf8;
    --clm-grund: #fff;
    --clm-brett: #f7f9fd;
    --clm-linie: #d9dfe9;
    --clm-trennung: #9aa9cc;
    --clm-leise: #5a6478;
    --clm-diagonale: #e4e8f0;
    --clm-sieg: #1c7a3d;
    --clm-niederlage: #b3261e;
}
.clm-tabelle,
.clm-spieltage {
    margin-bottom: 2em;
    font-variant-numeric: tabular-nums;
    line-height: 1.35;
}
.clm-tabelle table,
.clm-spieltage table {
    width: 100%;
    margin: 0;
    border: 0;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 1rem;
}
.clm-tabelle .clm-dwz,
.clm-spieltage .clm-dwz,
.clm-spieltage .clm-brettnr {
    font-size: .85em;
    font-weight: 400;
    color: var(--clm-leise);
}

/* Nur für Screenreader */
.clm-unsichtbar {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* Tabelle und Kreuztabelle */
.clm-scroll {
    overflow-x: auto;
}
.clm-tabelle thead th {
    padding: 6px 7px;
    border: 0;
    background: var(--clm-primaer);
    color: var(--clm-primaer-text);
    font-size: 1em;
    font-weight: 600;
    text-align: center;
}
.clm-tabelle tbody tr td {
    padding: 6px 7px;
    border: 0;
    border-bottom: 1px solid var(--clm-linie);
    background: var(--clm-grund);
    text-align: center;
    white-space: nowrap;
}
.clm-tabelle thead th.clm-team,
.clm-tabelle tbody tr td.clm-team {
    text-align: left;
}
.clm-tabelle tbody tr td.clm-mp {
    font-weight: 700;
}
.clm-tabelle tbody tr.clm-eigene td {
    background: var(--clm-eigene);
    font-weight: 700;
}
.clm-tabelle tbody tr.clm-eigene td:first-child {
    box-shadow: inset 4px 0 var(--clm-akzent);
}
.clm-tabelle tbody tr td.clm-sieg {
    color: var(--clm-sieg);
    font-weight: 700;
}
.clm-tabelle tbody tr td.clm-niederlage {
    color: var(--clm-niederlage);
    font-weight: 700;
}
.clm-tabelle tbody tr td.clm-diagonale {
    background: var(--clm-diagonale);
    color: var(--clm-leise);
    font-weight: 400;
}
/* Rang und Mannschaft bleiben beim seitlichen Scrollen stehen */
.clm-rangliste .clm-rang,
.clm-rangliste .clm-team {
    position: sticky;
    z-index: 1;
}
.clm-rangliste .clm-rang {
    left: 0;
    width: 48px;
    min-width: 48px;
    box-sizing: border-box;
}
.clm-rangliste .clm-team {
    left: 48px;
}
/* Ergebnisspalten gleich breit, den übrigen Platz erhält die Mannschaft */
.clm-rangliste thead th.clm-ergebnis,
.clm-rangliste tbody tr td.clm-ergebnis {
    box-sizing: border-box;
    width: 38px;
    min-width: 34px;
    padding-inline: 2px;
}
.clm-rangliste :is(.clm-mp, .clm-bp, .clm-fein) {
    width: 1%;
}
/* Ergebnisse senkrecht abgrenzen: kräftig vor der ersten und nach der letzten Spalte, sonst dünn */
.clm-rangliste thead th.clm-team,
.clm-rangliste tbody tr td.clm-team {
    border-right: 2px solid var(--clm-trennung);
}
.clm-rangliste thead th.clm-ergebnis + :not(.clm-ergebnis),
.clm-rangliste tbody tr td.clm-ergebnis + :not(.clm-ergebnis) {
    border-left: 2px solid var(--clm-trennung);
}
.clm-rangliste tbody tr td.clm-ergebnis + .clm-ergebnis,
.clm-rangliste tbody tr td:is(.clm-mp, .clm-bp, .clm-fein) + td {
    border-left: 1px solid var(--clm-linie);
}
.clm-marke {
    margin-left: 3px;
    font-size: .72em;
}
.clm-marke--up,
.clm-marke--upmaybe {
    color: var(--clm-sieg);
}
.clm-marke--down,
.clm-marke--downmaybe {
    color: var(--clm-niederlage);
}
.clm-marke--upmaybe,
.clm-marke--downmaybe {
    opacity: .6;
}
.clm-legende {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 18px;
    margin: 8px 0 0;
    font-size: .9em;
    color: var(--clm-leise);
}

/* Einzelergebnisse */
.clm-einzel abbr {
    text-decoration: none;
}
.clm-einzel thead th,
.clm-einzel tbody tr td,
.clm-einzel tfoot td {
    padding-inline: 5px;
    vertical-align: top;
}
.clm-einzel thead th {
    vertical-align: bottom;
}
.clm-einzel thead th.clm-partie,
.clm-einzel tbody tr td.clm-partie,
.clm-einzel tfoot td.clm-partie {
    box-sizing: border-box;
    width: 36px;
    min-width: 32px;
    padding-inline: 2px;
}
.clm-einzel .clm-rundennr,
.clm-einzel .clm-gegner,
.clm-einzel .clm-wert,
.clm-einzel .clm-quote,
.clm-einzel .clm-partie .clm-dwz {
    display: block;
}
.clm-einzel .clm-gegner {
    font-size: .8em;
    font-weight: 400;
}
.clm-einzel thead th.clm-partie .clm-gegner {
    white-space: normal;
}
.clm-einzel .clm-ohne {
    color: var(--clm-leise);
}
/* Lange Namen brechen um, wenn der Platz nicht reicht */
.clm-einzel tbody tr td.clm-team {
    white-space: normal;
}
/* Dünne senkrechte Striche ab der Spalte nach dem Namen */
.clm-einzel tbody tr td.clm-team ~ td,
.clm-einzel tfoot tr td.clm-team ~ td {
    border-left: 1px solid var(--clm-linie);
}
/* Gesamtwerte und Partien trennen */
.clm-einzel thead th.clm-trennung,
.clm-einzel tbody tr td.clm-team ~ td.clm-trennung,
.clm-einzel tfoot tr td.clm-team ~ td.clm-trennung {
    border-left: 2px solid var(--clm-trennung);
}
.clm-einzel tr > *:has(+ .clm-trennung) {
    padding-right: 10px;
}
.clm-einzel tfoot td {
    padding-block: 6px;
    border: 0;
    border-top: 2px solid var(--clm-primaer);
    background: var(--clm-eigene);
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
}
.clm-einzel tfoot td.clm-team {
    text-align: left;
}
.clm-einzel .clm-rang,
.clm-einzel .clm-team {
    position: sticky;
    z-index: 1;
}
.clm-einzel .clm-rang {
    left: 0;
    width: 46px;
    min-width: 46px;
    box-sizing: border-box;
}
.clm-einzel .clm-team {
    left: 46px;
}
@media (max-width: 600px) {
    .clm-einzel .clm-rang {
        display: none;
    }
    .clm-einzel .clm-team {
        left: 0;
        max-width: 130px;
    }
    .clm-einzel tbody tr td.clm-team {
        border-right: 1px solid var(--clm-linie);
    }
    .clm-einzel tbody tr td.clm-team + td:not(.clm-trennung) {
        border-left: 0;
    }
}

/* Spieltage */
.clm-spieltage .clm-spalte-ergebnis {
    width: 84px;
}
.clm-spieltage table {
    table-layout: fixed;
    margin-bottom: 1.2em;
}
.clm-spieltage .clm-kopf {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}
.clm-spieltage caption {
    padding: 7px 10px;
    background: var(--clm-primaer);
    color: var(--clm-primaer-text);
    font-weight: 700;
    text-align: left;
}
.clm-spieltage tbody tr td {
    padding: 6px 8px;
    border: 0;
    border-bottom: 1px solid var(--clm-linie);
    background: var(--clm-grund);
    vertical-align: baseline;
    overflow-wrap: break-word;
}
.clm-spieltage tbody tr td.clm-heim {
    text-align: right;
}
.clm-spieltage tbody tr td.clm-ergebnis {
    padding-inline: 2px;
    text-align: center;
    white-space: nowrap;
}
.clm-spieltage tbody tr td.clm-gast {
    text-align: left;
}
.clm-spieltage tbody tr.clm-kampf td.clm-ergebnis {
    font-weight: 700;
}
.clm-spieltage tbody tr.clm-eigene td {
    background: var(--clm-eigene);
    font-weight: 700;
}
.clm-spieltage tbody tr.clm-eigene td:first-child {
    box-shadow: inset 4px 0 var(--clm-akzent);
}
.clm-spieltage tbody tr.clm-brett td {
    padding-block: 4px;
    background: var(--clm-brett);
    font-size: .95em;
}
/* Feste Breite, damit alle Namen gleich weit von der Mitte beginnen, auch ohne DWZ */
.clm-spieltage .clm-brett .clm-dwz {
    display: inline-block;
    width: 2.4em;
    text-align: center;
}
/* Brettnummer am linken Rand, auf der Grundlinie des Namens */
.clm-spieltage .clm-brettnr {
    float: left;
    line-height: 1.59;
}
.clm-spieltage tbody tr.clm-bemerkung td {
    padding-block: 4px 8px;
    background: var(--clm-brett);
    color: var(--clm-leise);
    font-size: .9em;
    text-align: center;
}
.clm-spieltage .clm-termin {
    display: block;
    font-size: .85em;
    color: var(--clm-akzent);
}

@media (max-width: 600px) {
    .clm-tabelle .clm-gsrv,
    .clm-tabelle .clm-fein,
    .clm-spieltage .clm-brettnr {
        display: none;
    }
    .clm-tabelle table,
    .clm-spieltage table {
        font-size: .94rem;
    }
    .clm-spieltage tbody tr td {
        padding-inline: 4px;
    }
    .clm-spieltage .clm-spalte-ergebnis {
        width: 68px;
    }
}

@media print {
    .clm-tabelle thead th,
    .clm-spieltage caption {
        color: #000;
    }
}
