/* ============================================
   DESIGN TOKENS (CSS Custom Properties)
   Dark Theme = default
   ============================================ */

:root,
[data-theme="dark"] {
    /* Dashboard-Palette (direkt nutzbar + Basis für abgeleitete Tokens) */
    --text: #b4b4b6;
    --background: #0e0e10;
    --primary: #141415;
    --secondary: #222127;
    --accent: #5250d3;

    --font-heading: "Clash Display", "Inter", system-ui, sans-serif;
    --font-body: "Inter", system-ui, sans-serif;

    --text-primary: var(--text);
    --text-secondary: #94949a;
    --text-tertiary: #6e6e75;
    --bg-base: var(--background);
    --bg-surface: var(--primary);
    --bg-raised: var(--secondary);
    --bg-hover: color-mix(in srgb, var(--secondary) 88%, var(--text) 12%);
    --border: rgba(255, 255, 255, 0.06);
    --border-strong: rgba(255, 255, 255, 0.11);
    --accent-hover: #6c6adf;
    --accent-subtle: rgba(82, 80, 211, 0.12);
    --accent-border: rgba(82, 80, 211, 0.38);
    --accent-border-soft: rgba(82, 80, 211, 0.22);
    --accent-fill-ghost: rgba(82, 80, 211, 0.07);
    --primary-color: var(--accent);
    --success: #3ecf8e;
    --warning: #f5a623;
    --danger: #f06060;

    /* Legacy-Aliase (bestehende var()-Nutzung) */
    --bg-primary: var(--bg-base);
    --bg-app: var(--bg-base);
    --bg-sidebar: var(--bg-base);
    --bg-sidebar-hover: var(--bg-hover);
    --bg-sidebar-active: var(--bg-raised);
    --bg-content: var(--bg-base);
    --bg-card: var(--bg-surface);
    --bg-card-alt: var(--bg-raised);
    --bg-input: var(--bg-raised);
    --bg-entry: var(--bg-surface);
    --bg-tertiary: var(--bg-raised);
    --bg-elevated: var(--bg-raised);
    --border-subtle: var(--border);
    --border-sidebar: var(--border);
    --border-card: var(--border);
    --border-input: var(--border);
    --border-default: var(--border-strong);
    --border-focus: var(--accent);
    --text-heading: var(--text-primary);
    --text-muted: var(--text-tertiary);
    --text-inverse: #080808;
    --text-link: var(--accent);
    --accent-primary: var(--accent);
    --accent-secondary: var(--accent-hover);
    --accent-text: var(--accent);
    --accent-glow: var(--accent-subtle);
    --danger-bg: rgba(240, 96, 96, 0.12);
    --success-bg: rgba(62, 207, 142, 0.12);
    --warning-bg: rgba(245, 166, 35, 0.12);
    --purple: var(--accent);

    --shadow-sm: none;
    --shadow-md: none;
    --shadow-lg: none;
    --shadow-glow: none;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 12px;
    --radius-xl: 12px;

    --sidebar-width: 220px;
    --workbench-width: 300px;
    --sidebar-collapsed-width: 56px;
    --transition: 0.15s ease;
    --transition-slow: 0.15s ease;
}

[data-theme="light"] {
    --font-heading: "Clash Display", "Inter", system-ui, sans-serif;
    --font-body: "Inter", system-ui, sans-serif;

    --bg-base: #f5f5f5;
    --bg-surface: #ffffff;
    --bg-raised: #ececec;
    --bg-hover: #e4e4e4;
    --border: rgba(0, 0, 0, 0.08);
    --border-strong: rgba(0, 0, 0, 0.14);
    --accent: #5250d3;
    --accent-hover: #4543b8;
    --accent-subtle: rgba(82, 80, 211, 0.14);
    --primary-color: var(--accent);
    --text-primary: #141414;
    --text-secondary: #525252;
    --text-tertiary: #737373;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;

    --bg-primary: var(--bg-base);
    --bg-app: var(--bg-base);
    --bg-sidebar: var(--bg-base);
    --bg-sidebar-hover: var(--bg-hover);
    --bg-sidebar-active: var(--bg-raised);
    --bg-content: var(--bg-base);
    --bg-card: var(--bg-surface);
    --bg-card-alt: var(--bg-raised);
    --bg-input: var(--bg-raised);
    --bg-entry: var(--bg-surface);
    --bg-tertiary: var(--bg-raised);
    --bg-elevated: var(--bg-surface);
    --border-subtle: var(--border);
    --border-sidebar: var(--border);
    --border-card: var(--border);
    --border-input: var(--border);
    --border-default: var(--border-strong);
    --border-focus: var(--accent);
    --text-heading: var(--text-primary);
    --text-muted: var(--text-tertiary);
    --text-inverse: #ffffff;
    --text-link: var(--accent);
    --accent-primary: var(--accent);
    --accent-secondary: var(--accent-hover);
    --accent-text: var(--accent);
    --accent-glow: var(--accent-subtle);
    --danger-bg: rgba(220, 38, 38, 0.1);
    --success-bg: rgba(5, 150, 105, 0.1);
    --warning-bg: rgba(217, 119, 6, 0.12);
    --purple: var(--accent);

    --shadow-sm: none;
    --shadow-md: none;
    --shadow-lg: none;
    --shadow-glow: none;
}

/* Spherecast: keine Eintritts-Animationen */
.card.entrance-in {
    animation: none;
}

/* ============================================
   BASE
   ============================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-body), -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg-base);
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.7;
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

h1 {
    font-family: var(--font-heading), sans-serif;
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.sidebar h1.sidebar-title {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

h2 {
    font-family: var(--font-heading), sans-serif;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

h3 {
    font-family: var(--font-heading), sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--text-primary);
}

.sidebar-title,
.welcome-title,
.card h2,
.card h3,
.admin-console-page-title,
.admin-console-section-title,
.project-sidebar-title {
    font-family: var(--font-heading), sans-serif;
}

.welcome-title {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

p,
li,
td,
th,
label,
input,
textarea,
select,
button,
.badge,
.entry {
    font-family: var(--font-body), sans-serif;
}

.sidebar-section-label {
    font-family: var(--font-body), sans-serif;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    text-transform: uppercase;
}

p,
.entry,
.card p {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 400;
}

a {
    color: var(--accent);
    text-decoration: none;
}
a:hover {
    opacity: 0.8;
}

/* ============================================
   APP LAYOUT
   ============================================ */

.app-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: relative;
}

.app-body {
    display: flex;
    flex: 1;
    min-height: 0;
    position: relative;
}

/* —— App-Topbar (Firma · Plan · Abmelden) —— */
.app-topbar {
    flex-shrink: 0;
    min-height: 56px;
    height: auto;
    background: var(--bg-base);
    border-bottom: 1px solid var(--border);
    z-index: 140;
    box-shadow: none;
}

[data-theme="light"] .app-topbar {
    background: var(--bg-base);
}

.app-topbar-inner {
    min-height: 56px;
    height: auto;
    max-width: 100%;
    padding: 10px 40px 8px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 16px;
    box-sizing: border-box;
}

.app-topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 1 auto;
    min-width: 0;
    max-width: min(42vw, 320px);
}

.app-topbar-company {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.app-topbar-plan {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid transparent;
}
.plan-starter,
.plan-free {
    background: var(--bg-raised);
    color: var(--text-tertiary);
    border-color: var(--border);
}
.plan-pro {
    background: var(--accent-fill-ghost);
    color: var(--accent);
    border-color: var(--accent-border-soft);
}

.app-topbar-user {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    flex-shrink: 0;
    margin-left: auto;
}

.app-topbar-email {
    font-size: 12px;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.app-topbar-logout {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-tertiary);
    text-decoration: none;
    flex-shrink: 0;
    opacity: 1;
}
.app-topbar-logout:hover {
    color: var(--text-primary);
    opacity: 1;
}

.app-topbar-admin {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-tertiary);
    text-decoration: none;
    flex-shrink: 0;
}
.app-topbar-admin:hover {
    color: var(--accent);
}

.app-topbar-theme {
    flex-shrink: 0;
}

.app-topbar-tools {
    --app-topbar-control-h: 38px;
    display: flex;
    align-items: stretch;
    gap: 10px;
    flex: 0 1 auto;
    min-width: 0;
}

/* Suchfeld in der oberen Menüleiste (nicht in der linken Nav) */
.app-topbar-search-wrap {
    flex: 0 0 300px;
    width: 300px;
    max-width: 300px;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.app-topbar-search.sidebar-search {
    width: 100%;
    max-width: 100%;
    margin-bottom: 0;
    min-height: var(--app-topbar-control-h);
    align-items: center;
}

.app-topbar-search.sidebar-search input {
    height: var(--app-topbar-control-h);
    padding: 0 12px;
    font-size: 12px;
    font-weight: 500;
    box-sizing: border-box;
    border-radius: 8px;
}

.app-topbar-search .search-shortcut-hint {
    font-size: 0.65rem;
    padding: 3px 6px;
    align-self: center;
}

.app-topbar-upload-btn {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 340px;
    min-width: 0;
    max-width: 340px;
    height: var(--app-topbar-control-h);
    min-height: var(--app-topbar-control-h);
    max-height: var(--app-topbar-control-h);
    padding: 0 16px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-raised);
    border: 1px solid var(--accent-border-soft);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    flex: 0 0 340px;
}
.app-topbar-upload-btn:hover {
    background: var(--bg-sidebar-hover);
    border-color: var(--accent-border);
    color: var(--text-primary);
}

/* Schmale Viewports: gleiche Breite, aber flexibel (kein horizontales Scrollen) */
@media (max-width: 1536px) {
    .app-topbar-tools {
        flex: 1 1 auto;
        min-width: 0;
        max-width: 100%;
    }

    .app-topbar-search-wrap {
        flex: 2 1 0;
        width: auto;
        max-width: none;
        min-width: 0;
    }

    .app-topbar-upload-btn {
        flex: 1 1 0;
        width: auto;
        max-width: none;
        min-width: 0;
    }
}

/* Shell-Sektionen (Dashboard, Projekte, SIMAP, …) */
.app-shell-section .app-section-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 8px 0 40px;
}
.app-section-title {
    font-family: var(--font-heading), sans-serif;
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 8px;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}
.app-section-lead {
    margin: 0 0 24px;
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Projekte: wie Dashboard — Titelstrich + Karten */
#projects-section .app-section-title {
    padding-left: 14px;
    border-left: 3px solid var(--accent-border-soft);
}
#projects-section .sidebar-section {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px 16px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), inset 0 1px 0 0 var(--accent-border-soft);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
#projects-section .sidebar-section:hover {
    border-color: var(--accent-border-soft);
}
#projects-section .sidebar-section + .sidebar-section {
    margin-top: 12px;
}

/* SIMAP (eingebettet): Seitentitel + Karten wie Dashboard */
#simap-section .admin-console-page-title {
    padding-left: 14px;
    border-left: 3px solid var(--accent-border-soft);
}
#simap-section .admin-meta-card {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), inset 0 1px 0 0 var(--accent-border-soft);
    transition: border-color 0.15s ease;
}
#simap-section .admin-meta-card:hover {
    border-color: var(--accent-border-soft);
}

[data-theme="light"] #projects-section .sidebar-section {
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05), inset 0 1px 0 0 var(--accent-border-soft);
}
[data-theme="light"] #simap-section .admin-meta-card {
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05), inset 0 1px 0 0 var(--accent-border-soft);
}

/* ============================================
   SIDEBAR
   ============================================ */

.app-sidebar-shell.sidebar {
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    flex-shrink: 0;
    width: auto;
    min-width: 0;
    height: 100%;
    min-height: 0;
    padding: 0;
    margin: 0;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    box-shadow: none;
    overflow: visible;
    z-index: 150;
    transition: none;
}

