/* ============================================================================
   Text2Motion v2 — Premium UI
   Design principles: Focus. Reward. Recur.
   ============================================================================ */

/* ------- Theme tokens ------- */
:root {
    --tm-bg: #f7f8fa;
    --tm-surface: #ffffff;
    --tm-surface-2: #f2f4f7;
    --tm-border: #e5e7eb;
    --tm-border-soft: #eef0f3;
    --tm-text: #0f172a;
    --tm-text-muted: #565c66;
    --tm-text-soft: #666c76;
    --tm-primary: #2563eb;
    --tm-primary-h: #1d4ed8;
    --tm-primary-tint: #eff5ff;
    --tm-accent: #16a34a;
    --tm-warn: #d97706;
    --tm-danger: #dc2626;
    --tm-shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
    --tm-shadow-md: 0 4px 12px rgba(15, 23, 42, .06), 0 2px 4px rgba(15, 23, 42, .04);
    --tm-shadow-lg: 0 12px 30px rgba(15, 23, 42, .10), 0 4px 10px rgba(15, 23, 42, .06);
    --tm-radius: 12px;
    --tm-radius-lg: 16px;
    --tm-radius-xl: 20px;
    --tm-ease: cubic-bezier(.22, .36, .18, 1);
}

[data-bs-theme="dark"] {
    --tm-bg: #0b0d10;
    --tm-surface: #14171c;
    --tm-surface-2: #1a1e24;
    --tm-border: #262b32;
    --tm-border-soft: #1e2229;
    --tm-text: #e6e8ec;
    --tm-text-muted: #9aa1ab;
    --tm-text-soft: #868d97;
    --tm-primary: #3b82f6;
    --tm-primary-h: #2563eb;
    --tm-primary-tint: rgba(59, 130, 246, .12);
    --tm-shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --tm-shadow-md: 0 4px 12px rgba(0, 0, 0, .35);
    --tm-shadow-lg: 0 12px 30px rgba(0, 0, 0, .45);
}

/* ------- Base ------- */
.tm-body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--tm-bg);
    color: var(--tm-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    transition: background .3s var(--tm-ease), color .3s var(--tm-ease);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

kbd {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, .15);
    color: inherit;
    border: 1px solid rgba(255, 255, 255, .2);
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .1);
    line-height: 1;
}

/* ------- Corners (dekorative Ecken unten) ------- */
.tm-corner {
    position: fixed;
    bottom: 0;
    pointer-events: none;
    opacity: 1;
    z-index: 0;
    max-width: 22vw;
    /* skaliert dezent mit, statt fixer Größe */
    height: auto;
}

.tm-corner-left {
    left: 0;
}

.tm-corner-right {
    right: 0;
}

/* ============================================================================
   HEADER
   ============================================================================ */
.tm-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: color-mix(in oklab, var(--tm-bg) 82%, transparent);
    backdrop-filter: saturate(1.3) blur(14px);
    border-bottom: 1px solid var(--tm-border-soft);
}

.tm-header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 10px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.tm-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    /* erlaubt Schrumpfen ohne Overflow */
}

/* ----------------------------------------------------------------------------
   Header-Logo · Hover (Lift + Scale + Schein) — identisch zur Landing
   ---------------------------------------------------------------------------- */
.tm-brand-logo {
    display: inline-flex;
    line-height: 0;
    padding: 6px 12px;
    border-radius: 12px;
    transition: background .22s var(--tm-ease), box-shadow .22s var(--tm-ease);
}

.tm-brand-logo img {
    height: 38px;
    width: auto;
    display: block;
    transform-origin: center;
    transition: transform .25s var(--tm-ease), filter .25s var(--tm-ease);
}

.tm-brand-logo:hover {
    background: color-mix(in oklab, var(--tm-primary) 10%, transparent);
    box-shadow: var(--tm-shadow-sm);
}

.tm-brand-logo:hover img {
    transform: translateY(-2px) scale(1.08);
    filter: drop-shadow(0 6px 14px color-mix(in oklab, var(--tm-primary) 45%, transparent));
}

.tm-brand-logo:active img {
    transform: translateY(0) scale(1.02);
}

.tm-brand-logo:focus-visible {
    outline: 2px solid var(--tm-primary);
    outline-offset: 3px;
    border-radius: 12px;
}

@media (prefers-reduced-motion: reduce) {
    .tm-brand-logo:hover img {
        transform: none;
    }
}

.tm-brand-title {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 14px;
    border-left: 1px solid var(--tm-border);
    min-width: 0;
}

.tm-brand-name {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -.005em;
    white-space: nowrap;
}

.tm-brand-badge {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--tm-primary-tint);
    color: var(--tm-primary);
    white-space: nowrap;
}

/* ── Header-Actions als gruppierte PILL (Kapsel-Form) ─────────────────── */
.tm-header-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 5px 6px;
    background: var(--tm-surface);
    border: 1px solid var(--tm-border);
    border-radius: 999px;
    /* echte Pill-Kapsel */
    box-shadow: var(--tm-shadow-sm);
    flex-shrink: 0;
}

/* Buttons in der Pill: Icon + Label */
.tm-header-actions .tm-icon-btn {
    width: auto;
    height: 34px;
    padding: 0 14px;
    gap: 8px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--tm-text);
    display: inline-flex;
    align-items: center;
    font-size: 13px;
    font-weight: 500;
}

/* Icon in der Pill: blau, damit es wie im Zielbild aussieht */
.tm-header-actions .tm-icon-btn>i {
    color: var(--tm-primary);
    font-size: 14px;
}

.tm-header-actions .tm-icon-btn:hover {
    background: var(--tm-surface-2);
    border-color: transparent;
}

/* Trennstrich zwischen den Pill-Buttons */
.tm-header-actions .tm-menu-wrap::before {
    content: "";
    width: 1px;
    height: 18px;
    background: var(--tm-border);
    margin: 0 2px;
    align-self: center;
}

/* Label-Text */
.tm-btn-label {
    font-size: 13px;
    font-weight: 500;
    letter-spacing: -0.01em;
}

/* Basis-Icon-Button (außerhalb der Pill, z.B. in Modals/Drawer) */
.tm-icon-btn {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--tm-text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .18s var(--tm-ease);
}

