/* ============================================================
   Budget & Finance Planner – CSS
   Design: Clean / Industrial / Data-focused
   Farbschema: Dunkles Neutralgrau + präzise Akzente
   (Design-System identisch zur Trainingsapp)
   ============================================================ */

/* --- Custom Properties ------------------------------------ */
:root {
    /* Farben */
    --c-bg:         #0f1117;
    --c-surface:    #181c25;
    --c-surface-2:  #1e2333;
    --c-border:     #272d3f;
    --c-border-2:   #323a52;
    --c-text:       #dde2ee;
    --c-text-muted: #7a85a3;
    --c-text-dim:   #4d5670;

    /* Akzentfarben (Trainingskategorien) */
    --c-wettkampf:  #e53935;
    --c-sprint:     #fdd835;
    --c-intervall:  #8e24aa;
    --c-ausdauer:   #43a047;
    --c-kraft:      #1e88e5;
    --c-regen:      #607d8b;
    --c-radfahren:  #2e7d32;

    /* UI-Akzent */
    --c-accent:     #4f8ef7;
    --c-accent-dim: rgba(79, 142, 247, 0.15);
    --c-success:    #43a047;
    --c-error:      #e53935;
    --c-warning:    #fb8c00;

    /* Typografie */
    --font: 'DM Mono', 'Fira Code', 'Consolas', monospace;
    --font-ui: system-ui, -apple-system, sans-serif;

    /* Abstände */
    --r: 6px;          /* border-radius klein */
    --r-md: 10px;
    --r-lg: 14px;

    /* Layout */
    --sidebar-w: 220px;
    --header-h: 56px;
}

/* --- Reset ------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font-ui);
    background: var(--c-bg);
    color: var(--c-text);
    line-height: 1.6;
    min-height: 100vh;
}
a { color: var(--c-accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: block; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* --- App-Layout ------------------------------------------- */
.app-layout {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh;
}

/* --- Sidebar ---------------------------------------------- */
.sidebar {
    background: var(--c-surface);
    border-right: 1px solid var(--c-border);
    display: flex;
    flex-direction: column;
    padding: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 18px;
    border-bottom: 1px solid var(--c-border);
    color: var(--c-text);
}

.sidebar__logo {
    width: 28px; height: 28px;
    color: var(--c-accent);
    flex-shrink: 0;
}

.sidebar__name {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--c-text-muted);
}

.nav-list {
    list-style: none;
    padding: 12px 10px;
    flex: 1;
}

.nav-list--admin {
    border-top: 1px solid var(--c-border);
    margin-top: auto;
    flex: 0;
}

.nav-section-label {
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--c-text-dim);
    padding: 10px 8px 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--r);
    color: var(--c-text-muted);
    font-size: 14px;
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
}

.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; }

.nav-link:hover {
    background: var(--c-surface-2);
    color: var(--c-text);
    text-decoration: none;
}

.nav-link--active {
    background: var(--c-accent-dim);
    color: var(--c-accent);
}

.sidebar__footer {
    padding: 14px 18px;
    border-top: 1px solid var(--c-border);
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: space-between;
}

.sidebar__user {
    font-size: 13px;
    color: var(--c-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- Main Content ----------------------------------------- */
.main-content {
    padding: 32px 36px;
    max-width: 1100px;
}

.page-header {
    margin-bottom: 28px;
}

.page-header h2 {
    font-size: 22px;
    font-weight: 600;
    color: var(--c-text);
}

/* --- Cards ------------------------------------------------ */
.card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    padding: 22px 24px;
    margin-bottom: 20px;
}

.card__title {
    font-size: 14px;
    font-weight: 600;
    color: var(--c-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--c-border);
}

/* --- Buttons ---------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--r);
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s, border-color 0.15s, opacity 0.15s;
    line-height: 1;
    cursor: pointer;
    text-decoration: none;
}

.btn--primary {
    background: var(--c-accent);
    color: #fff;
    border-color: var(--c-accent);
}
.btn--primary:hover { opacity: 0.88; }

.btn--ghost {
    background: transparent;
    color: var(--c-text-muted);
    border-color: var(--c-border-2);
}
.btn--ghost:hover { background: var(--c-surface-2); color: var(--c-text); }

.btn--danger {
    background: var(--c-error);
    color: #fff;
    border-color: var(--c-error);
}
.btn--danger:hover { opacity: 0.85; }

.btn--sm { padding: 5px 12px; font-size: 13px; }
.btn--full { width: 100%; justify-content: center; }

/* --- Forms ----------------------------------------------- */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    color: var(--c-text-muted);
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    background: var(--c-bg);
    border: 1px solid var(--c-border-2);
    border-radius: var(--r);
    padding: 9px 12px;
    color: var(--c-text);
    font-size: 14px;
    transition: border-color 0.15s;
    -webkit-appearance: none;
    color-scheme: dark;
}

