/**
 * Training Tracker Stylesheet v2.0
 *
 * Gleiches Design-System wie der Macro Tracker v2.0 (Tokens, Karten, Kopfzeile,
 * Tabs, Sheets, Hinweise). Mobile-first, Systemschrift, alle Regeln hängen an
 * .tt-ui (App-Container und Ebenen am <body>), damit Theme-Styles wenig durchschlagen.
 */

/* --- Seite --- */
html {
    scrollbar-gutter: stable;
}
html.tt-scroll-locked,
body.tt-scroll-locked {
    overflow: hidden;
}

/* --- Design-Tokens --- */
.tt-ui {
    --tt-primary: #0f766e;
    --tt-primary-hover: #0b5f58;
    --tt-primary-soft: #e3f3f1;
    --tt-on-primary: #ffffff;
    --tt-bg: #f2f5f4;
    --tt-surface: #ffffff;
    --tt-surface-2: #f4f7f6;
    --tt-surface-3: #e9eeed;
    --tt-border: #e0e7e5;
    --tt-border-strong: #c5d0cd;
    --tt-text: #0f172a;
    --tt-text-2: #334155;
    --tt-muted: #5b6b78;
    --tt-danger: #dc2626;
    --tt-danger-soft: #fdecec;
    --tt-warning: #b45309;
    --tt-warning-soft: #fff4e5;
    --tt-success: #15803d;
    --tt-success-soft: #e8f6ec;
    --tt-c-strength: #0369a1;
    --tt-c-strength-soft: #e0f2fe;
    --tt-c-endurance: #b45309;
    --tt-c-endurance-soft: #fff4e5;
    --tt-skel: #e4eae8;
    --tt-radius: 16px;
    --tt-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 2px 10px rgba(15, 23, 42, 0.04);
    --tt-shadow-pop: 0 -8px 40px rgba(15, 23, 42, 0.18);
    --tt-focus: 0 0 0 3px rgba(20, 184, 166, 0.35);
    --tt-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
    font-family: var(--tt-font);
    font-size: 16px;
    font-weight: 400;
    line-height: 1.45;
    color: var(--tt-text);
    text-align: left;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}
body.tt-theme-dark .tt-ui {
    --tt-primary: #2dd4bf;
    --tt-primary-hover: #5eead4;
    --tt-primary-soft: rgba(45, 212, 191, 0.13);
    --tt-on-primary: #042f2e;
    --tt-bg: #0b1117;
    --tt-surface: #111a22;
    --tt-surface-2: #16212b;
    --tt-surface-3: #1d2a36;
    --tt-border: #22303c;
    --tt-border-strong: #33444f;
    --tt-text: #e6edf3;
    --tt-text-2: #c4d0da;
    --tt-muted: #94a5b4;
    --tt-danger: #f87171;
    --tt-danger-soft: rgba(248, 113, 113, 0.13);
    --tt-warning: #fbbf24;
    --tt-warning-soft: rgba(251, 191, 36, 0.12);
    --tt-success: #4ade80;
    --tt-success-soft: rgba(74, 222, 128, 0.12);
    --tt-c-strength: #7dd3fc;
    --tt-c-strength-soft: rgba(56, 189, 248, 0.14);
    --tt-c-endurance: #fbbf24;
    --tt-c-endurance-soft: rgba(251, 191, 36, 0.12);
    --tt-skel: #1c2833;
    --tt-shadow: none;
    --tt-shadow-pop: 0 -8px 40px rgba(0, 0, 0, 0.55);
    --tt-focus: 0 0 0 3px rgba(45, 212, 191, 0.35);
    color-scheme: dark;
}

/* --- Schutz gegen Theme-Styles --- */
.tt-ui,
.tt-ui *,
.tt-ui *::before,
.tt-ui *::after {
    box-sizing: border-box;
}
.tt-ui h1,
.tt-ui h2,
.tt-ui h3,
.tt-ui h4,
.tt-ui p,
.tt-ui ul,
.tt-ui ol,
.tt-ui li,
.tt-ui figure,
.tt-ui fieldset,
.tt-ui legend {
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    color: inherit;
    letter-spacing: inherit;
    text-transform: none;
    box-shadow: none;
}
.tt-ui ul,
.tt-ui ol {
    list-style: none;
}
.tt-ui li::before,
.tt-ui li::marker {
    content: none;
}
.tt-ui button,
.tt-ui input,
.tt-ui select,
.tt-ui textarea {
    margin: 0;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
    letter-spacing: normal;
    text-transform: none;
    text-shadow: none;
    color: inherit;
}
.tt-ui button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
    min-width: 0;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    text-align: inherit;
    text-decoration: none;
    white-space: normal;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
    float: none;
    vertical-align: middle;
}
.tt-ui :where(button):is(:hover, :focus, :active) {
    background: none;
    color: inherit;
    box-shadow: none;
    text-decoration: none;
}
.tt-ui button:disabled {
    cursor: not-allowed;
}
.tt-ui label {
    margin: 0;
    padding: 0;
    font: inherit;
    color: inherit;
    text-transform: none;
    letter-spacing: normal;
}
.tt-ui a {
    color: inherit;
    text-decoration: none;
    box-shadow: none;
    border: 0;
}
.tt-ui [hidden] {
    display: none !important;
}
.tt-ui :focus:not(:focus-visible) {
    outline: none;
}
.tt-ui :focus-visible {
    outline: 2px solid var(--tt-primary);
    outline-offset: 2px;
}
.tt-ui .tt-ico {
    display: block;
    flex: none;
    width: 20px;
    height: 20px;
    max-width: none;
    stroke-width: 2;
}
.tt-ui .tt-ico--sm {
    width: 16px;
    height: 16px;
}
.tt-sr-only,
.tt-ui .tt-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --- App-Container --- */
.tt-ui.tt-root {
    position: relative;
    max-width: 1100px;
    margin: 0 auto 24px;
    padding: 10px;
    border-radius: 20px;
    background: var(--tt-bg);
    container-type: inline-size;
    container-name: tt;
    transition: opacity 0.15s ease;
}
@media (min-width: 768px) {
    .tt-ui.tt-root {
        margin: 12px auto 40px;
        padding: 20px;
    }
}
.tt-ui.tt-root.tt-refreshing .tt-view {
    opacity: 0.55;
    pointer-events: none;
}
.tt-ui .tt-view {
    display: block;
}
/* Einspaltige Grids dürfen nie breiter als ihr Container werden. */
.tt-ui .tt-today,
.tt-ui .tt-today-main,
.tt-ui .tt-history,
.tt-ui .tt-history-side,
.tt-ui .tt-manage,
.tt-ui .tt-form,
.tt-ui .tt-field,
.tt-ui .tt-gate,
.tt-ui .tt-gate-alerts,
.tt-ui .tt-menu,
.tt-ui .tt-menu-group,
.tt-ui .tt-picker {
    grid-template-columns: minmax(0, 1fr);
}

