/* =========================================================================
   Ata Digital Partnerportal – Designsystem
   Ein bewusst zurückhaltendes, typografisch geführtes B2B-Interface.
   Alle Farben, Abstände und Radien laufen über Design Tokens, damit das
   Branding zentral über die Systemeinstellungen angepasst werden kann.
   ========================================================================= */

/* ------------------------------------------------------------ 1. Tokens */
:root {
    /* Markenfarben – werden zur Laufzeit aus den Einstellungen überschrieben */
    --brand-900: #123c74;
    --brand-800: #17509c;
    --brand-700: #1f6fd1;
    --brand-600: #3d86dd;
    --brand-500: #63a3e8;
    --brand-300: #a5cdf3;
    --brand-100: #d9eafa;
    --brand-50:  #eff6fe;

    --accent-700: #0b6160;
    --accent-600: #0e7c7b;
    --accent-100: #d5efee;
    --accent-50:  #edf8f7;

    /* Neutrale Skala */
    --n-0:   #ffffff;
    --n-25:  #fcfcfd;
    --n-50:  #f7f8fa;
    --n-100: #eef0f4;
    --n-200: #e2e5eb;
    --n-300: #cbd1da;
    --n-400: #9ba4b2;
    /* Rahmen von Bedienelementen brauchen laut WCAG 1.4.11 mindestens 3:1. */
    --border-control: #8c95a4;
    --border-control-hover: #767f8e;
    --n-500: #69727e;
    --n-600: #525c6b;
    --n-700: #3d4653;
    --n-800: #29303a;
    --n-900: #171c24;

    /* Semantik */
    --success-700: #0a6b45;
    --success-600: #0f8a5b;
    --success-100: #d6f2e5;
    --warning-700: #8a5206;
    --warning-600: #b06d0a;
    --warning-100: #fbeed4;
    --danger-700:  #97231c;
    --danger-600:  #bf2f26;
    --danger-100:  #fadedb;
    --info-700:    #1c4f8a;
    --info-600:    #2467a8;
    --info-100:    #dce9f6;

    /* Datenvisualisierung */
    --chart-1: #1f6fd1;
    --chart-2: #0e7c7b;
    --chart-3: #b06d0a;
    --chart-4: #6941c6;
    --chart-5: #2467a8;
    --chart-6: #a63d67;

    /* Typografie */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

    --text-xs:   0.75rem;
    --text-sm:   0.8125rem;
    --text-base: 0.875rem;
    --text-md:   0.9375rem;
    --text-lg:   1.0625rem;
    --text-xl:   1.25rem;
    --text-2xl:  1.5rem;
    --text-3xl:  1.875rem;
    --text-4xl:  2.25rem;

    /* Abstände */
    --sp-1: 0.25rem;
    --sp-2: 0.5rem;
    --sp-3: 0.75rem;
    --sp-4: 1rem;
    --sp-5: 1.25rem;
    --sp-6: 1.5rem;
    --sp-8: 2rem;
    --sp-10: 2.5rem;
    --sp-12: 3rem;
    --sp-16: 4rem;

    --radius-sm: 5px;
    --radius:    8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 999px;

    --shadow-xs: 0 1px 2px rgba(23, 28, 36, 0.05);
    --shadow-sm: 0 1px 3px rgba(23, 28, 36, 0.07), 0 1px 2px rgba(23, 28, 36, 0.04);
    --shadow-md: 0 4px 12px rgba(23, 28, 36, 0.08), 0 2px 4px rgba(23, 28, 36, 0.04);
    --shadow-lg: 0 12px 32px rgba(23, 28, 36, 0.12), 0 4px 8px rgba(23, 28, 36, 0.05);

    --sidebar-width: 250px;
    --topbar-height: 60px;
    --content-max: 1440px;

    --transition: 140ms cubic-bezier(0.4, 0, 0.2, 1);

    color-scheme: light;
}

/* -------------------------------------------------------- 2. Grundlagen */
*,
*::before,
*::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.55;
    color: var(--n-800);
    background: var(--n-50);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-variant-numeric: tabular-nums;
}

h1, h2, h3, h4, h5 {
    margin: 0;
    font-weight: 600;
    letter-spacing: -0.011em;
    color: var(--n-900);
    line-height: 1.25;
}

h1 { font-size: var(--text-2xl); letter-spacing: -0.02em; }
h2 { font-size: var(--text-xl); letter-spacing: -0.015em; }
h3 { font-size: var(--text-lg); }
h4 { font-size: var(--text-md); }

p { margin: 0 0 var(--sp-3); }
p:last-child { margin-bottom: 0; }

a {
    color: var(--brand-700);
    text-decoration: none;
    transition: color var(--transition);
}
a:hover { color: var(--brand-600); text-decoration: underline; }

small { font-size: var(--text-xs); }

hr {
    border: 0;
    border-top: 1px solid var(--n-200);
    margin: var(--sp-6) 0;
}

code, kbd, pre { font-family: var(--font-mono); font-size: 0.85em; }

code {
    background: var(--n-100);
    padding: 0.1em 0.35em;
    border-radius: var(--radius-sm);
    color: var(--n-800);
}

pre {
    background: var(--n-900);
    color: var(--n-100);
    padding: var(--sp-4);
    border-radius: var(--radius);
    overflow-x: auto;
    line-height: 1.5;
}
pre code { background: none; color: inherit; padding: 0; }

