/* ============================================================
   UI REVAMP — Unified hub layout layer
   Loaded LAST so it harmonises every area on top of
   main.css + content-creation-fixes.css.

   Principles:
   - Keep the red (#dc2626) / dark scheme — only refresh
     gradients, shadows, spacing and rhythm.
   - CSS-first: one collector selector aligns every module
     header, page shell and the "In Bearbeitung" bar.
   - No functional/workflow changes.
   ============================================================ */

/* ------------------------------------------------------------
   1. Tokens — extend the scale, add focus/gradient/shadow
   ------------------------------------------------------------ */
:root {
    --space-7: 28px;
    --space-9: 36px;

    /* Unified page width for every standard area */
    --content-max: 1320px;

    /* Fresh, layered shadows */
    --shadow-soft: 0 2px 8px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.12), 0 4px 8px rgba(0, 0, 0, 0.06);
    --shadow-pop: 0 16px 48px rgba(0, 0, 0, 0.18);

    /* Accessible focus ring */
    --focus-ring: 0 0 0 3px var(--primary-glow);

    /* Subtle brand gradients */
    --grad-primary: linear-gradient(135deg, #e5342f 0%, var(--primary) 55%, var(--primary-hover) 100%);
    --grad-surface: linear-gradient(180deg, rgba(255, 255, 255, 0.6) 0%, rgba(255, 255, 255, 0) 60%);

    /* Header divider */
    --header-divider: 1px solid var(--border-light);
    --header-title-size: clamp(1.4rem, 1.1rem + 1vw, 1.9rem);
}

body.dark-mode {
    --shadow-soft: 0 1px 3px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    --shadow-hover: 0 12px 36px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.07);
    --shadow-pop: 0 20px 48px rgba(0, 0, 0, 0.7);
    --grad-surface: linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0) 55%);
    --header-divider: 1px solid var(--border-default);
}

/* ------------------------------------------------------------
   2. Page shell — one width + rhythm for every area
   ------------------------------------------------------------ */
.content-area {
    padding: var(--space-8) var(--space-9);
}

body.dark-mode .content-area {
    padding: var(--space-8) var(--space-9);
}

/* Every module wrapper breathes the same way */
.module-container,
.video-workflow-module,
.trend-radar-module,
.ideas-dashboard-module,
.analytics-page,
.content-planner-container,
.admin-dashboard,
.kb-module,
.skills-module,
.mem-dash-module,
.debugger-unified-module,
.cockpit-dashboard,
.learning-hub {
    max-width: var(--content-max) !important;
    margin-left: auto !important;
    margin-right: auto !important;
    width: 100%;
}

/* Cards / containers pick up the refreshed elevation */
.module-container {
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
}

body.dark-mode .module-container {
    background:
        var(--grad-surface),
        var(--surface-primary);
    border: 1px solid var(--border-default);
    box-shadow:
        0 6px 28px rgba(0, 0, 0, 0.42),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* ------------------------------------------------------------
   3. Unified header pattern
   One flex row, shared spacing, shared divider, token colors.
   ------------------------------------------------------------ */
.module-header,
.video-header,
.radar-header,
.ideas-header-compact,
.kb-header,
.analytics-header,
.content-planner-header,
.admin-header,
.skills-header,
.mem-dash-header,
.debugger-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    flex-wrap: wrap;
    margin: 0 0 var(--space-6);
    padding: 0 0 var(--space-5);
    border-bottom: var(--header-divider);
}

/* Left column that holds the title stack */
.module-header > div:first-child,
.video-header-left,
.radar-header .header-left,
.ideas-header-left,
.kb-header > div:first-child,
.skills-header > div:first-child,
.mem-dash-header > div:first-child,
.analytics-header .header-left,
.admin-header .header-left,
.content-planner-header .header-left,
.debugger-header .header-left {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    min-width: 0;
}

/* Unified title */
.module-title,
.video-title,
.radar-title,
.ideas-title-compact,
.kb-header h1,
.skills-header h1,
.mem-dash-header h1,
.admin-header h1,
.debugger-header .module-title {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin: 0;
    font-family: var(--headline-font);
    font-size: var(--header-title-size);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

/* Title icon accent = brand red */
.module-title > i,
.video-title > i,
.radar-title > i,
.ideas-title-compact > i,
.kb-header h1 > i,
.skills-header h1 > i,
.mem-dash-header h1 > i,
.debugger-header .module-title > i {
    color: var(--primary);
    font-size: 0.9em;
}

/* Unified subtitle */
.module-subtitle,
.video-subtitle,
.radar-subtitle,
.mem-dash-sub,
.skills-header > div > p,
.kb-header > div > p {
    margin: 0;
    color: var(--text-secondary) !important;
    font-size: 0.9rem;
    line-height: 1.4;
    font-weight: var(--font-weight-normal);
}

/* Unified action clusters (right side) */
.module-actions,
.module-header-actions,
.module-header-right,
.video-header-actions,
.radar-header-actions,
.kb-header-actions,
.ideas-header-actions,
.mem-dash-toolbar,
.analytics-header .header-right,
.admin-header .header-right,
.content-planner-header .header-right,
.debugger-header .header-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}

/* Ideas stats strip sits calmly between title + actions */
.ideas-header-stats {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}

/* Radar meta line under the title */
.radar-last-updated {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* ------------------------------------------------------------
   4. "In Bearbeitung" bar — calm, consistent, under the header
   Real markup: .qc-projects-overview > button#(qc|video)-projects-toggle
   (CSS previously targeted a class that JS never renders.)
   ------------------------------------------------------------ */
.qc-projects-overview,
.qc-projects-overview.qc-projects-compact {
    margin: 0 0 var(--space-5) !important;
    padding: var(--space-2) !important;
    border: 1px solid var(--border-default) !important;
    border-radius: var(--radius-md) !important;
    background: var(--surface-secondary) !important;
    text-align: left !important;
}

/* The toggle is a .btn.btn-secondary.btn-sm in the DOM — calm it down */
#qc-projects-toggle,
#video-projects-toggle,
.qc-projects-overview > button {
    display: flex !important;
    align-items: center;
    width: 100%;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-3) !important;
    background: transparent !important;
    border: none !important;
    border-radius: var(--radius-sm) !important;
    color: var(--text-primary) !important;
    font-weight: var(--font-weight-semibold) !important;
    font-size: 0.9rem !important;
    text-align: left;
    box-shadow: none !important;
    transition: background 0.18s ease;
}