/* --- Karten --- */
.tt-ui .tt-card {
    background: var(--tt-surface);
    border: 1px solid var(--tt-border);
    border-radius: var(--tt-radius);
    box-shadow: var(--tt-shadow);
    padding: 14px;
    min-width: 0;
}
@container tt (min-width: 600px) {
    .tt-ui .tt-card {
        padding: 18px;
    }
}
.tt-ui .tt-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 36px;
    margin-bottom: 8px;
}
.tt-ui .tt-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--tt-text);
    letter-spacing: -0.005em;
}
.tt-ui .tt-card-meta {
    font-size: 14px;
    color: var(--tt-muted);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.tt-ui .tt-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--tt-surface-2);
    color: var(--tt-muted);
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.tt-ui .tt-hint {
    font-size: 13px;
    line-height: 1.45;
    color: var(--tt-muted);
}
.tt-ui .tt-alert {
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--tt-primary-soft);
    color: var(--tt-text-2);
    font-size: 14px;
    line-height: 1.45;
}
.tt-ui .tt-alert--error {
    background: var(--tt-danger-soft);
    color: var(--tt-danger);
}
.tt-ui .tt-card-dimmed {
    opacity: 0.55;
    transition: opacity 0.15s ease;
}

/* --- Platzhalter (feste Höhen, damit beim Laden nichts springt) --- */
@keyframes tt-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.tt-ui .tt-skel {
    display: block;
    height: 14px;
    border-radius: 6px;
    background: var(--tt-skel);
    animation: tt-pulse 1.4s ease-in-out infinite;
}
.tt-ui .tt-skel--name {
    width: 58%;
}
.tt-ui .tt-skel--meta {
    width: 38%;
    height: 11px;
    margin-top: 7px;
}
.tt-ui .tt-skel--profile {
    width: 56px;
    height: 13px;
}
.tt-ui .tt-skel--block {
    height: 44px;
    border-radius: 12px;
}

/* --- Buttons --- */
.tt-ui .tt-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
}
.tt-ui .tt-btn--primary,
.tt-ui .tt-btn--primary:hover,
.tt-ui .tt-btn--primary:focus,
.tt-ui .tt-btn--primary:active {
    background: var(--tt-primary);
    color: var(--tt-on-primary);
}
@media (hover: hover) {
    .tt-ui .tt-btn--primary:hover:not(:disabled) {
        background: var(--tt-primary-hover);
    }
}
.tt-ui .tt-btn--soft,
.tt-ui .tt-btn--soft:hover,
.tt-ui .tt-btn--soft:focus,
.tt-ui .tt-btn--soft:active {
    background: var(--tt-primary-soft);
    color: var(--tt-primary);
}
.tt-ui .tt-btn--ghost,
.tt-ui .tt-btn--ghost:focus,
.tt-ui .tt-btn--ghost:active {
    background: transparent;
    border-color: var(--tt-border);
    color: var(--tt-text-2);
}
@media (hover: hover) {
    .tt-ui .tt-btn--ghost:hover:not(:disabled),
    .tt-ui .tt-btn--soft:hover:not(:disabled) {
        background: var(--tt-surface-3);
    }
}
.tt-ui .tt-btn--danger,
.tt-ui .tt-btn--danger:hover,
.tt-ui .tt-btn--danger:focus,
.tt-ui .tt-btn--danger:active {
    background: var(--tt-danger-soft);
    color: var(--tt-danger);
}
.tt-ui .tt-btn--danger-text,
.tt-ui .tt-btn--danger-text:hover,
.tt-ui .tt-btn--danger-text:focus {
    color: var(--tt-danger);
}
.tt-ui .tt-btn--sm {
    min-height: 40px;
    padding: 0 12px;
    border-radius: 10px;
    font-size: 14px;
}
.tt-ui .tt-btn--sm .tt-ico {
    width: 18px;
    height: 18px;
}
.tt-ui .tt-btn--lg {
    min-height: 50px;
    font-size: 16px;
}
.tt-ui .tt-btn--xl {
    min-height: 56px;
    border-radius: 14px;
    font-size: 17px;
}
.tt-ui .tt-btn--block {
    display: flex;
    width: 100%;
}
.tt-ui .tt-btn:disabled {
    opacity: 0.5;
}
.tt-ui .tt-btn.is-busy {
    opacity: 0.8;
    cursor: progress;
}
.tt-ui .tt-btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.tt-ui .tt-btn-row > .tt-btn {
    flex: 1 1 140px;
    min-width: 0;
}

.tt-ui .tt-icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    color: var(--tt-text-2);
}
/* Trefferfläche auf 44 px vergrößern, ohne die Optik zu ändern. */
.tt-ui .tt-icon-btn::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: max(100%, 44px);
    height: max(100%, 44px);
    transform: translate(-50%, -50%);
}
.tt-ui .tt-icon-btn--lg {
    width: 44px;
    height: 44px;
}
.tt-ui .tt-icon-btn .tt-ico {
    width: 22px;
    height: 22px;
}
@media (hover: hover) {
    .tt-ui .tt-icon-btn:hover:not(:disabled) {
        background: var(--tt-surface-3);
        color: var(--tt-text);
    }
    .tt-ui .tt-icon-btn--danger:hover:not(:disabled) {
        background: var(--tt-danger-soft);
        color: var(--tt-danger);
    }
}
.tt-ui .tt-icon-btn:disabled {
    opacity: 0.3;
}
.tt-ui .tt-chip {
    display: inline-flex;
    align-items: center;
    flex: none;
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid var(--tt-border-strong);
    border-radius: 999px;
    background: var(--tt-surface);
    color: var(--tt-text-2);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}
.tt-ui .tt-chip:hover,
.tt-ui .tt-chip:focus {
    background: var(--tt-surface);
    color: var(--tt-text-2);
}

/* --- Segment-Umschalter --- */
.tt-ui .tt-seg {
    display: inline-grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--tt-border);
    border-radius: 12px;
    background: var(--tt-surface-2);
}
.tt-ui .tt-seg--block {
    display: grid;
    width: 100%;
}
.tt-ui .tt-seg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 0;
    min-height: 38px;
    padding: 0 10px;
    border-radius: 9px;
    color: var(--tt-muted);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}
.tt-ui .tt-seg-btn .tt-ico {
    width: 16px;
    height: 16px;
}
.tt-ui .tt-seg-btn:hover,
.tt-ui .tt-seg-btn:focus {
    color: var(--tt-muted);
}
.tt-ui .tt-seg-btn.is-active,
.tt-ui .tt-seg-btn.is-active:hover,
.tt-ui .tt-seg-btn.is-active:focus {
    background: var(--tt-surface);
    color: var(--tt-text);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08), 0 0 0 1px var(--tt-border);
}
body.tt-theme-dark .tt-ui .tt-seg-btn.is-active {
    background: var(--tt-surface-3);
    box-shadow: none;
}