.tm-icon-btn:hover {
    background: var(--tm-surface-2);
    color: var(--tm-text);
    border-color: var(--tm-border);
}

.tm-icon-btn-sm {
    width: 32px;
    height: 32px;
}

/* ✅ FIX "Zahl in Luft": Verlauf-Zähler in der Pill sitzt jetzt INLINE
   direkt hinter dem Label statt frei schwebend über der Ecke. */
.tm-icon-badge {
    position: absolute;
    top: -2px;
    right: 6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--tm-primary);
    color: #fff;
    font-size: 10.5px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* In der Header-Pill: Badge inline (nicht absolut), damit er sauber
   neben "Verlauf" klebt und nicht "in der Luft" hängt. */
.tm-header-actions .tm-icon-btn .tm-icon-badge {
    position: static;
    top: auto;
    right: auto;
    margin-left: 2px;
    min-width: 16px;
    height: 16px;
    font-size: 10px;
}

.tm-header-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 999px;
    background: var(--tm-surface);
    color: var(--tm-text-muted);
    border: 1px solid var(--tm-border);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: all .18s var(--tm-ease);
}

.tm-header-link:hover {
    color: var(--tm-text);
    background: var(--tm-surface-2);
}

/* ============================================================================
   MAIN LAYOUT
   ============================================================================ */
.tm-main {
    flex: 1 0 auto;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    /* ✅ oben weniger Rand */
    padding: 12px 24px 20px;
    position: relative;
    z-index: 1;
}

.tm-alerts:not(:empty) {
    margin-bottom: 16px;
}

.tm-stage {
    animation: tm-fade-in .35s var(--tm-ease);
}

@keyframes tm-fade-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================================
   STAGE 1 — COMPOSER
   ============================================================================ */
.tm-stage-composer {
    max-width: 820px;
    /* ✅ oben weniger Rand */
    margin: 6px auto 0;
    position: relative;
}

/* ── Dezenter Glow hinter dem Composer-Panel (leichte Version) ────────── */
.tm-stage-composer::before {
    content: "";
    position: absolute;
    inset: -8% -6% auto -6%;
    height: 260px;
    background: radial-gradient(60% 80% at 50% 0%,
            color-mix(in oklab, var(--tm-primary) 22%, transparent) 0%,
            transparent 70%);
    filter: blur(40px);
    opacity: .32;
    z-index: -1;
    pointer-events: none;
}

[data-bs-theme="dark"] .tm-stage-composer::before {
    opacity: .28;
}

.tm-composer-head {
    text-align: left;
    /* ✅ kompakter */
    margin-bottom: 12px;
}

.tm-headline {
    /* ✅ etwas kleiner, spart vertikalen Platz */
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -.015em;
    margin: 0 0 4px 0;
    color: var(--tm-text);
}

.tm-sublead {
    font-size: 14px;
    color: var(--tm-text-muted);
    margin: 0;
}

.tm-composer {
    background: var(--tm-surface);
    border: 1px solid var(--tm-border);
    border-radius: var(--tm-radius-xl);
    /* ✅ etwas weniger Innenabstand */
    padding: 20px 24px;
    box-shadow: var(--tm-shadow-md);
    transition: box-shadow .25s var(--tm-ease), border-color .25s var(--tm-ease);
}

.tm-textarea-wrap {
    position: relative;
}

.tm-textarea {
    width: 100%;
    /* ✅ Textfeld deutlich niedriger. Feste Höhe überschreibt rows="16".
       Wer wachsen lassen will, zieht am Resize-Griff (resize: vertical). */
    height: clamp(160px, 42dvh, 420px);
    min-height: 140px;
    padding: 16px 18px 52px 18px;
    border: 1px solid var(--tm-border);
    border-radius: var(--tm-radius);
    background: var(--tm-surface);
    color: var(--tm-text);
    font-family: inherit;
    font-size: 15px;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    transition: border-color .18s var(--tm-ease), box-shadow .18s var(--tm-ease), background .18s var(--tm-ease);
}

.tm-textarea::placeholder {
    color: var(--tm-text-soft);
    opacity: 1;
}

.tm-textarea:focus {
    border-color: var(--tm-primary);
    box-shadow: 0 0 0 4px var(--tm-primary-tint);
}

/* Quality Meter */
.tm-quality {
    position: absolute;
    right: 12px;
    bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 10px 5px 8px;
    border-radius: 999px;
    background: color-mix(in oklab, var(--tm-surface) 92%, transparent);
    border: 1px solid var(--tm-border-soft);
    backdrop-filter: blur(4px);
}

.tm-quality-ring {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: conic-gradient(var(--tm-primary) var(--pct, 0deg), var(--tm-border) 0deg);
    position: relative;
    transition: background .3s var(--tm-ease);
}

.tm-quality-ring::after {
    content: "";
    position: absolute;
    inset: 3px;
    background: var(--tm-surface);
    border-radius: 50%;
}

.tm-quality-label {
    font-size: 12px;
    color: var(--tm-text-muted);
    font-weight: 500;
}

.tm-quality-count {
    font-size: 11.5px;
    color: var(--tm-text-soft);
    font-variant-numeric: tabular-nums;
    padding-left: 8px;
    border-left: 1px solid var(--tm-border);
}

.tm-quality.is-warn .tm-quality-ring {
    background: conic-gradient(var(--tm-warn) var(--pct, 0deg), var(--tm-border) 0deg);
}

.tm-quality.is-warn .tm-quality-label {
    color: var(--tm-warn);
}

.tm-quality.is-danger .tm-quality-ring {
    background: conic-gradient(var(--tm-danger) var(--pct, 0deg), var(--tm-border) 0deg);
}

.tm-quality.is-danger .tm-quality-label {
    color: var(--tm-danger);
}