:focus-visible {
    outline: 2px solid var(--brand-600);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

::selection { background: var(--brand-100); color: var(--brand-900); }

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

.skip-link {
    position: absolute;
    top: -100px;
    left: var(--sp-4);
    z-index: 200;
    background: var(--brand-700);
    color: #fff;
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--radius);
    font-weight: 600;
}
.skip-link:focus { top: var(--sp-3); text-decoration: none; }

/* ------------------------------------------------------------- 3. Shell */
.shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--brand-100);
    color: var(--brand-900);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.sidebar__brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: var(--sp-5) var(--sp-5) var(--sp-4);
    margin-bottom: var(--sp-3);
    border-bottom: 1px solid rgba(18, 60, 116, 0.15);
    color: var(--brand-900);
    min-height: var(--topbar-height);
}
.sidebar__brand:hover { text-decoration: none; }
.sidebar__brand-logo {
    display: flex;
    align-items: center;
    width: 164px;
    max-width: 100%;
    min-height: 42px;
}
.sidebar__brand-logo img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 30px;
    object-fit: contain;
    object-position: left center;
}
.sidebar__brand-label {
    padding-left: 2px;
    color: rgba(18, 60, 116, 0.66);
    font-size: var(--text-xs);
    line-height: 1.2;
}

.brand-mark {
    width: 34px; height: 34px;
    border-radius: 9px;
    background: linear-gradient(145deg, var(--brand-500), var(--accent-600));
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.02em;
    color: #fff;
    flex-shrink: 0;
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; border-radius: 9px; }

.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text strong { font-size: var(--text-md); font-weight: 650; letter-spacing: -0.01em; }
.brand-text span { font-size: var(--text-xs); color: rgba(18, 60, 116, 0.66); }

.sidebar__nav { flex: 1; padding: var(--sp-3) var(--sp-3) var(--sp-6); }

.nav-section { margin-bottom: var(--sp-5); }
.nav-section__title {
    font-size: 0.6875rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: rgba(18, 60, 116, 0.55);
    padding: 0 var(--sp-3) var(--sp-2);
    margin: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: 0.5rem var(--sp-3);
    margin-bottom: 1px;
    border-radius: var(--radius);
    color: rgba(18, 60, 116, 0.85);
    font-size: var(--text-base);
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
    position: relative;
}
.nav-link:hover {
    background: rgba(31, 111, 209, 0.1);
    color: var(--brand-900);
    text-decoration: none;
}
.nav-link[aria-current="page"] {
    background: rgba(31, 111, 209, 0.18);
    color: var(--brand-900);
    font-weight: 600;
}
.nav-link[aria-current="page"]::before {
    content: "";
    position: absolute;
    left: -0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 18px;
    border-radius: 0 3px 3px 0;
    background: var(--accent-600);
}
.nav-link .icon { flex-shrink: 0; opacity: 0.85; }
.nav-link__badge {
    margin-left: auto;
    background: var(--accent-600);
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 650;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    border-radius: var(--radius-full);
    display: grid;
    place-items: center;
}

.sidebar__footer {
    padding: var(--sp-4) var(--sp-4) var(--sp-5);
    border-top: 1px solid rgba(18, 60, 116, 0.15);
    font-size: var(--text-xs);
    color: rgba(18, 60, 116, 0.6);
}
.sidebar__footer a { color: rgba(18, 60, 116, 0.8); }

/* Der Navigations-Schleier ist nur auf kleinen Geraeten aktiv und darf das
   Grid der Shell auf dem Desktop nicht beeinflussen. */
.nav-scrim { display: none; }

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

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    min-height: var(--topbar-height);
    padding: 0 var(--sp-6);
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--n-200);
}

.topbar__title { font-size: var(--text-md); font-weight: 600; color: var(--n-900); }

.topbar__bell { position: relative; }
.topbar__username {
    font-size: var(--text-sm);
    white-space: nowrap;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.topbar__badge {
    position: absolute;
    top: 1px;
    right: 0;
    transform: translate(35%, -35%);
    background: var(--accent-600);
    color: #fff;
    font-size: 0.625rem;
    font-weight: 700;
    line-height: 1;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: var(--radius-full);
    display: grid;
    place-items: center;
    border: 2px solid var(--n-0);
}
.topbar__spacer { flex: 1; }

.nav-toggle {
    display: none;
    background: none;
    border: 1px solid var(--n-200);
    border-radius: var(--radius);
    padding: 6px;
    cursor: pointer;
    color: var(--n-700);
}

.content {
    flex: 1;
    padding: var(--sp-6);
    max-width: var(--content-max);
    width: 100%;
}

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--sp-4);
    margin-bottom: var(--sp-6);
}
.page-head__text { min-width: 0; }
.page-head h1 { margin-bottom: var(--sp-1); }
.page-head__sub { color: var(--n-500); font-size: var(--text-md); margin: 0; }
.page-head__actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sp-2);
    font-size: var(--text-sm);
    color: var(--n-500);
    margin-bottom: var(--sp-2);
    padding: 0;
    list-style: none;
}
.breadcrumb li { display: flex; align-items: center; gap: var(--sp-2); }
.breadcrumb li + li::before { content: "/"; color: var(--n-300); }
.breadcrumb a { color: var(--n-500); }
.breadcrumb a:hover { color: var(--brand-700); }

/* ------------------------------------------------------------ 4. Layout */
.stack { display: flex; flex-direction: column; gap: var(--sp-6); }
.stack--tight { gap: var(--sp-4); }
.row { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; }
.row--between { justify-content: space-between; }
.row--end { justify-content: flex-end; }

.grid { display: grid; gap: var(--sp-4); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid--sidebar { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); align-items: start; }
.grid--halves { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }

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