.sidebar-nav {
    width: 220px;
    min-width: 220px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
    padding: 0;
    overflow: hidden;
}

.sidebar-nav-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 16px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-nav-middle {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.sidebar-nav-brand-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    text-decoration: none;
    color: inherit;
}

.sidebar-nav-title {
    font-family: var(--font-heading), sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.sidebar-nav-main {
    flex-shrink: 0;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-rail__link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 400;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
    width: 100%;
    text-decoration: none;
    border: none;
    background: none;
    text-align: left;
    box-sizing: border-box;
}

.sidebar-rail__link:hover {
    background: var(--bg-raised);
    color: var(--text-primary);
}

.sidebar-rail__link.is-active {
    background: var(--bg-raised);
    color: var(--text-primary);
    font-weight: 500;
    box-shadow: inset 2px 0 0 var(--accent-border-soft);
}

.sidebar-rail__icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.sidebar-rail__soon {
    margin-left: auto;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.sidebar-rail__link--soon {
    opacity: 0.85;
}

.sidebar-badge-alert {
    margin-left: auto;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--danger-bg);
    color: var(--danger);
    font-size: 10px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sidebar-recent-wrap {
    margin-top: 8px;
    padding: 12px 0 0;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-recent-wrap.sidebar-recent-wrap--empty .sidebar-recent-list {
    display: none;
}

.sidebar-recent-label {
    padding: 4px 12px 8px;
    font-size: 10px;
    letter-spacing: 0.1em;
    color: var(--text-tertiary);
    text-transform: uppercase;
}

.sidebar-recent-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-recent-file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 196px;
    width: 100%;
    border: none;
    background: none;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    transition: background 0.12s ease, color 0.12s ease;
}

.sidebar-recent-file__icon {
    width: 12px !important;
    height: 12px !important;
    flex-shrink: 0;
}

.sidebar-recent-file:hover {
    background: var(--bg-raised);
    color: var(--text-primary);
}

.sidebar-recent-file.is-active {
    background: var(--bg-raised);
    color: var(--text-primary);
}

.sidebar-recent-all {
    display: block;
    font-size: 11px;
    color: var(--text-tertiary);
    padding: 4px 12px 0;
    text-decoration: none;
    transition: color 0.12s ease;
}

.sidebar-recent-all:hover {
    color: var(--accent);
}

.sidebar-nav-user {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.sidebar-nav-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-subtle);
    color: var(--accent);
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-nav-user-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.sidebar-nav-company {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-nav-plan {
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    width: fit-content;
}

.sidebar-nav-plan--pro {
    color: var(--accent);
    background: var(--accent-fill-ghost);
    border: 1px solid var(--accent-border-soft);
}

.sidebar-nav-plan--free {
    color: var(--text-tertiary);
    background: var(--bg-raised);
}

/* Single-Shell: eingeklappte Nav (Icon-Leiste, Desktop) */
@media (min-width: 769px) {
    .app-sidebar-shell.sidebar.collapsed {
        width: var(--sidebar-collapsed-width);
        min-width: var(--sidebar-collapsed-width);
        max-width: var(--sidebar-collapsed-width);
        overflow: hidden;
    }

    .app-sidebar-shell.sidebar.collapsed .sidebar-nav {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    .app-sidebar-shell.sidebar.collapsed .sidebar-nav-brand {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 12px 6px 10px;
        gap: 6px;
    }

    .app-sidebar-shell.sidebar.collapsed .sidebar-nav-brand-inner {
        justify-content: center;
    }

    .app-sidebar-shell.sidebar.collapsed .sidebar-nav-title {
        display: none !important;
    }

    .app-sidebar-shell.sidebar.collapsed .sidebar-nav-brand-actions {
        width: 100%;
        display: flex;
        justify-content: center;
    }

    .app-sidebar-shell.sidebar.collapsed .sidebar-nav-main {
        padding: 8px 6px;
    }

    .app-sidebar-shell.sidebar.collapsed .sidebar-rail__link {
        justify-content: center;
        padding: 10px 6px;
        gap: 0;
    }

    .app-sidebar-shell.sidebar.collapsed .sidebar-rail__link > span {
        display: none !important;
    }

    .app-sidebar-shell.sidebar.collapsed .sidebar-badge-alert {
        display: none !important;
    }

    .app-sidebar-shell.sidebar.collapsed .sidebar-recent-wrap {
        display: none !important;
    }

    .app-sidebar-shell.sidebar.collapsed .sidebar-nav-user {
        justify-content: center;
        padding: 12px 6px;
    }

    .app-sidebar-shell.sidebar.collapsed .sidebar-nav-user-text {
        display: none !important;
    }
}

.sidebar-workbench {
    width: var(--workbench-width);
    min-width: 240px;
    max-width: 520px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 12px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
    min-height: 0;
}

.sidebar svg {
    width: 15px;
    height: 15px;
    stroke-width: 1.5;
    flex-shrink: 0;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
    min-width: var(--sidebar-collapsed-width);
    opacity: 1;
    pointer-events: auto;
    overflow: visible;
}

/* Collapsed: Nur Icons sichtbar */
.sidebar.collapsed .sidebar-expanded-only,
.sidebar.collapsed .sidebar-search,
.sidebar.collapsed .sidebar-section-label,
.sidebar.collapsed .sidebar-upload,
.sidebar.collapsed .sidebar-upload .sidebar-btn-primary-action,
.sidebar.collapsed .upload-options,
.sidebar.collapsed .sidebar-loading,
.sidebar.collapsed .error-small,
.sidebar.collapsed .sidebar-btn-nav,
.sidebar.collapsed .sidebar-section-header,
.sidebar.collapsed .project-filter-input,
.sidebar.collapsed #recent-docs,
.sidebar.collapsed #project-tree,
.sidebar.collapsed .sidebar-hint,
.sidebar.collapsed #compare-actions,
.sidebar.collapsed .sidebar-trial-banner,
.sidebar.collapsed .sidebar-user-details,
.sidebar.collapsed .sidebar-footer-actions .sidebar-user-link,
.sidebar.collapsed .sidebar-title {
    display: none !important;
}

.sidebar.collapsed .sidebar-brand .sidebar-logo { display: block; }
.sidebar.collapsed .sidebar-header { padding: 12px; justify-content: center; }
.sidebar.collapsed .sidebar-collapse-btn { transform: rotate(180deg); }
.sidebar.collapsed ~ .sidebar-resize-handle { display: none !important; }

.sidebar-resize-handle {
    width: 4px;
    min-width: 4px;
    background: transparent;
    cursor: col-resize;
    flex-shrink: 0;
    transition: background var(--transition);
}
.sidebar-resize-handle:hover,
.sidebar-resize-handle.resizing { background: var(--accent); opacity: 0.5; }
.sidebar.collapsed .sidebar-section { padding: 8px; align-items: center; }
.sidebar.collapsed .sidebar-section-analyse,
.sidebar.collapsed .sidebar-section-analyse .sidebar-upload { flex-direction: row; justify-content: center; }
.sidebar-collapsed-icons { display: none; flex-direction: column; gap: 4px; }
.sidebar.collapsed .sidebar-collapsed-icons { display: flex !important; }
.sidebar.collapsed .sidebar-collapsed-icon {
    display: flex !important;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 1.25rem;
    transition: background var(--transition), color var(--transition);
}
.sidebar.collapsed .sidebar-collapsed-icon:hover { background: var(--bg-sidebar-hover); color: var(--text-primary); }
.sidebar.collapsed .sidebar-footer { padding: 8px; justify-content: center; }
.sidebar.collapsed .sidebar-user-info { justify-content: center; }
.sidebar.collapsed .sidebar-footer-actions { justify-content: center; }

/* Scrollbar-Design */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 999px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0 0 0;
    border-bottom: none;
    flex-shrink: 0;
    gap: 8px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 8px 12px 24px;
    font-family: var(--font-heading), sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.sidebar-logo {
    width: 22px;
    height: 22px;
    padding: 0;
    border-radius: 0;
    background: transparent;
    color: var(--text-primary);
    flex-shrink: 0;
    box-sizing: border-box;
}

.sidebar-title {
    font-family: var(--font-heading), sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    letter-spacing: -0.02em;
}

.sidebar-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.sidebar-close-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 1.5rem;
    cursor: pointer;
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: var(--radius-sm);
    transition: background var(--transition), color var(--transition);
}
.sidebar-close-btn:hover { background: var(--bg-sidebar-hover); color: var(--text-primary); }

.sidebar-collapse-btn {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition), color var(--transition);
}
.sidebar-collapse-btn:hover { background: var(--bg-sidebar-hover); color: var(--text-primary); }

.theme-toggle {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition), color var(--transition);
}
.theme-toggle:hover { background: var(--bg-sidebar-hover); color: var(--accent); }

[data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="light"] .theme-icon-dark { display: none; }

/* Sidebar-Expand Button */
.sidebar-expand-btn {
    display: none;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 100;
    background: var(--bg-surface);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 0;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    transition: background var(--transition), color var(--transition);
}
.sidebar-expand-btn:hover { background: var(--bg-sidebar-hover); color: var(--text-primary); }
.sidebar-expand-btn.visible {
    display: flex !important;
}

/* ============================================
   SIDEBAR FOOTER & USER INFO
   ============================================ */

.sidebar-footer {
    padding: 12px 0 0;
    margin-top: auto;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    font-size: 12px;
}

.sidebar-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-subtle);
    flex-shrink: 0;
}

.sidebar-user-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-user-company {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-plan-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    width: fit-content;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.sidebar-user-plan-badge.plan-free {
    background: var(--bg-raised);
    color: var(--text-tertiary);
}

.sidebar-user-plan-badge.plan-pro {
    background: var(--accent-subtle);
    color: var(--accent);
}

.sidebar-footer-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.sidebar-user-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-tertiary);
    text-decoration: none;
    transition: color var(--transition);
}
.sidebar-user-link:hover {
    color: var(--text-primary);
    opacity: 1;
}

.sidebar-footer-actions .theme-toggle {
    margin-left: auto;
}

/* ============================================
   SIDEBAR TRIAL BANNER
   ============================================ */

.sidebar-trial-banner {
    padding: 8px 16px;
    border-bottom: 1px solid var(--border-sidebar);
    text-align: center;
}

.trial-info { font-size: 0.75rem; color: var(--accent-text); }
.trial-urgent { font-size: 0.75rem; color: var(--danger); font-weight: 600; }

/* ============================================
   SIDEBAR SEARCH
   ============================================ */

.sidebar-search {
    padding: 0;
    margin-bottom: 20px;
    border-bottom: none;
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
}

.search-shortcut-hint {
    font-size: 0.7rem;
    color: var(--text-tertiary);
    padding: 4px 6px;
    background: var(--bg-input);
    border-radius: 4px;
    flex-shrink: 0;
}

.sidebar-search input {
    flex: 1;
    min-width: 0;
    width: 100%;
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-raised);
    color: var(--text-tertiary);
    font-size: 12px;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.sidebar-search input:focus {
    border-color: var(--accent);
    color: var(--text-primary);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}
.sidebar-search input::placeholder {
    color: var(--text-tertiary);
}

.search-results {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    max-height: 350px;
    overflow-y: auto;
    z-index: 9999;
    box-shadow: none;
    padding: 4px 0;
}

.search-result-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background var(--transition);
    border-bottom: 1px solid var(--border-sidebar);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg-sidebar-hover); }