/* Composer Actions */
.tm-composer-actions {
    /* ✅ kompakter Abstand */
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ✅ "zu viel" gefixt: eine Zeile, kein Umbruch mehr.
   "Zuletzt …" bleibt einzeilig und wird abgeschnitten statt zu wuchern. */
.tm-composer-sub {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
    overflow: hidden;
    font-size: 13px;
}

.tm-composer-hint {
    color: var(--tm-text-soft);
    margin-left: auto;
    font-size: 12px;
    min-width: 0;
    max-width: 48%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tm-dot {
    color: var(--tm-text-soft);
}

.tm-linkbtn {
    background: transparent;
    border: 0;
    padding: 4px 2px;
    color: var(--tm-text-muted);
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 4px;
    white-space: nowrap;
    transition: color .15s var(--tm-ease);
}

.tm-linkbtn:hover {
    color: var(--tm-text);
}

.tm-linkbtn:focus-visible {
    outline: 2px solid var(--tm-primary);
    outline-offset: 2px;
}

.tm-linkbtn-strong {
    color: var(--tm-text);
    font-weight: 500;
}

/* CTA */
.tm-cta {
    width: 100%;
    /* ✅ etwas kompakter */
    height: 48px;
    border: 0;
    border-radius: var(--tm-radius);
    background: var(--tm-primary);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -.005em;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, .28), inset 0 1px 0 rgba(255, 255, 255, .14);
    transition: transform .12s var(--tm-ease), box-shadow .18s var(--tm-ease), background .18s var(--tm-ease);
}

.tm-cta:hover {
    background: var(--tm-primary-h);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(37, 99, 235, .34), inset 0 1px 0 rgba(255, 255, 255, .16);
}

.tm-cta:active {
    transform: translateY(0) scale(.985);
}

.tm-cta:disabled {
    opacity: .55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.tm-cta-meta {
    display: inline-flex;
    gap: 4px;
    opacity: .85;
    font-size: 12px;
    font-weight: 500;
}

.tm-cta-sm {
    height: 40px;
    padding: 0 18px;
    width: auto;
    font-size: 14px;
    box-shadow: var(--tm-shadow-sm);
}

/* ============================================================================
   STAGE 2 — PROGRESS
   ============================================================================ */
.tm-stage-progress {
    max-width: 820px;
    margin: 24px auto 0;
}

.tm-progress-wrap {
    background: var(--tm-surface);
    border: 1px solid var(--tm-border);
    border-radius: var(--tm-radius-xl);
    padding: 28px;
    box-shadow: var(--tm-shadow-md);
}

.tm-progress-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.tm-progress-title {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    font-weight: 600;
    color: var(--tm-text);
}

.tm-progress-meta {
    font-variant-numeric: tabular-nums;
    color: var(--tm-text-muted);
    font-size: 13px;
}

.tm-spinner-ring {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2.5px solid var(--tm-primary-tint);
    border-top-color: var(--tm-primary);
    animation: tm-spin 1s linear infinite;
}

@keyframes tm-spin {
    to {
        transform: rotate(360deg);
    }
}

.tm-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--tm-border-soft);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 22px;
}

.tm-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--tm-primary), color-mix(in oklab, var(--tm-primary) 60%, #22d3ee));
    border-radius: inherit;
    transition: width .8s var(--tm-ease);
}

.tm-findings {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 200px;
}

.tm-finding {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: var(--tm-surface-2);
    border-radius: 10px;
    font-size: 14px;
    color: var(--tm-text);
    animation: tm-finding-in .5s var(--tm-ease);
    opacity: 0;
    animation-fill-mode: forwards;
}

.tm-finding-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
    background: var(--tm-primary);
    color: #fff;
    font-size: 10px;
}

.tm-finding.is-pending .tm-finding-icon {
    background: transparent;
    border: 2px solid var(--tm-border);
    color: var(--tm-primary);
}

.tm-finding.is-pending .tm-finding-icon::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--tm-primary);
    animation: tm-pulse 1.2s ease-in-out infinite;
}

.tm-finding-body {
    flex: 1;
}

.tm-finding-num {
    color: var(--tm-primary);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

@keyframes tm-finding-in {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes tm-pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.4);
        opacity: .5;
    }
}

.tm-progress-foot {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--tm-border-soft);
    font-size: 12.5px;
    color: var(--tm-text-muted);
    text-align: center;
}

/* ============================================================================
   STAGE 3 — RESULT
   ============================================================================ */
.tm-stage-result {
    max-width: 1400px;
    margin: 0 auto;
}

.tm-result-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 4px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.tm-result-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.tm-result-tools {
    display: flex;
    gap: 4px;
    padding-left: 8px;
    border-left: 1px solid var(--tm-border);
}

/* Segmented control */
.tm-segmented {
    display: inline-flex;
    padding: 3px;
    background: var(--tm-surface-2);
    border: 1px solid var(--tm-border);
    border-radius: 10px;
    gap: 2px;
}

.tm-seg-btn {
    border: 0;
    background: transparent;
    color: var(--tm-text-muted);
    padding: 6px 14px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 108px;
    letter-spacing: 0;
    text-transform: none;
    transition: all .18s var(--tm-ease);
}

.tm-seg-btn i {
    font-size: 12px;
    line-height: 1;
    width: 14px;
    text-align: center;
}

.tm-seg-btn[data-view="uas"] {
    letter-spacing: .01em;
    font-weight: 500;
}

.tm-seg-btn:hover:not(.is-active) {
    color: var(--tm-text);
}

.tm-seg-btn.is-active {
    background: var(--tm-surface);
    color: var(--tm-text);
    box-shadow: var(--tm-shadow-sm);
}

/* Metrics */
.tm-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
    animation: tm-metric-in .5s var(--tm-ease);
}

@keyframes tm-metric-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tm-metric {
    background: var(--tm-surface);
    border: 1px solid var(--tm-border);
    border-radius: var(--tm-radius);
    padding: 14px 16px;
    transition: transform .18s var(--tm-ease), box-shadow .18s var(--tm-ease);
}

.tm-metric:hover {
    transform: translateY(-2px);
    box-shadow: var(--tm-shadow-md);
}