/* ------------------------------------------------------------- 5. Karte */
.card {
    background: var(--n-0);
    border: 1px solid var(--n-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
}
.card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    padding: var(--sp-4) var(--sp-5);
    border-bottom: 1px solid var(--n-200);
}
.card__head h2, .card__head h3 { font-size: var(--text-md); font-weight: 600; }
.card__head-sub { font-size: var(--text-xs); color: var(--n-500); margin: 2px 0 0; }
.card__body { padding: var(--sp-5); }
.card__body--flush { padding: 0; }
.card__foot {
    padding: var(--sp-3) var(--sp-5);
    border-top: 1px solid var(--n-200);
    background: var(--n-25);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    font-size: var(--text-sm);
    color: var(--n-500);
}

/* --------------------------------------------------------- 6. Kennzahlen */
.stat {
    background: var(--n-0);
    border: 1px solid var(--n-200);
    border-radius: var(--radius-lg);
    padding: var(--sp-4) var(--sp-5);
    box-shadow: var(--shadow-xs);
    display: flex;
    flex-direction: column;
    gap: var(--sp-1);
    min-width: 0;
}
.stat__label {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.045em;
    color: var(--n-500);
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}
.stat__value {
    font-size: var(--text-2xl);
    font-weight: 650;
    letter-spacing: -0.022em;
    color: var(--n-900);
    line-height: 1.15;
    word-break: break-word;
}
.stat__value small { font-size: var(--text-md); font-weight: 500; color: var(--n-500); margin-left: 2px; }
.stat__meta { font-size: var(--text-xs); color: var(--n-500); }
.stat--accent { border-left: 3px solid var(--brand-700); }
.stat--success .stat__value { color: var(--success-700); }
.stat--danger .stat__value { color: var(--danger-700); }

.trend { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; font-size: var(--text-xs); }
.trend--up { color: var(--success-700); }
.trend--down { color: var(--danger-700); }
.trend--flat { color: var(--n-500); }

/* --------------------------------------------------------- 7. Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    padding: 0.5rem 0.9rem;
    font-family: inherit;
    font-size: var(--text-base);
    font-weight: 550;
    line-height: 1.3;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition);
    white-space: nowrap;
    text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }

.btn--primary { background: var(--brand-700); color: #fff; box-shadow: var(--shadow-xs); }
.btn--primary:hover:not(:disabled) { background: var(--brand-800); color: #fff; }

.btn--secondary { background: var(--n-0); color: var(--n-700); border-color: var(--border-control); box-shadow: var(--shadow-xs); }
.btn--secondary:hover:not(:disabled) { background: var(--n-50); border-color: var(--n-400); color: var(--n-900); }

.btn--ghost { background: transparent; color: var(--n-600); }
.btn--ghost:hover:not(:disabled) { background: var(--n-100); color: var(--n-900); }

.btn--accent { background: var(--accent-600); color: #fff; }
.btn--accent:hover:not(:disabled) { background: var(--accent-700); color: #fff; }

.btn--danger { background: var(--n-0); color: var(--danger-700); border-color: var(--danger-100); }
.btn--danger:hover:not(:disabled) { background: var(--danger-100); border-color: var(--danger-600); }

.btn--sm { padding: 0.3rem 0.6rem; font-size: var(--text-sm); }
.btn--lg { padding: 0.65rem 1.2rem; font-size: var(--text-md); }
.btn--block { width: 100%; }
.btn--icon { padding: 0.4rem; }

.btn-group { display: inline-flex; gap: 0; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--radius) 0 0 var(--radius); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; }

/* --------------------------------------------------------- 8. Formulare */
.form-grid { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.form-grid--single { grid-template-columns: minmax(0, 1fr); }
.field--full { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.field > label, .field__label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--n-700);
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}
.field__required { color: var(--danger-600); }
.field__hint { font-size: var(--text-xs); color: var(--n-500); }
.field__error { font-size: var(--text-xs); color: var(--danger-700); font-weight: 500; display: flex; align-items: center; gap: 4px; }

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="search"], input[type="tel"], input[type="url"],
input[type="datetime-local"], select, textarea {
    width: 100%;
    padding: 0.45rem 0.65rem;
    font-family: inherit;
    font-size: var(--text-base);
    color: var(--n-900);
    background: var(--n-0);
    border: 1px solid var(--border-control);
    border-radius: var(--radius);
    transition: border-color var(--transition), box-shadow var(--transition);
    min-height: 36px;
}
textarea { min-height: 90px; resize: vertical; line-height: 1.55; }

input:hover:not(:disabled), select:hover:not(:disabled), textarea:hover:not(:disabled) { border-color: var(--border-control-hover); }

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand-600);
    box-shadow: 0 0 0 3px var(--brand-100);
}

input:disabled, select:disabled, textarea:disabled {
    background: var(--n-100);
    color: var(--n-500);
    cursor: not-allowed;
}

input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] {
    border-color: var(--danger-600);
}
input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px var(--danger-100); }

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%2369727e' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5 6 7.5 9 4.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    padding-right: 1.9rem;
}

.check {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-2);
    font-size: var(--text-base);
    color: var(--n-700);
    cursor: pointer;
    padding: 2px 0;
}
.check input[type="checkbox"], .check input[type="radio"] {
    width: 16px; height: 16px;
    margin: 2px 0 0;
    accent-color: var(--brand-700);
    flex-shrink: 0;
    cursor: pointer;
}
.check span { min-width: 0; }
.check__hint { display: block; font-size: var(--text-xs); color: var(--n-500); }

.check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--sp-2) var(--sp-4);
}