/* Kalender- und Uhr-Icons aufhellen */
input[type="date"],
input[type="time"],
input[type="datetime-local"] {
    color-scheme: dark;
    background-color: var(--c-bg);
    box-sizing: border-box;
    max-width: 100%;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 16px;
    color: transparent;
    cursor: pointer;
    opacity: 0.9;
    width: 20px;
    height: 20px;
}

input[type="time"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpolyline points='12 6 12 12 16 14'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 16px;
    color: transparent;
    cursor: pointer;
    opacity: 0.9;
    width: 20px;
    height: 20px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--c-accent);
    box-shadow: 0 0 0 3px var(--c-accent-dim);
}

.form-group select {
    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='%237a85a3' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

.form-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: flex-end;
}

.form-inline .form-group {
    margin-bottom: 0;
    flex: 1;
    min-width: 160px;
}

/* --- Flash-Nachrichten ------------------------------------ */
.flash {
    padding: 11px 16px;
    border-radius: var(--r);
    font-size: 14px;
    margin-bottom: 16px;
    border-left: 3px solid;
}

.flash--success {
    background: rgba(67, 160, 71, 0.12);
    color: #81c784;
    border-color: var(--c-success);
}

.flash--error {
    background: rgba(229, 57, 53, 0.12);
    color: #ef9a9a;
    border-color: var(--c-error);
}

.flash--info {
    background: rgba(79, 142, 247, 0.1);
    color: var(--c-accent);
    border-color: var(--c-accent);
}

/* --- Tabellen --------------------------------------------- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--c-text-dim);
    border-bottom: 1px solid var(--c-border);
}

.data-table td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--c-border);
    color: var(--c-text);
    vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--c-surface-2); }
.row--inactive td { opacity: 0.45; }
.actions { display: flex; gap: 6px; }

/* --- Badges ----------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.badge--admin    { background: rgba(79,142,247,0.15); color: #82b4ff; }
.badge--athlet   { background: rgba(67,160,71,0.15);  color: #81c784; }
.badge--aktiv    { background: rgba(67,160,71,0.15);  color: #81c784; }
.badge--inaktiv  { background: rgba(229,57,53,0.12);  color: #ef9a9a; }

/* Kategorie-Badges */
.kat { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* --- Modal ------------------------------------------------ */
.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px 0;
    align-items: flex-start;
    justify-content: center;
}
.modal { display: none; }
.modal.modal--open { display: flex; }

.modal__backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.65);
}

.modal__box {
    position: relative;
    z-index: 101;
    background: var(--c-surface);
    border: 1px solid var(--c-border-2);
    border-radius: var(--r-lg);
    padding: 24px 20px 20px;
    width: calc(100% - 16px);
    max-width: 600px;
    margin: auto;
}

.modal__body {
    /* modal selbst scrollt */
}

.modal__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--c-border);
}

@media (max-width: 600px) {
    .modal__actions {
        flex-direction: column;
        align-items: stretch;
    }
    .modal__actions .btn {
        text-align: center;
        width: 100%;
    }
    .modal__actions div[style*="flex:1"] {
        display: none;
    }
}

.modal__box h3 {
    font-size: 17px;
    margin-bottom: 6px;
}