.tm-metric-value {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -.02em;
    color: var(--tm-text);
    font-variant-numeric: tabular-nums;
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.tm-metric-unit {
    font-size: 13px;
    color: var(--tm-text-muted);
    font-weight: 500;
}

.tm-metric-label {
    font-size: 12px;
    color: var(--tm-text-muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 500;
}

/* Report view */
.tm-view {
    animation: tm-fade-in .35s var(--tm-ease);
}

.tm-report-frame {
    width: 100%;
    height: calc(100dvh - 200px);
    min-height: 540px;
    border: 1px solid var(--tm-border);
    border-radius: var(--tm-radius-lg);
    background: #fff;
    box-shadow: var(--tm-shadow-md);
}

.tm-report-frame {
    height: calc(100dvh - var(--tm-h-header, 52px) - var(--tm-h-toolbar, 52px) - 48px);
    min-height: 480px;
}

/* UAS view */
.tm-uas-wrap {
    background: var(--tm-surface);
    border: 1px solid var(--tm-border);
    border-radius: var(--tm-radius-lg);
    box-shadow: var(--tm-shadow-md);
    overflow: hidden;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tm-uas-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    min-width: 560px;
}

.tm-uas-table th,
.tm-uas-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--tm-border-soft);
    vertical-align: middle;
}

.tm-uas-table th:nth-child(1),
.tm-uas-table td:nth-child(1) {
    width: 60px;
    text-align: left;
}

.tm-uas-table th:nth-child(2),
.tm-uas-table td:nth-child(2) {
    text-align: left;
}

.tm-uas-table th:nth-child(3),
.tm-uas-table td:nth-child(3) {
    text-align: center;
    width: 100px;
}

.tm-uas-table th:nth-child(n+4),
.tm-uas-table td:nth-child(n+4) {
    text-align: right;
    font-variant-numeric: tabular-nums;
    width: 140px;
}

.tm-uas-table th {
    background: var(--tm-surface-2);
    font-weight: 600;
    color: var(--tm-text);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.tm-uas-table tbody tr:hover {
    background: var(--tm-surface-2);
}

.tm-uas-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.tm-uas-code {
    color: var(--tm-primary);
    font-weight: 600;
}

.tm-uas-sum td {
    font-weight: 700;
    background: var(--tm-surface-2);
    border-top: 2px solid var(--tm-border);
}

/* ============================================================================
   MODAL
   ============================================================================ */
.tm-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .5);
    backdrop-filter: blur(4px);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: tm-fade-in .2s var(--tm-ease);
}

.tm-modal {
    background: var(--tm-surface);
    border: 1px solid var(--tm-border);
    border-radius: var(--tm-radius-xl);
    padding: 28px;
    width: 100%;
    max-width: 800px;
    max-height: calc(100dvh - 48px);
    overflow: auto;
    box-shadow: var(--tm-shadow-lg);
    animation: tm-modal-in .3s var(--tm-ease);
}

@keyframes tm-modal-in {
    from {
        opacity: 0;
        transform: translateY(16px) scale(.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.tm-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.tm-modal-head h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.tm-modal-sub {
    color: var(--tm-text-muted);
    font-size: 13.5px;
    margin: 0 0 20px 0;
}

/* Example grid */
.tm-example-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}

.tm-example-card {
    text-align: left;
    padding: 16px;
    background: var(--tm-surface);
    border: 1px solid var(--tm-border);
    border-radius: var(--tm-radius);
    cursor: pointer;
    transition: all .18s var(--tm-ease);
    position: relative;
    overflow: hidden;
}

.tm-example-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--_tone, var(--tm-primary));
    opacity: .8;
}

.tm-example-card:hover {
    border-color: var(--tm-primary);
    transform: translateY(-2px);
    box-shadow: var(--tm-shadow-md);
}

.tm-example-title {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--tm-text);
    margin-bottom: 4px;
}