/* --- Kopfzeile, Tracker-Umschalter & Tabs --- */
.tt-ui .tt-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 48px;
    margin-bottom: 10px;
}
.tt-ui .tt-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
    white-space: nowrap;
}
.tt-ui .tt-brand-mark {
    width: 22px;
    height: 22px;
    flex: none;
    border-radius: 7px;
    background: linear-gradient(135deg, #0f766e, #14b8a6);
}
.tt-ui .tt-brand-name {
    overflow: hidden;
    text-overflow: ellipsis;
}
/* Umschalter zwischen Ernährung (Macro Tracker) und Training. */
.tt-ui .tt-switch {
    display: inline-grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 2px;
    min-width: 0;
    padding: 3px;
    border: 1px solid var(--tt-border);
    border-radius: 14px;
    background: var(--tt-surface-2);
}
.tt-ui .tt-switch-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-width: 0;
    min-height: 40px;
    padding: 0 12px;
    border-radius: 11px;
    color: var(--tt-muted);
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
}
.tt-ui .tt-switch-btn > span {
    overflow: hidden;
    text-overflow: ellipsis;
}
.tt-ui .tt-switch-btn .tt-ico {
    width: 18px;
    height: 18px;
}
.tt-ui .tt-switch-btn:not(.is-active):hover,
.tt-ui .tt-switch-btn:not(.is-active):focus-visible {
    color: var(--tt-text);
}
@media (hover: hover) {
    .tt-ui .tt-switch-btn:not(.is-active):hover {
        background: var(--tt-surface-3);
    }
}
.tt-ui .tt-switch-btn.is-active,
.tt-ui .tt-switch-btn.is-active:hover,
.tt-ui .tt-switch-btn.is-active:focus {
    background: var(--tt-surface);
    color: var(--tt-text);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08), 0 0 0 1px var(--tt-border);
}
.tt-ui .tt-switch-btn.is-active .tt-ico {
    color: var(--tt-primary);
}
body.tt-theme-dark .tt-ui .tt-switch-btn.is-active {
    background: var(--tt-surface-3);
    box-shadow: none;
}
@container tt (max-width: 340px) {
    .tt-ui .tt-switch-btn {
        padding: 0 9px;
        font-size: 14px;
    }
    .tt-ui .tt-switch-btn .tt-ico {
        display: none;
    }
}
.tt-ui .tt-profile-btn {
    display: inline-flex;
    align-items: center;
    flex: none;
    gap: 8px;
    min-width: 0;
    max-width: 46%;
    min-height: 44px;
    padding: 4px 10px 4px 4px;
    border: 1px solid var(--tt-border);
    border-radius: 999px;
    background: var(--tt-surface);
    color: var(--tt-text);
}
.tt-ui .tt-profile-btn:hover,
.tt-ui .tt-profile-btn:focus {
    background: var(--tt-surface);
    color: var(--tt-text);
}
@media (hover: hover) {
    .tt-ui .tt-profile-btn:hover {
        border-color: var(--tt-border-strong);
    }
}
.tt-ui .tt-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--tt-primary-soft);
    color: var(--tt-primary);
    font-size: 13px;
    font-weight: 700;
}
.tt-ui .tt-profile-btn-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 15px;
    font-weight: 600;
}
.tt-ui .tt-profile-btn .tt-ico {
    color: var(--tt-muted);
}
.tt-ui .tt-profile-btn--skel .tt-avatar {
    background: var(--tt-skel);
}
/* Neben dem Umschalter bleibt auf schmalen Bildschirmen nur das Kürzel stehen. */
@container tt (max-width: 520px) {
    .tt-ui .tt-switch ~ .tt-profile-btn .tt-profile-btn-name,
    .tt-ui .tt-switch ~ .tt-profile-btn .tt-skel--profile {
        display: none;
    }
    .tt-ui .tt-switch ~ .tt-profile-btn {
        gap: 4px;
        padding-right: 8px;
    }
}
.tt-ui .tt-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    margin-bottom: 12px;
    padding: 4px;
    border: 1px solid var(--tt-border);
    border-radius: 14px;
    background: var(--tt-surface-2);
}
.tt-ui .tt-tab {
    min-height: 44px;
    padding: 0 8px;
    border-radius: 10px;
    color: var(--tt-muted);
    font-size: 15px;
    font-weight: 600;
    text-align: center;
}
.tt-ui .tt-tab:hover,
.tt-ui .tt-tab:focus {
    color: var(--tt-muted);
}
.tt-ui .tt-tab.is-active,
.tt-ui .tt-tab.is-active:hover,
.tt-ui .tt-tab.is-active:focus {
    background: var(--tt-surface);
    color: var(--tt-text);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08), 0 0 0 1px var(--tt-border);
}
body.tt-theme-dark .tt-ui .tt-tab.is-active {
    background: var(--tt-surface-3);
    box-shadow: none;
}
@container tt (min-width: 820px) {
    .tt-ui .tt-tabs {
        max-width: 420px;
    }
}

/* --- Anmeldung --- */
.tt-ui .tt-gate {
    display: grid;
    gap: 12px;
    max-width: 440px;
    margin: 8px auto;
    padding: 24px 20px;
}
.tt-ui .tt-gate-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--tt-primary-soft);
    color: var(--tt-primary);
}
.tt-ui .tt-gate-icon .tt-ico {
    width: 24px;
    height: 24px;
}
.tt-ui .tt-gate-title {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.01em;
}
.tt-ui .tt-gate-text {
    font-size: 15px;
    line-height: 1.5;
    color: var(--tt-muted);
}
.tt-ui .tt-gate-alerts {
    display: grid;
    gap: 8px;
}
.tt-ui .tt-gate-alerts:empty {
    display: none;
}