.search-result-icon { flex-shrink: 0; font-size: 0.9rem; width: 20px; text-align: center; padding-top: 1px; }
.search-result-info { flex: 1; min-width: 0; overflow: hidden; }
.search-result-name { font-size: 0.85rem; color: var(--text-primary); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result-detail { font-size: 0.75rem; color: var(--text-tertiary); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result-snippet { font-size: 0.75rem; color: var(--text-secondary); margin-top: 3px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.search-highlight { background: var(--accent); color: #fff; border-radius: 2px; padding: 0 2px; }
.search-no-results { padding: 16px 12px; text-align: center; color: var(--text-tertiary); font-size: 0.8rem; }

/* ============================================
   SIDEBAR SECTIONS
   ============================================ */

.sidebar-section {
    padding: 0;
    border-top: none;
    flex-shrink: 0;
}
.sidebar-section + .sidebar-section {
    margin-top: 4px;
}

.sidebar-section-analyse {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-section-label {
    font-family: var(--font-body), sans-serif;
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-tertiary);
    margin-bottom: 6px;
    padding: 16px 12px 6px;
    display: block;
}

.sidebar-section-label-with-icon {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.sidebar-section-header .sidebar-section-label-with-icon {
    display: inline-flex;
    margin-bottom: 0;
}
.sidebar-section-analyse > .sidebar-section-label-with-icon.sidebar-section-label {
    margin-bottom: 8px;
}
.sidebar-section-icon {
    font-size: 0.95rem;
    line-height: 1;
    opacity: 0.92;
    filter: grayscale(0.15);
}

.sidebar-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.sidebar-section-header .sidebar-section-label {
    margin-bottom: 0;
}

.sidebar-section-title {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    font-weight: 600;
}

.sidebar-btn-primary-action {
    width: 100%;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    background: var(--accent-subtle);
    color: var(--accent);
    border: 1px solid rgba(124, 110, 247, 0.2);
    border-radius: 8px;
    font-family: var(--font-body), sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
    box-shadow: none;
}
.sidebar-btn-primary-action:hover {
    background: rgba(124, 110, 247, 0.2);
}
.sidebar-btn-primary-action:active {
    opacity: 0.95;
}

.sidebar-btn-nav {
    width: 100%;
    padding: 7px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 400;
    cursor: pointer;
    text-align: left;
    transition: background var(--transition), color var(--transition);
}
.sidebar-btn-nav:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar-projects {
    flex: 1;
    overflow-y: auto;
}

.sidebar-roster-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 200px;
    overflow-y: auto;
}

.sidebar-roster-list li {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-sidebar);
    font-size: 0.8rem;
}

.sidebar-roster-list li:last-child {
    border-bottom: none;
}

.sidebar-roster-email {
    color: var(--text-secondary);
    word-break: break-all;
}

.sidebar-roster-meta {
    font-size: 0.72rem;
    color: var(--text-tertiary);
}

.sidebar-section-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.project-filter-input {
    width: 100%;
    padding: 6px 10px;
    margin-bottom: 8px;
    border: 1px solid var(--border-input);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.8rem;
    transition: border-color var(--transition);
}
.project-filter-input::placeholder { color: var(--text-tertiary); }
.project-filter-input:focus {
    outline: none;
    border-color: var(--accent);
}

.sidebar-projects.compact .project-header {
    padding: 6px 10px;
    font-size: 0.8rem;
}
.sidebar-projects.compact .project-group { margin-bottom: 1px; }
.sidebar-projects.compact .doc-item { padding: 4px 10px 4px 28px; font-size: 0.8rem; }

.recent-docs { margin-bottom: 12px; }
.recent-docs.hidden { display: none !important; }
.recent-docs-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    font-weight: 600;
    margin-bottom: 6px;
}
.recent-doc-item {
    display: flex;
    align-items: center;
    padding: 6px 10px 6px 10px;
    border-radius: 8px;
    border-left: 2px solid transparent;
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--text-secondary);
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.recent-doc-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.recent-doc-item.active {
    background: var(--bg-raised);
    color: var(--text-primary);
    border-left-color: transparent;
}
.recent-doc-filename {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Sidebar Buttons */
.sidebar-btn {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border-input);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    cursor: pointer;
    background: var(--bg-input);
    color: var(--text-secondary);
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.sidebar-btn:hover:not(:disabled) { background: var(--bg-sidebar-hover); color: var(--text-primary); border-color: var(--border-input); }
.sidebar-btn.primary {
    background: var(--accent-fill-ghost);
    color: var(--accent);
    border-color: var(--accent-border);
    border-radius: 8px;
    font-family: var(--font-body), sans-serif;
    font-weight: 500;
    font-size: 13px;
    box-shadow: none;
}
.sidebar-btn.primary:hover {
    background: color-mix(in srgb, var(--accent) 16%, var(--bg-raised));
    border-color: var(--accent);
    color: var(--text-primary);
}
.sidebar-btn.primary:active {
    opacity: 0.95;
}
.sidebar-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.sidebar-icon-btn {
    background: none;
    border: 1px solid var(--border-input);
    color: var(--text-tertiary);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background var(--transition), color var(--transition);
}
.sidebar-icon-btn:hover { background: var(--bg-sidebar-hover); color: var(--text-primary); }

.sidebar-hint { font-size: 0.8rem; color: var(--text-tertiary); margin-bottom: 6px; }

/* SIMAP / Gmail Kurzlinks */
.sidebar-section-extra {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 10px;
    padding-bottom: 10px;
}
.sidebar-extra-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 400;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
}
.sidebar-extra-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.sidebar-extra-emoji {
    display: none;
}
.sidebar-extra-link--soon {
    opacity: 0.92;
}
.sidebar-badge-alert {
    margin-left: auto;
    min-width: 1.1rem;
    height: 1.1rem;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1.1rem;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-badge-alert:not(.hidden):not(:empty) {
    min-width: 1.25rem;
}
.sidebar-badge-soon {
    margin-left: auto;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--accent-subtle);
    color: var(--accent);
}
.sidebar-loading { display: flex; align-items: center; gap: 8px; padding: 8px 0; font-size: 0.85rem; }
.error-small { font-size: 0.8rem; color: var(--danger); padding: 6px 0; }

/* Upload area */
.sidebar-upload { display: flex; flex-direction: column; gap: 8px; }
.upload-options { display: flex; flex-direction: column; gap: 12px; }
.upload-file-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--bg-sidebar-hover);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--text-primary);
}
.upload-file-icon { font-size: 1rem; opacity: 0.7; }
.upload-cancel-btn {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.upload-cancel-btn:hover { color: var(--text-primary); }
#file-selected-name {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.upload-step { display: flex; flex-direction: column; gap: 6px; }
.upload-step-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
#upload-project-select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border-input);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.85rem;
}
.upload-type-options { display: flex; flex-direction: column; gap: 8px; }
.upload-type-option {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    border: 1px solid var(--border-input);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.upload-type-option:hover { background: var(--bg-sidebar-hover); }
.upload-type-option:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-subtle);
}
.upload-type-option input { margin: 0; accent-color: var(--accent); }
.upload-type-title { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); }
.upload-type-desc { font-size: 0.75rem; color: var(--text-secondary); line-height: 1.35; }

/* Upload-Modal (zentriert, unabhängig von Scroll in „Projekte“) */
.upload-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10040;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    box-sizing: border-box;
}
.upload-modal-overlay.hidden {
    display: none !important;
}
.upload-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.52);
    backdrop-filter: blur(3px);
}
.upload-modal-panel {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    max-height: min(90vh, 680px);
    overflow: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 24px 56px rgba(0, 0, 0, 0.38);
}
.upload-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.upload-modal-heading {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}
.upload-modal-close {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.upload-modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.upload-modal-body {
    padding: 18px;
}
.upload-modal-form.sidebar-upload {
    gap: 14px;
}
.upload-pick-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.upload-modal-pick-btn {
    width: 100%;
    justify-content: center;
}
.upload-modal-hint {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.45;
}
.content-upload-card-hint {
    margin: 0 0 10px;
    font-size: 0.8rem;
    line-height: 1.45;
}
body.upload-modal-open {
    overflow: hidden;
}

/* Analyse: Vergabe-Kurzfakten & Terminliste */
.vergabe-kurzfakten-dl {
    display: grid;
    grid-template-columns: minmax(0, 140px) 1fr;
    gap: 6px 16px;
    margin: 0;
    font-size: 0.88rem;
}
.vergabe-kurzfakten-dl dt {
    margin: 0;
    color: var(--text-secondary);
    font-weight: 500;
}
.vergabe-kurzfakten-dl dd {
    margin: 0;
    color: var(--text-primary);
    line-height: 1.45;
}
.result-termine-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.result-termine-item {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.result-termine-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.result-termine-date {
    flex: 0 0 92px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: right;
}
.result-termine-body {
    flex: 1;
    min-width: 0;
}
.result-termine-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}
.result-termine-typ {
    display: inline-block;
    margin-left: 6px;
    font-size: 0.72rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--accent);
    vertical-align: middle;
}
.result-termine-desc {
    margin-top: 4px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.45;
}
.result-termine-meta {
    margin-top: 6px;
}
@media (max-width: 520px) {
    .vergabe-kurzfakten-dl {
        grid-template-columns: 1fr;
    }
    .result-termine-item {
        flex-direction: column;
        gap: 6px;
    }
    .result-termine-date {
        text-align: left;
    }
}

/* ============================================
   PROJECT TREE
   ============================================ */

.project-group { margin-bottom: 2px; position: relative; }

.project-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    transition: background var(--transition), color var(--transition);
    box-shadow: none;
}
.project-header:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.project-toggle {
    font-size: 0.6rem;
    color: var(--text-tertiary);
    transition: transform 0.2s;
    width: 12px;
    flex-shrink: 0;
}
.project-toggle.open { transform: rotate(90deg); }

.project-name {
    flex: 1;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-count {
    font-size: 0.65rem;
    color: var(--text-tertiary);
    background: var(--bg-input);
    padding: 1px 7px;
    border-radius: 10px;
    font-weight: 500;
}

.project-menu-btn {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 1rem;
    padding: 0 4px;
    border-radius: 4px;
    width: auto;
    opacity: 0;
    transition: opacity 0.15s, color var(--transition);
    line-height: 1;
    flex-shrink: 0;
    position: relative;
}
.project-header:hover .project-menu-btn { opacity: 1; }
.project-menu-btn:hover { background: var(--bg-sidebar-hover); color: var(--text-primary); }

.project-docs { overflow: visible; transition: max-height 0.2s ease; }
.project-docs.collapsed { max-height: 0; overflow: hidden; }

.doc-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px 7px 28px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    transition: background var(--transition), color var(--transition);
    border-left: none;
    box-shadow: none;
}
.doc-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.doc-item.active {
    background: var(--bg-raised);
    color: var(--text-primary);
}
[data-theme="light"] .doc-item.active {
    background: var(--bg-raised);
}

.doc-item-checkbox {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    accent-color: var(--accent);
}

.doc-item-name {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}
.doc-item-filename {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.doc-item-pages { font-size: 0.65rem; color: var(--text-tertiary); }
.doc-item-ref-badge {
    flex-shrink: 0;
    font-size: 0.6rem;
    padding: 1px 4px;
    background: var(--accent);
    color: var(--accent-text);
    border-radius: 3px;
}

/* Context Menu */
.doc-item-actions { position: relative; flex-shrink: 0; }
.doc-menu-btn {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 1rem;
    padding: 2px 4px;
    border-radius: 4px;
    width: auto;
    opacity: 0;
    transition: opacity 0.15s;
    line-height: 1;
    letter-spacing: -1px;
}
.doc-item:hover .doc-menu-btn { opacity: 1; }
.doc-menu-btn:hover { background: var(--bg-sidebar-hover); color: var(--text-primary); }

.doc-context-menu {
    position: fixed;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    min-width: 170px;
    z-index: 9999;
    box-shadow: none;
    padding: 4px 0;
}

.doc-context-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    text-align: left;
    padding: 8px 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    position: relative;
    transition: background var(--transition);
}
.doc-context-item:hover { background: var(--bg-sidebar-hover); color: var(--text-primary); }
.doc-context-item.danger { color: var(--danger); }
.doc-context-item.danger:hover { background: var(--danger-bg); }