.tm-example-meta {
    font-size: 11.5px;
    color: var(--tm-text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 8px;
}

.tm-example-preview {
    font-size: 12.5px;
    color: var(--tm-text-muted);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================================================
   DRAWER (History)
   ============================================================================ */
.tm-drawer {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    justify-content: flex-end;
    background: rgba(15, 23, 42, .4);
    backdrop-filter: blur(4px);
    animation: tm-fade-in .2s var(--tm-ease);
}

.tm-drawer-panel {
    width: 100%;
    max-width: 420px;
    background: var(--tm-surface);
    border-left: 1px solid var(--tm-border);
    display: flex;
    flex-direction: column;
    animation: tm-drawer-in .3s var(--tm-ease);
}

@keyframes tm-drawer-in {
    from {
        transform: translateX(30px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.tm-drawer-head {
    padding: 18px 20px;
    border-bottom: 1px solid var(--tm-border-soft);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tm-drawer-head h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.tm-drawer-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tm-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 12px 20px;
}

.tm-drawer-foot {
    padding: 12px 20px;
    border-top: 1px solid var(--tm-border-soft);
    color: var(--tm-text-muted);
    font-size: 12px;
    text-align: center;
}

.tm-history-group {
    padding: 12px 8px 6px;
    font-size: 11.5px;
    color: var(--tm-text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    font-weight: 600;
}

.tm-history-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: background .15s var(--tm-ease);
    border: 1px solid transparent;
}

.tm-history-item:hover {
    background: var(--tm-surface-2);
    border-color: var(--tm-border);
}

.tm-history-item.is-active {
    background: var(--tm-primary-tint);
    border-color: var(--tm-primary);
}

.tm-history-main {
    flex: 1;
    min-width: 0;
}

.tm-history-title {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--tm-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tm-history-meta {
    font-size: 11.5px;
    color: var(--tm-text-muted);
    margin-top: 2px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tm-history-chip {
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--tm-surface-2);
    border: 1px solid var(--tm-border-soft);
    font-variant-numeric: tabular-nums;
}

.tm-history-del {
    visibility: hidden;
    background: transparent;
    border: 0;
    color: var(--tm-text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
}

.tm-history-item:hover .tm-history-del {
    visibility: visible;
}

.tm-history-del:hover {
    color: var(--tm-danger);
    background: var(--tm-surface-2);
}

.tm-history-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--tm-text-muted);
    font-size: 13.5px;
}

.tm-history-empty i {
    font-size: 32px;
    margin-bottom: 12px;
    opacity: .4;
    display: block;
}

/* Consent-Bereich oben im Drawer */
.tm-history-consent {
    padding: 14px 20px;
    border-bottom: 1px solid var(--tm-border-soft);
    background: var(--tm-surface-2);
}

.tm-history-consent-note {
    margin: 8px 0 0 0;
    font-size: 11.5px;
    line-height: 1.5;
    color: var(--tm-text-muted);
}

.tm-history-stat {
    margin-top: 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--tm-text-muted);
}

.tm-history-stat b {
    color: var(--tm-primary);
}

.tm-history-stat i {
    color: var(--tm-primary);
    font-size: 12px;
}

/* Toggle-Switch */
.tm-switch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.tm-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.tm-switch-track {
    position: relative;
    width: 40px;
    height: 22px;
    border-radius: 999px;
    background: var(--tm-border);
    transition: background .2s var(--tm-ease);
    flex-shrink: 0;
}

.tm-switch-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
    transition: transform .2s var(--tm-ease);
}

.tm-switch input:checked+.tm-switch-track {
    background: var(--tm-primary);
}

.tm-switch input:checked+.tm-switch-track .tm-switch-thumb {
    transform: translateX(18px);
}

.tm-switch input:focus-visible+.tm-switch-track {
    outline: 2px solid var(--tm-primary);
    outline-offset: 2px;
}

.tm-switch-label {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--tm-text);
}

/* Umbenennen-Button pro History-Eintrag */
.tm-history-rename {
    visibility: hidden;
    background: transparent;
    border: 0;
    color: var(--tm-text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
}

.tm-history-item:hover .tm-history-rename {
    visibility: visible;
}

.tm-history-rename:hover {
    color: var(--tm-primary);
    background: var(--tm-surface-2);
}

/* ============================================================================
   ONBOARDING
   ============================================================================ */
.tm-onboarding {
    position: fixed;
    bottom: 60px;
    right: 24px;
    z-index: 40;
    max-width: 380px;
    background: var(--tm-surface);
    border: 1px solid var(--tm-border);
    border-radius: var(--tm-radius-lg);
    box-shadow: var(--tm-shadow-lg);
    padding: 18px 20px;
    animation: tm-onboarding-in .5s var(--tm-ease);
}

@keyframes tm-onboarding-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tm-onboarding-inner {
    display: flex;
    align-items: center;
    gap: 16px;
}

.tm-onboarding-title {
    font-weight: 600;
    font-size: 14.5px;
    margin-bottom: 3px;
}

.tm-onboarding-text {
    font-size: 12.5px;
    color: var(--tm-text-muted);
    line-height: 1.5;
}

/* ============================================================================
   ALERTS
   ============================================================================ */
.tm-alert {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13.5px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid;
    animation: tm-fade-in .3s var(--tm-ease);
}

.tm-alert-info {
    background: var(--tm-primary-tint);
    border-color: color-mix(in oklab, var(--tm-primary) 30%, transparent);
    color: var(--tm-text);
}

.tm-alert-success {
    background: rgba(22, 163, 74, .08);
    border-color: rgba(22, 163, 74, .25);
    color: var(--tm-text);
}

.tm-alert-warn {
    background: rgba(217, 119, 6, .08);
    border-color: rgba(217, 119, 6, .25);
    color: var(--tm-text);
}

.tm-alert-danger {
    background: rgba(220, 38, 38, .08);
    border-color: rgba(220, 38, 38, .25);
    color: var(--tm-text);
}

.tm-alert-close {
    background: transparent;
    border: 0;
    color: inherit;
    cursor: pointer;
    padding: 2px 6px;
    margin-left: auto;
    opacity: .6;
}

.tm-alert-close:hover {
    opacity: 1;
}

/* ============================================================================
   FOOTER
   ============================================================================ */
.tm-footer {
    flex: 0 0 auto;
    padding: 14px 20px 18px;
    text-align: center;
    font-size: 12.5px;
    color: var(--tm-text-muted);
    border-top: 1px solid var(--tm-border-soft);
    position: relative;
    z-index: 1;
    background: var(--tm-bg);
}

.tm-footer a,
.tm-footer a:link,
.tm-footer a:visited {
    color: var(--tm-text-muted);
    text-decoration: none;
    margin: 0 2px;
    transition: color .15s var(--tm-ease);
}

.tm-footer a:hover,
.tm-footer a:focus {
    color: var(--tm-text);
    text-decoration: none;
}

.tm-footer span {
    color: var(--tm-text-soft);
    margin: 0 6px;
}

/* ============================================================================
   AI-DISCLAIMER unter der Textarea
   ============================================================================ */
.tm-ai-note {
    position: absolute;
    left: 14px;
    bottom: 16px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    color: var(--tm-text-soft);
    pointer-events: none;
}

.tm-ai-note i {
    font-size: 11px;
    opacity: .8;
}

/* ============================================================================
   BETA-BADGE als Button (CRA-Modal)
   ============================================================================ */
.tm-brand-badge-btn {
    border: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: inherit;
    transition: background .15s var(--tm-ease);
}

.tm-brand-badge-btn i {
    font-size: 9px;
    opacity: .8;
}

.tm-brand-badge-btn:hover {
    background: color-mix(in oklab, var(--tm-primary-tint) 70%, var(--tm-primary) 12%);
}

/* ============================================================================
   HEADER DROPDOWN MENU (Legal & Info)
   ============================================================================ */
.tm-menu-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.tm-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 260px;
    background: var(--tm-surface);
    border: 1px solid var(--tm-border);
    border-radius: var(--tm-radius);
    box-shadow: var(--tm-shadow-lg);
    padding: 6px;
    z-index: 30;
    transform-origin: top right;
    animation: tm-menu-in .18s var(--tm-ease);
}

@keyframes tm-menu-in {
    from {
        opacity: 0;
        transform: translateY(-4px) scale(.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.tm-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--tm-text);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: background .15s var(--tm-ease);
}

.tm-menu a:link,
.tm-menu a:visited {
    color: var(--tm-text);
    text-decoration: none;
}

.tm-menu a>i:first-child {
    width: 16px;
    color: var(--tm-text-muted);
    text-align: center;
    font-size: 13px;
    flex-shrink: 0;
}

.tm-menu a>span {
    flex: 1;
}

.tm-menu-ext {
    font-size: 10px;
    color: var(--tm-text-soft);
    opacity: 0;
    transition: opacity .15s var(--tm-ease);
}

.tm-menu a:hover {
    background: var(--tm-surface-2);
}

.tm-menu a:hover .tm-menu-ext {
    opacity: 1;
}

.tm-menu a:hover>i:first-child {
    color: var(--tm-primary);
}

.tm-menu a:focus-visible {
    outline: 2px solid var(--tm-primary);
    outline-offset: -2px;
    background: var(--tm-surface-2);
}

.tm-menu-sep {
    height: 1px;
    background: var(--tm-border-soft);
    margin: 6px 4px;
}

.tm-menu-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 12px 6px;
}

.tm-menu-meta-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--tm-text);
}