.modal__box p {
    font-size: 14px;
    color: var(--c-text-muted);
    margin-bottom: 20px;
}

.modal__actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* --- Login-Seite ------------------------------------------ */
.page--login {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--c-bg);
}

.login-wrap { width: 100%; padding: 20px; }

.login-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--r-lg);
    padding: 40px;
    max-width: 400px;
    margin: 0 auto;
}

.login-header {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo {
    width: 44px; height: 44px;
    color: var(--c-accent);
    margin: 0 auto 14px;
}

.login-header h1 {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 4px;
}

.login-sub {
    font-size: 13px;
    color: var(--c-text-muted);
}

/* --- Kalender-Farben (werden inline als style="" verwendet) - */
/* Kategorie-Farben via CSS-Custom-Properties */
.kat-wettkampf  { --kat-c: var(--c-wettkampf); }
.kat-sprint     { --kat-c: var(--c-sprint); }
.kat-intervall  { --kat-c: var(--c-intervall); }
.kat-ausdauer   { --kat-c: var(--c-ausdauer); }
.kat-kraft      { --kat-c: var(--c-kraft); }
.kat-regen      { --kat-c: var(--c-regen); }
.kat-radfahren  { --kat-c: var(--c-radfahren); }

/* --- Pace-Matrix ------------------------------------------ */
.pace-table { font-family: var(--font); }
.pace-table th,
.pace-table td { text-align: right; }
.pace-table td:first-child,
.pace-table th:first-child { text-align: left; }

.pace-100 { color: var(--c-text); font-weight: 600; }
.pace-95  { color: #a5b4fc; }
.pace-90  { color: #93c5fd; }
.pace-85  { color: #6ee7b7; }
.pace-80  { color: #86efac; }

/* --- Statistik-Diagramme ---------------------------------- */
.chart-wrap {
    position: relative;
    height: 240px;
    margin-top: 10px;
}

/* --- Health-Monitor --------------------------------------- */
.health-bar-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 13px;
}
.health-bar {
    flex: 1;
    height: 8px;
    background: var(--c-border);
    border-radius: 4px;
    overflow: hidden;
}
.health-bar__fill {
    height: 100%;
    border-radius: 4px;
    background: var(--c-accent);
    transition: width 0.4s;
}

/* --- Responsive ------------------------------------------- */
@media (max-width: 768px) {
    .app-layout {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: static;
        height: auto;
        flex-direction: row;
        flex-wrap: wrap;
    }
    .main-content {
        padding: 20px 16px;
    }
}

/* --- PWA / Safe Area -------------------------------------- */
@supports (padding: env(safe-area-inset-bottom)) {
    .sidebar__footer {
        padding-bottom: calc(14px + env(safe-area-inset-bottom));
    }
}

/* ============================================================
   Kalender – Phase 3
   ============================================================ */

/* --- Kalender Header -------------------------------------- */
.kalender-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.kalender-nav {
    display: flex;
    align-items: center;
    gap: 14px;
}

.kalender-nav h2 {
    font-size: 20px;
    font-weight: 600;
    min-width: 200px;
    text-align: center;
}

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

/* --- Kategorie-Legende ------------------------------------ */
.kat-legende {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 20px;
    margin-bottom: 16px;
}

.kat-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--c-text-muted);
}

.kat-dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* --- Kalender-Grid --------------------------------------- */
.kalender-wrap {
    padding: 0;
    overflow: hidden;
}

.kalender-wochentage {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-bottom: 1px solid var(--c-border);
}

.kalender-wt {
    padding: 10px 0;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--c-text-dim);
}

.kalender-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.kalender-loading {
    grid-column: 1 / -1;
    padding: 40px;
    text-align: center;
    color: var(--c-text-muted);
    font-size: 14px;
}

/* --- Einzelner Tag --------------------------------------- */
.kalender-tag {
    min-height: 100px;
    border-right: 1px solid var(--c-border);
    border-bottom: 1px solid var(--c-border);
    padding: 6px;
    position: relative;
    cursor: pointer;
    transition: background 0.1s;
}

.kalender-tag:hover { background: var(--c-surface-2); }
.kalender-tag:nth-child(7n) { border-right: none; }

.kalender-tag--leer {
    background: rgba(0,0,0,0.1);
    cursor: default;
}
.kalender-tag--leer:hover { background: rgba(0,0,0,0.1); }

.kalender-tag--heute .kalender-tag__nr {
    background: var(--c-accent);
    color: #fff;
    border-radius: 50%;
    width: 22px; height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.kalender-tag__nr {
    font-size: 12px;
    color: var(--c-text-muted);
    display: inline-flex;
    width: 22px; height: 22px;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
    flex-shrink: 0;
}

.kalender-tag__termine {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.kalender-tag__add {
    position: absolute;
    bottom: 4px; right: 4px;
    width: 20px; height: 20px;
    border-radius: 50%;
    border: 1px solid var(--c-border-2);
    background: transparent;
    color: var(--c-text-dim);
    font-size: 14px;
    line-height: 1;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.1s, color 0.1s;
    padding: 0;
}

.kalender-tag:hover .kalender-tag__add { display: flex; }
.kalender-tag__add:hover {
    background: var(--c-accent);
    color: #fff;
    border-color: var(--c-accent);
}

/* --- Termin-Chip ----------------------------------------- */
.kal-termin {
    border-left: 3px solid;
    background: var(--c-surface-2);
    border-radius: 3px;
    padding: 2px 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    transition: filter 0.1s;
}

.kal-termin:hover { filter: brightness(1.15); }

.kal-termin__name {
    font-size: 11px;
    color: var(--c-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

/* --- Score-Badge ----------------------------------------- */
.kal-score {
    font-size: 10px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 3px;
    flex-shrink: 0;
}
.kal-score--niedrig { background: rgba(67,160,71,0.25); color: #81c784; }
.kal-score--mittel  { background: rgba(251,140,0,0.25);  color: #ffb74d; }
.kal-score--hoch    { background: rgba(229,57,53,0.25);  color: #ef9a9a; }

/* --- Score Slider im Modal ------------------------------ */
.score-slider {
    width: 100%;
    -webkit-appearance: none;
    height: 5px;
    background: var(--c-border-2);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}
.score-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px; height: 16px;
    background: var(--c-accent);
    border-radius: 50%;
}

.score-badge {
    display: inline-flex;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 8px;
    background: var(--c-border);
    color: var(--c-text-muted);
}
.score-badge--niedrig { background: rgba(67,160,71,0.2);  color: #81c784; }
.score-badge--mittel  { background: rgba(251,140,0,0.2);  color: #ffb74d; }
.score-badge--hoch    { background: rgba(229,57,53,0.2);  color: #ef9a9a; }

.score-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--c-text-dim);
    margin-top: 4px;
}

/* --- Dauer-Eingabe -------------------------------------- */
.dauer-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}
.dauer-input {
    width: 64px !important;
    text-align: center;
}
.dauer-sep {
    color: var(--c-text-muted);
    font-weight: 600;
}

/* --- Wochentage-Picker ---------------------------------- */
.wochentage-picker {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.wt-btn {
    cursor: pointer;
}
.wt-btn input { display: none; }
.wt-btn span {
    display: flex;
    width: 38px; height: 38px;
    align-items: center;
    justify-content: center;
    border-radius: var(--r);
    border: 1px solid var(--c-border-2);
    font-size: 13px;
    font-weight: 500;
    color: var(--c-text-muted);
    transition: background 0.1s, color 0.1s, border-color 0.1s;
}
.wt-btn input:checked + span {
    background: var(--c-accent-dim);
    border-color: var(--c-accent);
    color: var(--c-accent);
}
.wt-btn:hover span { border-color: var(--c-accent); }

/* --- Form-Row (zwei Spalten) ---------------------------- */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* --- Modal groß ----------------------------------------- */
.modal__box--lg { width: min(600px, 94vw); }

/* --- Responsive ----------------------------------------- */
@media (max-width: 640px) {
    .kalender-tag { min-height: 60px; }
    .kal-termin__name { display: none; }
    .form-row { grid-template-columns: 1fr; }
    .kalender-nav h2 { min-width: 140px; font-size: 16px; }
}

/* ============================================================
   Bestleistungen – Phase 4
   ============================================================ */

.bl-loading,
.bl-leer {
    color: var(--c-text-muted);
    font-size: 14px;
    padding: 32px;
    text-align: center;
}

/* --- Distanz-Gruppe --------------------------------------- */
.bl-gruppe {
    margin-bottom: 20px;
    padding: 0;
    overflow: hidden;
}

.bl-gruppe__header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--c-border);
}

.bl-distanz-titel {
    font-size: 15px;
    font-weight: 600;
    color: var(--c-text);
}

.bl-beste-zeit {
    font-size: 18px;
    font-weight: 700;
    color: var(--c-accent);
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-family: var(--font);
}

.bl-beste-label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--c-text-dim);
    font-family: var(--font-ui);
}

/* --- Tabellen-Zeilen -------------------------------------- */
.bl-gruppe .data-table th:first-child,
.bl-gruppe .data-table td:first-child {
    padding-left: 20px;
}
.bl-gruppe .data-table th:last-child,
.bl-gruppe .data-table td:last-child {
    padding-right: 20px;
}
.bl-gruppe .data-table tr:last-child td {
    border-bottom: none;
}

.bl-zeit {
    font-family: var(--font);
    font-size: 15px;
    font-weight: 500;
    color: var(--c-text);
}

.bl-zeit--top {
    color: var(--c-accent);
}

.bl-row--beste td {
    background: rgba(79, 142, 247, 0.04);
}

.bl-notiz {
    color: var(--c-text-muted);
    font-size: 13px;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- Formular-Hinweis ------------------------------------ */
.form-hint {
    font-size: 11px;
    color: var(--c-text-dim);
    font-weight: 400;
    margin-left: 6px;
}

/* --- Page-Header mit Button ----------------------------- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 28px;
}

/* ============================================================
   Pace-Matrix – Phase 5
   ============================================================ */

.page-sub {
    font-size: 13px;
    color: var(--c-text-muted);
    margin-top: 4px;
}

/* --- Legende ---------------------------------------------- */
.pace-legende {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 24px;
    margin-bottom: 20px;
    font-size: 13px;
    color: var(--c-text-muted);
}

.pace-legend-item {
    display: flex;
    align-items: center;
    gap: 7px;
}

.pace-legend-hinweis {
    color: var(--c-text-dim);
    font-size: 12px;
}

.pace-quelle-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-block;
}

.pace-quelle-dot--eigen  { background: var(--c-accent); }
.pace-quelle-dot--riegel {
    background: transparent;
    border: 1.5px solid var(--c-text-dim);
}

/* Quellenhinweis in der Distanz-Zelle (z. B. "aus 400 m") */
.pace-quelle-label {
    font-size: 11px;
    color: var(--c-text-dim);
    margin-left: 4px;
    white-space: nowrap;
}

/* Hinweis in der Legende */
.pace-legend-sub {
    font-size: 11px;
    color: var(--c-text-dim);
}

/* --- Karte ------------------------------------------------ */
.pace-card {
    padding: 0;
    overflow: hidden;
    margin-bottom: 20px;
}

.pace-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--c-border);
}

.pace-card__header h3 {
    font-size: 15px;
    font-weight: 600;
}

.pace-einheit-badge {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--c-text-dim);
    background: var(--c-surface-2);
    border: 1px solid var(--c-border);
    padding: 3px 8px;
    border-radius: 20px;
}

.pace-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* --- Tabelle ---------------------------------------------- */
.pace-table {
    font-family: var(--font);
    font-size: 14px;
    min-width: 480px;
}

.pace-table th,
.pace-table td {
    text-align: right;
    padding: 11px 16px;
}

.pace-table th:first-child,
.pace-table td:first-child {
    text-align: left;
    padding-left: 20px;
}

.pace-table th:last-child,
.pace-table td:last-child {
    padding-right: 20px;
}

.pace-th-distanz {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--c-text-dim);
    border-bottom: 1px solid var(--c-border);
    font-family: var(--font-ui);
}

