.taskflow-toolbar-panel {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(120% 70% at 100% -10%, rgba(16, 185, 129, 0.12), transparent 62%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.94) 100%);
    border-color: rgba(148, 163, 184, 0.3);
    box-shadow: 0 16px 34px rgba(15, 23, 42, 0.1);
}

.taskflow-toolbar-panel::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 3px;
    background: linear-gradient(90deg, #10b981 0%, #14b8a6 45%, #3b82f6 100%);
    opacity: 0.95;
}

.dark .taskflow-toolbar-panel {
    background:
        radial-gradient(120% 70% at 100% -10%, rgba(16, 185, 129, 0.18), transparent 62%),
        linear-gradient(180deg, rgba(17, 24, 39, 0.98) 0%, rgba(15, 23, 42, 0.96) 100%);
    border-color: rgba(71, 85, 105, 0.6);
    box-shadow: 0 16px 36px rgba(2, 6, 23, 0.52);
}

.taskflow-toolbar-kicker,
.taskflow-toolbar-top,
.taskflow-toolbar-presets,
.taskflow-toolbar-meta {
    position: relative;
    z-index: 1;
}

.taskflow-toolbar-kicker {
    color: #475569;
}

.dark .taskflow-toolbar-kicker {
    color: #94a3b8;
}

.taskflow-toolbar-grid {
    align-items: end;
}

.taskflow-field {
    font-weight: 600;
    letter-spacing: 0.01em;
}

.taskflow-toolbar-actions {
    padding: 6px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(255, 255, 255, 0.72);
}

.dark .taskflow-toolbar-actions {
    border-color: rgba(71, 85, 105, 0.5);
    background: rgba(15, 23, 42, 0.45);
}

.taskflow-toolbar-presets {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(148, 163, 184, 0.28);
}

.dark .taskflow-toolbar-presets {
    border-top-color: rgba(71, 85, 105, 0.45);
}

.taskflow-toolbar-meta {
    margin-top: 10px;
    padding: 7px 10px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    background: rgba(255, 255, 255, 0.65);
    color: #475569;
}

.dark .taskflow-toolbar-meta {
    border-color: rgba(71, 85, 105, 0.48);
    background: rgba(15, 23, 42, 0.5);
    color: #94a3b8;
}

.taskflow-module-card {
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.99) 0%, rgba(248, 250, 252, 0.94) 100%);
    border-color: rgba(148, 163, 184, 0.28);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
    min-height: 132px;
}

.taskflow-module-card::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 2px;
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.6), rgba(59, 130, 246, 0.2));
}

.dark .taskflow-module-card {
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.98) 0%, rgba(15, 23, 42, 0.96) 100%);
    border-color: rgba(71, 85, 105, 0.54);
    box-shadow: 0 12px 26px rgba(2, 6, 23, 0.4);
}

.taskflow-module-head {
    padding-top: 2px;
    padding-bottom: 2px;
}

.taskflow-module-title {
    letter-spacing: 0.01em;
    white-space: normal;
    line-height: 1.35;
}

.taskflow-module-stats {
    color: #64748b;
}

.dark .taskflow-module-stats {
    color: #94a3b8;
}

.taskflow-module-controls {
    padding: 4px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    background: rgba(248, 250, 252, 0.7);
}

.dark .taskflow-module-controls {
    border-color: rgba(71, 85, 105, 0.45);
    background: rgba(15, 23, 42, 0.45);
}

.taskflow-group-surface {
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.9) 0%, rgba(241, 245, 249, 0.72) 100%);
    border-color: rgba(148, 163, 184, 0.24);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.dark .taskflow-group-surface {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.62) 0%, rgba(15, 23, 42, 0.44) 100%);
    border-color: rgba(71, 85, 105, 0.45);
    box-shadow: inset 0 1px 0 rgba(148, 163, 184, 0.04);
}

.taskflow-group-heading {
    color: #475569;
}

.dark .taskflow-group-heading {
    color: #cbd5e1;
}

.taskflow-control {
    border-color: #cbd5e1;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75), 0 1px 2px rgba(15, 23, 42, 0.06);
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.taskflow-control:hover {
    border-color: #94a3b8;
}

.taskflow-control:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.18);
}

.dark .taskflow-control {
    border-color: #475569;
    background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
    box-shadow: inset 0 1px 0 rgba(148, 163, 184, 0.07), 0 1px 2px rgba(2, 6, 23, 0.45);
}

.dark .taskflow-control:hover {
    border-color: #64748b;
}