.doc-context-item .submenu-arrow { margin-left: auto; font-size: 0.6rem; color: var(--text-tertiary); }
.doc-context-divider { height: 1px; background: var(--border-card); margin: 4px 0; }

.doc-context-submenu {
    display: none;
    position: absolute;
    left: 100%;
    top: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    min-width: 150px;
    z-index: 10000;
    box-shadow: none;
    padding: 4px 0;
}
.doc-context-item.has-submenu:hover .doc-context-submenu { display: block; }

.doc-context-submenu-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 6px 10px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 0;
    transition: background var(--transition);
}
.doc-context-submenu-item:hover { background: var(--bg-sidebar-hover); color: var(--text-primary); }
.doc-context-submenu-item.disabled { color: var(--text-tertiary); cursor: default; }

/* ============================================
   MAIN CONTENT
   ============================================ */

.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 32px 40px;
    min-height: 0;
    max-height: 100%;
    max-width: none;
    width: 100%;
    background: var(--bg-base);
    border-radius: 0;
    margin: 0;
    box-shadow: none;
}

.sidebar.collapsed ~ .main-content,
.sidebar.collapsed ~ * ~ .main-content {
    border-radius: 0;
    margin: 0;
}

.main-content::-webkit-scrollbar {
    width: 4px;
}
.main-content::-webkit-scrollbar-track {
    background: transparent;
}
.main-content::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 999px;
}
.main-content::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* —— Dashboard-Startseite —— */
.welcome-dashboard {
    max-width: 1100px;
    margin: 0 auto;
    padding: 8px 0 40px;
}

.dash-page-title {
    font-family: var(--font-heading), sans-serif;
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 24px;
    padding-left: 14px;
    border-left: 3px solid var(--accent-border-soft);
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

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

.welcome-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}
.welcome-subtitle {
    font-size: 0.98rem;
    color: var(--text-secondary);
    max-width: 480px;
    margin: 0 auto;
    line-height: 1.6;
}

.dash-stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.dash-stat-card {
    position: relative;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), inset 0 1px 0 0 var(--accent-border-soft);
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.dash-surface-inset {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), inset 0 1px 0 0 var(--accent-border-soft);
}
.dash-stat-card:hover {
    border-color: var(--accent-border-soft);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), inset 0 1px 0 0 color-mix(in srgb, var(--accent-border-soft) 70%, transparent);
}
#dash-stat-simap-card {
    border-color: var(--accent-border-soft);
}
.dash-stat-card::after {
    display: none;
}
.dash-stat-card--muted .dash-stat-value {
    color: var(--text-tertiary);
}
#dash-stat-simap-card.dash-stat-card--muted .dash-stat-value {
    color: var(--text-tertiary);
}
.dash-stat-label {
    font-size: 11px;
    color: var(--text-tertiary);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.dash-stat-value {
    font-family: var(--font-heading), sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin: 8px 0 4px;
}
#dash-stat-simap-card .dash-stat-value {
    color: color-mix(in srgb, var(--accent) 32%, var(--text-primary));
}
.dash-stat-hint {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 0;
}

.dash-row-two {
    display: flex;
    flex-direction: row;
    gap: 12px;
    margin-bottom: 24px;
    align-items: stretch;
}

.dash-col-dash {
    min-width: 0;
}

.dash-col-dash--60 {
    flex: 1 1 60%;
}

.dash-col-dash--40 {
    flex: 1 1 40%;
}

.dash-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 0;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), inset 0 1px 0 0 var(--accent-border-soft);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.dash-panel--inset {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), inset 0 1px 0 0 var(--accent-border-soft);
}
.dash-panel:hover {
    border-color: var(--accent-border-soft);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), inset 0 1px 0 0 color-mix(in srgb, var(--accent-border-soft) 75%, transparent);
}

.dash-panel-simap {
    margin-bottom: 0;
    border-color: var(--accent-border-soft);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), inset 0 1px 0 0 var(--accent-border-soft), inset 3px 0 0 0 var(--accent-border-soft);
}
.dash-panel-simap:hover {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), inset 0 1px 0 0 color-mix(in srgb, var(--accent-border-soft) 75%, transparent), inset 3px 0 0 0 color-mix(in srgb, var(--accent-border) 55%, var(--accent-border-soft));
}

.dash-panel-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid color-mix(in srgb, var(--accent-border-soft) 35%, var(--border));
}
.dash-panel-title {
    font-family: var(--font-body), sans-serif;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.dash-panel-title::before {
    content: "";
    width: 3px;
    height: 11px;
    border-radius: 2px;
    background: var(--accent);
    opacity: 0.42;
    flex-shrink: 0;
}
.dash-panel-sub {
    font-size: 0.78rem;
    color: var(--text-tertiary);
    font-weight: 500;
}

.dash-recent-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.dash-project-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    background: none;
    border-left: none;
    border-right: none;
    border-top: none;
    border-radius: 0;
}
.dash-project-row:last-child {
    border-bottom: none;
}
.dash-project-name {
    flex: 1;
    font-weight: 500;
    font-size: 13px;
    color: var(--text-primary);
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dash-project-badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 4px 9px;
    border-radius: 999px;
    flex-shrink: 0;
}
.dash-project-badge--active {
    background: var(--success-bg);
    color: var(--success);
}
.dash-project-badge--empty {
    background: var(--bg-input);
    color: var(--text-tertiary);
}
.dash-project-meta {
    font-size: 12px;
    color: var(--text-tertiary);
    flex-shrink: 0;
}
.dash-btn-secondary {
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--bg-raised);
    color: var(--text-primary);
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
}
.dash-btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
    transform: none;
}

.dash-project-open {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--bg-raised);
    color: var(--text-primary);
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
}
.dash-project-open:hover {
    background: var(--accent-fill-ghost);
    border-color: var(--accent-border-soft);
    color: var(--accent-text);
}
.dash-project-open__icon {
    width: 16px;
    height: 16px;
}
.dash-recent-empty,
.dash-timeline-empty {
    font-size: 0.88rem;
    color: var(--text-tertiary);
    padding: 12px 4px;
}

.dash-deadline-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.dash-deadline-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.dash-deadline-row:last-child {
    border-bottom: none;
}

.dash-deadline-row-text {
    flex: 1;
    min-width: 0;
}

.dash-dd-date {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.dash-dd-date--urgent {
    color: var(--danger);
}

.dash-dd-title {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.45;
}

.dash-simap-suggestions {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.dash-simap-empty {
    font-size: 12px;
    color: var(--text-tertiary);
    padding: 8px 0 4px;
    line-height: 1.5;
}

.dash-simap-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.dash-simap-row:last-child {
    border-bottom: none;
}

.dash-simap-row-main {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.dash-simap-row-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    min-width: 0;
}

.dash-simap-score {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-subtle);
    padding: 2px 8px;
    border-radius: 6px;
    flex-shrink: 0;
}

.dash-simap-row-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.dash-simap-dl {
    font-size: 12px;
    color: var(--text-tertiary);
}

.dash-simap-link {
    font-size: 12px;
    font-weight: 500;
    color: var(--accent);
    text-decoration: none;
    margin-left: auto;
}
.dash-simap-link:hover {
    text-decoration: underline;
}

.dash-simap-panel-footer {
    display: flex;
    justify-content: flex-end;
    padding-top: 12px;
    margin-top: 4px;
}

.dash-simap-all-link {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-text);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--accent-border-soft);
    background: var(--accent-fill-ghost);
    transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}
.dash-simap-all-link:hover {
    border-color: var(--accent-border);
    background: color-mix(in srgb, var(--accent-fill-ghost) 65%, var(--bg-raised));
    color: var(--accent-hover);
}

.dash-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
    padding-left: 18px;
}
.dash-timeline::before {
    content: "";
    position: absolute;
    left: 5px;
    top: 6px;
    bottom: 6px;
    width: 1px;
    border-radius: 0;
    background: linear-gradient(180deg, var(--accent-border-soft) 0%, var(--border) 42%, var(--border) 100%);
    opacity: 1;
}
.dash-timeline-item {
    position: relative;
    padding-bottom: 18px;
    padding-left: 8px;
}
.dash-timeline-item:last-child {
    padding-bottom: 0;
}
.dash-timeline-dot {
    position: absolute;
    left: -14px;
    top: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 2px var(--bg-surface), 0 0 0 3px var(--accent-border-soft);
}
.dash-timeline-date {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}
.dash-timeline-body {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex-wrap: wrap;
}
.dash-timeline-type {
    font-size: 0.58rem;
    padding: 3px 8px;
    border-radius: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}
.dash-timeline-type.Frist,
.dash-timeline-type.Ende { background: var(--danger-bg); color: var(--danger); }
.dash-timeline-type.Beginn { background: var(--success-bg); color: var(--success); }
.dash-timeline-type.Abgabe { background: var(--warning-bg); color: var(--warning); }
.dash-timeline-type.Termin { background: var(--accent-subtle); color: var(--accent-text); }
.dash-timeline-type.Zahlung { background: rgba(171, 71, 188, 0.12); color: var(--purple); }

.dash-timeline-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    min-width: 140px;
}
.dash-timeline-open {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-input);
    background: var(--bg-entry);
    color: var(--accent-text);
    cursor: pointer;
    transition: background var(--transition);
}
.dash-timeline-open:hover {
    background: var(--accent-subtle);
}

.welcome-hint {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    text-align: center;
    max-width: 420px;
    margin: 8px auto 0;
}

/* Hamburger Button (mobile) */
.hamburger-btn {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 100;
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    align-items: center;
    justify-content: center;
    box-shadow: none;
}
.hamburger-btn svg {
    width: 18px;
    height: 18px;
}

/* ============================================
   CARDS
   ============================================ */

.card {
    background: var(--bg-surface);
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 18px;
    border: 1px solid var(--border);
    box-shadow: none;
    transition: border-color 0.15s ease;
}
.card:hover {
    border-color: var(--border-strong);
    box-shadow: none;
}

.card h2 {
    font-size: 16px;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 600;
    letter-spacing: -0.01em;
}
.card h3 {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    color: var(--text-tertiary);
    margin-bottom: 12px;
}
.card p, .card .entry, .card .todo-item {
    font-size: 13px;
    line-height: 1.7;
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}
.result-header h2 { margin-bottom: 0; font-size: 1.1rem; flex: 1; min-width: 0; }

.role-filter-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}
.role-filter-label {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    white-space: nowrap;
}
.role-filter-select {
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-input);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    min-width: 140px;
}

.result-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.result-back-to-shell-btn {
    white-space: nowrap;
    max-width: 100%;
}

.badge {
    background: var(--accent-subtle);
    color: var(--accent);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    white-space: nowrap;
    font-weight: 500;
    letter-spacing: 0.02em;
    font-family: var(--font-body), sans-serif;
}

/* ============================================
   ENTRIES
   ============================================ */

.entry {
    padding: 12px 14px;
    border-left: 2px solid var(--border);
    margin-bottom: 10px;
    background: transparent;
    border-radius: 0;
    transition: background var(--transition);
}