.input-group { display: flex; align-items: stretch; }
.input-group input { border-radius: var(--radius) 0 0 var(--radius); }
.input-group .input-group__addon {
    display: flex;
    align-items: center;
    padding: 0 0.65rem;
    background: var(--n-100);
    border: 1px solid var(--n-300);
    border-left: 0;
    border-radius: 0 var(--radius) var(--radius) 0;
    color: var(--n-600);
    font-size: var(--text-sm);
    white-space: nowrap;
}

fieldset { border: 0; padding: 0; margin: 0 0 var(--sp-5); min-width: 0; }
fieldset:last-child { margin-bottom: 0; }
legend {
    font-size: var(--text-xs);
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--n-500);
    padding: 0 0 var(--sp-3);
    width: 100%;
    border-bottom: 1px solid var(--n-200);
    margin-bottom: var(--sp-4);
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-3);
    align-items: center;
    padding-top: var(--sp-5);
    margin-top: var(--sp-5);
    border-top: 1px solid var(--n-200);
}
.form-actions--sticky {
    position: sticky;
    bottom: 0;
    background: linear-gradient(to top, var(--n-0) 70%, rgba(255, 255, 255, 0));
    padding-bottom: var(--sp-2);
}

/* --------------------------------------------------------- 9. Tabellen */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-base);
}
.table th, .table td {
    padding: 0.6rem var(--sp-4);
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--n-100);
}
.table thead th {
    font-size: var(--text-xs);
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.045em;
    color: var(--n-500);
    background: var(--n-25);
    border-bottom: 1px solid var(--n-200);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}
.table thead th a { color: inherit; display: inline-flex; align-items: center; gap: 4px; }
.table thead th a:hover { color: var(--brand-700); }
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: var(--n-25); }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table td.actions, .table th.actions { text-align: right; white-space: nowrap; width: 1%; }
.table__primary { font-weight: 600; color: var(--n-900); }
.table__secondary { font-size: var(--text-xs); color: var(--n-500); display: block; margin-top: 1px; }
.table tfoot td { font-weight: 650; background: var(--n-25); border-top: 2px solid var(--n-200); }

.table--compact th, .table--compact td { padding: 0.4rem var(--sp-3); }

.table-link { color: inherit; display: block; }
.table-link:hover { color: var(--brand-700); text-decoration: none; }

/* -------------------------------------------------------- 10. Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0.15rem 0.5rem;
    font-size: var(--text-xs);
    font-weight: 600;
    line-height: 1.5;
    border-radius: var(--radius-full);
    white-space: nowrap;
    border: 1px solid transparent;
}
.badge::before {
    content: "";
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.badge--neutral { background: var(--n-100); color: var(--n-700); border-color: var(--n-200); }
.badge--muted   { background: var(--n-50); color: var(--n-500); border-color: var(--n-200); }
.badge--info    { background: var(--info-100); color: var(--info-700); border-color: rgba(28, 79, 138, 0.15); }
.badge--accent  { background: var(--accent-100); color: var(--accent-700); border-color: rgba(11, 97, 96, 0.15); }
.badge--success { background: var(--success-100); color: var(--success-700); border-color: rgba(10, 107, 69, 0.15); }
.badge--warning { background: var(--warning-100); color: var(--warning-700); border-color: rgba(138, 82, 6, 0.15); }
.badge--danger  { background: var(--danger-100); color: var(--danger-700); border-color: rgba(151, 35, 28, 0.15); }
.badge--plain::before { display: none; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0.15rem 0.55rem;
    border-radius: var(--radius-full);
    background: var(--n-100);
    color: var(--n-700);
    font-size: var(--text-xs);
    font-weight: 500;
}

.pill-group { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

/* --------------------------------------------------------- 11. Meldungen */
.alert {
    display: flex;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--radius);
    border: 1px solid;
    font-size: var(--text-base);
    align-items: flex-start;
}
.alert__icon { flex-shrink: 0; margin-top: 1px; }
.alert__body { min-width: 0; flex: 1; }
.alert__title { font-weight: 650; margin-bottom: 2px; }
.alert--success { background: var(--success-100); border-color: rgba(10, 107, 69, 0.22); color: var(--success-700); }
.alert--error, .alert--danger { background: var(--danger-100); border-color: rgba(151, 35, 28, 0.22); color: var(--danger-700); }
.alert--warning { background: var(--warning-100); border-color: rgba(138, 82, 6, 0.22); color: var(--warning-700); }
.alert--info { background: var(--info-100); border-color: rgba(28, 79, 138, 0.2); color: var(--info-700); }

.flash-region {
    position: fixed;
    top: calc(var(--topbar-height) + var(--sp-3));
    right: var(--sp-6);
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    max-width: min(430px, calc(100vw - 2rem));
}
.flash {
    box-shadow: var(--shadow-lg);
    background: var(--n-0);
    animation: flash-in 220ms cubic-bezier(0.2, 0.9, 0.3, 1);
}
@keyframes flash-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.flash__close {
    background: none;
    border: 0;
    color: inherit;
    opacity: 0.6;
    cursor: pointer;
    padding: 2px;
    line-height: 1;
}
.flash__close:hover { opacity: 1; }

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

/* ------------------------------------------------------- 12. Leerzustand */
.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--sp-12) var(--sp-6);
    gap: var(--sp-3);
}
.empty__icon {
    width: 46px; height: 46px;
    border-radius: var(--radius-lg);
    background: var(--n-100);
    display: grid;
    place-items: center;
    color: var(--n-400);
}
.empty__title { font-size: var(--text-md); font-weight: 600; color: var(--n-800); }
.empty__text { color: var(--n-500); max-width: 44ch; font-size: var(--text-base); }