#qc-projects-toggle:hover,
#video-projects-toggle:hover,
.qc-projects-overview > button:hover {
    background: var(--surface-hover) !important;
    transform: none !important;
}

/* Leading folder icon = brand accent, chevron pushed to the far right */
#qc-projects-toggle > i:first-child,
#video-projects-toggle > i:first-child,
.qc-projects-overview > button > i:first-child {
    color: var(--primary);
}

#qc-projects-toggle > i:last-child,
#video-projects-toggle > i:last-child,
.qc-projects-overview > button > i:last-child {
    margin-left: auto !important;
    opacity: 0.6;
}

.qc-projects-drawer {
    padding: var(--space-3) var(--space-2) var(--space-1);
    max-height: min(60vh, 520px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.qc-projects-search {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    background: var(--surface-primary);
    color: var(--text-primary);
    margin-bottom: var(--space-3);
}

/* ------------------------------------------------------------
   5. Cleaned-up module headers that used hardcoded colors
   (JS still injects a few; make sure tokens win here.)
   ------------------------------------------------------------ */
.skills-header h1,
.mem-dash-header h1,
.kb-header h1 {
    color: var(--text-primary) !important;
}

.skills-header p,
.mem-dash-sub,
.kb-header > div > p {
    color: var(--text-secondary) !important;
}

.kb-header-link {
    color: var(--primary);
}

/* ------------------------------------------------------------
   6. Components — cards, buttons, inputs, empty states, modals
   ------------------------------------------------------------ */

/* Cards: consistent radius + gentle hover lift */
.card {
    border-radius: var(--radius-lg);
    transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 0.22s ease,
                border-color 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

/* Primary buttons: subtle brand gradient + depth */
.btn-primary {
    background: var(--grad-primary);
    border: 1px solid transparent;
    box-shadow: 0 2px 8px var(--primary-glow);
}

.btn-primary:hover:not(:disabled) {
    background: var(--grad-primary);
    box-shadow: 0 8px 20px var(--primary-glow);
}

/* Secondary / outline: consistent token borders */
.btn-secondary {
    border-radius: var(--radius-sm);
}

.btn-outline {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: transparent;
    color: var(--text-primary);
}

.btn-outline:hover:not(:disabled) {
    background: var(--surface-hover);
    border-color: var(--primary);
}

/* Visible, consistent keyboard focus everywhere */
.btn:focus-visible,
a:focus-visible,
[role="button"]:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* Inputs: unified radius + brand focus ring */
.form-control,
.kb-search-input,
.qc-projects-search,
input[type="text"],
input[type="search"],
input[type="email"],
input[type="number"],
input[type="password"],
textarea,
select {
    border-radius: var(--radius-sm);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.form-control:focus,
.kb-search-input:focus,
.qc-projects-search:focus,
input[type="text"]:focus,
input[type="search"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

/* Empty states: consistent, calm */
.empty-state {
    border-radius: var(--radius-lg);
    padding: var(--space-8) var(--space-6);
}

/* Modals: refreshed elevation + backdrop (extends prior polish layer) */
.ui-modal-panel,
.radar-modal,
.modal-content {
    box-shadow: var(--shadow-pop);
    border: 1px solid var(--border-default);
}

.ui-modal-overlay,
.radar-modal-overlay,
.modal-overlay {
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
}

/* Modern, unobtrusive scrollbars */
.content-area,
.qc-projects-drawer,
.modal-body,
.ui-modal-panel .modal-body {
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}

.content-area::-webkit-scrollbar,
.qc-projects-drawer::-webkit-scrollbar,
.modal-body::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.content-area::-webkit-scrollbar-thumb,
.qc-projects-drawer::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.content-area::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--text-disabled);
    background-clip: padding-box;
}

/* ------------------------------------------------------------
   7. Special pages — align width/rhythm only, keep character
   ------------------------------------------------------------ */
.learning-hub,
.cockpit-dashboard {
    padding-top: var(--space-2);
}

/* Compliance is full-viewport; keep its centered character,
   just make the inner content share the rhythm. */
.compliance-coming-soon .coming-soon-content {
    max-width: min(820px, 100%);
    margin: 0 auto;
}

/* ------------------------------------------------------------
   Reference-image uploader (hybrid image generation)
   ------------------------------------------------------------ */
.ref-images {
    margin: var(--space-4) 0;
    padding: var(--space-4);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-md);
    background: var(--surface-secondary);
}

.ref-images-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin: 0 0 var(--space-1);
    font-weight: var(--font-weight-semibold);
}

.ref-images-label i { color: var(--primary); }

.ref-images-coming-soon {
    opacity: 0.72;
    pointer-events: none;
    user-select: none;
}

.ref-images-soon-badge {
    display: inline-flex;
    align-items: center;
    margin-left: var(--space-2);
    padding: 0.1rem 0.45rem;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: var(--font-weight-semibold);
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--text-secondary);
    background: var(--surface-tertiary, rgba(0, 0, 0, 0.06));
    border: 1px solid var(--border-strong);
}

.ref-images-hint {
    margin: 0 0 var(--space-3);
    font-size: 0.82rem;
    line-height: 1.4;
    color: var(--text-secondary);
}

.ref-images-coming-soon .ref-images-hint {
    margin-bottom: 0;
}

.ref-images-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.ref-thumb {
    position: relative;
    width: 88px;
    height: 88px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-default);
    background: var(--surface-primary);
    box-shadow: var(--shadow-soft);
}

.ref-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ref-thumb-pending {
    opacity: 0.6;
}

.ref-thumb-pending::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(45deg, rgba(0,0,0,0.15) 0 6px, rgba(0,0,0,0) 6px 12px);
}

.ref-thumb-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.18s ease, transform 0.18s ease;
}

.ref-thumb-remove:hover {
    background: var(--primary);
    transform: scale(1.08);
}