#wichtige-stellen-card .entry {
    border-left: 2px solid var(--accent);
    padding-left: 16px;
    background: transparent;
    border-radius: 0;
}
.result-summary-row {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    flex-wrap: wrap;
}
.result-summary-row p { flex: 1; min-width: 200px; margin: 0; }
.risiko-score-wrap {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}
.risiko-score-label { font-size: 0.8rem; color: var(--text-tertiary); }
.risiko-score-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    font-size: 15px;
    font-weight: 700;
    font-family: var(--font-heading), sans-serif;
    padding: 0;
    border-radius: 50%;
    border: 2px solid transparent;
    box-sizing: border-box;
    background: transparent;
}
.risiko-score-badge.hoch {
    border-color: var(--danger);
    color: var(--danger);
}
.risiko-score-badge.mittel {
    border-color: var(--warning);
    color: var(--warning);
}
.risiko-score-badge.niedrig {
    border-color: var(--success);
    color: var(--success);
}
.risiko-score-max { font-size: 0.9rem; color: var(--text-tertiary); }

.info-popup-trigger {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: help;
}
.info-icon {
    font-size: 0.9rem;
    color: var(--text-tertiary);
    opacity: 0.8;
    margin-left: 4px;
}
.info-popup-trigger:hover .info-icon { opacity: 1; color: var(--accent-text); }

.info-popup {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);
    min-width: 160px;
    padding: 10px 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: none;
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s, visibility 0.15s;
    z-index: 99999;
    pointer-events: none;
}
.info-popup-trigger:hover .info-popup {
    opacity: 1;
    visibility: visible;
}
.info-popup::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--border-card);
}
.info-popup strong {
    display: block;
    color: var(--text-heading);
    margin-bottom: 6px;
    font-size: 0.85rem;
}
.info-popup span {
    display: block;
    white-space: nowrap;
    padding: 2px 0;
}
.info-popup span:not(:last-child) { border-bottom: none; }

.card-hint-row {
    margin: -4px 0 12px 0;
    display: flex;
    align-items: center;
}
.card-hint-row .info-popup {
    bottom: auto;
    top: calc(100% + 8px);
    left: 0;
    transform: translateX(0);
}
.card-hint-row .info-popup::after {
    top: auto;
    bottom: 100%;
    left: 8px;
    transform: translateX(0);
    border-top-color: transparent;
    border-bottom-color: var(--border-card);
}

.entry-stufe {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 6px;
}
.entry-stufe.hoch {
    background: rgba(240, 96, 96, 0.12);
    color: var(--danger);
}
.entry-stufe.mittel {
    background: rgba(245, 166, 35, 0.12);
    color: var(--warning);
}
.entry-stufe.niedrig {
    background: var(--success-bg);
    color: var(--success);
}

.entry.verantwortlichkeit { border-left-color: var(--purple); }
.verant-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.verant-rolle {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--accent-text);
}
.verant-frist {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}
.card-hint { font-size: 0.85rem; color: var(--text-tertiary); margin: -4px 0 12px 0; }

.entry.risiko { border-left-color: var(--danger); }
.entry.bemerkung { border-left-color: var(--warning); }
.entry .page-ref { font-size: 0.8rem; color: var(--accent-text); font-weight: 600; margin-bottom: 4px; }
.entry .main-text { font-weight: 500; margin-bottom: 4px; color: var(--text-primary); }
.entry .detail-text { font-size: 0.9rem; color: var(--text-secondary); }

.todo-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    margin-bottom: 8px;
    background: var(--bg-entry);
    border-radius: var(--radius-sm);
}

.todo-priority {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.todo-priority.hoch {
    background: rgba(240, 96, 96, 0.12);
    color: var(--danger);
}
.todo-priority.mittel {
    background: rgba(245, 166, 35, 0.12);
    color: var(--warning);
}
.todo-priority.niedrig {
    background: var(--success-bg);
    color: var(--success);
}

/* ============================================
   BRANCHEN-PRUEFUNG
   ============================================ */

.branch-check { padding: 12px 14px; margin-bottom: 8px; background: var(--bg-entry); border-radius: var(--radius-sm); }
.branch-check-header { display: flex; align-items: center; gap: 8px; }

.branch-status {
    width: 24px; height: 24px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; flex-shrink: 0;
}
.branch-status.ok { background: var(--success-bg); color: var(--success); }
.branch-status.warnung { background: var(--warning-bg); color: var(--warning); }
.branch-status.fehlt { background: var(--danger-bg); color: var(--danger); }
.branch-status.nicht_anwendbar { background: var(--bg-input); color: var(--text-tertiary); }

.branch-name { font-weight: 600; font-size: 0.9rem; flex: 1; color: var(--text-primary); }

.branch-label { font-size: 0.7rem; padding: 2px 8px; border-radius: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.branch-label.ok { background: var(--success-bg); color: var(--success); }
.branch-label.warnung { background: var(--warning-bg); color: var(--warning); }
.branch-label.fehlt { background: var(--danger-bg); color: var(--danger); }
.branch-label.nicht_anwendbar { background: var(--bg-input); color: var(--text-tertiary); }

.branch-detail { font-size: 0.85rem; color: var(--text-secondary); margin-top: 4px; padding-left: 32px; }

/* ============================================
   CHAT INTERFACE
   ============================================ */

.chat-container {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
}

.chat-load-more {
    align-self: center;
    background: transparent;
    border: 1px solid var(--border-input);
    color: var(--text-tertiary);
    font-size: 0.8rem;
    padding: 8px 20px;
    border-radius: 50px;
    cursor: pointer;
    margin: 8px 0;
    width: auto;
    transition: background var(--transition), color var(--transition);
}
.chat-load-more:hover { background: var(--bg-sidebar-hover); color: var(--text-primary); }

.chat-messages { display: flex; flex-direction: column; gap: 16px; padding: 8px 0; }

.chat-bubble {
    max-width: 85%;
    padding: 14px 18px;
    border-radius: 14px;
    font-size: 0.9rem;
    line-height: 1.65;
    position: relative;
    word-wrap: break-word;
}
.chat-bubble.user {
    align-self: flex-end;
    background: var(--accent);
    color: #fff;
    border-bottom-right-radius: 6px;
}
.chat-bubble.assistant {
    align-self: flex-start;
    background: var(--bg-card);
    color: var(--text-primary);
    border-bottom-left-radius: 6px;
    border: 1px solid var(--border-card);
    box-shadow: var(--shadow-sm);
}

.chat-bubble-content ul { margin: 4px 0; padding-left: 18px; list-style: disc; }
.chat-bubble-content ul li { margin-bottom: 4px; line-height: 1.5; }
.chat-bubble-content p { margin: 0; }

.chat-meta { display: flex; gap: 10px; margin-top: 8px; font-size: 0.75rem; color: var(--text-tertiary); flex-wrap: wrap; }
.chat-bubble.assistant .chat-meta { color: var(--text-tertiary); }
.chat-timestamp { font-size: 0.7rem; color: var(--text-tertiary); margin-top: 4px; }
.chat-bubble.user .chat-timestamp { text-align: right; color: rgba(255, 255, 255, 0.6); }

.chat-contradictions {
    margin-top: 10px;
    padding: 10px;
    background: var(--danger-bg);
    border: 1px solid var(--danger);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--danger);
}
.chat-contradictions-title { font-weight: 600; font-size: 0.8rem; color: var(--danger); margin-bottom: 6px; }

.chat-contradiction-item {
    padding: 6px 8px;
    margin-bottom: 4px;
    background: var(--bg-card);
    border-radius: 4px;
    font-size: 0.8rem;
    border: 1px solid var(--border-card);
}
.chat-contradiction-item:last-child { margin-bottom: 0; }
.chat-contradiction-topic { font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.chat-contradiction-docs { font-size: 0.75rem; color: var(--text-tertiary); margin-bottom: 2px; }
.chat-contradiction-advice { font-size: 0.75rem; color: var(--danger); font-style: italic; }

.chat-confidence {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.chat-confidence.hoch { background: var(--success-bg); color: var(--success); }
.chat-confidence.mittel { background: var(--warning-bg); color: var(--warning); }
.chat-confidence.niedrig { background: var(--danger-bg); color: var(--danger); }

.chat-empty { text-align: center; color: var(--text-tertiary); padding: 20px 0; font-size: 0.9rem; }

/* Chat Input */
.chat-input-row { display: flex; gap: 12px; }
.chat-input-row input {
    flex: 1; padding: 12px 16px;
    border: 1px solid var(--border-input);
    border-radius: 10px;
    font-size: 0.9rem;
    background: var(--bg-input);
    color: var(--text-primary);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.chat-input-row input:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--accent-subtle); }
.chat-input-row button { width: auto; padding: 12px 24px; border-radius: 10px; }

.qa-project-context {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin-bottom: 12px;
    background: var(--accent-subtle);
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--accent-text);
    cursor: pointer;
}
.qa-project-context input { margin: 0; }

.qa-contradictions {
    margin-top: 14px;
    padding: 14px;
    background: var(--danger-bg);
    border: 1px solid var(--danger);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--danger);
}
.qa-contradictions-title { font-weight: 600; font-size: 0.9rem; color: var(--danger); margin-bottom: 10px; }

.qa-contradiction-item {
    padding: 8px 10px;
    margin-bottom: 8px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    border: 1px solid var(--border-card);
}
.qa-contradiction-item:last-child { margin-bottom: 0; }
.qa-contradiction-topic { font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.qa-contradiction-docs { display: flex; flex-direction: column; gap: 2px; font-size: 0.8rem; color: var(--text-tertiary); margin-bottom: 4px; }
.qa-contradiction-advice { font-size: 0.8rem; color: var(--danger); font-style: italic; }

/* ============================================
   VERGLEICH
   ============================================ */

.compare-docs-header { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.compare-doc { flex: 1; min-width: 150px; }
.compare-label { font-size: 0.8rem; color: var(--text-tertiary); display: block; }
.compare-doc span:last-child { font-weight: 600; font-size: 0.95rem; color: var(--text-primary); }
.compare-vs { font-weight: 600; color: var(--text-tertiary); font-size: 0.9rem; }

.change-entry { padding: 12px; margin-bottom: 10px; background: var(--bg-entry); border-radius: var(--radius-sm); border: 1px solid var(--border-card); }
.change-entry-header { font-weight: 600; margin-bottom: 8px; color: var(--text-primary); }
.change-entry-row { display: flex; gap: 8px; font-size: 0.9rem; margin-bottom: 4px; color: var(--text-primary); }
.change-entry-label { font-weight: 500; color: var(--text-tertiary); min-width: 90px; flex-shrink: 0; }

.change-badge { display: inline-block; font-size: 0.7rem; padding: 2px 8px; border-radius: 10px; font-weight: 600; margin-top: 6px; text-transform: uppercase; letter-spacing: 0.3px; }
.change-badge.verschlechterung { background: var(--danger-bg); color: var(--danger); }
.change-badge.verbesserung { background: var(--success-bg); color: var(--success); }
.change-badge.neutral { background: var(--bg-input); color: var(--text-tertiary); }
.change-badge.pruefen { background: var(--warning-bg); color: var(--warning); }

#compare-nur-a, #compare-nur-b { list-style: none; padding: 0; }
#compare-nur-a li, #compare-nur-b li {
    padding: 8px 12px; border-left: 2px solid var(--warning);
    margin-bottom: 6px; background: var(--bg-entry); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 0.9rem; color: var(--text-primary);
}

/* ============================================
   PROJEKT-CHECK
   ============================================ */

.project-check-btn {
    background: none;
    border: 1px solid var(--border-input);
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    width: auto;
    opacity: 0;
    transition: opacity 0.15s, background var(--transition), color var(--transition);
    line-height: 1;
    flex-shrink: 0;
    white-space: nowrap;
}
.project-header:hover .project-check-btn { opacity: 1; }
.project-check-btn:hover { background: var(--success); color: #fff; border-color: var(--success); }

.project-check-btn.loading {
    opacity: 1;
    cursor: wait;
    color: var(--accent-text);
    border-color: var(--accent);
}

.check-status-banner {
    padding: 16px 24px;
    border-radius: var(--radius-md);
    margin-bottom: 14px;
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 12px;
}
.check-status-banner.ok { background: var(--success-bg); color: var(--success); border: 1px solid var(--success); }
.check-status-banner.warning { background: var(--warning-bg); color: var(--warning); border: 1px solid var(--warning); }
.check-status-banner.error { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger); }

.check-item {
    padding: 14px;
    margin-bottom: 12px;
    background: var(--bg-entry);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-card);
    border-left: 3px solid var(--danger);
}
.check-item.hoch { border-left-color: var(--danger); }
.check-item.mittel { border-left-color: var(--warning); }
.check-item.niedrig { border-left-color: var(--success); }