.loading-bar {
    position: fixed;
    top: 0; left: 0;
    height: 2px;
    width: 0;
    background: var(--accent-600);
    z-index: 200;
    transition: width 200ms ease-out, opacity 300ms;
}
.loading-bar.is-active { width: 80%; }
.loading-bar.is-done { width: 100%; opacity: 0; }

.spinner {
    width: 15px; height: 15px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    display: inline-block;
    animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.is-busy { pointer-events: none; opacity: 0.7; }

/* ------------------------------------------------------- 13. Filterleiste */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-3);
    align-items: flex-end;
    padding: var(--sp-4) var(--sp-5);
    border-bottom: 1px solid var(--n-200);
    background: var(--n-25);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.toolbar .field { flex: 0 1 190px; }
.toolbar .field--search { flex: 1 1 260px; }
.toolbar__actions { display: flex; gap: var(--sp-2); margin-left: auto; }

.filter-summary {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
    align-items: center;
    padding: var(--sp-3) var(--sp-5);
    background: var(--brand-50);
    border-bottom: 1px solid var(--n-200);
    font-size: var(--text-sm);
    color: var(--n-600);
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-5);
    border-top: 1px solid var(--n-200);
    font-size: var(--text-sm);
    color: var(--n-500);
}
.pagination__pages { display: flex; gap: 3px; align-items: center; flex-wrap: wrap; }
.pagination__page {
    min-width: 30px; height: 30px;
    display: grid; place-items: center;
    padding: 0 6px;
    border-radius: var(--radius);
    color: var(--n-600);
    font-weight: 550;
    border: 1px solid transparent;
}
.pagination__page:hover { background: var(--n-100); text-decoration: none; color: var(--n-900); }
.pagination__page[aria-current="page"] { background: var(--brand-700); color: #fff; border-color: var(--brand-700); }
.pagination__page.is-disabled { color: var(--n-300); pointer-events: none; }

/* ---------------------------------------------------------- 14. Tabs */
.tabs {
    display: flex;
    gap: var(--sp-1);
    border-bottom: 1px solid var(--n-200);
    margin-bottom: var(--sp-5);
    overflow-x: auto;
    scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
    padding: 0.55rem 0.85rem;
    font-size: var(--text-base);
    font-weight: 550;
    color: var(--n-500);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
}
.tab:hover { color: var(--n-800); text-decoration: none; }
.tab[aria-current="page"], .tab.is-active { color: var(--brand-700); border-bottom-color: var(--brand-700); }

.segmented {
    display: inline-flex;
    background: var(--n-100);
    border-radius: var(--radius);
    padding: 2px;
    gap: 2px;
}
.segmented a, .segmented button {
    padding: 0.3rem 0.7rem;
    border-radius: 6px;
    font-size: var(--text-sm);
    font-weight: 550;
    color: var(--n-600);
    border: 0;
    background: none;
    cursor: pointer;
    font-family: inherit;
}
.segmented a:hover, .segmented button:hover { color: var(--n-900); text-decoration: none; }
.segmented a[aria-current="true"], .segmented .is-active {
    background: var(--n-0);
    color: var(--brand-700);
    box-shadow: var(--shadow-xs);
}

/* ------------------------------------------------- 15. Beschreibungsliste */
.dl { display: grid; grid-template-columns: minmax(120px, 34%) minmax(0, 1fr); gap: 0; margin: 0; }
.dl dt {
    padding: 0.5rem 0;
    font-size: var(--text-sm);
    color: var(--n-500);
    border-bottom: 1px solid var(--n-100);
}
.dl dd {
    padding: 0.5rem 0;
    margin: 0;
    border-bottom: 1px solid var(--n-100);
    color: var(--n-800);
    min-width: 0;
    word-break: break-word;
}
.dl dt:last-of-type, .dl dd:last-of-type { border-bottom: 0; }

/* --------------------------------------------------------- 16. Timeline */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
    content: "";
    position: absolute;
    left: 11px; top: 6px; bottom: 6px;
    width: 1px;
    background: var(--n-200);
}
.timeline__item { position: relative; padding: 0 0 var(--sp-5) var(--sp-8); }
.timeline__item:last-child { padding-bottom: 0; }
.timeline__dot {
    position: absolute;
    left: 0; top: 2px;
    width: 23px; height: 23px;
    border-radius: 50%;
    background: var(--n-0);
    border: 1px solid var(--n-200);
    display: grid;
    place-items: center;
    color: var(--n-500);
}
.timeline__dot--system { background: var(--n-100); }
.timeline__dot--success { background: var(--success-100); border-color: rgba(10,107,69,0.2); color: var(--success-700); }
.timeline__head { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: baseline; }
.timeline__title { font-weight: 600; color: var(--n-900); }
.timeline__meta { font-size: var(--text-xs); color: var(--n-500); }
.timeline__body { color: var(--n-600); margin-top: 2px; white-space: pre-line; }

/* ------------------------------------------------- 17. Fortschritt/Ziele */
.progress {
    height: 7px;
    background: var(--n-100);
    border-radius: var(--radius-full);
    overflow: hidden;
}
.progress__bar {
    height: 100%;
    background: var(--brand-600);
    border-radius: var(--radius-full);
    transition: width 400ms cubic-bezier(0.4, 0, 0.2, 1);
}
.progress__bar--success { background: var(--success-600); }
.progress__bar--warning { background: var(--warning-600); }
.progress__bar--accent { background: var(--accent-600); }