.ref-thumb-add {
    width: 88px;
    height: 88px;
    border-radius: var(--radius-sm);
    border: 1px dashed var(--border-strong);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 0.72rem;
    text-align: center;
    padding: var(--space-2);
    transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.ref-thumb-add i { font-size: 1rem; }

.ref-thumb-add:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

/* ------------------------------------------------------------
   8. Responsive: headers stack gracefully on narrow widths
   ------------------------------------------------------------ */
@media (max-width: 720px) {
    .module-header,
    .video-header,
    .radar-header,
    .ideas-header-compact,
    .kb-header,
    .analytics-header,
    .content-planner-header,
    .admin-header,
    .skills-header,
    .mem-dash-header,
    .debugger-header {
        flex-direction: column;
        align-items: stretch;
    }

    .module-actions,
    .video-header-actions,
    .radar-header-actions,
    .kb-header-actions,
    .mem-dash-toolbar,
    .analytics-header .header-right,
    .admin-header .header-right {
        width: 100%;
    }

    .content-area {
        padding: var(--space-5) var(--space-4);
    }
}

/* ------------------------------------------------------------
   9. Per-brand module access (admin) — toggles + modal
   ------------------------------------------------------------ */

/* Compact "6/8" badge in the admin brands table */
.brand-modules-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: var(--space-2);
    padding: 2px 8px;
    font-size: 0.72rem;
    font-weight: var(--font-weight-semibold);
    line-height: 1.4;
    color: var(--text-secondary);
    background: var(--surface-secondary);
    border: 1px solid var(--border);
    border-radius: 999px;
    white-space: nowrap;
}
.brand-modules-badge i { font-size: 0.66rem; color: var(--primary); }

/* Modal shell reuse */
.mod-access-overlay { z-index: 10050 !important; }
.mod-access-modal { max-width: 520px; width: 100%; }
.mod-access-hint {
    margin: 0 0 var(--space-4);
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-secondary);
}
.mod-access-bulk {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

/* List of toggle rows (shared by admin modal + settings modal) */
.mod-access-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.mod-access-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-secondary);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.mod-access-row:hover { border-color: var(--border-strong); }
.mod-access-row.locked { cursor: default; opacity: 0.85; }

.mod-access-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
}
.mod-access-info > i {
    width: 20px;
    text-align: center;
    color: var(--primary);
    font-size: 0.95rem;
}
.mod-access-name {
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
}
.mod-access-locked {
    margin-left: var(--space-2);
    padding: 1px 8px;
    font-size: 0.68rem;
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-secondary);
    background: var(--surface-tertiary, var(--surface));
    border: 1px solid var(--border);
    border-radius: 999px;
}

/* Toggle switch */
.mod-access-switch {
    position: relative;
    flex: 0 0 auto;
    width: 42px;
    height: 24px;
}
.mod-access-switch input {
    position: absolute;
    inset: 0;
    opacity: 0;
    margin: 0;
    cursor: pointer;
    z-index: 2;
}
.mod-access-switch input:disabled { cursor: default; }
.mod-access-slider {
    position: absolute;
    inset: 0;
    background: var(--border-strong);
    border-radius: 999px;
    transition: background 0.2s ease;
}
.mod-access-slider::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
    transition: transform 0.2s ease;
}
.mod-access-switch input:checked ~ .mod-access-slider { background: var(--primary); }
.mod-access-switch input:checked ~ .mod-access-slider::before { transform: translateX(18px); }
.mod-access-switch input:disabled ~ .mod-access-slider { opacity: 0.7; }
.mod-access-switch input:focus-visible ~ .mod-access-slider {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* Settings brand modal: give the section breathing room + a divider */
.brand-module-access-section {
    margin-top: var(--space-5);
    padding-top: var(--space-5);
    border-top: 1px solid var(--border);
}

/* ============================================================
   GRAPHITE POLISH — Apple-like dark surfaces, tight rhythm
   Loaded last; dark-mode only overrides.
   ============================================================ */

body.dark-mode .content-area {
    padding: var(--space-5) var(--space-6) !important;
}

body.dark-mode .module-container,
body.dark-mode .video-workflow-module,
body.dark-mode .trend-radar-module,
body.dark-mode .ideas-dashboard-module,
body.dark-mode .analytics-page,
body.dark-mode .content-planner-container,
body.dark-mode .admin-dashboard,
body.dark-mode .kb-module,
body.dark-mode .skills-module,
body.dark-mode .mem-dash-module,
body.dark-mode .debugger-unified-module,
body.dark-mode .cockpit-dashboard,
body.dark-mode .learning-hub {
    padding: var(--space-5) !important;
    border-radius: var(--radius-lg) !important;
}

body.dark-mode .top-header {
    height: 56px;
    backdrop-filter: saturate(1.4) blur(12px);
    background: rgba(10, 10, 10, 0.88) !important;
}

body.dark-mode .sidebar {
    backdrop-filter: saturate(1.2) blur(8px);
}

body.dark-mode .module-title,
body.dark-mode h2.module-title,
body.dark-mode .page-title {
    letter-spacing: -0.02em;
    font-weight: 650;
}

body.dark-mode .module-subtitle,
body.dark-mode .page-subtitle {
    color: var(--text-secondary);
    letter-spacing: -0.01em;
}

/* Cards / panels — metallic graphite */
body.dark-mode .analytics-card,
body.dark-mode .quick-stat-card,
body.dark-mode .cockpit-card,
body.dark-mode .stat-card,
body.dark-mode .settings-card,
body.dark-mode .settings-section,
body.dark-mode .kb-card,
body.dark-mode .idea-card,
body.dark-mode .stage-card,
body.dark-mode .workflow-card,
body.dark-mode .admin-card,
body.dark-mode .panel,
body.dark-mode .modal-content,
body.dark-mode .mod-access-modal {
    background: linear-gradient(180deg, #141416 0%, #0e0e10 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--card-highlight), 0 4px 20px rgba(0, 0, 0, 0.35) !important;
}

body.dark-mode .analytics-card .card-header,
body.dark-mode .card-header,
body.dark-mode .panel-header,
body.dark-mode .settings-card-header {
    background: transparent !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07) !important;
    padding: 12px 16px !important;
}

body.dark-mode .analytics-card .card-body,
body.dark-mode .card-body {
    padding: 14px 16px !important;
}

body.dark-mode .analytics-page {
    padding: 20px !important;
}

body.dark-mode .analytics-header {
    margin-bottom: 18px !important;
    gap: 12px !important;
}

body.dark-mode .analytics-quick-stats {
    gap: 12px !important;
    margin-bottom: 16px !important;
}

body.dark-mode .analytics-charts-grid {
    gap: 12px !important;
    margin-bottom: 12px !important;
}

body.dark-mode .quick-stat-card {
    padding: 14px 16px !important;
    border-radius: var(--radius-md) !important;
}

body.dark-mode .quick-stat-card .stat-icon {
    width: 40px !important;
    height: 40px !important;
    border-radius: 8px !important;
    font-size: 16px !important;
}

body.dark-mode .quick-stat-card .stat-value {
    font-size: 22px !important;
    letter-spacing: -0.02em;
}

/* Buttons — sharper, metallic */
body.dark-mode .btn {
    border-radius: 8px !important;
    letter-spacing: -0.01em;
}

body.dark-mode .btn-sm {
    border-radius: 6px !important;
}

body.dark-mode .btn-outline {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
}

body.dark-mode .btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(220, 38, 38, 0.5);
}