.check-item-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.check-item-kategorie { font-size: 0.65rem; padding: 2px 8px; border-radius: 10px; font-weight: 600; background: var(--bg-input); color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.3px; }
.check-item-thema { font-weight: 600; font-size: 0.95rem; flex: 1; color: var(--text-primary); }
.check-item-schweregrad { font-size: 0.65rem; padding: 2px 8px; border-radius: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.check-item-schweregrad.hoch { background: var(--danger-bg); color: var(--danger); }
.check-item-schweregrad.mittel { background: var(--warning-bg); color: var(--warning); }
.check-item-schweregrad.niedrig { background: var(--success-bg); color: var(--success); }

.check-item-details { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.check-item-detail { display: flex; gap: 8px; font-size: 0.85rem; padding: 6px 10px; background: var(--bg-card); border-radius: 4px; border: 1px solid var(--border-card); color: var(--text-primary); }
.check-item-detail-doc { font-weight: 500; color: var(--text-tertiary); min-width: 120px; flex-shrink: 0; }
.check-item-empfehlung { font-size: 0.85rem; color: var(--accent-text); font-style: italic; padding-top: 4px; }

#project-check-konsistent { list-style: none; padding: 0; }
#project-check-konsistent li {
    padding: 8px 12px;
    border-left: 2px solid var(--success);
    margin-bottom: 6px;
    background: var(--success-bg);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 0.9rem;
    color: var(--text-primary);
}

/* ============================================
   BUTTONS (main area)
   ============================================ */

button {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition);
    width: 100%;
    box-shadow: none;
}
button:hover:not(:disabled) {
    background: var(--accent-hover);
    box-shadow: none;
}
button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
button.secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-strong);
}
button.secondary:hover:not(:disabled) {
    background: transparent;
    color: var(--text-primary);
    border-color: var(--border-strong);
}
button.small-btn { width: auto; padding: 9px 18px; font-size: 0.85rem; }

/* ============================================
   SPINNER
   ============================================ */

.spinner {
    width: 40px; height: 40px;
    border: 3px solid var(--border-card);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}
.spinner.small {
    width: 16px; height: 16px; border-width: 2px;
    display: inline-block; vertical-align: middle; margin: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================
   UTILITIES
   ============================================ */

.hidden { display: none !important; }
.center { text-align: center; }
.disclaimer { text-align: center; font-size: 0.8rem; color: var(--text-tertiary); margin-top: 20px; padding: 0 20px; }

/* ============================================
   SPLIT-VIEW (Analyse + Originaltext)
   ============================================ */

.main-content.split-view { display: flex; padding: 0; }

.main-content.split-view #result-section {
    width: 50%; min-width: 0; overflow-y: auto;
    padding: 28px 24px; max-height: 100vh;
}

.main-content.split-view #welcome-section,
.main-content.split-view #compare-result-section {
    width: 50%; min-width: 0; overflow-y: auto; padding: 20px;
}

/* ============================================
   TEXT VIEWER PANEL
   ============================================ */

.text-viewer-panel {
    width: 50%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border-card);
    background: var(--bg-card-alt);
    max-height: 100vh;
}

.text-viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-card);
    flex-shrink: 0;
}

.highlight-nav { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--text-secondary); }

.nav-arrow {
    width: 28px; height: 28px; padding: 0; font-size: 0.7rem;
    border-radius: var(--radius-sm);
    background: var(--bg-input); color: var(--text-secondary);
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--border-input);
}
.nav-arrow:hover:not(:disabled) { background: var(--bg-sidebar-hover); color: var(--text-primary); }

#highlight-counter { min-width: 100px; text-align: center; font-weight: 500; }

.text-viewer-close {
    width: 28px; height: 28px; padding: 0; font-size: 1.2rem;
    border-radius: var(--radius-sm); background: none; color: var(--text-tertiary);
    display: flex; align-items: center; justify-content: center;
    border: none;
}
.text-viewer-close:hover { background: var(--bg-sidebar-hover); color: var(--text-primary); }

/* Viewer Tabs */
.viewer-tabs {
    display: flex; gap: 2px;
    background: var(--bg-input); border-radius: var(--radius-sm); padding: 3px;
}
.viewer-tab {
    width: auto; padding: 5px 14px; font-size: 0.8rem;
    border: none; border-radius: 6px; background: transparent;
    color: var(--text-tertiary); cursor: pointer; font-weight: 500;
    transition: background var(--transition), color var(--transition);
}
.viewer-tab:hover { color: var(--text-primary); }
.viewer-tab.active { background: var(--bg-card); color: var(--text-primary); box-shadow: var(--shadow-sm); }

/* PDF Viewer */
.pdf-viewer-content { flex: 1; overflow: hidden; }
.pdf-iframe { width: 100%; height: 100%; border: none; background: var(--bg-app); }

/* Text Viewer */
.text-viewer-content { flex: 1; overflow-y: auto; padding: 16px; }

.text-page {
    margin-bottom: 24px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    border: 1px solid var(--border-card);
}
.text-page-header {
    font-size: 0.7rem; font-weight: 600;
    color: var(--accent-text); text-transform: uppercase;
    letter-spacing: 0.5px; padding-bottom: 8px;
    margin-bottom: 12px; border-bottom: 1px solid var(--border-card);
}
.text-page-body {
    font-size: 0.9rem; line-height: 1.7;
    color: var(--text-primary); white-space: pre-wrap; word-wrap: break-word;
}

/* Highlights */
.text-highlight { background: var(--accent-subtle); border-radius: 2px; padding: 1px 0; transition: background 0.2s; }
.text-highlight.active { background: var(--accent); color: #fff; box-shadow: 0 0 0 2px var(--accent); border-radius: 3px; }

/* Clickable Entries */
.entry.clickable { cursor: pointer; transition: background 0.15s, border-left-color 0.15s; }
.entry.clickable:hover { background: var(--accent-subtle); }
.entry.clickable .page-ref { text-decoration: underline; text-decoration-style: dotted; }
.entry.clickable.entry-active { background: var(--accent-subtle); border-left-color: var(--accent); }

#toggle-text-btn.active { background: var(--accent); color: #fff; }

/* ============================================
   KALENDER
   ============================================ */

.calendar-sidebar-btn {
    width: 100%;
    text-align: left;
    background: var(--bg-input);
    border: 1px solid var(--border-input);
    color: var(--text-secondary);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    transition: background var(--transition), color var(--transition);
}
.calendar-sidebar-btn:hover { background: var(--bg-sidebar-hover); color: var(--text-primary); }

.calendar-nav { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding: 12px 0; }

.calendar-nav-btn {
    width: 36px; height: 36px; border-radius: var(--radius-sm);
    border: 1px solid var(--border-input); background: var(--bg-card);
    cursor: pointer; font-size: 1.1rem; color: var(--text-secondary);
    display: flex; align-items: center; justify-content: center;
    transition: background var(--transition);
}
.calendar-nav-btn:hover { background: var(--bg-sidebar-hover); color: var(--text-primary); }

.calendar-month-label { font-size: 1.15rem; font-weight: 600; color: var(--text-heading); min-width: 180px; text-align: center; }

.calendar-today-btn {
    margin-left: auto; padding: 6px 16px; border-radius: var(--radius-sm);
    border: 1px solid var(--accent); background: transparent; color: var(--accent-text);
    cursor: pointer; font-size: 0.85rem; font-weight: 500;
    transition: background var(--transition), color var(--transition);
}
.calendar-today-btn:hover { background: var(--accent); color: #fff; }

.calendar-export-btn {
    margin-left: auto; padding: 6px 16px; border-radius: var(--radius-sm);
    border: 1px solid var(--border-input); background: var(--bg-card);
    font-size: 0.85rem; font-weight: 500; color: var(--text-secondary);
    text-decoration: none; cursor: pointer;
    transition: background var(--transition), color var(--transition);
}
.calendar-export-btn:hover { background: var(--bg-sidebar-hover); color: var(--accent-text); }

.calendar-grid {
    display: grid; grid-template-columns: repeat(7, 1fr);
    gap: 1px; background: var(--border-card); border-radius: var(--radius-md);
    overflow: hidden; border: 1px solid var(--border-card);
}

.calendar-weekday {
    background: var(--bg-card-alt); padding: 10px; text-align: center;
    font-weight: 600; font-size: 0.75rem; color: var(--text-tertiary);
    text-transform: uppercase; letter-spacing: 0.5px;
}

#calendar-days { display: contents; }

.calendar-day {
    background: var(--bg-card); min-height: 80px; padding: 8px;
    cursor: pointer; transition: background 0.1s; position: relative;
}
.calendar-day:hover { background: var(--bg-sidebar-hover); }
.calendar-day.other-month { background: var(--bg-card-alt); }
.calendar-day.other-month:hover { background: var(--bg-sidebar-hover); }
.calendar-day.today { background: var(--accent-subtle); box-shadow: inset 0 0 0 2px var(--accent); }
.calendar-day.selected { background: var(--accent-subtle); }

.calendar-day-number { font-size: 0.85rem; font-weight: 500; color: var(--text-primary); margin-bottom: 4px; }
.calendar-day.other-month .calendar-day-number { color: var(--text-tertiary); }
.calendar-day.today .calendar-day-number { color: var(--accent-text); font-weight: 700; }

.calendar-day-dots { display: flex; gap: 3px; flex-wrap: wrap; }
.calendar-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; background: var(--accent); }
.calendar-dot.Frist, .calendar-dot.Ende { background: var(--danger); }
.calendar-dot.Beginn { background: var(--success); }
.calendar-dot.Abgabe { background: var(--warning); }
.calendar-dot.Termin { background: var(--accent); }
.calendar-dot.Zahlung { background: var(--purple); }

.calendar-day-event-mini {
    font-size: 0.6rem; padding: 2px 5px; border-radius: 3px;
    margin-top: 2px; white-space: nowrap; overflow: hidden;
    text-overflow: ellipsis; max-width: 100%;
    background: var(--accent-subtle); color: var(--accent-text);
}
.calendar-day-event-mini.Frist, .calendar-day-event-mini.Ende { background: var(--danger-bg); color: var(--danger); }
.calendar-day-event-mini.Beginn { background: var(--success-bg); color: var(--success); }
.calendar-day-event-mini.Abgabe { background: var(--warning-bg); color: var(--warning); }
.calendar-day-event-mini.Termin { background: var(--accent-subtle); color: var(--accent-text); }
.calendar-day-event-mini.Zahlung { background: rgba(171, 71, 188, 0.12); color: var(--purple); }

.calendar-events { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border-card); }
.calendar-events-title { font-size: 1rem; font-weight: 600; margin-bottom: 16px; color: var(--text-heading); }