.pace-td-distanz {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--c-text-muted);
    font-family: var(--font-ui);
    font-size: 13px;
    white-space: nowrap;
}

.pace-td {
    font-weight: 500;
    white-space: nowrap;
}

.pace-td--leer {
    color: var(--c-text-dim);
    font-weight: 400;
}

/* --- Prozentwert-Farben ----------------------------------- */
.pace-100 { color: var(--c-text);    font-weight: 700; }
.pace-95  { color: #a5b4fc; }
.pace-90  { color: #7dd3fc; }
.pace-85  { color: #6ee7b7; }
.pace-80  { color: #86efac; }

/* Tabellenkopf-Farben */
thead .pace-95  { color: #818cf8; }
thead .pace-90  { color: #38bdf8; }
thead .pace-85  { color: #34d399; }
thead .pace-80  { color: #4ade80; }

/* --- Zustände -------------------------------------------- */
.pace-loading,
.pace-leer {
    color: var(--c-text-muted);
    font-size: 14px;
    padding: 40px 32px;
    text-align: center;
}

/* ============================================================
   Statistik & Health-Monitor – Phase 6
   ============================================================ */

/* --- Kennzahlen-Kacheln ----------------------------------- */
.stat-kacheln {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

.stat-kachel {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat-kachel__wert {
    font-size: 28px;
    font-weight: 700;
    color: var(--c-text);
    font-family: var(--font);
    line-height: 1;
}

.stat-kachel__wert--score {
    color: var(--c-text-muted);
}

.stat-kachel__label {
    font-size: 12px;
    color: var(--c-text-dim);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-weight: 500;
}

/* --- Statistik-Karte -------------------------------------- */
.stat-card {
    padding: 0;
    overflow: hidden;
    margin-bottom: 20px;
}

.stat-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 14px;
    border-bottom: 1px solid var(--c-border);
    flex-wrap: wrap;
    gap: 10px;
}

.stat-card__header h3 {
    font-size: 15px;
    font-weight: 600;
}

/* --- Tabs ------------------------------------------------- */
.stat-tabs,
.health-tab {
    display: flex;
    gap: 4px;
}

.stat-tab,
.health-tab {
    padding: 5px 12px;
    border-radius: var(--r);
    border: 1px solid var(--c-border-2);
    background: transparent;
    color: var(--c-text-muted);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.stat-tab:hover,
.health-tab:hover {
    background: var(--c-surface-2);
    color: var(--c-text);
}

.stat-tab--active,
.health-tab--active {
    background: var(--c-accent-dim);
    border-color: var(--c-accent);
    color: var(--c-accent);
}

/* --- Chart-Bereich ---------------------------------------- */
.stat-chart-wrap {
    padding: 20px 20px 8px;
    height: 280px;
    position: relative;
}

/* --- Legende ---------------------------------------------- */
.stat-legende {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    padding: 12px 20px 16px;
    border-top: 1px solid var(--c-border);
}

.stat-legend-item {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: var(--c-text-muted);
}

.stat-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}

/* --- Health-Skala ----------------------------------------- */
.health-skala {
    display: flex;
    gap: 20px;
    padding: 10px 20px 16px;
    font-size: 12px;
    border-top: 1px solid var(--c-border);
}

/* --- Responsive ------------------------------------------- */
@media (max-width: 768px) {
    .stat-kacheln {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .stat-kacheln {
        grid-template-columns: 1fr 1fr;
    }
    .stat-chart-wrap {
        height: 220px;
    }
}

/* ============================================================
}

/* ============================================================
   Burger-Menü & Mobile Navigation – Phase 7 Fix
   ============================================================ */

/* --- Mobile Header (nur auf kleinen Screens) -------------- */
.mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    height: 54px;
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
    position: sticky;
    top: 0;
    z-index: 90;
    grid-column: 1 / -1;
}

.mobile-header__brand {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--c-text);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.mobile-header__brand svg { color: var(--c-accent); }

/* --- Burger-Button --------------------------------------- */
.burger-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    padding: 6px;
    background: transparent;
    border: 1px solid var(--c-border-2);
    border-radius: var(--r);
    cursor: pointer;
    transition: background 0.15s;
}

.burger-btn:hover { background: var(--c-surface-2); }

.burger-line {
    display: block;
    height: 1.5px;
    background: var(--c-text-muted);
    border-radius: 1px;
    transition: transform 0.25s, opacity 0.25s;
    transform-origin: center;
}

/* Burger → X-Animation wenn offen */
.sidebar--open ~ * .burger-btn .burger-line:nth-child(1),
#burger-btn[aria-expanded="true"] .burger-line:nth-child(1) {
    transform: translateY(6.5px) rotate(45deg);
}
#burger-btn[aria-expanded="true"] .burger-line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
#burger-btn[aria-expanded="true"] .burger-line:nth-child(3) {
    transform: translateY(-6.5px) rotate(-45deg);
}

/* --- Overlay -------------------------------------------- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 98;
    opacity: 0;
    transition: opacity 0.25s;
}

/* --- Responsive: Mobile --------------------------------- */
@media (max-width: 768px) {

    /* Grid: kein Sidebar-Bereich mehr */
    .app-layout {
        grid-template-columns: 1fr;
        grid-template-rows: 54px 1fr;
    }

    .mobile-header {
        display: flex;
    }

    /* Sidebar als Drawer von links */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100dvh;
        width: 260px;
        z-index: 99;
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none;
    }

    .sidebar--open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
    }

    /* Overlay sichtbar wenn Sidebar offen */
    .sidebar-overlay--visible {
        display: block;
        opacity: 1;
    }

    .main-content {
        padding: 20px 16px;
        grid-column: 1;
    }
}

/* --- Desktop: Overlay + Mobile-Header verstecken -------- */
@media (min-width: 769px) {
    .mobile-header    { display: none; }
    .sidebar-overlay  { display: none !important; }
    .sidebar {
        transform: none !important;
        position: sticky;
    }
}

/* --- Coach: Detail-Modal ---------------------------------- */
.coach-detail-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
═══════════════════════════════════════════════════════════ */

.desktop-only { display: block; }
.mobile-only  { display: none; }

@media (max-width: 699px) {
    .desktop-only { display: none !important; }
    .mobile-only  { display: block !important; }
}

/* Mini-Monatskalender */

/* ============================================================
   Budget & Finance Planner – Finanz-Module
   ============================================================ */

/* --- Monats-Navigation (wie Kalender-Header) -------------- */
.monat-nav {
    display: flex;
    align-items: center;
    gap: 14px;
}
.monat-nav h2 {
    font-size: 20px;
    font-weight: 600;
    min-width: 190px;
    text-align: center;
    font-family: var(--font);
}

/* --- KPI-Kacheln (Einnahmen / Ausgaben / Saldo / Sparen) -- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 22px;
}
.kpi {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    position: relative;
    overflow: hidden;
}
.kpi::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--kpi-c, var(--c-accent));
}
.kpi__label {
    font-size: 11px;
    color: var(--c-text-dim);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}
.kpi__wert {
    font-size: 24px;
    font-weight: 700;
    font-family: var(--font);
    line-height: 1;
    color: var(--c-text);
}
.kpi__sub {
    font-size: 12px;
    color: var(--c-text-muted);
}
.kpi--einnahme { --kpi-c: var(--c-success); }
.kpi--ausgabe  { --kpi-c: var(--c-error); }
.kpi--saldo    { --kpi-c: var(--c-accent); }
.kpi--sparen   { --kpi-c: #7986cb; }
.wert--positiv { color: #81c784; }
.wert--negativ { color: #ef9a9a; }

/* --- Buchungsliste --------------------------------------- */
.buchung-zeile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 4px;
    border-bottom: 1px solid var(--c-border);
}
.buchung-zeile:last-child { border-bottom: none; }
.buchung-zeile:hover { background: var(--c-surface-2); }
.buchung-zeile__dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.buchung-zeile__main {
    flex: 1;
    min-width: 0;
}
.buchung-zeile__kat {
    font-size: 14px;
    color: var(--c-text);
    font-weight: 500;
}
.buchung-zeile__meta {
    font-size: 12px;
    color: var(--c-text-muted);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.buchung-zeile__betrag {
    font-family: var(--font);
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
}
.buchung-zeile__betrag--aus { color: #ef9a9a; }
.buchung-zeile__betrag--ein { color: #81c784; }
.buchung-zeile__betrag--spar { color: #9fa8da; }
.buchung-zeile__actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}
.icon-btn {
    width: 38px; height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--r);
    border: 1px solid var(--c-border-2);
    background: transparent;
    color: var(--c-text-muted);
    cursor: pointer;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
    flex-shrink: 0;
}
.icon-btn:hover { background: var(--c-surface-2); color: var(--c-text); border-color: var(--c-accent); }
.icon-btn svg { width: 20px; height: 20px; display: block; }
.icon-btn--edit:hover { color: var(--c-accent); }
.icon-btn--del:hover  { color: var(--c-error); border-color: var(--c-error); }

.tagesgruppe__datum {
    font-size: 12px;
    color: var(--c-text-dim);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    padding: 14px 4px 4px;
    border-bottom: 1px solid var(--c-border);
    margin-top: 6px;
}

/* --- Schnell-Erfassung (Quick Add) ----------------------- */
.quick-add {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}
.quick-add .form-group { margin-bottom: 0; flex: 1; min-width: 130px; }

/* --- Budget-Balken (Soll/Ist) ---------------------------- */
.budget-zeile {
    padding: 12px 4px;
    border-bottom: 1px solid var(--c-border);
}
.budget-zeile:last-child { border-bottom: none; }
.budget-zeile__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 7px;
}
.budget-zeile__name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}
.budget-zeile__zahlen {
    font-family: var(--font);
    font-size: 13px;
    color: var(--c-text-muted);
    white-space: nowrap;
}
.budget-bar {
    height: 7px;
    background: var(--c-border);
    border-radius: 4px;
    overflow: hidden;
}
.budget-bar__fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s;
}
.budget-bar__fill--ok    { background: var(--c-success); }
.budget-bar__fill--warn  { background: var(--c-warning); }
.budget-bar__fill--over  { background: var(--c-error); }

/* --- Filter-Leiste --------------------------------------- */
.filter-leiste {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    margin-bottom: 18px;
}
.filter-leiste .form-group { margin-bottom: 0; }

/* --- Gruppen-Aufschlüsselung (Donut-Legende) ------------- */
.gruppe-liste {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.gruppe-zeile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 4px;
    border-bottom: 1px solid var(--c-border);
    font-size: 14px;
}
.gruppe-zeile:last-child { border-bottom: none; }
.gruppe-zeile__name { flex: 1; }
.gruppe-zeile__wert { font-family: var(--font); font-weight: 600; }
.gruppe-zeile__pct {
    font-size: 12px;
    color: var(--c-text-muted);
    width: 48px;
    text-align: right;
}

/* --- Leerer Zustand -------------------------------------- */
.leer-zustand {
    text-align: center;
    padding: 40px 20px;
    color: var(--c-text-muted);
    font-size: 14px;
}

/* --- Responsive ------------------------------------------ */
@media (max-width: 768px) {
    .kpi-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
    .kpi__wert { font-size: 21px; }
    .buchung-zeile__actions { flex-direction: column; }
}

/* --- Budget-Tabelle (Soll/Ist) --------------------------- */
.budget-table .budget-bar {
    display: inline-block;
    width: 90px;
    vertical-align: middle;
    margin-right: 8px;
}
.budget-pct {
    font-family: var(--font);
    font-size: 12px;
    color: var(--c-text-muted);
    vertical-align: middle;
}
.spalte-balken { white-space: nowrap; min-width: 150px; }

@media (max-width: 680px) {
    .budget-table .spalte-balken { display: none; }
}