.tm-menu-meta-sub {
    font-size: 11px;
    color: var(--tm-text-soft);
    line-height: 1.4;
}

.tm-menu-meta code {
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
    font-size: 10.5px;
    padding: 1px 4px;
    border-radius: 3px;
    background: rgba(15, 23, 42, 0.06);
}

.tm-icon-btn[aria-expanded="true"] {
    background: var(--tm-surface-2);
    color: var(--tm-text);
    border-color: var(--tm-border);
}

/* Menü-Item-Button (Theme-Toggle, Info, Team) */
.tm-menu button.tm-menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--tm-text);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: background .15s var(--tm-ease);
}

.tm-menu button.tm-menu-item:hover {
    background: var(--tm-surface-2);
}

.tm-menu button.tm-menu-item>i:first-child {
    width: 16px;
    text-align: center;
    font-size: 13px;
    color: var(--tm-text-muted);
    flex-shrink: 0;
}

.tm-menu button.tm-menu-item:hover>i:first-child {
    color: var(--tm-primary);
}

/* Version-Badge im Header (dezent neben Beta) */
.tm-brand-version {
    font-size: 11px;
    font-weight: 500;
    color: var(--tm-text-muted, #64748b);
    padding: 2px 7px;
    border-radius: 4px;
    background: rgba(15, 23, 42, 0.05);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
}

.tm-brand-version:hover {
    background: rgba(15, 23, 42, 0.09);
    color: var(--tm-text, #0f172a);
}

[data-bs-theme="dark"] .tm-brand-version {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
}

[data-bs-theme="dark"] .tm-brand-version:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

/* ============================================================================
   INFO / DEMO MODAL — Video + Feature-Cards
   ============================================================================ */
.tm-video {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: var(--tm-radius);
    overflow: hidden;
    background: #000;
}

.tm-video iframe,
.tm-video video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    object-fit: cover;
}

.tm-feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.tm-feature {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px;
    text-align: center;
    background: var(--tm-surface-2);
    border: 1px solid var(--tm-border);
    border-radius: var(--tm-radius);
}

.tm-feature i {
    font-size: 20px;
    color: var(--tm-primary);
    margin-bottom: 4px;
}

.tm-feature b {
    font-size: 14px;
    color: var(--tm-text);
}

.tm-feature span {
    font-size: 12px;
    color: var(--tm-text-muted);
}

/* Team-Modal: Karten */
.tm-team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
}

.tm-team-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 16px;
    text-align: center;
    background: var(--tm-surface);
    border: 1px solid var(--tm-border);
    border-radius: var(--tm-radius);
}

.tm-team-card img {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 6px;
}

.tm-team-card b {
    font-size: 14px;
    color: var(--tm-text);
}

.tm-team-card span {
    font-size: .78rem;
    opacity: 1;
    /* war .6 */
    color: var(--tm-text-muted);
    /* explizit statt geerbt */
    white-space: nowrap;
}

.tm-team-links {
    display: flex;
    gap: 12px;
    margin-top: 6px;
}

.tm-team-links a {
    color: var(--tm-text-muted);
    font-size: 16px;
    transition: color .15s var(--tm-ease);
}

.tm-team-links a:hover {
    color: var(--tm-primary);
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

/* ── Tablet / kleiner Desktop ── */
@media (max-width: 900px) {
    .tm-header-inner {
        padding: 10px 18px;
    }

    .tm-main {
        padding: 12px 18px 20px;
    }

    .tm-report-frame {
        height: calc(100dvh - 240px);
    }

    /* Ecken kleiner ziehen, damit sie nicht dominieren */
    .tm-corner {
        max-width: 16vw;
    }
}

/* ── Phone ── */
@media (max-width: 720px) {
    .tm-header-inner {
        padding: 10px 14px;
    }

    /* Version-Badge raus, spart Platz */
    .tm-brand-version {
        display: none;
    }

    .tm-brand-title {
        padding-left: 10px;
        gap: 6px;
    }

    .tm-brand-name {
        font-size: 14px;
    }

    /* Pill: Labels ausblenden, Buttons wieder kompakt/rund */
    .tm-btn-label {
        display: none;
    }

    .tm-header-actions .tm-icon-btn {
        width: 36px;
        padding: 0;
        justify-content: center;
    }

    /* Trennstrich in der Pill weg auf Mobile */
    .tm-header-actions .tm-menu-wrap::before {
        display: none;
    }

    /* Badge: ohne Label wieder als runde Ecken-Blase */
    .tm-header-actions .tm-icon-btn .tm-icon-badge {
        position: absolute;
        top: -2px;
        right: 2px;
        margin-left: 0;
    }

    .tm-main {
        padding: 12px 14px 18px;
    }

    .tm-headline {
        font-size: 20px;
    }

    .tm-sublead {
        font-size: 13.5px;
    }

    .tm-composer {
        padding: 18px;
    }

    .tm-textarea {
        height: 160px;
        min-height: 130px;
        padding: 14px 14px 46px;
    }

    /* Glow auf Mobile abschwächen */
    .tm-stage-composer::before {
        opacity: .22;
        height: 200px;
    }

    /* Quality-Meter nicht mehr überm Text kleben → unter die Textarea */
    .tm-quality {
        position: static;
        margin-top: 10px;
        width: fit-content;
        margin-left: auto;
    }

    .tm-ai-note {
        position: static;
        margin-top: 8px;
    }

    /* Sub-Zeile darf auf Mobile umbrechen */
    .tm-composer-sub {
        flex-wrap: wrap;
        overflow: visible;
    }

    .tm-composer-hint {
        max-width: 100%;
    }

    /* Ecken ausblenden — stören auf kleinen Screens */
    .tm-corner {
        display: none;
    }

    /* Result-Bar: sauber stapeln */
    .tm-result-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .tm-result-actions {
        margin-left: 0;
        justify-content: space-between;
        width: 100%;
    }

    .tm-segmented {
        flex: 1;
    }

    .tm-seg-btn {
        flex: 1;
        min-width: 0;
    }

    .tm-report-frame {
        height: calc(100dvh - var(--tm-h-header, 52px) - var(--tm-h-toolbar, 52px) - 48px);
        min-height: 480px;
    }

    /* Modal / Drawer volle Breite */
    .tm-modal {
        padding: 20px;
    }

    .tm-example-grid {
        grid-template-columns: 1fr;
    }

    .tm-drawer-panel {
        max-width: 100%;
    }

    /* Onboarding volle Breite mit Rand */
    .tm-onboarding {
        left: 12px;
        right: 12px;
        bottom: 12px;
        max-width: none;
    }
}

/* ── Mini-Phone (≤400px) ── */
@media (max-width: 400px) {
    .tm-header-actions {
        gap: 0;
        padding: 4px;
    }

    .tm-header-actions .tm-icon-btn {
        width: 34px;
        height: 32px;
    }

    .tm-headline {
        font-size: 20px;
    }

    .tm-composer {
        padding: 16px;
    }

    .tm-seg-btn i {
        display: none;
    }

    .tm-report-frame {
        height: calc(100dvh - 320px);
    }
}

/* ============================================================================
   Landing-Footer: Förderhinweis + ProTeam
   ✅ "größer": Logos deutlich größer, Abstand kompakter (passt auf eine Seite)
   ============================================================================ */
.tm-funding {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--tm-border, rgba(0, 0, 0, .08));
    opacity: .9;
}