.calendar-event-card {
    display: flex; align-items: flex-start; gap: 14px; padding: 16px;
    background: var(--bg-card); border-radius: var(--radius-sm);
    border: 1px solid var(--border-card); margin-bottom: 10px;
    transition: box-shadow var(--transition);
}
.calendar-event-card:hover { box-shadow: var(--shadow-sm); }

.calendar-event-type {
    font-size: 0.6rem; padding: 3px 8px; border-radius: 10px;
    font-weight: 600; white-space: nowrap; flex-shrink: 0;
    text-transform: uppercase; letter-spacing: 0.3px;
}
.calendar-event-type.Frist, .calendar-event-type.Ende { background: var(--danger-bg); color: var(--danger); }
.calendar-event-type.Beginn { background: var(--success-bg); color: var(--success); }
.calendar-event-type.Abgabe { background: var(--warning-bg); color: var(--warning); }
.calendar-event-type.Termin { background: var(--accent-subtle); color: var(--accent-text); }
.calendar-event-type.Zahlung { background: rgba(171, 71, 188, 0.12); color: var(--purple); }

.calendar-event-content { flex: 1; min-width: 0; }
.calendar-event-title { font-weight: 600; font-size: 0.95rem; margin-bottom: 6px; color: var(--text-primary); }
.calendar-event-desc { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 6px; }
.calendar-event-meta { font-size: 0.8rem; color: var(--text-tertiary); display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.calendar-event-meta .calendar-event-date { font-weight: 600; color: var(--text-secondary); font-size: 0.85rem; }

.calendar-event-actions { display: flex; flex-direction: column; align-items: center; gap: 4px; flex-shrink: 0; }

.calendar-event-open {
    font-size: 0.75rem; padding: 4px 10px; border-radius: var(--radius-sm);
    border: 1px solid var(--border-input); background: var(--bg-card);
    cursor: pointer; color: var(--accent-text); transition: background var(--transition);
}
.calendar-event-open:hover { background: var(--accent-subtle); }

.calendar-event-delete {
    font-size: 0.75rem; padding: 4px 10px; border-radius: var(--radius-sm);
    border: 1px solid var(--danger); background: var(--bg-card);
    cursor: pointer; color: var(--danger); transition: background var(--transition);
}
.calendar-event-delete:hover { background: var(--danger-bg); }

.calendar-no-events { text-align: center; color: var(--text-tertiary); padding: 24px; font-size: 0.9rem; }

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 900px) {
    .dash-stats-row {
        grid-template-columns: 1fr;
    }
    .dash-row-two {
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    .app-topbar-inner {
        padding: 10px 12px 8px;
        gap: 8px;
    }
    .app-topbar-brand {
        max-width: min(46vw, 200px);
        gap: 6px;
    }
    .app-topbar-tools {
        flex: 1 1 auto;
        min-width: 0;
        gap: 8px;
    }
    .app-topbar-search-wrap {
        max-width: none;
        flex: 2 1 0;
        width: auto;
        min-width: 0;
    }
    .app-topbar-upload-btn {
        flex: 1 1 0;
        width: auto;
        max-width: none;
        min-width: 0;
    }
    .app-topbar-email {
        display: none;
    }
    .app-topbar-plan {
        padding: 4px 9px;
        font-size: 0.58rem;
    }
    .app-sidebar-shell.sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        height: 100vh;
        z-index: 200;
        transition: left 0.25s ease;
        border-radius: 0;
        width: min(100vw, 360px);
        max-width: 100vw;
        min-width: 0;
        opacity: 1;
        pointer-events: auto;
        flex-direction: column;
        overflow-y: auto;
        overflow-x: hidden;
        background: var(--bg-surface);
    }
    .app-sidebar-shell.sidebar.open { left: 0; }
    .app-sidebar-shell.sidebar.collapsed { left: -100%; }
    .sidebar-nav {
        width: 100%;
        min-width: 0;
        height: auto;
        min-height: 0;
        border-right: none;
    }
    .sidebar-workbench {
        width: 100% !important;
        max-width: none;
        min-width: 0;
        flex: 1;
        border-right: none;
    }
    .sidebar-close-btn { display: block; }
    .sidebar-collapse-btn { display: none; }
    .sidebar-expand-btn { display: none !important; }
    .sidebar-resize-handle { display: none !important; }
    .hamburger-btn {
        display: flex;
        top: 62px;
    }
    .main-content { padding: 16px; padding-top: 64px; border-radius: 0; margin: 0; }
    .chat-input-row { flex-direction: column; }
    .chat-input-row button { width: 100%; }
    .compare-docs-header { flex-direction: column; }
    .change-entry-row { flex-direction: column; gap: 2px; }
    .main-content.split-view { flex-direction: column; }
    .main-content.split-view #result-section { width: 100%; max-height: none; }
    .text-viewer-panel { width: 100%; max-height: 50vh; border-left: none; border-top: 1px solid var(--border-card); }
}

/* —— Projekt-Fokus (/app/project/…) —— */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.project-focus-layout {
    min-height: 100vh;
    background: var(--bg-app);
    color: var(--text-primary);
    padding: 24px 28px 48px;
    max-width: 920px;
    margin: 0 auto;
}

.project-focus-header {
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-card);
}

.project-focus-back {
    display: inline-block;
    color: var(--accent);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.project-focus-back:hover {
    text-decoration: underline;
}

.project-focus-title {
    font-size: 1.65rem;
    font-weight: 600;
    margin: 0 0 8px;
    letter-spacing: -0.02em;
}

.project-focus-meta {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-tertiary);
}

.project-focus-main {
    display: flex;
    flex-direction: column;
    gap: 36px;
}

.project-focus-section {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 12px;
    padding: 20px 22px;
}

.project-focus-h2 {
    font-size: 1.1rem;
    margin: 0 0 16px;
    font-weight: 600;
}

.project-focus-h3 {
    font-size: 0.95rem;
    margin: 0 0 10px;
    color: var(--text-secondary);
    font-weight: 500;
}

.project-focus-subsection {
    margin-bottom: 22px;
}

.project-focus-subsection:last-child {
    margin-bottom: 0;
}

.project-focus-doc-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.project-focus-doc-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-subtle, var(--border-card));
}

.project-focus-doc-row:last-child {
    border-bottom: none;
}

.project-focus-doc-name {
    flex: 1 1 160px;
    font-weight: 500;
    min-width: 0;
    word-break: break-word;
}

.project-focus-doc-meta {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.project-focus-doc-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.project-focus-link {
    font-size: 0.85rem;
    color: var(--accent);
    text-decoration: none;
}

.project-focus-link:hover {
    text-decoration: underline;
}

.project-focus-empty {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-tertiary);
}

.project-focus-notes-hint {
    margin: 0 0 14px;
    font-size: 0.85rem;
    color: var(--text-tertiary);
    line-height: 1.45;
}

.project-focus-error {
    color: #f87171;
    font-size: 0.875rem;
    margin: 0 0 12px;
}

.project-focus-error.hidden {
    display: none;
}

.project-notes-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 18px;
}

.project-note-card {
    background: var(--bg-sidebar, var(--bg-app));
    border: 1px solid var(--border-card);
    border-radius: 10px;
    padding: 12px 14px;
}

.project-note-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin-bottom: 8px;
    font-size: 0.8rem;
}

.project-note-author {
    font-weight: 500;
    color: var(--text-secondary);
}

.project-note-date {
    color: var(--text-tertiary);
}

.project-note-delete {
    margin-left: auto;
    background: transparent;
    border: 1px solid var(--border-input);
    color: var(--text-secondary);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 0.75rem;
    cursor: pointer;
}

.project-note-delete:hover {
    border-color: #f87171;
    color: #f87171;
}

.project-note-body {
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.project-notes-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.project-notes-textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--border-input);
    background: var(--bg-app);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    min-height: 100px;
}

.project-notes-textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

.project-notes-submit {
    align-self: flex-start;
}

/* —— Projekt-Dashboard (Übersicht + Sidebar) —— */
/* Global body nutzt overflow:hidden + 100vh für .app-layout; hier Seite normal scrollen. */
body.project-dashboard-body {
    margin: 0;
    height: auto;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    background: var(--bg-app);
    color: var(--text-primary);
}

/* Projektseite eingebettet in Haupt-App (gleiche Shell wie /app) */
.main-content.main-content--project-focus {
    overflow-x: hidden;
}

.project-dashboard {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px 24px 40px;
    box-sizing: border-box;
}

.project-dashboard-header {
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border-card);
}

.project-dashboard-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.project-dashboard-user {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.project-dashboard-title {
    font-size: 1.75rem;
    font-weight: 600;
    margin: 0 0 8px;
    letter-spacing: -0.02em;
}

.project-dashboard-lead {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    max-width: 900px;
}

.project-dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
    align-items: start;
}

.project-dashboard-main {
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-width: 0;
}

.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 12px;
    padding: 18px 20px;
}

.project-card-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0 0 14px;
}

.project-card-hero .project-card-title {
    margin-bottom: 10px;
}

.project-doc-type-tags,
.project-role-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.project-tag {
    display: inline-block;
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--accent-subtle);
    color: var(--accent);
    border: 1px solid var(--border-input);
}

.project-tag-role {
    background: var(--bg-sidebar-hover);
    color: var(--text-secondary);
}

.project-summary-blocks {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.project-summary-block {
    padding: 12px 0;
    border-top: 1px solid var(--border-card);
}

.project-summary-block:first-of-type {
    border-top: none;
    padding-top: 0;
}

.project-summary-block-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.project-summary-text {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--text-primary);
    white-space: pre-wrap;
}

.project-chat-hint {
    margin: 0 0 12px;
    font-size: 0.82rem;
    color: var(--text-tertiary);
    line-height: 1.45;
}

.project-chat-messages {
    max-height: 320px;
    overflow-y: auto;
    padding: 12px;
    border-radius: 10px;
    background: var(--bg-app);
    border: 1px solid var(--border-card);
    margin-bottom: 12px;
}

.project-chat-msg {
    margin-bottom: 14px;
}

.project-chat-msg:last-child {
    margin-bottom: 0;
}

.project-chat-bubble {
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 0.9rem;
    line-height: 1.45;
    word-break: break-word;
}

.project-chat-msg-user .project-chat-bubble {
    background: var(--accent-subtle);
    border: 1px solid var(--border-input);
}

.project-chat-msg-assistant .project-chat-bubble {
    background: var(--bg-sidebar, var(--bg-card));
    border: 1px solid var(--border-card);
}

.project-chat-time {
    display: block;
    font-size: 0.72rem;
    color: var(--text-tertiary);
    margin-top: 4px;
    margin-left: 4px;
}

.project-chat-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.project-chat-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-input);
    background: var(--bg-app);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    min-height: 52px;
}

.project-chat-input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

.project-insights-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

@media (max-width: 900px) {
    .project-insights-columns {
        grid-template-columns: 1fr;
    }
}

.project-data-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.project-data-row {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-card);
}

@media (max-width: 640px) {
    .project-data-row {
        grid-template-columns: 1fr;
    }
}

.project-data-row:last-child {
    border-bottom: none;
}

.project-data-date {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
}

.project-data-title {
    display: block;
    font-weight: 500;
    margin-bottom: 4px;
}

.project-data-meta {
    font-size: 0.78rem;
    color: var(--text-tertiary);
}

.project-data-desc {
    margin: 6px 0 4px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.project-data-source {
    display: block;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 4px;
}

.project-verant-list {
    margin: 8px 0 0;
    padding-left: 1.1rem;
    font-size: 0.88rem;
    line-height: 1.5;
}

.project-verant-list li {
    margin-bottom: 10px;
}

.project-people-lead {
    margin: 0 0 14px;
    font-size: 0.85rem;
    color: var(--text-tertiary);
    line-height: 1.45;
}

.project-todo-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.project-todo-row {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-card);
}