.taskflow-control-chip {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.9) 100%);
    border-color: #cbd5e1;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.dark .taskflow-control-chip {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.74) 0%, rgba(17, 24, 39, 0.64) 100%);
    border-color: #475569;
}

.taskflow-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    letter-spacing: 0.01em;
    background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
    border-color: rgba(148, 163, 184, 0.7);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.09);
    transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.taskflow-btn:hover {
    background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
    border-color: rgba(100, 116, 139, 0.78);
    box-shadow: 0 3px 8px rgba(15, 23, 42, 0.14);
}

.taskflow-btn:active {
    transform: translateY(1px);
}

.taskflow-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

.dark .taskflow-btn {
    background: linear-gradient(180deg, #1f2937 0%, #111827 100%);
    border-color: rgba(100, 116, 139, 0.72);
    box-shadow: 0 1px 2px rgba(2, 6, 23, 0.5);
}

.dark .taskflow-btn:hover {
    background: linear-gradient(180deg, #334155 0%, #1e293b 100%);
    border-color: rgba(148, 163, 184, 0.72);
}

.taskflow-group-toggle {
    border-radius: 8px;
    padding: 4px 8px;
    transition: background-color 0.16s ease, color 0.16s ease;
}

.taskflow-group-toggle:hover {
    background: rgba(226, 232, 240, 0.78);
}

.dark .taskflow-group-toggle:hover {
    background: rgba(71, 85, 105, 0.45);
}

.taskflow-history-bar {
    display: inline-block;
    -webkit-appearance: none;
    appearance: none;
    width: 5px;
    height: 18px;
    min-width: 5px !important;
    min-height: 18px !important;
    border: 1px solid transparent;
    border-radius: 2px;
    padding: 0 !important;
    margin: 0;
    cursor: pointer;
    vertical-align: middle;
    touch-action: manipulation;
}

.taskflow-history-bar:focus-visible {
    outline: 2px solid #60a5fa;
    outline-offset: 1px;
}

.taskflow-filter-checkbox {
    min-width: 14px !important;
    min-height: 14px !important;
}

.taskflow-module-controls,
.taskflow-toolbar-actions,
.taskflow-toolbar-presets {
    column-gap: 0.6rem !important;
    row-gap: 0.6rem !important;
}

@media (max-width: 1279px) {
    .taskflow-toolbar-actions {
        width: 100%;
    }
}

@media (min-width: 640px) {
    .taskflow-history-bar {
        width: 6px;
        height: 20px;
        min-width: 6px !important;
        min-height: 20px !important;
    }
}

@media (pointer: coarse) {
    .taskflow-history-bar {
        width: 8px;
        height: 24px;
        min-width: 8px !important;
        min-height: 24px !important;
    }
}

/* Reduce offscreen rendering work for heavy app views */
#main-content > div[id^="view-"] {
    content-visibility: auto;
    contain-intrinsic-size: 900px;
}

/* Sticky headers behave reliably in the currently visible view */
#main-content > div[id^="view-"]:not(.hidden) {
    content-visibility: visible !important;
    contain-intrinsic-size: auto !important;
}

@media (prefers-reduced-motion: reduce) {
    .taskflow-btn,
    .taskflow-group-toggle {
        transition: none !important;
    }
}

/* ============================================================
   Diagramme: teal utility fallback (styles.min.css lacks teal set)
   ============================================================ */