.tm-funding-link {
    display: inline-flex;
}

.tm-funding-logo {
    /* min | ideal (breitenabhängig) | max */
    height: clamp(52px, 10dvh, 110px);
    width: auto;
    object-fit: contain;
    transition: opacity .15s ease;
}

.tm-funding-logo-sponsor {
    height: clamp(72px, 10dvh, 110px);
    /* deine Zielhöhe */
    filter: none !important;
    /* offizielle Förderfarben – nie invertieren */
    border-radius: 10px;
    background: #fff;
    /* füllt evtl. transparente Ränder sauber weiß */
    padding: 6px 10px;
    /* etwas Luft, damit der Text nicht am Rand klebt */
    box-sizing: border-box;
}

[data-bs-theme="dark"] .tm-funding-logo-sponsor {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .08),
        0 2px 10px rgba(0, 0, 0, .35);
}

.tm-funding-link:hover .tm-funding-logo {
    opacity: .7;
}

.tm-funding-sep {
    width: 1px;
    height: 40px;
    background: var(--tm-border, rgba(0, 0, 0, .12));
}

/* Dark Mode: ProTeam-Logo darf invertieren, Förderlogo NICHT (offizielle Farben) */
[data-bs-theme="dark"] .tm-funding-logo:not(.tm-funding-logo-sponsor) {
    filter: brightness(0) invert(1);
}

/* no-invert: Förderlogo behält immer die Originalfarben */
.tm-funding-logo-sponsor {
    filter: none !important;
}

@media (max-width: 520px) {
    .tm-funding {
        gap: 16px;
    }

    .tm-funding-logo {
        height: 40px;
    }

    .tm-funding-logo-sponsor {
        height: 52px;
    }

    .tm-funding-sep {
        display: none;
    }
}

/* ============================================================================
   TOPBAR — „Neue Analyse"
   ============================================================================ */
.tm-ctx-back {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 32px;
    padding: 0 14px;
    margin-left: 6px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    color: var(--tm-text);
    background: var(--tm-surface);
    border: 1px solid var(--tm-border);
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
    flex: 0 0 auto;
    box-shadow: var(--tm-shadow-sm);
    transition: all .15s var(--tm-ease);
}

.tm-ctx-back:hover {
    background: var(--tm-surface-2);
    border-color: var(--tm-text-soft);
    transform: translateX(-2px);
}

.tm-ctx-back:active {
    transform: translateX(-2px) scale(.97);
}

.tm-ctx-back i {
    font-size: 11px;
    color: var(--tm-text-muted);
    transition: transform .15s var(--tm-ease);
}

.tm-ctx-back:hover i {
    color: var(--tm-primary);
    transform: translateX(-2px);
}

.tm-ctx-back:focus-visible {
    outline: 2px solid var(--tm-primary);
    outline-offset: 2px;
}

@media (max-width: 720px) {
    .tm-ctx-back {
        padding: 0 10px;
    }

    .tm-ctx-back span {
        display: none;
    }
}

/* ============================================================================
   RESULT-BAR — sticky, eine Reihe
   ============================================================================ */
.tm-result-bar {
    position: sticky;
    top: var(--tm-h-header, 52px);
    z-index: 9;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 4px;
    margin-bottom: 14px;
    background: transparent;
    backdrop-filter: saturate(1.2) blur(10px);
}

.tm-result-slot {
    display: flex;
    align-items: center;
    min-width: 0;
    flex: 1 1 auto;
}

.tm-result-tools {
    display: flex;
    gap: 4px;
    padding-left: 10px;
    border-left: 1px solid var(--tm-border);
    flex: 0 0 auto;
}

/* Responsive */
@media (max-width: 900px) {
    .tm-ctx-title {
        max-width: 160px;
    }

    .tm-ctx-time {
        display: none;
    }
}

@media (max-width: 720px) {
    .tm-header-ctx {
        padding-left: 10px;
        gap: 8px;
    }

    .tm-ctx-back span {
        display: none;
    }

    .tm-ctx-back {
        padding: 6px 10px;
    }

    .tm-ctx-title {
        display: none;
    }

    .tm-result-bar {
        gap: 8px;
    }

    .tm-result-slot {
        order: 3;
        flex-basis: 100%;
    }

    .tm-result-tools {
        margin-left: 0;
    }
}



/* ---- Modal-Header mit Untertitel ---- */
.modal-header.tm-header {
    align-items: flex-start;
    padding-bottom: .9rem;
}