/* Inputs */
body.dark-mode .form-control,
body.dark-mode input.form-control,
body.dark-mode select.form-control,
body.dark-mode textarea.form-control {
    border-radius: 8px !important;
}

/* Tables */
body.dark-mode .data-table,
body.dark-mode .analytics-brand-table,
body.dark-mode .planning-table {
    border-collapse: collapse;
}

body.dark-mode .data-table th,
body.dark-mode .analytics-brand-table th,
body.dark-mode .planning-table th {
    background: #0c0c0e !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-secondary) !important;
    padding: 10px 12px !important;
}

body.dark-mode .data-table td,
body.dark-mode .analytics-brand-table td,
body.dark-mode .planning-table td {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    padding: 10px 12px !important;
}

body.dark-mode .data-table tbody tr:hover,
body.dark-mode .analytics-brand-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03) !important;
}

/* Modals */
body.dark-mode .modal-overlay,
body.dark-mode .mod-access-overlay {
    background: rgba(0, 0, 0, 0.72) !important;
    backdrop-filter: blur(8px);
}

body.dark-mode .modal-content,
body.dark-mode .mod-access-modal {
    border-radius: 12px !important;
}

body.dark-mode .modal-header,
body.dark-mode .modal-footer {
    border-color: rgba(255, 255, 255, 0.07) !important;
    padding: 14px 18px !important;
}

/* Empty states — compact */
body.dark-mode .empty-state {
    padding: 28px 16px !important;
}

body.dark-mode .empty-state.compact {
    padding: 20px 12px !important;
}

/* Usage / progress bars */
body.dark-mode .usage-limit-row,
body.dark-mode .stat-bar-wrapper,
body.dark-mode .usage-limit-bar {
    background: rgba(255, 255, 255, 0.05) !important;
}

body.dark-mode .usage-limit-row {
    border-radius: 8px !important;
    padding: 10px 12px !important;
}

/* Cockpit / Control Center */
body.dark-mode .cockpit-dashboard {
    gap: 14px;
}

body.dark-mode .cockpit-grid,
body.dark-mode .dashboard-grid {
    gap: 12px !important;
}

/* Ideas / Video / Planner denser cards */
body.dark-mode .idea-card,
body.dark-mode .stage-panel,
body.dark-mode .workflow-stage {
    border-radius: var(--radius-md) !important;
}

/* Toast container sits above content */
body.dark-mode .toast,
body.dark-mode .toast-item {
    background: #141416 !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 10px !important;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
}

/* Scrollbars — thin, dark */
body.dark-mode ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
body.dark-mode ::-webkit-scrollbar-track {
    background: transparent;
}
body.dark-mode ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
}
body.dark-mode ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ============================================================
   GRAPHITE POLISH II — submenus, stage phases, tabs, popups
   ============================================================ */

/* --- Stage navigation / content creation phases --- */
/* Note: do NOT target .progress-steps — that class is the boot loader step row,
   which must stay borderless so long German labels are not clipped by the card radius. */
body.dark-mode .stage-navigator,
body.dark-mode .creation-stages,
body.dark-mode .workflow-progress {
    background: linear-gradient(180deg, #0e0e10 0%, #0a0a0a 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.07) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--card-highlight) !important;
}

body.dark-mode .stage-nav-item,
body.dark-mode .stage-progress-item,
body.dark-mode .progress-step {
    border-radius: 8px !important;
    transition: background 0.15s ease, color 0.15s ease;
}

body.dark-mode .stage-nav-item:not(.active):not(.completed),
body.dark-mode .stage-progress-item:not(.active):not(.completed) {
    background: transparent !important;
    color: var(--text-secondary);
}

body.dark-mode .stage-nav-item:hover:not(.active),
body.dark-mode .stage-progress-item:hover:not(.active) {
    background: rgba(255, 255, 255, 0.04) !important;
}

body.dark-mode .stage-nav-item.active,
body.dark-mode .stage-progress-item.active,
body.dark-mode .progress-step.active {
    background: linear-gradient(180deg, rgba(220, 38, 38, 0.16) 0%, rgba(220, 38, 38, 0.06) 100%) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), inset 0 0 0 1px rgba(220, 38, 38, 0.35) !important;
    color: #f5f5f7 !important;
}

body.dark-mode .stage-nav-item.completed,
body.dark-mode .stage-progress-item.completed,
body.dark-mode .progress-step.completed {
    color: #d4d4d8 !important;
}

body.dark-mode .stage-nav-number,
body.dark-mode .step-number,
body.dark-mode .step-num,
body.dark-mode .step-indicator {
    background: #18181b !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
    border-radius: 8px !important;
}