.bg-teal-50 { background-color: #f0fdfa !important; }
.bg-teal-600 { background-color: #0d9488 !important; }
.hover\:bg-teal-700:hover { background-color: #0f766e !important; }
.hover\:bg-teal-100:hover { background-color: #ccfbf1 !important; }

.text-teal-300 { color: #5eead4 !important; }
.text-teal-400 { color: #2dd4bf !important; }
.text-teal-600 { color: #0d9488 !important; }
.text-teal-700 { color: #0f766e !important; }

.border-teal-200 { border-color: #99f6e4 !important; }
.border-teal-500 { border-color: #14b8a6 !important; }
.border-teal-800 { border-color: #115e59 !important; }

.ring-teal-500\/20 { --tw-ring-color: rgba(20, 184, 166, 0.2) !important; }
.border-teal-500\/30 { border-color: rgba(20, 184, 166, 0.3) !important; }
.border-teal-500\/40 { border-color: rgba(20, 184, 166, 0.4) !important; }

.dark .dark\:bg-teal-900\/20 { background-color: rgba(19, 78, 74, 0.2) !important; }
.dark .dark\:bg-teal-900\/30 { background-color: rgba(19, 78, 74, 0.3) !important; }
.dark .dark\:text-teal-300 { color: #5eead4 !important; }
.dark .dark\:text-teal-400 { color: #2dd4bf !important; }
.dark .dark\:border-teal-800 { border-color: #115e59 !important; }
.dark .dark\:hover\:bg-teal-900\/20:hover { background-color: rgba(19, 78, 74, 0.2) !important; }
.dark .dark\:hover\:bg-teal-900\/30:hover { background-color: rgba(19, 78, 74, 0.3) !important; }

/* Keep Diagramme button labels readable in light mode */
#diagramme-header button,
#diagramme-next-btn,
#diagramme-sim-submit-wrap button {
    color: inherit;
}


/* Keep module headers below the mobile app header */
@media (max-width: 767px) {
    #main-content [id$="-header"].sticky.top-0 {
        top: calc(var(--app-mobile-top-offset) + env(safe-area-inset-top, 0px) + 0.5rem) !important;
    }
}

#diagramme-invert-btn,
#diagramme-bookmark-btn {
    color: #334155 !important;
}

.dark #diagramme-invert-btn,
.dark #diagramme-bookmark-btn {
    color: #e2e8f0 !important;
}

/* Force readable button text in Diagramme view across light/dark + browser quirks */
#view-diagramme button,
#view-diagramme button span,
#view-diagramme button i,
#view-diagramme button svg {
    -webkit-text-fill-color: currentColor !important;
}

#diagramme-mode-selection button {
    color: #0f172a !important;
}

#diagramme-mode-selection button p {
    color: #64748b !important;
}

.dark #diagramme-mode-selection button {
    color: #e2e8f0 !important;
}

.dark #diagramme-mode-selection button p {
    color: #94a3b8 !important;
}

#diagramme-dropdown-btn {
    color: #0f766e !important;
}

.dark #diagramme-dropdown-btn {
    color: #5eead4 !important;
}

#diagramme-header button[data-ui-action="open-module-pdf-dialog"],
#diagramme-next-btn,
#diagramme-sim-submit-wrap button {
    color: #ffffff !important;
}

/* ============================================================
   Wiederholen: entschlackte Filterleiste + Kategorie-Buttons
   (ersetzt Status-Select, Lesezeichen-Checkbox und Auswahlmodus)
   ============================================================ */
.taskflow-toolbar-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.taskflow-toolbar-spacer { flex: 1 1 auto; min-width: 0; }

.taskflow-chip {
    padding: 5px 12px; border-radius: 999px; font: 600 12px/1 var(--otms-f-body);
    border: 1px solid var(--otms-line-strong); background: var(--otms-surface); color: var(--otms-ink-soft);
    cursor: pointer; transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.taskflow-chip:hover { background: var(--otms-bg-2); color: var(--otms-ink); }
.taskflow-chip.is-active { background: var(--otms-ink); border-color: var(--otms-ink); color: var(--otms-bg); }
.taskflow-chip.is-active.is-wrong { background: var(--otms-danger); border-color: var(--otms-danger); color: var(--otms-on-accent); }
.taskflow-chip.is-active.is-correct { background: var(--otms-ok); border-color: var(--otms-ok); color: var(--otms-on-accent); }
.taskflow-chip.is-active.is-marked { background: var(--otms-warn); border-color: var(--otms-warn); color: #1B1B1F; }

.taskflow-linkbtn {
    padding: 4px 8px; border: 0; background: none; cursor: pointer;
    font: 600 12px/1 var(--otms-f-body); color: var(--otms-ink-soft);
    text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
}
.taskflow-linkbtn:hover { color: var(--otms-ink); }

.taskflow-btn--repeat {
    border-color: var(--otms-line-strong) !important;
    background: var(--otms-tint); color: var(--otms-ink); font-weight: 600;
}
.taskflow-btn--repeat:hover { background: var(--otms-accent); border-color: var(--otms-accent) !important; color: var(--otms-on-accent); }

.taskflow-group-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.taskflow-group-toggle { flex: 1 1 auto; min-width: 0; }
.taskflow-group-repeat {
    flex: 0 0 auto; padding: 2px 8px; border: 1px solid var(--otms-line); border-radius: 999px;
    background: none; cursor: pointer; font: 600 10px/1.6 var(--otms-f-body);
    letter-spacing: .04em; text-transform: uppercase; color: var(--otms-ink-soft);
}
.taskflow-group-repeat:hover { border-color: var(--otms-accent); color: var(--otms-accent); }

@media (max-width: 640px) {
    .taskflow-toolbar-spacer { display: none; }
    .taskflow-group-repeat { font-size: 9.5px; }
}