/* --- Formulare --- */
.tt-ui .tt-form {
    display: grid;
    gap: 14px;
}
.tt-ui .tt-field {
    display: grid;
    gap: 6px;
    min-width: 0;
}
.tt-ui .tt-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--tt-text-2);
}
.tt-ui .tt-input,
.tt-ui .tt-select {
    display: block;
    width: 100%;
    max-width: none;
    min-height: 48px;
    height: 48px;
    margin: 0;
    padding: 0 14px;
    border: 1px solid var(--tt-border-strong);
    border-radius: 12px;
    background: var(--tt-surface);
    background-image: none;
    color: var(--tt-text);
    font-size: 16px;
    line-height: 1.3;
    box-shadow: none;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.tt-ui .tt-select {
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b6b78' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px 18px;
}
.tt-ui .tt-input:hover,
.tt-ui .tt-select:hover {
    border-color: var(--tt-border-strong);
    background-color: var(--tt-surface);
}
.tt-ui .tt-input:focus,
.tt-ui .tt-select:focus {
    outline: none;
    border-color: var(--tt-primary);
    background-color: var(--tt-surface);
    box-shadow: var(--tt-focus);
}
.tt-ui .tt-input::placeholder {
    color: var(--tt-muted);
    opacity: 0.85;
}
.tt-ui .tt-input:disabled,
.tt-ui .tt-select:disabled {
    opacity: 0.55;
}
.tt-ui input[type="date"].tt-input {
    padding: 0 12px;
    line-height: 46px;
}
.tt-ui input[type="date"].tt-input::-webkit-date-and-time-value {
    text-align: left;
}
.tt-ui .tt-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
@container tt (max-width: 340px) {
    .tt-ui .tt-grid-2 {
        grid-template-columns: minmax(0, 1fr);
    }
}
.tt-ui .tt-check {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    font-size: 15px;
    cursor: pointer;
}
.tt-ui .tt-check input {
    flex: none;
    width: 22px;
    height: 22px;
    margin: 0;
    padding: 0;
    accent-color: var(--tt-primary);
    -webkit-appearance: auto;
    appearance: auto;
    box-shadow: none;
}
.tt-ui .tt-status {
    font-size: 13px;
    line-height: 1.45;
    color: var(--tt-muted);
}
.tt-ui .tt-status:empty {
    display: none;
}
.tt-ui .tt-status--error {
    color: var(--tt-danger);
}
.tt-ui .tt-status--success {
    color: var(--tt-success);
}
/* Suchfeld mit Lupe */
.tt-ui .tt-search {
    position: relative;
    display: flex;
    align-items: center;
}
.tt-ui .tt-search-ico {
    position: absolute;
    left: 14px;
    width: 20px;
    height: 20px;
    color: var(--tt-muted);
    pointer-events: none;
}
.tt-ui .tt-search-input {
    padding-left: 44px;
    border-color: var(--tt-border);
    background: var(--tt-surface-2);
}
.tt-ui .tt-search-input:hover {
    border-color: var(--tt-border);
    background-color: var(--tt-surface-2);
}
.tt-ui .tt-search-input::-webkit-search-decoration {
    -webkit-appearance: none;
    appearance: none;
}

/* --- Heute: Aufbau --- */
.tt-ui .tt-today {
    display: grid;
    gap: 12px;
}
.tt-ui .tt-today-main {
    display: grid;
    gap: 12px;
    align-content: start;
    min-width: 0;
}
@container tt (min-width: 820px) {
    .tt-ui .tt-today {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        align-items: start;
        gap: 20px;
    }
}
.tt-ui .tt-add-cta .tt-ico {
    width: 22px;
    height: 22px;
}
/* Platzhalter aus shortcode.php: Hinzufügen-Button nur am Handy, Auswahl-Karte nur am Desktop
   (gleiche Grenze wie isCompactView() in main.js). */
@media (min-width: 769px) {
    .tt-ui .tt-add-cta--skel {
        display: none;
    }
}
@media (max-width: 768px) {
    .tt-ui .tt-add-card--skel {
        display: none;
    }
}

/* --- Heute: Datumsleiste --- */
.tt-ui .tt-daybar {
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 56px;
}
.tt-ui .tt-daybar-center {
    position: relative;
    flex: 1;
    min-width: 0;
}
.tt-ui .tt-daybar-label {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    min-height: 52px;
    padding: 4px 8px;
    border-radius: 12px;
    text-align: left;
}
@media (hover: hover) {
    .tt-ui .tt-daybar-label:hover {
        background: var(--tt-surface-3);
    }
}
.tt-ui .tt-daybar-title {
    font-size: 21px;
    font-weight: 750;
    line-height: 1.15;
    letter-spacing: -0.015em;
    white-space: nowrap;
}
.tt-ui .tt-daybar-sub {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    color: var(--tt-muted);
}
/* Unsichtbares natives Datumsfeld über der Beschriftung: auf Touch-Geräten öffnet ein Tipp
   direkt den Datumswähler des Systems. */
.tt-ui .tt-daybar-native {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    opacity: 0;
    font-size: 16px;
    pointer-events: none;
    -webkit-appearance: none;
    appearance: none;
}
@media (pointer: coarse) {
    .tt-ui .tt-daybar-native {
        pointer-events: auto;
    }
}
.tt-ui .tt-daybar-today {
    min-height: 36px;
    padding: 0 12px;
}
.tt-ui .tt-daybar-today.is-hidden {
    display: none;
}

/* --- Typ-Kennzeichnung (Kraft / Ausdauer) --- */
.tt-ui .tt-badge {
    display: inline-flex;
    align-items: center;
    flex: none;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--tt-primary-soft);
    color: var(--tt-primary);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.5;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}
.tt-ui .tt-badge-strength {
    background: var(--tt-c-strength-soft);
    color: var(--tt-c-strength);
}
.tt-ui .tt-badge-endurance {
    background: var(--tt-c-endurance-soft);
    color: var(--tt-c-endurance);
}