.tm-header .modal-title {
    font-size: 1.05rem;
    font-weight: 650;
    line-height: 1.3;
    margin-bottom: .15rem;
}

.tm-header-sub {
    display: block;
    font-size: .78rem;
    opacity: .5;
    line-height: 1.4;
}

/* ---- Typografie ---- */
.tm-eyebrow {
    display: block;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    opacity: .45;
    margin-bottom: .55rem;
}

.tm-lead {
    font-size: 1rem;
    line-height: 1.55;
    margin: 0 0 1rem;
}

.tm-text {
    font-size: .9rem;
    line-height: 1.65;
    opacity: .78;
    margin: 0 0 1.25rem;
}

.tm-sep {
    margin: 1.5rem 0 1.15rem;
    opacity: .1;
}

/* ---- Ablaufkette ---- */
.tm-flow {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .4rem;
    margin: 0 0 1.35rem;
}

.tm-flow-step {
    padding: .32rem .7rem;
    border: 1px solid var(--tm-border, #dee2e6);
    border-radius: 7px;
    font-size: .82rem;
    font-weight: 500;
    background: var(--tm-surface, #fff);
    white-space: nowrap;
}

.tm-flow-step--out {
    border-color: currentColor;
    font-weight: 650;
}

.tm-flow-arrow {
    opacity: .3;
    font-size: .85rem;
}

/* ---- Video als gerahmte Figure ---- */
.tm-video-card {
    margin: 0 0 1.35rem;
    border: 1px solid var(--tm-border, #dee2e6);
    border-radius: 10px;
    overflow: hidden;
    background: var(--tm-surface, #fff);
}

.tm-video-card video {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    background: #000;
}

.tm-video-card figcaption {
    display: flex;
    align-items: center;
    gap: .45rem;
    padding: .55rem .8rem;
    font-size: .78rem;
    opacity: .6;
    border-top: 1px solid var(--tm-border, #dee2e6);
}

.tm-video-card figcaption i {
    font-size: .8rem;
}

/* ---- Features: linksbuendig, ruhig ---- */
.tm-feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: .5rem;
    margin-bottom: 1.35rem;
}

.tm-feature {
    text-align: left;
    padding: .8rem .85rem;
    border: 1px solid var(--tm-border, #dee2e6);
    border-radius: 8px;
    background: transparent;
}

.tm-feature i {
    display: block;
    font-size: .95rem;
    opacity: .4;
    margin: 0 0 .5rem;
}

.tm-feature b {
    display: block;
    font-size: .87rem;
    font-weight: 600;
    margin-bottom: .15rem;
}

.tm-feature span {
    display: block;
    font-size: .8rem;
    line-height: 1.45;
    opacity: .62;
}

/* ---- Hinweis ---- */
.tm-note {
    font-size: .78rem;
    line-height: 1.55;
    opacity: 1;
    /* war .45 */
    color: var(--tm-text-muted);
    /* erbte vorher --tm-text */
    margin: 0;
    padding-top: .9rem;
    border-top: 1px solid var(--tm-border);
}

/* ---- Team-Grid ---- */
.tm-team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
    gap: .6rem;
}


/* ---- Dark Mode ---- */
[data-bs-theme="dark"] .tm-flow-step,
[data-bs-theme="dark"] .tm-feature,
[data-bs-theme="dark"] .tm-video-card,
[data-bs-theme="dark"] .tm-video-card figcaption,
[data-bs-theme="dark"] .tm-note {
    border-color: #3a4657;
}

/* ---- Mobil ---- */
@media (max-width: 575.98px) {
    .tm-flow-arrow {
        display: none;
    }

    .tm-header .modal-title {
        font-size: .95rem;
    }

    .tm-lead {
        font-size: .94rem;
    }
}


/* Modal-Links (Startseite, Viewer) */
.tm-modal-links {
    display: grid;
    gap: 8px;
    margin: 4px 0 16px;
}

.tm-modal-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--tm-border);
    border-radius: var(--tm-radius);
    background: var(--tm-surface);
    color: var(--tm-text);
    text-decoration: none;
    transition: border-color .15s var(--tm-ease), background .15s var(--tm-ease);
}

.tm-modal-link:hover {
    border-color: var(--tm-primary);
    background: var(--tm-primary-tint);
    color: var(--tm-text);
}

.tm-modal-link>i:first-child {
    font-size: 15px;
    color: var(--tm-primary);
    width: 18px;
    text-align: center;
    flex: 0 0 auto;
}

.tm-modal-link span {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    flex: 1 1 auto;
}

.tm-modal-link b {
    font-size: 13.5px;
    font-weight: 600;
}

.tm-modal-link small {
    font-size: 11.5px;
    color: var(--tm-text-muted);
    line-height: 1.4;
}

.tm-modal-link-go {
    font-size: 11px;
    color: var(--tm-text-soft);
    flex: 0 0 auto;
    transition: transform .15s var(--tm-ease), color .15s var(--tm-ease);
}

.tm-modal-link:hover .tm-modal-link-go {
    color: var(--tm-primary);
    transform: translateX(2px);
}

/* ============================================================================
   HEADER-LOGO · Theme-Umschaltung
   ----------------------------------------------------------------------------
   Zwei Bilder statt src-Tausch per JS: der Theme-Guard im <head> setzt
   data-bs-theme vor dem ersten Rendern, dadurch kein Umschalt-Flash.

   ACHTUNG Spezifitaet: .lp-header-logo img und .tm-brand-logo img setzen
   display:block (0,1,1). Ein blosses .tm-logo-dark (0,1,0) wuerde davon
   ueberschrieben -- beide Logos waeren sichtbar. Deshalb hier die
   Kombination aus Container und Klasse (0,2,1).
   ============================================================================ */

.tm-brand-logo img.tm-logo-dark,
.lp-header-logo img.tm-logo-dark {
    display: none;
}

[data-bs-theme="dark"] .tm-brand-logo img.tm-logo-light,
[data-bs-theme="dark"] .lp-header-logo img.tm-logo-light {
    display: none;
}

[data-bs-theme="dark"] .tm-brand-logo img.tm-logo-dark,
[data-bs-theme="dark"] .lp-header-logo img.tm-logo-dark {
    display: block;
}