.project-todo-row:last-child {
    border-bottom: none;
}

.project-todo-prio {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-tertiary);
    padding-top: 4px;
}

.project-todo-prio-hoch .project-todo-prio {
    color: #f87171;
}

.project-todo-task {
    margin: 0 0 4px;
    font-size: 0.9rem;
}

.project-card-risks {
    border-color: rgba(248, 113, 113, 0.35);
}

.project-risk-list {
    margin: 0;
    padding-left: 1.1rem;
    font-size: 0.88rem;
}

.project-risk-list li {
    margin-bottom: 14px;
}

/* Sidebar */
.project-dashboard-sidebar {
    position: sticky;
    top: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: calc(100vh - 32px);
    min-width: 0;
}

.project-sidebar-docs {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 0 1 42vh;
}

.project-doc-scroll {
    overflow-y: auto;
    padding-right: 4px;
    border: 1px solid var(--border-card);
    border-radius: 10px;
    background: var(--bg-card);
    flex: 1 1 auto;
    min-height: 120px;
    max-height: 36vh;
}

.project-sidebar-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 10px;
}

.project-sidebar-sub {
    margin: 10px 12px 6px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
}

.project-doc-sidebar-ul {
    list-style: none;
    margin: 0;
    padding: 4px 6px 12px;
}

.project-doc-pick {
    width: 100%;
    text-align: left;
    padding: 10px 10px;
    margin-bottom: 6px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: var(--bg-app);
    color: var(--text-primary);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.82rem;
    transition: background 0.12s, border-color 0.12s;
}

.project-doc-pick:hover {
    background: var(--bg-sidebar-hover);
    border-color: var(--border-input);
}

.project-doc-pick.is-active {
    border-color: var(--accent);
    background: var(--accent-subtle);
}

.project-doc-pick-name {
    display: block;
    font-weight: 500;
    word-break: break-word;
}

.project-doc-pick-meta {
    font-size: 0.72rem;
    color: var(--text-tertiary);
}

.project-sidebar-preview {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 200px;
}

.project-pdf-frame-wrap {
    flex: 1 1 auto;
    min-height: 320px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-card);
    background: #111;
    display: flex;
    flex-direction: column;
}

.project-pdf-toolbar {
    flex-shrink: 0;
    display: flex;
    gap: 8px;
    padding: 8px 10px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-card);
}

.project-pdf-tool-btn {
    font-family: inherit;
    font-size: 0.78rem;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-input);
    background: var(--bg-app);
    color: var(--text-primary);
    cursor: pointer;
}

.project-pdf-tool-btn:hover {
    background: var(--bg-sidebar-hover);
    border-color: var(--accent);
    color: var(--accent-text);
}

.project-pdf-frame-inner {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.project-pdf-iframe {
    width: 100%;
    flex: 1 1 auto;
    height: min(55vh, 520px);
    min-height: 280px;
    border: none;
    display: block;
}

.project-pdf-frame-wrap:fullscreen {
    border-radius: 0;
    min-height: 100%;
    background: #0a0a0c;
}

.project-pdf-frame-wrap:fullscreen .project-pdf-frame-inner {
    flex: 1;
    min-height: 0;
}

.project-pdf-frame-wrap:fullscreen .project-pdf-iframe {
    height: 100%;
    min-height: 0;
    flex: 1;
}

.project-pdf-placeholder {
    padding: 2rem;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 0.9rem;
}

.project-preview-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.project-preview-actions .sidebar-btn {
    flex: 1 1 auto;
    text-align: center;
    text-decoration: none;
    font-size: 0.82rem;
    padding: 8px 12px;
}

@media (max-width: 1100px) {
    .project-dashboard-grid {
        grid-template-columns: 1fr;
    }

    .project-dashboard-sidebar {
        position: static;
        max-height: none;
    }

    .project-sidebar-docs {
        flex: none;
        max-height: none;
    }

    .project-doc-scroll {
        max-height: 240px;
    }

    .project-pdf-iframe {
        height: 65vh;
    }
}

/* ============================================
   SPHERECAST – Globale Inputs, Scroll, Modals
   ============================================ */

html::-webkit-scrollbar {
    width: 4px;
}
html::-webkit-scrollbar-track {
    background: transparent;
}
html::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 999px;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="hidden"]),
textarea,
select {
    font-family: var(--font-body), sans-serif;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-primary);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-shadow: none;
}

input::placeholder,
textarea::placeholder {
    color: var(--text-tertiary);
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent-border);
    box-shadow: 0 0 0 2px var(--accent-subtle);
}

.verant-frist--critical {
    color: var(--danger);
    font-weight: 700;
}

.verant-frist--soon {
    color: var(--warning);
}

html body .admin-modal-overlay {
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: none;
}

html body .admin-modal {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: none;
}

html body .admin-modal h2 {
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
    margin-bottom: 12px;
    font-family: var(--font-heading), sans-serif;
}

/* ── Vera Nachrichten (Glocke + Popover in Topbar) ─────────────────────── */
.vera-feed-wrap {
    position: relative;
    flex-shrink: 0;
}

.vera-feed-bell {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    font-family: inherit;
}

.vera-feed-bell:hover {
    color: var(--text-primary);
    background: var(--bg-subtle, rgba(255, 255, 255, 0.06));
}

.vera-feed-bell__icon {
    display: block;
    flex-shrink: 0;
}

.vera-feed-popover {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 200;
    width: min(380px, calc(100vw - 24px));
    max-height: min(70vh, 520px);
    overflow: hidden;
    box-sizing: border-box;
    padding: 0 12px 12px;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    pointer-events: auto;
}

/* Sicher schließen: display:flex darf [hidden] nicht „sichtbar“ lassen */
.vera-feed-popover[hidden] {
    display: none !important;
    pointer-events: none !important;
}

[data-theme="light"] .vera-feed-popover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}

.vera-feed-popover__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 0;
    margin: 0 0 4px;
    position: sticky;
    top: 0;
    background: var(--bg-raised);
    border-bottom: 1px solid var(--border);
    z-index: 1;
}

.vera-feed-popover__title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    min-width: 0;
    flex: 1;
}

.vera-feed-popover__head-right {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.vera-feed-popover__nav {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--accent, #2e6da4);
    text-decoration: none;
    white-space: nowrap;
    padding: 6px 8px;
    border-radius: 6px;
    font-family: inherit;
}

.vera-feed-popover__nav:hover {
    text-decoration: underline;
    background: var(--bg-subtle, rgba(255, 255, 255, 0.06));
}

.vera-feed-popover__close {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-tertiary);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    font-family: inherit;
}

.vera-feed-popover__close:hover {
    color: var(--text-primary);
    background: var(--bg-subtle, rgba(255, 255, 255, 0.06));
}

.vera-feed-popover__toolbar {
    display: flex;
    justify-content: flex-end;
    padding: 8px 0 0;
}

.vera-feed-popover__allread {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.78rem;
    cursor: pointer;
    color: var(--text-secondary);
    font-family: inherit;
}

.vera-feed-popover__allread:hover {
    border-color: var(--accent, #2e6da4);
    color: var(--text-primary);
}

.vf-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #e24b4a;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    position: absolute;
    top: 3px;
    right: 3px;
    box-sizing: border-box;
    border: 2px solid var(--bg-raised, var(--bg-base));
    pointer-events: none;
}

.vf-badge[data-count="0"] {
    display: none;
}

.vera-feed-strip__capacity,
.vera-feed-capacity {
    margin: 0 0 10px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.55;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--bg-subtle, rgba(255, 255, 255, 0.04));
    border: 1px solid var(--border);
}

.vera-feed-popover__body .vera-feed-capacity {
    flex-shrink: 0;
}

/* ── Feed Popover Body (scroll, inkl. Kapazitätstext) ── */
.vera-feed-popover__body {
    padding: 8px 0 0;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    margin: 0 -12px -12px;
    padding-left: 12px;
    padding-right: 12px;
    padding-bottom: 8px;
}

/* Gruppenheader */
.vf-group-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #9a9a9a;
    padding: 10px 14px 4px;
}

.vf-group--system .vf-group-label {
    color: #8a8a8a;
    opacity: 0.9;
}

.vf-group--system .vf-item {
    opacity: 0.94;
}

/* Eintrag */
.vf-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 0.5px solid #ebebeb;
    transition: background 0.15s;
    position: relative;
}

[data-theme="dark"] .vf-item {
    border-bottom-color: var(--border);
}

.vf-item:hover {
    background: #fafafa;
}

[data-theme="dark"] .vf-item:hover {
    background: var(--bg-subtle, rgba(255, 255, 255, 0.06));
}

.vf-item:last-child {
    border-bottom: none;
}

/* Typ-Farben + Hintergrund */
.vf-item--warning {
    border-left: 3px solid #e8a020;
    background: #fdf3e3;
}

.vf-item--ai {
    border-left: 3px solid #2e6da4;
    background: #eef3f9;
}

.vf-item--job {
    border-left: 3px solid #5a9e2f;
    background: #eaf3de;
}

.vf-item--info {
    border-left: 3px solid #ccc;
    background: #f4f4f4;
}

[data-theme="dark"] .vf-item--warning {
    background: rgba(232, 160, 32, 0.12);
}

[data-theme="dark"] .vf-item--ai {
    background: rgba(46, 109, 164, 0.14);
}

[data-theme="dark"] .vf-item--job {
    background: rgba(90, 158, 47, 0.12);
}

[data-theme="dark"] .vf-item--info {
    background: rgba(255, 255, 255, 0.05);
}

/* Icon */
.vf-item__icon {
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 1px;
    width: 18px;
    text-align: center;
    line-height: 1.2;
}

.vf-item--warning .vf-item__icon {
    color: #854f0b;
}

.vf-item--ai .vf-item__icon {
    color: #1a3a5c;
}

.vf-item--job .vf-item__icon {
    color: #3b6d11;
}

.vf-item--info .vf-item__icon {
    color: #888;
}

/* Text */
.vf-item__body {
    flex: 1;
    min-width: 0;
}

.vf-item__headline {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    color: #1a1a1a;
    margin: 0 0 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.vf-item__sub {
    font-size: 12px;
    font-weight: 400;
    line-height: 1.4;
    color: #555;
    margin: 0 0 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

[data-theme="dark"] .vf-item__headline {
    color: var(--text-primary);
}

[data-theme="dark"] .vf-item__sub {
    color: var(--text-secondary);
}

.vf-item__dismiss {
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 2px;
    width: 26px;
    height: 26px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-tertiary, #9a9a9a);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    font-family: inherit;
}

.vf-item__dismiss:hover {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .vf-item__dismiss:hover {
    background: rgba(255, 255, 255, 0.08);
}

.vf-item__meta {
    font-size: 11px;
    color: #9a9a9a;
}

.vf-item__meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
}

/* Ungelesen-Punkt */
.vf-item__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #2e6da4;
    flex-shrink: 0;
    margin-top: 5px;
    opacity: 0;
}

.vf-item[data-unread="true"] .vf-item__dot {
    opacity: 1;
}

/* Leerzustand */
.vf-empty {
    text-align: center;
    padding: 32px 16px;
    color: #aaa;
    font-size: 13px;
}

[data-theme="dark"] .vf-empty {
    color: var(--text-tertiary);
}

/* Details-Link + Aktion */
.vf-item__link {
    font-size: 12px;
    color: #2e6da4;
    text-decoration: none;
    display: inline-block;
    margin-top: 0;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
}

.vf-item__link:hover {
    text-decoration: underline;
}

[data-theme="dark"] .vf-item__link {
    color: var(--accent, #5a9fd4);
}