/* --- Übung hinzufügen (Karte am Desktop, Sheet am Handy) --- */
.tt-ui .tt-picker {
    display: grid;
    gap: 12px;
}
.tt-ui .tt-picker-tools {
    display: grid;
    gap: 10px;
    min-width: 0;
}
/* Leeren-Knopf im Suchfeld */
.tt-ui .tt-search-input {
    padding-right: 48px;
}
.tt-ui .tt-search-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
}
.tt-ui .tt-search-clear {
    position: absolute;
    top: 50%;
    right: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    color: var(--tt-muted);
    transform: translateY(-50%);
}
.tt-ui .tt-search-clear[hidden] {
    display: none;
}
.tt-ui .tt-search-clear .tt-ico {
    width: 18px;
    height: 18px;
}
@media (hover: hover) {
    .tt-ui .tt-search-clear:hover {
        background: var(--tt-surface-3);
        color: var(--tt-text);
    }
}
/* Filter: eine waagerecht wischbare Chip-Reihe */
.tt-ui .tt-filter-chips {
    display: flex;
    gap: 8px;
    margin: 0 -16px;
    padding: 0 16px 2px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.tt-ui .tt-add-card .tt-filter-chips {
    flex-wrap: wrap;
    margin: 0;
    padding: 0;
    overflow: visible;
}
.tt-ui .tt-filter-chips::-webkit-scrollbar {
    display: none;
}
.tt-ui .tt-filter-chip {
    display: inline-flex;
    align-items: center;
    flex: none;
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid var(--tt-border);
    border-radius: 999px;
    background: var(--tt-surface);
    color: var(--tt-text-2);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}
.tt-ui .tt-filter-chip:hover,
.tt-ui .tt-filter-chip:focus {
    background: var(--tt-surface);
    color: var(--tt-text-2);
}
@media (hover: hover) {
    .tt-ui .tt-filter-chip:hover {
        background: var(--tt-surface-2);
    }
}
.tt-ui .tt-filter-chip.is-active,
.tt-ui .tt-filter-chip.is-active:hover,
.tt-ui .tt-filter-chip.is-active:focus {
    border-color: var(--tt-primary);
    background: var(--tt-primary);
    color: var(--tt-on-primary);
}
.tt-ui .tt-exercise-list {
    margin: 0;
    padding: 0;
}
.tt-ui .tt-add-card .tt-exercise-list {
    max-height: 460px;
    overflow-y: auto;
    overscroll-behavior: contain;
    margin: 0 -6px;
    padding: 0 6px;
}
/* Gruppen-Überschrift bleibt beim Scrollen oben stehen */
.tt-ui .tt-pick-section + .tt-pick-section {
    margin-top: 8px;
}
.tt-ui .tt-pick-section-title {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 8px 10px 6px;
    background: var(--tt-surface);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--tt-muted);
}
/* Eine Zeile = ein Knopf: Tippen fügt die Übung hinzu */
.tt-ui .tt-pick-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    width: 100%;
    min-height: 56px;
    padding: 8px 6px 8px 10px;
    border-radius: 12px;
    background: transparent;
    color: var(--tt-text);
    text-align: left;
    -webkit-tap-highlight-color: transparent;
}
.tt-ui .tt-pick-row:hover,
.tt-ui .tt-pick-row:focus {
    background: transparent;
    color: var(--tt-text);
}
.tt-ui .tt-pick-row:focus-visible {
    box-shadow: var(--tt-focus);
}
@media (hover: hover) {
    .tt-ui .tt-pick-row:hover {
        background: var(--tt-surface-2);
    }
}
.tt-ui .tt-pick-row:active {
    background: var(--tt-primary-soft);
}
.tt-ui .tt-pick-row.is-added,
.tt-ui .tt-pick-row.is-added:hover,
.tt-ui .tt-pick-row.is-added:active {
    background: transparent;
    cursor: default;
}
.tt-ui .tt-pick-row.is-busy {
    cursor: progress;
}
.tt-ui .tt-pick-main {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.tt-ui .tt-pick-name {
    display: -webkit-box;
    overflow: hidden;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}
.tt-ui .tt-pick-row.is-added .tt-pick-name {
    color: var(--tt-muted);
}
.tt-ui .tt-pick-meta {
    overflow: hidden;
    font-size: 13px;
    color: var(--tt-muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tt-ui .tt-pick-state {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: var(--tt-primary-soft);
    color: var(--tt-primary);
}
.tt-ui .tt-pick-state .tt-ico {
    width: 20px;
    height: 20px;
}
.tt-ui .tt-pick-state.is-busy .tt-ico {
    animation: tt-pulse 0.9s ease-in-out infinite;
}
.tt-ui .tt-pick-state.is-added {
    gap: 4px;
    width: auto;
    padding: 0 10px 0 8px;
    background: var(--tt-success-soft);
    color: var(--tt-success);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}
.tt-ui .tt-pick-state.is-added .tt-ico {
    width: 16px;
    height: 16px;
}
/* Skelett-Zeilen aus shortcode.php */
.tt-ui .tt-exercise-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 56px;
    padding: 8px 6px;
}
.tt-ui .tt-exercise-row-main {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}
/* Lange Übungsnamen brechen auf höchstens zwei Zeilen um, statt abgeschnitten zu werden. */
.tt-ui .tt-exercise-name {
    display: -webkit-box;
    overflow: hidden;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}
.tt-ui .tt-exercise-empty {
    display: grid;
    justify-items: center;
    gap: 10px;
    padding: 22px 4px;
    font-size: 14px;
    color: var(--tt-muted);
    text-align: center;
}

/* --- Heute: Training (Einträge) --- */
.tt-ui .tt-entry-list {
    display: grid;
    gap: 10px;
}
.tt-ui .tt-entry {
    min-width: 0;
    border: 1px solid var(--tt-border);
    border-radius: 14px;
    background: var(--tt-surface);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.tt-ui .tt-entry.is-open {
    border-color: var(--tt-border-strong);
    box-shadow: var(--tt-shadow);
}
.tt-ui .tt-entry-toggle {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
    min-height: 60px;
    padding: 8px 12px 8px 14px;
    border-radius: 14px;
    text-align: left;
}
@media (hover: hover) {
    .tt-ui .tt-entry-toggle:hover {
        background: var(--tt-surface-2);
    }
}
.tt-ui .tt-entry.is-open .tt-entry-toggle {
    border-radius: 14px 14px 0 0;
}
.tt-ui .tt-entry-heading {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-width: 0;
}
.tt-ui .tt-entry-title {
    display: -webkit-box;
    max-width: 100%;
    overflow: hidden;
    font-size: 16px;
    font-weight: 650;
    line-height: 1.3;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}
.tt-ui .tt-entry-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    min-width: 0;
}
.tt-ui .tt-entry-summary .tt-badge {
    flex: none;
}
.tt-ui .tt-entry-summary-text {
    overflow: hidden;
    font-size: 13px;
    font-weight: 600;
    color: var(--tt-text-2);
    text-overflow: ellipsis;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.tt-ui .tt-entry-summary-text.is-empty {
    font-weight: 400;
    color: var(--tt-muted);
}
.tt-ui .tt-entry-chevron {
    width: 20px;
    height: 20px;
    color: var(--tt-muted);
    transition: transform 0.2s ease;
}
.tt-ui .tt-entry.is-open .tt-entry-chevron {
    transform: rotate(180deg);
}
.tt-ui .tt-entry-body {
    display: none;
    padding: 4px 14px 14px;
}
.tt-ui .tt-entry.is-open .tt-entry-body {
    display: grid;
    gap: 12px;
}
.tt-ui .tt-entry.tt-entry-saving {
    border-color: var(--tt-border-strong);
}
.tt-ui .tt-entry.tt-entry-saved {
    border-color: var(--tt-success);
}
/* Sätze: Nr. · Gewicht · Wiederholungen · Entfernen */
.tt-ui .tt-sets {
    display: grid;
    gap: 8px;
}
.tt-ui .tt-sets-head,
.tt-ui .tt-set-row {
    display: grid;
    grid-template-columns: 28px minmax(0, 1.25fr) minmax(0, 1fr) 40px;
    align-items: center;
    gap: 8px;
}
.tt-ui .tt-sets-head {
    font-size: 12px;
    font-weight: 600;
    color: var(--tt-muted);
}
.tt-ui .tt-set-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--tt-muted);
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.tt-ui .tt-set-row .tt-input {
    height: 46px;
    min-height: 46px;
    padding: 0 10px;
    font-variant-numeric: tabular-nums;
}
.tt-ui .tt-weight-cell {
    position: relative;
    min-width: 0;
}
.tt-ui .tt-weight-cell .tt-input {
    padding-right: 44px;
}
/* „K“ setzt Körpergewicht – der iOS-Dezimalblock hat keine Buchstaben. */
.tt-ui .tt-k-chip {
    position: absolute;
    top: 50%;
    right: 5px;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--tt-surface-2);
    color: var(--tt-text-2);
    font-size: 13px;
    font-weight: 700;
    transform: translateY(-50%);
}
.tt-ui .tt-k-chip:hover,
.tt-ui .tt-k-chip:focus {
    background: var(--tt-surface-2);
    color: var(--tt-text-2);
}
@media (hover: hover) {
    .tt-ui .tt-k-chip:hover {
        background: var(--tt-surface-3);
    }
}
.tt-ui .tt-set-remove {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    color: var(--tt-muted);
}
.tt-ui .tt-set-remove .tt-ico {
    width: 18px;
    height: 18px;
}
@media (hover: hover) {
    .tt-ui .tt-set-remove:hover {
        background: var(--tt-danger-soft);
        color: var(--tt-danger);
    }
}
.tt-ui .tt-entry-hint {
    font-size: 12px;
    line-height: 1.45;
    color: var(--tt-muted);
}
.tt-ui .tt-entry-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--tt-border);
}
.tt-ui .tt-entry-actions {
    display: flex;
    flex: 1;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
}
.tt-ui .tt-save-feedback {
    order: -1;
    margin-right: auto;
    font-size: 13px;
    font-weight: 600;
    color: var(--tt-muted);
}
.tt-ui .tt-save-feedback:empty {
    display: none;
}
.tt-ui .tt-entry-saved .tt-save-feedback {
    color: var(--tt-success);
}
.tt-ui .tt-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 22px 12px;
    text-align: center;
    color: var(--tt-muted);
}
.tt-ui .tt-empty .tt-ico {
    width: 28px;
    height: 28px;
    margin-bottom: 4px;
    color: var(--tt-border-strong);
}
.tt-ui .tt-empty p {
    font-weight: 600;
    color: var(--tt-text-2);
}
.tt-ui .tt-empty .tt-empty-hint {
    max-width: 320px;
    font-size: 14px;
    font-weight: 400;
    color: var(--tt-muted);
}
.tt-ui .tt-empty .tt-btn {
    margin-top: 8px;
}