body.dark-mode .stage-nav-item.active .stage-nav-number,
body.dark-mode .progress-step.active .step-number,
body.dark-mode .progress-step.active .step-indicator {
    background: linear-gradient(180deg, #e5342f 0%, #b91c1c 100%) !important;
    border-color: transparent !important;
    color: #fff !important;
}

body.dark-mode .step-connector {
    background: rgba(255, 255, 255, 0.08) !important;
}

/* Stage cards & output areas (Quick Create phases) */
body.dark-mode .stage-card,
body.dark-mode .stage-card-mini,
body.dark-mode .stage-content,
body.dark-mode .output-section,
body.dark-mode .platform-card {
    background: linear-gradient(180deg, #141416 0%, #0e0e10 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--card-highlight) !important;
}

body.dark-mode .stage-card-header {
    background: transparent !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07) !important;
}

body.dark-mode .platform-card:hover,
body.dark-mode .stage-card:hover {
    border-color: rgba(220, 38, 38, 0.45) !important;
    box-shadow: 0 0 20px rgba(220, 38, 38, 0.1), var(--card-highlight) !important;
}

body.dark-mode .platform-card.selected,
body.dark-mode .platform-card.active {
    border-color: rgba(220, 38, 38, 0.6) !important;
    background: linear-gradient(180deg, rgba(220, 38, 38, 0.12) 0%, #0e0e10 100%) !important;
}

/* --- Settings tabs --- */
body.dark-mode .settings-tabs {
    background: #0a0a0a !important;
    border: 1px solid rgba(255, 255, 255, 0.07) !important;
    border-radius: 10px !important;
    padding: 4px !important;
    gap: 2px !important;
}

body.dark-mode .settings-tab {
    background: transparent !important;
    border: none !important;
    border-radius: 7px !important;
    color: var(--text-secondary) !important;
    padding: 8px 14px !important;
}

body.dark-mode .settings-tab:hover:not(.active) {
    background: rgba(255, 255, 255, 0.05) !important;
    color: #f5f5f7 !important;
}

body.dark-mode .settings-tab.active {
    background: linear-gradient(180deg, #222226 0%, #18181b 100%) !important;
    color: #f5f5f7 !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 1px 3px rgba(0, 0, 0, 0.4) !important;
}

/* --- Knowledge Base --- */
body.dark-mode .kb-header,
body.dark-mode .kb-card {
    background: linear-gradient(180deg, #141416 0%, #0e0e10 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--card-highlight) !important;
}

body.dark-mode .kb-search-input {
    background: #0c0c0e !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 8px !important;
}

/* --- Learning Hub --- */
body.dark-mode .lesson-card,
body.dark-mode .lesson-hero,
body.dark-mode .lesson-content,
body.dark-mode .lesson-nav {
    background: linear-gradient(180deg, #141416 0%, #0e0e10 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--card-highlight) !important;
}

body.dark-mode .lesson-card:hover {
    border-color: rgba(220, 38, 38, 0.4) !important;
    transform: translateY(-2px);
}

/* --- Admin dashboard --- */
body.dark-mode .admin-header,
body.dark-mode .admin-card,
body.dark-mode .admin-section {
    background: linear-gradient(180deg, #141416 0%, #0e0e10 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--card-highlight) !important;
}

body.dark-mode .admin-grid {
    gap: 12px !important;
}

/* --- Dropdowns, selects, context menus, tooltips --- */
body.dark-mode .dropdown-menu,
body.dark-mode .brand-selector-dropdown,
body.dark-mode .autocomplete-list,
body.dark-mode .context-menu,
body.dark-mode select.form-control option {
    background: #141416 !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 10px !important;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
}

body.dark-mode .dropdown-menu a,
body.dark-mode .dropdown-menu button,
body.dark-mode .brand-selector-dropdown .brand-option {
    border-radius: 7px;
}

body.dark-mode .dropdown-menu a:hover,
body.dark-mode .dropdown-menu button:hover,
body.dark-mode .brand-selector-dropdown .brand-option:hover {
    background: rgba(255, 255, 255, 0.05) !important;
}

/* --- All modals & popups: unified graphite --- */
body.dark-mode .modal-content,
body.dark-mode .modal-large,
body.dark-mode [class*="-modal"]:not(.modal-overlay):not([class*="overlay"]) > .modal-content {
    background: linear-gradient(180deg, #16161a 0%, #0e0e10 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 12px !important;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
}

body.dark-mode .modal-header {
    background: transparent !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07) !important;
}

body.dark-mode .modal-footer {
    background: transparent !important;
    border-top: 1px solid rgba(255, 255, 255, 0.07) !important;
}

body.dark-mode .modal-close,
body.dark-mode .btn-icon {
    border-radius: 7px !important;
}

body.dark-mode .modal-close:hover,
body.dark-mode .btn-icon:hover {
    background: rgba(255, 255, 255, 0.06) !important;
}

/* --- Badges / chips / pills: consistent metal --- */
body.dark-mode .badge,
body.dark-mode .chip,
body.dark-mode .tag,
body.dark-mode .pill {
    border-radius: 999px !important;
}

/* --- Inputs inside popups and phases --- */
body.dark-mode .modal-body .form-control,
body.dark-mode .stage-content .form-control,
body.dark-mode .stage-content textarea {
    background: #0c0c0e !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* --- Progress bars: hairline track, red metal fill --- */
body.dark-mode .progress-bar,
body.dark-mode .progress-track {
    background: rgba(255, 255, 255, 0.06) !important;
    border-radius: 999px !important;
}

body.dark-mode .progress-bar .progress-fill,
body.dark-mode .progress-fill {
    background: linear-gradient(90deg, #b91c1c 0%, #e5342f 100%);
    border-radius: 999px;
}

/* ============================================================
   FROSTED GLASS POPUPS — Milchglas für alle Overlays & Popups
   ============================================================ */

/* Overlays: dunkel abdimmen + Hintergrund weichzeichnen */
body.dark-mode .modal-overlay,
body.dark-mode .feedback-modal-overlay,
body.dark-mode .radar-modal-overlay,
body.dark-mode .ui-modal-overlay,
body.dark-mode .mod-access-overlay,
body.dark-mode .navi-tutorial-overlay,
body.dark-mode .navi-fullscreen-overlay {
    background: rgba(4, 4, 6, 0.45) !important;
    -webkit-backdrop-filter: blur(20px) saturate(1.3);
    backdrop-filter: blur(20px) saturate(1.3);
}

/* Modal-Panels: transluzentes Milchglas mit Hairline und Top-Glanz */
body.dark-mode .modal-content,
body.dark-mode .modal-large,
body.dark-mode .feedback-modal,
body.dark-mode .radar-modal,
body.dark-mode .navi-mem-modal,
body.dark-mode .navi-cap-modal,
body.dark-mode .mod-access-modal,
body.dark-mode .ui-modal-panel {
    background: linear-gradient(180deg, rgba(30, 30, 36, 0.72) 0%, rgba(14, 14, 17, 0.78) 100%) !important;
    -webkit-backdrop-filter: blur(32px) saturate(1.5);
    backdrop-filter: blur(32px) saturate(1.5);
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

body.dark-mode .modal-header,
body.dark-mode .feedback-modal-header {
    background: transparent !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

body.dark-mode .modal-footer,
body.dark-mode .feedback-modal-footer {
    background: transparent !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
}

/* Login-Modal ebenfalls verglasen */
body.dark-mode .login-modal,
.login-modal {
    background: linear-gradient(180deg, rgba(30, 30, 36, 0.66) 0%, rgba(12, 12, 15, 0.74) 100%) !important;
    -webkit-backdrop-filter: blur(36px) saturate(1.5);
    backdrop-filter: blur(36px) saturate(1.5);
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
}

/* Schwebende Popups ohne Overlay: eigenes Milchglas */
body.dark-mode .chatbot-window,
body.dark-mode .notifications-dropdown,
body.dark-mode .dropdown-menu,
body.dark-mode .brand-selector-dropdown,
body.dark-mode .autocomplete-dropdown,
body.dark-mode .context-menu,
body.dark-mode .qc-projects-drawer {
    background: linear-gradient(180deg, rgba(26, 26, 31, 0.82) 0%, rgba(12, 12, 15, 0.86) 100%) !important;
    -webkit-backdrop-filter: blur(28px) saturate(1.4);
    backdrop-filter: blur(28px) saturate(1.4);
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
}

/* Innenflächen der Glas-Popups nicht deckend übermalen */
body.dark-mode .chatbot-window .chatbot-messages,
body.dark-mode .notifications-dropdown .notification-item,
body.dark-mode .modal-content .modal-body {
    background: transparent !important;
}

/* Formularfelder im Glas: halbtransparent statt deckend */
body.dark-mode .modal-content .form-control,
body.dark-mode .modal-content textarea,
body.dark-mode .modal-content select,
body.dark-mode .feedback-modal .form-control,
body.dark-mode .feedback-modal textarea {
    background: rgba(0, 0, 0, 0.35) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
}

/* ============================================================
   NAVI CHAT OVERHAUL — widget + fullscreen, alle Untermenüs
   ============================================================ */

/* --- Toggle-Button: metallische rote Kugel --- */
body.dark-mode .chatbot-toggle {
    width: 54px !important;
    height: 54px !important;
    background: linear-gradient(160deg, #e5342f 0%, #b91c1c 55%, #7f1414 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    box-shadow: 0 8px 24px rgba(220, 38, 38, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25) !important;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease !important;
}

body.dark-mode .chatbot-toggle:hover {
    transform: scale(1.08) !important;
    box-shadow: 0 12px 32px rgba(220, 38, 38, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
}

body.dark-mode .chatbot-toggle:active {
    transform: scale(0.95) !important;
}

/* --- Widget-Fenster --- */
body.dark-mode .chatbot-window {
    border-radius: 16px !important;
    overflow: hidden;
}

body.dark-mode .chatbot-header {
    background: rgba(255, 255, 255, 0.03) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    padding: 12px 14px !important;
}

body.dark-mode .chatbot-header-left {
    font-weight: 650;
    letter-spacing: -0.01em;
}

body.dark-mode .chatbot-header-left > i {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: linear-gradient(160deg, #e5342f 0%, #991616 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
    font-size: 13px;
    color: #fff;
}

body.dark-mode .chatbot-action-btn,
body.dark-mode .navi-fs-btn {
    background: transparent !important;
    border: none !important;
    border-radius: 7px !important;
    color: var(--text-secondary) !important;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

body.dark-mode .chatbot-action-btn:hover,
body.dark-mode .navi-fs-btn:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #f5f5f7 !important;
}

body.dark-mode .chatbot-action-btn:active,
body.dark-mode .navi-fs-btn:active {
    transform: scale(0.92);
}

/* --- Kontext-Chip über dem Input (Widget) --- */
body.dark-mode .chatbot-context {
    order: 0;
    margin: 0 12px 8px !important;
    padding: 5px 12px !important;
    display: inline-flex !important;
    align-items: center;
    gap: 7px;
    align-self: flex-start;
    width: auto !important;
    border-radius: 999px !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.09) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
    font-size: 11px !important;
    color: var(--text-secondary) !important;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

body.dark-mode .chatbot-context i {
    color: #e5342f;
    font-size: 10px;
}

/* --- Nachrichten (Widget) --- */
body.dark-mode .chatbot-messages {
    background: transparent !important;
    padding: 14px !important;
}

body.dark-mode .chatbot-message-content {
    border-radius: 14px !important;
}

body.dark-mode .chatbot-message-assistant .chatbot-message-content {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

body.dark-mode .chatbot-message-user .chatbot-message-content {
    background: linear-gradient(160deg, #d92c27 0%, #a11818 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 4px 12px rgba(220, 38, 38, 0.25);
}

body.dark-mode .chatbot-message-avatar {
    background: linear-gradient(160deg, #26262a 0%, #101012 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* --- Input (Widget) --- */
body.dark-mode .chatbot-input-container {
    background: transparent !important;
    border-top: 1px solid rgba(255, 255, 255, 0.07) !important;
    padding: 10px 12px 12px !important;
    gap: 8px !important;
}

body.dark-mode .chatbot-input {
    background: rgba(0, 0, 0, 0.35) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 12px !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

body.dark-mode .chatbot-input:focus {
    border-color: rgba(220, 38, 38, 0.5) !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12) !important;
}

body.dark-mode .chatbot-send-btn,
body.dark-mode .navi-fs-send-btn {
    background: linear-gradient(160deg, #e5342f 0%, #b91c1c 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 10px !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 2px 8px rgba(220, 38, 38, 0.3);
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

body.dark-mode .chatbot-send-btn:hover,
body.dark-mode .navi-fs-send-btn:hover {
    filter: brightness(1.12);
    transform: translateY(-1px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 6px 16px rgba(220, 38, 38, 0.4);
}

body.dark-mode .chatbot-send-btn:active,
body.dark-mode .navi-fs-send-btn:active {
    transform: scale(0.94);
}

body.dark-mode .chatbot-attach-btn {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.09) !important;
    border-radius: 10px !important;
    color: var(--text-secondary) !important;
    transition: background 0.15s ease, color 0.15s ease;
}

body.dark-mode .chatbot-attach-btn:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #f5f5f7 !important;
}

/* --- Fullscreen: Header & Rahmen --- */
body.dark-mode .navi-fs-header {
    background: rgba(10, 10, 12, 0.75) !important;
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    backdrop-filter: blur(24px) saturate(1.4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

body.dark-mode .navi-fs-context {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.09) !important;
    border-radius: 999px !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* --- Fullscreen: Sidebar (Ordner, Skills, Memory, Verlauf) --- */
body.dark-mode .navi-fs-sidebar {
    background: rgba(12, 12, 15, 0.72) !important;
    -webkit-backdrop-filter: blur(24px) saturate(1.3);
    backdrop-filter: blur(24px) saturate(1.3);
    border-right: 1px solid rgba(255, 255, 255, 0.07) !important;
}

body.dark-mode .navi-fs-sidebar-tabs {
    background: rgba(0, 0, 0, 0.3) !important;
    border: 1px solid rgba(255, 255, 255, 0.07) !important;
    border-radius: 10px !important;
    padding: 4px !important;
    gap: 2px !important;
    margin: 10px !important;
}

body.dark-mode .navi-fs-tab {
    background: transparent !important;
    border: none !important;
    border-radius: 7px !important;
    color: var(--text-secondary) !important;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

body.dark-mode .navi-fs-tab:hover:not(.active) {
    background: rgba(255, 255, 255, 0.06) !important;
    color: #f5f5f7 !important;
}

body.dark-mode .navi-fs-tab.active {
    background: linear-gradient(180deg, rgba(220, 38, 38, 0.28) 0%, rgba(220, 38, 38, 0.12) 100%) !important;
    color: #ff6b64 !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), inset 0 0 0 1px rgba(220, 38, 38, 0.35) !important;
}

body.dark-mode .navi-fs-sidebar-item {
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    border-radius: 10px !important;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

body.dark-mode .navi-fs-sidebar-item:hover {
    background: rgba(255, 255, 255, 0.07) !important;
    border-color: rgba(255, 255, 255, 0.14) !important;
    transform: translateX(2px);
}

body.dark-mode .navi-fs-sidebar-item.active {
    background: linear-gradient(180deg, rgba(220, 38, 38, 0.16) 0%, rgba(220, 38, 38, 0.06) 100%) !important;
    border-color: rgba(220, 38, 38, 0.4) !important;
}

body.dark-mode .navi-fs-sidebar-newbtn {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px dashed rgba(255, 255, 255, 0.16) !important;
    border-radius: 10px !important;
    color: var(--text-secondary) !important;
    transition: all 0.15s ease;
}

body.dark-mode .navi-fs-sidebar-newbtn:hover {
    border-color: rgba(220, 38, 38, 0.5) !important;
    color: #ff6b64 !important;
    background: rgba(220, 38, 38, 0.07) !important;
}

body.dark-mode .navi-fs-kb-section-head,
body.dark-mode .navi-fs-mem-section-head {
    color: var(--text-secondary) !important;
    font-size: 10.5px !important;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 650;
}

/* Memory-Einträge */
body.dark-mode .navi-fs-mem-item {
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.07) !important;
    border-radius: 10px !important;
    transition: border-color 0.15s ease, background 0.15s ease;
}

body.dark-mode .navi-fs-mem-item:hover {
    background: rgba(255, 255, 255, 0.06) !important;
    border-color: rgba(255, 255, 255, 0.14) !important;
}

body.dark-mode .navi-fs-mem-badge,
body.dark-mode .navi-fs-mem-kind,
body.dark-mode .navi-fs-mem-scope {
    border-radius: 999px !important;
    background: rgba(255, 255, 255, 0.07) !important;
    border: 1px solid rgba(255, 255, 255, 0.09) !important;
}

/* Vorschau-Panel (KB-Dokumente) */
body.dark-mode .navi-fs-preview-panel {
    background: rgba(16, 16, 20, 0.85) !important;
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 12px !important;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.07) !important;
}

/* Verlauf */
body.dark-mode .navi-fs-history-row {
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    border-radius: 10px !important;
    transition: background 0.15s ease, border-color 0.15s ease;
}

body.dark-mode .navi-fs-history-row:hover {
    background: rgba(255, 255, 255, 0.07) !important;
    border-color: rgba(255, 255, 255, 0.14) !important;
}

/* --- Fullscreen: Nachrichten & Input --- */
body.dark-mode .navi-fs-messages {
    background: transparent !important;
}

body.dark-mode .navi-fs-msg-bubble {
    border-radius: 14px !important;
}

body.dark-mode .navi-fs-input-context {
    display: flex;
    justify-content: flex-start;
    margin: 0 auto 8px;
    max-width: 860px;
    width: 100%;
}

body.dark-mode .navi-fs-ctx-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.09);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
    font-size: 11px;
    color: var(--text-secondary);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

body.dark-mode .navi-fs-ctx-chip i {
    color: #e5342f;
    font-size: 10px;
}

body.dark-mode .navi-fs-input-container {
    background: rgba(20, 20, 24, 0.7) !important;
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    backdrop-filter: blur(24px) saturate(1.4);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 16px !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 8px 24px rgba(0, 0, 0, 0.35) !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

body.dark-mode .navi-fs-input-container:focus-within {
    border-color: rgba(220, 38, 38, 0.45) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 0 0 3px rgba(220, 38, 38, 0.12), 0 8px 24px rgba(0, 0, 0, 0.35) !important;
}

body.dark-mode .navi-fs-input {
    background: transparent !important;
    border: none !important;
}

/* ============================================================
   MOTION & HOVER POLISH — Animationen im ganzen Toolkit
   ============================================================ */

@keyframes naviRiseIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}

@keyframes naviModalPop {
    from { opacity: 0; transform: scale(0.96) translateY(10px); }
    to { opacity: 1; transform: none; }
}

@keyframes naviOverlayFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Module-Inhalte gleiten beim Öffnen ein */
body.dark-mode .module-container,
body.dark-mode .analytics-page,
body.dark-mode .admin-dashboard,
body.dark-mode .kb-module {
    animation: naviRiseIn 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Modals poppen sanft auf, Overlays faden — nur wenn .active, sonst bleibt
   animation-fill-mode:both als unsichtbarer Blur-Rest stehen. */
body.dark-mode .modal-overlay.active,
body.dark-mode .feedback-modal-overlay.active,
body.dark-mode .radar-modal-overlay.active,
body.dark-mode .ui-modal-overlay.active {
    animation: naviOverlayFade 0.2s ease-out both;
}

body.dark-mode .modal-content,
body.dark-mode .modal-large,
body.dark-mode .feedback-modal,
body.dark-mode .radar-modal,
body.dark-mode .navi-mem-modal,
body.dark-mode .ui-modal-panel {
    animation: naviModalPop 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Chat-Fenster & Dropdowns poppen ebenfalls */
body.dark-mode .chatbot-window,
body.dark-mode .notifications-dropdown.show,
body.dark-mode .dropdown-menu,
body.dark-mode .brand-selector-dropdown {
    animation: naviModalPop 0.24s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Karten: sanftes Anheben beim Hover */
body.dark-mode .analytics-card,
body.dark-mode .quick-stat-card,
body.dark-mode .admin-card,
body.dark-mode .kb-card,
body.dark-mode .lesson-card,
body.dark-mode .stage-card,
body.dark-mode .platform-card,
body.dark-mode .brand-card,
body.dark-mode .idea-card,
body.dark-mode .video-card,
body.dark-mode .planner-card,
body.dark-mode .settings-card {
    transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.2s ease, box-shadow 0.2s ease !important;
}

body.dark-mode .analytics-card:hover,
body.dark-mode .quick-stat-card:hover,
body.dark-mode .admin-card:hover,
body.dark-mode .kb-card:hover,
body.dark-mode .brand-card:hover,
body.dark-mode .idea-card:hover,
body.dark-mode .video-card:hover,
body.dark-mode .planner-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.16) !important;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
}

/* Buttons: Lift + Press */
body.dark-mode .btn {
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease, background 0.15s ease, border-color 0.15s ease !important;
}

body.dark-mode .btn:hover:not(:disabled) {
    transform: translateY(-1px);
    filter: brightness(1.08);
}

body.dark-mode .btn:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
    filter: brightness(0.95);
}

body.dark-mode .btn-primary:hover:not(:disabled) {
    box-shadow: 0 6px 18px rgba(220, 38, 38, 0.35) !important;
}

/* Navigation: sanfter Slide */
body.dark-mode .nav-item a {
    transition: background 0.15s ease, color 0.15s ease, padding-left 0.15s ease !important;
}

body.dark-mode .nav-item:not(.active) a:hover {
    padding-left: calc(var(--space-4) + 3px) !important;
}

/* Inputs: weicher Fokus-Ring */
body.dark-mode .form-control,
body.dark-mode input[type="text"],
body.dark-mode textarea,
body.dark-mode select {
    transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
}

body.dark-mode .form-control:focus,
body.dark-mode textarea:focus {
    border-color: rgba(220, 38, 38, 0.45) !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1) !important;
}

/* Tabellenzeilen */
body.dark-mode .data-table tbody tr,
body.dark-mode table tbody tr {
    transition: background 0.12s ease;
}

body.dark-mode .data-table tbody tr:hover,
body.dark-mode table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* Icon-Buttons */
body.dark-mode .btn-icon,
body.dark-mode .modal-close {
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease !important;
}

body.dark-mode .btn-icon:active,
body.dark-mode .modal-close:active {
    transform: scale(0.9);
}

/* Reduzierte Bewegung respektieren */
@media (prefers-reduced-motion: reduce) {
    body.dark-mode * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================================
   LEARNING HUB GAMIFICATION — Level, XP, Streak, Badges
   ============================================================ */

.lh-gamify {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 18px;
    padding: 12px 16px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.09);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
    -webkit-backdrop-filter: blur(18px) saturate(1.3);
    backdrop-filter: blur(18px) saturate(1.3);
}

.lh-level {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 210px;
}

.lh-level-ring {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 700;
    font-size: 16px;
    color: #fff;
    background: linear-gradient(160deg, #e5342f 0%, #991616 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 4px 14px rgba(220, 38, 38, 0.3);
}

.lh-level-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.lh-level-label {
    font-size: 12px;
    font-weight: 650;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.lh-xp-track {
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.lh-xp-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #b91c1c 0%, #e5342f 100%);
    transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.lh-xp-text {
    font-size: 10.5px;
    color: var(--text-secondary);
}

.lh-streak {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.09);
}

.lh-streak i {
    color: #f59e0b;
}

.lh-streak span {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
}

.lh-streak small {
    font-size: 10.5px;
    color: var(--text-secondary);
}

.lh-badges {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

.lh-badge {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    font-size: 13px;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}

.lh-badge.earned {
    background: linear-gradient(160deg, rgba(229, 52, 47, 0.35) 0%, rgba(153, 22, 22, 0.25) 100%);
    border: 1px solid rgba(229, 52, 47, 0.45);
    color: #ff8a84;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.lh-badge.earned:hover {
    transform: translateY(-2px) scale(1.08);
    box-shadow: 0 6px 16px rgba(220, 38, 38, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.lh-badge.locked {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    color: rgba(255, 255, 255, 0.18);
}

@media (max-width: 720px) {
    .lh-gamify { gap: 12px; padding: 10px 12px; }
    .lh-level { min-width: 160px; }
}

/* Brand social profile links in settings */
.brand-social-links-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.brand-social-link-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.brand-social-link-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 130px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.brand-social-link-input {
    flex: 1;
}
.brand-social-links-empty {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.platform-icon-link {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    transition: transform 0.15s ease, color 0.15s ease;
}
.platform-icon-link:hover {
    transform: translateY(-1px);
    color: #e5342f;
}