.goal { display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-4) 0; border-bottom: 1px solid var(--n-100); }
.goal:last-child { border-bottom: 0; padding-bottom: 0; }
.goal:first-child { padding-top: 0; }
.goal__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-3); }
.goal__name { font-weight: 600; color: var(--n-900); }
.goal__value { font-size: var(--text-sm); color: var(--n-600); white-space: nowrap; }
.goal__meta { display: flex; justify-content: space-between; font-size: var(--text-xs); color: var(--n-500); gap: var(--sp-2); }

/* -------------------------------------------------------- 18. Diagramme */
.chart { width: 100%; display: block; overflow: visible; }
.chart text { font-family: var(--font-sans); fill: var(--n-500); font-size: 10px; }
.chart .chart__grid { stroke: var(--n-100); stroke-width: 1; }
.chart .chart__axis { stroke: var(--n-200); stroke-width: 1; }
.chart .chart__bar { fill: var(--brand-600); transition: fill var(--transition); }
.chart .chart__bar:hover { fill: var(--brand-700); }
.chart .chart__bar--alt { fill: var(--accent-600); }
.chart .chart__line { fill: none; stroke: var(--brand-600); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .chart__area { fill: var(--brand-100); opacity: 0.5; }
.chart .chart__point { fill: var(--n-0); stroke: var(--brand-600); stroke-width: 2; }
.chart .chart__value { fill: var(--n-700); font-weight: 600; font-size: 10px; }

.chart-legend { display: flex; flex-wrap: wrap; gap: var(--sp-4); font-size: var(--text-xs); color: var(--n-600); margin-top: var(--sp-3); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }


/* ------------------------------------------------------ 19. Leaderboard */
.rank-list { list-style: none; margin: 0; padding: 0; }
.rank-row {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--sp-3);
    padding: 0.65rem var(--sp-5);
    border-bottom: 1px solid var(--n-100);
}
.rank-row:last-child { border-bottom: 0; }
.rank-row--self { background: var(--brand-50); }
.rank-row--self .rank-row__name { color: var(--brand-800); font-weight: 650; }
.rank-badge {
    width: 28px; height: 28px;
    border-radius: 50%;
    display: grid; place-items: center;
    font-size: var(--text-sm);
    font-weight: 650;
    background: var(--n-100);
    color: var(--n-600);
}
.rank-badge--1 { background: #f4e2b8; color: #7a5a11; }
.rank-badge--2 { background: #e4e7ec; color: #4b5563; }
.rank-badge--3 { background: #f0dccb; color: #7c4a1e; }
.rank-row__name { font-weight: 550; color: var(--n-800); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row__value { font-weight: 650; color: var(--n-900); font-variant-numeric: tabular-nums; }

.podium { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-3); margin-bottom: var(--sp-5); }
.podium__item {
    background: var(--n-0);
    border: 1px solid var(--n-200);
    border-radius: var(--radius-lg);
    padding: var(--sp-4);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-2);
}
.podium__item--1 { border-color: #e3c98b; background: linear-gradient(180deg, #fdf8ec, var(--n-0)); }
.podium__avatar {
    width: 42px; height: 42px;
    border-radius: 50%;
    background: var(--brand-100);
    color: var(--brand-800);
    display: grid; place-items: center;
    font-weight: 650;
}
.podium__name { font-weight: 600; font-size: var(--text-base); }
.podium__value { font-size: var(--text-xl); font-weight: 650; color: var(--brand-800); }

/* ----------------------------------------------------- 20. Avatar/Menü */
.avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: var(--brand-100);
    color: var(--brand-800);
    display: grid;
    place-items: center;
    font-size: var(--text-xs);
    font-weight: 650;
    flex-shrink: 0;
}
.avatar--lg { width: 44px; height: 44px; font-size: var(--text-md); }

.dropdown { position: relative; }
.dropdown__panel {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 240px;
    background: var(--n-0);
    border: 1px solid var(--n-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--sp-2);
    z-index: 60;
}
.dropdown__panel[hidden] { display: none; }
.dropdown__item {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: 0.45rem var(--sp-3);
    border-radius: var(--radius);
    color: var(--n-700);
    font-size: var(--text-base);
    width: 100%;
    background: none;
    border: 0;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
}
.dropdown__item:hover { background: var(--n-100); color: var(--n-900); text-decoration: none; }
.dropdown__divider { height: 1px; background: var(--n-200); margin: var(--sp-2) 0; }
.dropdown__head { padding: var(--sp-2) var(--sp-3); border-bottom: 1px solid var(--n-200); margin-bottom: var(--sp-2); }

.notif-item {
    display: flex;
    gap: var(--sp-3);
    padding: var(--sp-3);
    border-radius: var(--radius);
    align-items: flex-start;
}
.notif-item:hover { background: var(--n-50); text-decoration: none; }
.notif-item--unread { background: var(--brand-50); }
.notif-item__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand-600); margin-top: 6px; flex-shrink: 0; }
.notif-item__title { font-weight: 600; color: var(--n-900); font-size: var(--text-base); }
.notif-item__body { color: var(--n-600); font-size: var(--text-sm); }
.notif-item__time { color: var(--n-400); font-size: var(--text-xs); margin-top: 2px; }