/* --- Verlauf --- */
.tt-ui .tt-history,
.tt-ui .tt-history-side {
    display: grid;
    gap: 12px;
    align-content: start;
}
@container tt (min-width: 820px) {
    .tt-ui .tt-history {
        grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
        align-items: start;
        gap: 20px;
    }
}
.tt-ui .tt-day-list {
    margin: 0;
    padding: 0;
}
.tt-ui .tt-day {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 18px;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 64px;
    padding: 8px 4px;
    border-top: 1px solid var(--tt-border);
    border-radius: 0;
    text-align: left;
}
.tt-ui .tt-day-list > li:first-child > .tt-day {
    border-top: 0;
}
@media (hover: hover) {
    .tt-ui button.tt-day:hover {
        background: var(--tt-surface-2);
    }
}
.tt-ui .tt-day-date {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
}
.tt-ui .tt-day-date b {
    font-size: 15px;
    font-weight: 700;
}
.tt-ui .tt-day-date small {
    font-size: 12px;
    color: var(--tt-muted);
    font-variant-numeric: tabular-nums;
}
.tt-ui .tt-day-main {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}
.tt-ui .tt-day-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}
.tt-ui .tt-day-title {
    overflow: hidden;
    font-size: 15px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tt-ui .tt-day-count {
    flex: none;
    font-size: 13px;
    color: var(--tt-muted);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.tt-ui .tt-day-meta {
    display: -webkit-box;
    overflow: hidden;
    font-size: 13px;
    color: var(--tt-muted);
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow-wrap: anywhere;
}
.tt-ui .tt-day-chev {
    width: 18px;
    height: 18px;
    color: var(--tt-border-strong);
}
.tt-ui .tt-day--skel {
    grid-template-columns: minmax(0, 1fr);
}
.tt-ui .tt-exportbox,
.tt-ui .tt-history-delete-body {
    display: grid;
    gap: 12px;
}
.tt-ui .tt-exportbox .tt-card-head {
    margin-bottom: 0;
}
.tt-ui .tt-collapse-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    min-height: 44px;
    margin: -4px 0;
    text-align: left;
}
.tt-ui .tt-collapse-chev {
    width: 20px;
    height: 20px;
    color: var(--tt-muted);
    transition: transform 0.2s ease;
}
.tt-ui .tt-history-delete-card.is-open .tt-collapse-chev {
    transform: rotate(180deg);
}
.tt-ui .tt-history-delete-body {
    display: none;
    margin-top: 14px;
}
.tt-ui .tt-history-delete-card.is-open .tt-history-delete-body {
    display: grid;
}

/* --- Übungen verwalten --- */
.tt-ui .tt-manage {
    display: grid;
    gap: 12px;
}
@container tt (min-width: 820px) {
    .tt-ui .tt-manage {
        grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
        align-items: start;
        gap: 20px;
    }
}
.tt-ui .tt-exercise-library {
    display: grid;
    gap: 18px;
}
.tt-ui .tt-library-section {
    display: grid;
    gap: 10px;
}
.tt-ui .tt-library-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.tt-ui .tt-library-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 700;
}
.tt-ui .tt-library-count {
    font-size: 13px;
    color: var(--tt-muted);
    white-space: nowrap;
}
.tt-ui .tt-library-group {
    padding: 10px 12px;
    border: 1px solid var(--tt-border);
    border-radius: 14px;
}
.tt-ui .tt-library-group-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 2px;
}
.tt-ui .tt-library-group-title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--tt-primary);
}
.tt-ui .tt-library-group-count {
    font-size: 12px;
    color: var(--tt-muted);
    white-space: nowrap;
}
.tt-ui .tt-library-subgroup + .tt-library-subgroup {
    margin-top: 6px;
}
.tt-ui .tt-library-subgroup-title {
    margin-top: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--tt-text-2);
}
.tt-ui .tt-library-list {
    margin: 0;
    padding: 0;
}
.tt-ui .tt-exercise-item {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 52px;
    border-bottom: 1px solid var(--tt-border);
}
.tt-ui .tt-library-list > .tt-exercise-item:last-child {
    border-bottom: 0;
}
.tt-ui .tt-exercise-item-main {
    flex: 1;
    min-width: 0;
}
.tt-ui .tt-exercise-item-actions {
    display: flex;
    flex: none;
    gap: 4px;
}
.tt-ui .tt-library-empty {
    padding: 12px 4px;
    font-size: 14px;
    color: var(--tt-muted);
}
.tt-ui .tt-library-card .tt-card-head {
    margin-bottom: 12px;
}