/* ---------------------------------------------------------- 21. Dialog */
dialog {
    border: 0;
    border-radius: var(--radius-xl);
    padding: 0;
    box-shadow: var(--shadow-lg);
    max-width: min(560px, calc(100vw - 2rem));
    width: 100%;
    color: inherit;
    background: var(--n-0);
}
dialog::backdrop { background: rgba(23, 28, 36, 0.45); backdrop-filter: blur(2px); }
.dialog__head { padding: var(--sp-5) var(--sp-5) var(--sp-3); }
.dialog__body { padding: 0 var(--sp-5) var(--sp-5); }
.dialog__foot {
    display: flex;
    justify-content: flex-end;
    gap: var(--sp-2);
    padding: var(--sp-4) var(--sp-5);
    background: var(--n-25);
    border-top: 1px solid var(--n-200);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* ---------------------------------------------------- 22. Auth-Layout */
.auth {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: var(--sp-6);
    background: var(--n-50);
}
.auth__panel {
    width: 100%;
    max-width: 420px;
    padding: var(--sp-8);
    background: var(--n-0);
    border: 1px solid var(--n-200);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
}
.auth__brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-2);
    margin-bottom: var(--sp-6);
    text-align: center;
}
.auth__logo {
    display: block;
    width: min(220px, 75%);
    height: auto;
}
.auth__portal {
    color: var(--n-500);
    font-size: var(--text-sm);
    font-weight: 550;
    letter-spacing: 0.015em;
}
.auth__panel h1 {
    margin-bottom: var(--sp-5);
    font-size: var(--text-xl);
    text-align: center;
}
.auth__panel .field { margin-bottom: var(--sp-4); }
.auth__foot { margin-top: var(--sp-5); font-size: var(--text-sm); color: var(--n-500); text-align: center; }

@media (max-width: 520px) {
    .auth { padding: var(--sp-4); }
    .auth__panel {
        padding: var(--sp-6);
        border-radius: var(--radius-lg);
    }
}

/* ------------------------------------------------------- 23. Installer */
.install { min-height: 100vh; background: var(--n-50); padding: var(--sp-8) var(--sp-4); }
.install__inner { max-width: 760px; margin: 0 auto; }
.install__brand { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-6); color: var(--n-900); }
.steps { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-6); list-style: none; padding: 0; }
.step {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: 0.3rem 0.7rem;
    border-radius: var(--radius-full);
    background: var(--n-0);
    border: 1px solid var(--n-200);
    font-size: var(--text-xs);
    font-weight: 550;
    color: var(--n-500);
}
.step__num {
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--n-200);
    color: var(--n-600);
    display: grid; place-items: center;
    font-size: 0.6875rem;
    font-weight: 650;
}
.step.is-current { border-color: var(--brand-600); color: var(--brand-800); background: var(--brand-50); }
.step.is-current .step__num { background: var(--brand-700); color: #fff; }
.step.is-done { color: var(--success-700); border-color: rgba(10, 107, 69, 0.25); background: var(--success-100); }
.step.is-done .step__num { background: var(--success-600); color: #fff; }

.check-list { list-style: none; margin: 0; padding: 0; }
.check-list li {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--n-100);
}
.check-list li:last-child { border-bottom: 0; }
.check-list__status { flex-shrink: 0; margin-top: 1px; }
.check-list__name { font-weight: 550; color: var(--n-800); }
.check-list__hint { font-size: var(--text-xs); color: var(--n-500); }
.check-list__value { margin-left: auto; font-size: var(--text-sm); color: var(--n-600); font-family: var(--font-mono); white-space: nowrap; }
.status-ok { color: var(--success-600); }
.status-warn { color: var(--warning-600); }
.status-fail { color: var(--danger-600); }

/* -------------------------------------------------------- 24. Hilfsmittel */
.text-muted { color: var(--n-500); }
.text-strong { font-weight: 650; color: var(--n-900); }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.text-lg { font-size: var(--text-lg); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-success { color: var(--success-700); }
.text-danger { color: var(--danger-700); }
.text-warning { color: var(--warning-700); }
.text-nowrap { white-space: nowrap; }
.text-break { word-break: break-word; }
.mono { font-family: var(--font-mono); font-size: 0.85em; }
.num { font-variant-numeric: tabular-nums; }

.mt-0 { margin-top: 0; } .mt-2 { margin-top: var(--sp-2); } .mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); } .mt-5 { margin-top: var(--sp-5); } .mt-6 { margin-top: var(--sp-6); }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: var(--sp-2); } .mb-3 { margin-bottom: var(--sp-3); }
.mb-4 { margin-bottom: var(--sp-4); } .mb-5 { margin-bottom: var(--sp-5); } .mb-6 { margin-bottom: var(--sp-6); }
.gap-2 { gap: var(--sp-2); } .gap-3 { gap: var(--sp-3); } .gap-4 { gap: var(--sp-4); }
.w-full { width: 100%; }
.flex-1 { flex: 1; }
.hidden { display: none !important; }

.divider { height: 1px; background: var(--n-200); margin: var(--sp-5) 0; }

.copy-field {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    background: var(--n-50);
    border: 1px solid var(--n-200);
    border-radius: var(--radius);
    padding: var(--sp-2) var(--sp-3);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    word-break: break-all;
}
.copy-field code { background: none; padding: 0; flex: 1; min-width: 0; }

.kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--sp-4); }
.kv { display: flex; flex-direction: column; gap: 2px; }
.kv__label { font-size: var(--text-xs); color: var(--n-500); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.kv__value { font-size: var(--text-md); color: var(--n-900); font-weight: 550; }

.icon { width: 17px; height: 17px; stroke-width: 1.7; flex-shrink: 0; }
.icon--sm { width: 14px; height: 14px; }
.icon--lg { width: 22px; height: 22px; }

/* --------------------------------------------------------- 25. Responsive */
@media (max-width: 1024px) {
    :root { --sidebar-width: 0px; }

    .shell { grid-template-columns: minmax(0, 1fr); }

    .sidebar {
        position: fixed;
        top: 0; left: 0;
        width: 268px;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 220ms cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: var(--shadow-lg);
    }
    .sidebar.is-open { transform: translateX(0); }

    .nav-toggle { display: inline-flex; }

    .nav-scrim {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(23, 28, 36, 0.4);
        z-index: 99;
        opacity: 0;
        pointer-events: none;
        transition: opacity 200ms;
    }
    .nav-scrim.is-visible { opacity: 1; pointer-events: auto; }

    .content { padding: var(--sp-4); }
    .topbar { padding: 0 var(--sp-4); }

    /* Auf kleinen Geräten erscheinen Meldungen im Fluss statt schwebend,
       damit sie die Seitenüberschrift nicht verdecken. */
    .flash-region {
        position: static;
        max-width: none;
        padding: var(--sp-4) var(--sp-4) 0;
    }
    .flash { box-shadow: var(--shadow-sm); }
}

@media (max-width: 720px) {
    h1 { font-size: var(--text-xl); }
    /* Beträge sollen in schmalen Kacheln nicht umbrechen. */
    .stat__value { font-size: var(--text-xl); }
    .stat__value small { font-size: var(--text-base); }
    .page-head { flex-direction: column; align-items: stretch; }
    .page-head__actions .btn { flex: 1; }
    .grid--3, .grid--4 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
    .podium { grid-template-columns: minmax(0, 1fr); }
    .dl { grid-template-columns: minmax(0, 1fr); }
    .dl dt { padding-bottom: 0; border-bottom: 0; font-weight: 600; }
    .dl dd { padding-top: 2px; }
    .toolbar { padding: var(--sp-3) var(--sp-4); }
    .toolbar .field, .toolbar .field--search { flex: 1 1 100%; }
    .toolbar__actions { margin-left: 0; width: 100%; }
    .toolbar__actions .btn { flex: 1; }
    .card__body { padding: var(--sp-4); }

    /* Datenreiche Tabellen werden zu Karten, statt horizontal zu überlaufen. */
    .table--responsive,
    .table--responsive tbody,
    .table--responsive tfoot { display: block; width: 100%; }
    .table--responsive thead { display: none; }
    .table--responsive tbody tr {
        display: block;
        padding: var(--sp-3) var(--sp-4);
        border-bottom: 1px solid var(--n-200);
    }
    .table--responsive tbody tr:hover { background: transparent; }
    .table--responsive td {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: var(--sp-4);
        padding: 0.2rem 0;
        border: 0;
        text-align: right;
    }
    .table--responsive td::before {
        content: attr(data-label);
        font-size: var(--text-xs);
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--n-500);
        text-align: left;
        flex-shrink: 0;
    }
    .table--responsive td:empty { display: none; }
    .table--responsive td[data-label=""]::before { display: none; }
    .table--responsive td.actions { justify-content: flex-end; padding-top: var(--sp-2); }
    .table--responsive .table__secondary { display: inline; margin: 0; }
    .table--responsive tfoot td { justify-content: space-between; }
    .table-wrap { overflow-x: visible; }

    .topbar__username { display: none; }
    .pagination { flex-direction: column; align-items: stretch; text-align: center; }
    .pagination__pages { justify-content: center; }
    .rank-row { padding: 0.6rem var(--sp-4); }
    .form-actions .btn { flex: 1; }
}

/* ------------------------------------------------------------ 26. Druck */
@media print {
    body { background: #fff; color: #000; font-size: 10pt; }
    .sidebar, .topbar, .flash-region, .page-head__actions, .toolbar, .pagination, .no-print { display: none !important; }
    .shell { display: block; }
    .content { padding: 0; max-width: none; }
    .card { border: 0; box-shadow: none; }
    .card__head { padding-left: 0; padding-right: 0; }
    .card__body { padding-left: 0; padding-right: 0; }
    a { color: #000; text-decoration: none; }
    .table thead th { background: #f2f2f2 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .statement { box-shadow: none; border: 0; margin: 0; padding: 0; max-width: none; }
    @page { margin: 16mm; }
}

/* -------------------------------------------------------- 27. Abrechnung */
.statement {
    background: var(--n-0);
    border: 1px solid var(--n-200);
    border-radius: var(--radius-lg);
    padding: var(--sp-10);
    max-width: 900px;
    margin: 0 auto;
    box-shadow: var(--shadow-sm);
}
.statement__head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--sp-6); padding-bottom: var(--sp-5); border-bottom: 2px solid var(--n-200); }
.statement__title { font-size: var(--text-2xl); font-weight: 650; color: var(--brand-800); letter-spacing: -0.02em; }
.statement__party { font-size: var(--text-base); color: var(--n-700); line-height: 1.6; }
.statement__party strong { display: block; color: var(--n-900); font-size: var(--text-md); }
.statement__meta { display: grid; grid-template-columns: auto auto; gap: 0.35rem var(--sp-4); font-size: var(--text-sm); align-content: start; }
.statement__meta dt { color: var(--n-500); }
.statement__meta dd { margin: 0; font-weight: 600; color: var(--n-900); text-align: right; }
.statement__totals { margin-left: auto; max-width: 340px; margin-top: var(--sp-5); }
.statement__totals .row { justify-content: space-between; padding: 0.35rem 0; }
.statement__grand {
    border-top: 2px solid var(--n-300);
    margin-top: var(--sp-2);
    padding-top: var(--sp-3) !important;
    font-size: var(--text-lg);
    font-weight: 650;
    color: var(--brand-800);
}
.statement__note { margin-top: var(--sp-8); font-size: var(--text-xs); color: var(--n-500); line-height: 1.6; }