/* --- Fenster (Sheets auf dem Handy, Dialoge am Desktop) --- */
.tt-ui.tt-layer {
    position: relative;
    z-index: 100000;
}
.tt-ui .tt-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
@keyframes tt-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes tt-sheet-in {
    from { opacity: 0; transform: translateY(28px); }
    to { opacity: 1; transform: none; }
}
@keyframes tt-dialog-in {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: none; }
}
.tt-ui .tt-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    animation: tt-fade-in 0.2s ease;
    touch-action: none;
}
body.tt-theme-dark .tt-ui .tt-backdrop {
    background: rgba(2, 6, 12, 0.7);
}
.tt-ui .tt-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-height: calc(100% - 12px);
    margin: 0;
    border: 1px solid var(--tt-border);
    border-bottom: 0;
    border-radius: 20px 20px 0 0;
    background: var(--tt-surface);
    color: var(--tt-text);
    box-shadow: var(--tt-shadow-pop);
    animation: tt-sheet-in 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@supports (height: 100dvh) {
    .tt-ui .tt-overlay {
        height: 100dvh;
    }
}
.tt-ui .tt-panel:focus {
    outline: none;
}
.tt-ui .tt-panel--tall {
    height: calc(100% - 12px);
}
.tt-ui .tt-panel-head {
    display: flex;
    flex: none;
    align-items: center;
    gap: 6px;
    min-height: 64px;
    padding: 10px 10px 10px 16px;
    border-bottom: 1px solid var(--tt-border);
}
.tt-ui .tt-panel-heading {
    flex: 1;
    min-width: 0;
}
.tt-ui .tt-panel-title {
    overflow: hidden;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tt-ui .tt-panel-sub {
    margin-top: 2px;
    overflow: hidden;
    font-size: 13px;
    color: var(--tt-muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tt-ui .tt-panel-body {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}
.tt-ui .tt-panel:has(> .tt-panel-foot) .tt-panel-body {
    padding-bottom: 16px;
}
.tt-ui .tt-panel-body > * + * {
    margin-top: 14px;
}
.tt-ui .tt-panel-foot {
    display: flex;
    flex: none;
    gap: 10px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--tt-border);
    background: var(--tt-surface);
}
.tt-ui .tt-panel-foot > .tt-btn {
    flex: 1;
    min-width: 0;
}
.tt-ui .tt-modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 4px;
}
.tt-ui .tt-modal-actions > .tt-btn {
    flex: 1 1 120px;
    min-width: 0;
}
@media (min-width: 768px) {
    .tt-ui .tt-overlay {
        align-items: center;
        padding: 24px;
    }
    .tt-ui .tt-panel {
        width: min(100%, 520px);
        max-height: min(100%, 820px);
        border-bottom: 1px solid var(--tt-border);
        border-radius: 20px;
        box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
        animation-name: tt-dialog-in;
    }
    .tt-ui .tt-panel--sm {
        width: min(100%, 440px);
    }
    .tt-ui .tt-panel--tall {
        height: min(100%, 760px);
    }
    .tt-ui .tt-panel-body,
    .tt-ui .tt-panel:has(> .tt-panel-foot) .tt-panel-body {
        padding-bottom: 16px;
    }
    .tt-ui .tt-panel-foot {
        padding-bottom: 12px;
        border-radius: 0 0 20px 20px;
    }
}
/* Übungsauswahl im Sheet: Suche und Filter fest oben, nur die Liste scrollt. */
.tt-ui .tt-panel .tt-exercise-list {
    max-height: none;
    overflow: visible;
}
.tt-ui .tt-panel-tools {
    flex: none;
    min-width: 0;
    padding: 12px 16px 12px;
    border-bottom: 1px solid var(--tt-border);
}
.tt-ui .tt-panel-body.tt-pick-scroll {
    padding-top: 4px;
    padding-right: 10px;
    padding-left: 10px;
}
.tt-ui .tt-panel-body.tt-pick-scroll > * + * {
    margin-top: 0;
}
/* Das Sheet folgt dem sichtbaren Bereich (Werte aus syncSheetViewport in main.js),
   damit die Tastatur nicht über der Liste liegt. */
.tt-ui .tt-overlay--viewport {
    top: var(--tt-vv-top, 0px);
    height: var(--tt-vv-height, 100%);
}
.tt-ui.tt-layer.is-keyboard-open .tt-panel--tall {
    height: calc(100% - 8px);
}
.tt-ui.tt-layer.is-keyboard-open .tt-mobile-add-sheet .tt-panel-foot {
    display: none;
}
.tt-ui.tt-layer.is-keyboard-open .tt-mobile-add-sheet .tt-panel-body {
    padding-bottom: 12px;
}

/* --- Profil-Menü --- */
.tt-ui .tt-menu {
    display: grid;
}
.tt-ui .tt-menu-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 14px;
    width: 100%;
    min-height: 62px;
    padding: 8px 4px;
    border-bottom: 1px solid var(--tt-border);
    color: var(--tt-text);
    text-align: left;
}
.tt-ui .tt-menu-item:hover,
.tt-ui .tt-menu-item:focus {
    color: var(--tt-text);
}
@media (hover: hover) {
    .tt-ui .tt-menu-item:hover {
        background: var(--tt-surface-2);
    }
}
.tt-ui .tt-menu-item > .tt-ico:first-child {
    width: 22px;
    height: 22px;
    color: var(--tt-primary);
}
.tt-ui .tt-menu-text {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.tt-ui .tt-menu-text b {
    font-size: 15px;
    font-weight: 600;
}
.tt-ui .tt-menu-text small {
    overflow: hidden;
    font-size: 13px;
    color: var(--tt-muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tt-ui .tt-menu-chev {
    width: 18px;
    height: 18px;
    color: var(--tt-border-strong);
}
.tt-ui .tt-menu-group {
    display: grid;
    gap: 8px;
}

/* --- Hinweise (Toasts) --- */
.tt-ui.tt-toasts {
    position: fixed;
    left: 50%;
    bottom: calc(16px + env(safe-area-inset-bottom));
    z-index: 100010;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: min(calc(100vw - 24px), 440px);
    transform: translateX(-50%);
    pointer-events: none;
}
body.tt-scroll-locked .tt-ui.tt-toasts {
    top: calc(12px + env(safe-area-inset-top));
    bottom: auto;
}
@keyframes tt-toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}
.tt-ui .tt-toast {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 48px;
    padding: 4px 4px 4px 16px;
    border-radius: 14px;
    background: #0f172a;
    color: #f8fafc;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.3);
    pointer-events: auto;
    animation: tt-toast-in 0.18s ease-out;
}
body.tt-theme-dark .tt-ui .tt-toast {
    background: #1d2a36;
    border: 1px solid #33444f;
}
.tt-ui .tt-toast--error {
    background: #8f1d1d;
}
body.tt-theme-dark .tt-ui .tt-toast--error {
    background: #7f1d1d;
    border-color: #991b1b;
}
.tt-ui .tt-toast-text {
    flex: 1;
    min-width: 0;
    padding: 6px 0;
    overflow-wrap: anywhere;
}
.tt-ui .tt-toast-btn,
.tt-ui .tt-toast-btn:hover,
.tt-ui .tt-toast-btn:focus {
    flex: none;
    min-height: 40px;
    padding: 0 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: #5eead4;
    font-weight: 700;
}
.tt-ui .tt-toast-close,
.tt-ui .tt-toast-close:hover,
.tt-ui .tt-toast-close:focus {
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    color: rgba(248, 250, 252, 0.75);
}
.tt-ui .tt-toast-close .tt-ico {
    width: 18px;
    height: 18px;
}

/* --- Erzwungene Farben (Windows-Kontrastmodus) --- */
@media (forced-colors: active) {
    .tt-ui .tt-btn,
    .tt-ui .tt-tab.is-active,
    .tt-ui .tt-seg-btn.is-active,
    .tt-ui .tt-switch-btn.is-active {
        border: 1px solid ButtonText;
    }
}

/* --- Weniger Bewegung --- */
@media (prefers-reduced-motion: reduce) {
    .tt-ui *,
    .tt-ui *::before,
    .tt-ui *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* --- Export (unsichtbar gerendert, wird als JPG gespeichert) --- */
.tt-export-wrapper {
    position: fixed;
    top: 0;
    left: -99999px;
    width: 1200px;
    padding: 20px;
    z-index: -1;
    pointer-events: none;
}

.tt-export-sheet {
    width: 1100px;
    background: #f8fafc;
    color: #0f172a;
    padding: 40px 46px;
    border-radius: 28px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.4;
    box-shadow: 0 24px 50px rgba(15, 118, 110, 0.12);
}

.tt-export-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.tt-export-activity {
    font-size: 0.8em;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #0f766e;
}

.tt-export-title {
    font-weight: 700;
    letter-spacing: -0.01em;
    font-size: 2.1em;
    color: #0f766e;
}

.tt-export-meta {
    margin-top: 6px;
    color: #64748b;
    font-size: 0.95em;
}

.tt-export-tag {
    background: linear-gradient(135deg, #0f766e, #14b8a6);
    color: #fff;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 0.9em;
}

.tt-export-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 26px;
}

.tt-export-summary-item {
    background: #fff;
    border: 1px solid rgba(15, 118, 110, 0.12);
    border-radius: 16px;
    padding: 14px 16px;
}

.tt-export-summary-label {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.7em;
    color: #64748b;
    font-weight: 600;
}

.tt-export-summary-value {
    margin-top: 6px;
    font-size: 1.4em;
    font-weight: 600;
    color: #0f172a;
}

.tt-export-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.tt-export-sections {
    display: flex;
    flex-direction: column;
    gap: 22px;
    margin-top: 18px;
}

.tt-export-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.tt-export-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.tt-export-section-title {
    font-weight: 700;
    letter-spacing: -0.01em;
    font-size: 1.5em;
    color: #0f172a;
}

.tt-export-section-sub {
    margin-top: 4px;
    color: #64748b;
    font-size: 0.85em;
}

.tt-export-section-badge {
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.8em;
    font-weight: 600;
}

.tt-export-section-badge-strength {
    background: rgba(56, 189, 248, 0.18);
    color: #075985;
}

.tt-export-section-badge-endurance {
    background: rgba(245, 158, 11, 0.2);
    color: #92400e;
}

.tt-export-group {
    background: #fff;
    border: 1px solid rgba(15, 118, 110, 0.12);
    border-radius: 20px;
    padding: 18px;
    box-shadow: 0 10px 22px rgba(15, 118, 110, 0.1);
}

.tt-export-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.tt-export-group-title {
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.7em;
    font-weight: 700;
    color: #0f766e;
}

.tt-export-group-count {
    font-size: 0.85em;
    color: #64748b;
}

.tt-export-subgroup {
    margin-top: 14px;
}

.tt-export-subgroup-title {
    font-weight: 600;
    margin-bottom: 10px;
    color: #0f172a;
}

.tt-export-group-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
}

.tt-export-exercise {
    background: #fff;
    border: 1px solid rgba(15, 118, 110, 0.12);
    border-radius: 18px;
    padding: 16px;
    box-shadow: 0 10px 20px rgba(15, 118, 110, 0.08);
}

.tt-export-exercise-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.tt-export-exercise-name {
    font-size: 1.05em;
    font-weight: 600;
    color: #0f172a;
}

.tt-export-exercise-meta {
    margin-top: 4px;
    color: #64748b;
    font-size: 0.85em;
}

.tt-export-badge {
    background: rgba(20, 184, 166, 0.12);
    color: #0f766e;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.75em;
    font-weight: 600;
}

.tt-export-badge-strength {
    background: rgba(56, 189, 248, 0.18);
    color: #075985;
}

.tt-export-badge-endurance {
    background: rgba(245, 158, 11, 0.18);
    color: #b45309;
}

.tt-export-exercise-body {
    display: grid;
    gap: 8px;
}

.tt-export-session {
    background: #fff;
    border: 1px solid rgba(15, 118, 110, 0.12);
    border-radius: 18px;
    padding: 16px;
    box-shadow: 0 10px 20px rgba(15, 118, 110, 0.08);
}

.tt-export-session + .tt-export-session {
    margin-top: 14px;
}

.tt-export-session-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.tt-export-session-title {
    font-weight: 600;
    color: #0f172a;
}

.tt-export-session-meta {
    font-size: 0.85em;
    color: #64748b;
}

.tt-export-day {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #fff;
    border: 1px solid rgba(15, 118, 110, 0.12);
    border-radius: 20px;
    padding: 16px;
    box-shadow: 0 10px 20px rgba(15, 118, 110, 0.08);
}

.tt-export-day + .tt-export-day {
    margin-top: 12px;
}

.tt-export-day-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.tt-export-day-title {
    font-weight: 700;
    color: #0f172a;
}

.tt-export-day-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.tt-export-entry {
    background: rgba(15, 118, 110, 0.04);
    border-radius: 14px;
    padding: 12px;
    border: 1px solid rgba(15, 118, 110, 0.08);
}

.tt-export-entry + .tt-export-entry {
    margin-top: 10px;
}

.tt-export-entry-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.tt-export-entry-name {
    font-weight: 600;
    color: #0f172a;
}

.tt-export-entry-sub {
    margin-top: 2px;
    font-size: 0.8em;
    color: #64748b;
}

.tt-export-entry-body {
    display: grid;
    gap: 6px;
}

.tt-export-entry-body-sets {
    gap: 4px;
}

.tt-export-entry-row,
.tt-export-set {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.9em;
    color: #475569;
}

.tt-export-set span:last-child,
.tt-export-entry-row span:last-child {
    color: #0f172a;
    font-weight: 600;
}

.tt-export-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.9em;
    color: #475569;
}

.tt-export-row strong {
    color: #0f172a;
    font-weight: 600;
}

.tt-export-empty {
    padding: 30px;
    text-align: center;
    color: #64748b;
    background: #fff;
    border-radius: 18px;
    border: 1px dashed rgba(15, 118, 110, 0.25);
}

.tt-export-footer {
    margin-top: 26px;
    font-size: 0.85em;
    color: #94a3b8;
    text-align: right;
}
