/* Spacious white navigation with restrained blue accents for actions and orientation. */
:root { --sidebar-width: 320px; }

aside#sidebar {
    --side-bg: #ffffff;
    --side-surface: #ffffff;
    --side-hover: #f2f5f8;
    --side-selected: #edf4ff;
    --side-accent: #1d6bf3;
    --side-active-ink: #1859cf;
    --side-accent-line: #cfe0ff;
    --side-focus: #dfebff;
    --side-ink: #303036;
    --side-muted: #6b6b75;
    --side-line: #e5e9ee;
    --side-button: #1d6bf3;
    --side-button-hover: #1859cf;
    --side-button-ink: #ffffff;
    background: var(--side-bg);
    color: var(--side-ink);
    border-right: 1px solid var(--side-line);
    padding: 22px 18px 14px;
    height: 100vh;
    height: 100dvh;
    font-size: 15px;
}

#sidebar[data-theme="dark"] {
    --side-bg: var(--bg-body, #111827);
    --side-surface: #2b2b30;
    --side-hover: #232f43;
    --side-selected: #192e50;
    --side-accent: #9cc2ff;
    --side-active-ink: #9cc2ff;
    --side-accent-line: #355580;
    --side-focus: #263f64;
    --side-ink: #ededf0;
    --side-muted: #aaaab3;
    --side-line: #3d3d44;
    --side-button: #1d6bf3;
    --side-button-hover: #1859cf;
    --side-button-ink: #ffffff;
}

#sidebar [hidden] { display: none !important; }
#sidebar button, #sidebar input { font-family: inherit; }
#sidebar button, #sidebar a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
#sidebar button:focus-visible, #sidebar a:focus-visible {
    outline: 2px solid var(--side-accent);
    outline-offset: 2px;
}
#sidebar .brand { flex: none; margin: 0 3px 24px; padding: 0; min-height: 38px; }
#sidebar .brand-pill {
    gap: 11px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    box-shadow: none;
    transform: none;
    font-size: 21px;
    letter-spacing: -.6px;
}
#sidebar .brand-logo-img { width: 34px; height: 34px; }
#sidebar .brand-text-main { color: var(--side-ink); }
#sidebar .brand-text-accent { color: var(--side-accent); }
#sidebar[data-theme="dark"] .brand-logo-img { filter: brightness(1.35); }
#sidebar .sidebar-close { display: none; width: 44px; height: 44px; color: var(--side-muted); }
#sidebar .sidebar-top { flex: none; padding-bottom: 20px; }
#sidebar .nav-item {
    min-height: 48px;
    padding: 11px 13px;
    gap: 9px;
    border: 1px solid transparent;
    border-radius: 11px;
    background: transparent;
    color: var(--side-ink);
    font-size: 15px;
    font-weight: 500;
    line-height: 1.5;
    box-shadow: none;
    transition: background .15s, color .15s;
}
#sidebar .nav-item-left { gap: 13px; }
#sidebar .nav-item i, #sidebar .nav-section-title-row i, #sidebar .sidebar-footer-btn i {
    width: 21px;
    flex: 0 0 21px;
    font-size: 17px;
    text-align: center;
    color: var(--side-muted);
}
#sidebar .nav-item:hover, #sidebar .nav-item.nav-hit { background: var(--side-hover); }
#sidebar .nav-item.active {
    color: var(--side-active-ink);
    background: var(--side-selected);
    font-weight: 600;
    border-color: var(--side-accent-line);
}
#sidebar .nav-item.active::before { display: none; }
#sidebar .nav-item:hover i, #sidebar .nav-item.active i { color: var(--side-accent); }
#sidebar .nav-item strong { font-weight: 500; }
#sidebar .nav-item.new-chat {
    width: 100%;
    min-height: 50px;
    margin: 0 0 12px;
    padding: 12px 14px;
    background: var(--side-button);
    border-color: var(--side-button);
    color: var(--side-button-ink);
    box-shadow: 0 1px 2px #0000000a;
    font-weight: 550;
    text-align: left;
    transform: none;
}
#sidebar .nav-item.new-chat i { color: var(--side-button-ink); }
#sidebar .new-chat > i { opacity: .65; font-size: 16px; }
#sidebar .nav-item.new-chat:hover { background: var(--side-button-hover); border-color: var(--side-button-hover); }
#sidebar .search-box { margin: 0; }
#sidebar .search-box > i { left: 14px; color: var(--side-muted); font-size: 14px; }
#sidebar .search-box input {
    min-height: 46px;
    padding: 12px 42px 12px 39px;
    border: 1px solid var(--side-line);
    border-radius: 11px;
    background: transparent;
    box-shadow: none;
    color: var(--side-ink);
    font-size: 13px;
}
#sidebar .search-box input::placeholder { color: var(--side-muted); font-size: inherit; opacity: 1; }
#sidebar .search-box input:focus { background: var(--side-surface); border-color: var(--side-accent); box-shadow: 0 0 0 2px var(--side-focus); }
#sidebar .search-box:focus-within > i { color: var(--side-accent); }
#sidebar .search-box input::-webkit-search-cancel-button { -webkit-appearance: none; }
#sidebar .sidebar-search-clear {
    position: absolute;
    right: 4px;
    top: 5px;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--side-muted);
    cursor: pointer;
}
#sidebar .sidebar-search-clear i { position: static; transform: none; color: inherit; font-size: 12px; }
#sidebar .sidebar-search-clear:hover { background: var(--side-hover); }
#sidebar .sidebar-scroll {
    gap: 0;
    margin-right: -8px;
    padding-right: 8px;
    padding-bottom: 12px;
    scrollbar-width: thin;
    scrollbar-color: var(--side-line) transparent;
    scrollbar-gutter: stable;
}
#sidebar .sidebar-scroll::-webkit-scrollbar { width: 5px; }
#sidebar .sidebar-scroll::-webkit-scrollbar-thumb { border: 0; background: var(--side-line); }
#sidebar .primary-nav { display: flex; flex-direction: column; gap: 20px; margin: 0; }
#sidebar .nav-section { gap: 7px; }
#sidebar .nav-section ul { gap: 3px; }
#sidebar .sidebar-section-label, #sidebar .sidebar-history-heading .nav-section-title {
    padding: 0 12px;
    color: var(--side-muted);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .085em;
    line-height: 1.6;
    text-transform: uppercase;
}
#sidebar .sidebar-secondary { padding-top: 10px; border-top: 1px solid var(--side-line); }
#sidebar .nav-group, #sidebar .nav-group + .nav-group { margin: 0; gap: 0; }
#sidebar .nav-section-title-row {
    position: static;
    width: 100%;
    min-height: 48px;
    padding: 11px 13px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: var(--side-ink);
    font-size: 15px;
    font-weight: 500;
    text-align: left;
    line-height: 1.5;
}
#sidebar .nav-section-title-row:hover { background: var(--side-hover); }
#sidebar .nav-section-title-row:hover .nav-item-left > i,
#sidebar .nav-section-title-row[aria-expanded="true"] .nav-item-left > i { color: var(--side-accent); }
#sidebar .nav-section-title-row .section-caret { width: 14px; flex: 0 0 14px; font-size: 10px; color: var(--side-muted); }
#sidebar .nav-group > ul { margin: 3px 0 10px 23px; padding-left: 10px; border-left: 1px solid var(--side-line); }
#sidebar .nav-group > ul .nav-item { min-height: 44px; font-size: 14px; padding-inline: 9px; }
#sidebar .nav-group > ul .nav-item-left { gap: 10px; }
#sidebar .nav-group > ul .nav-item i { font-size: 15px; }
#sidebar .nav-item-left > span { white-space: normal; overflow-wrap: anywhere; }
#sidebar .nav-scroll { padding: 0; margin-top: 20px; }
#sidebar .sidebar-history-heading { min-height: 36px; padding: 6px 13px; }
#sidebar .sidebar-history-heading .nav-section-title { padding: 0; }
#sidebar .nav-section.collapsed > ul { display: none; }
#sidebar .history-item { min-height: 44px; font-size: 14px; gap: 12px; }
#sidebar .chat-dot { width: 5px; min-width: 5px; height: 5px; min-height: 5px; background: var(--side-muted); opacity: .5; }
#sidebar .chat-dot.current { background: var(--side-accent); opacity: 1; box-shadow: none; }
#sidebar .hw-chat-weg { min-width: 32px; min-height: 32px; color: var(--side-muted); border-radius: 7px; }
#sidebar .hw-chat-weg:hover { color: var(--side-ink); background: var(--side-line); }
#sidebar .hw-chat-leer { padding: 8px 13px; color: var(--side-muted); font-size: 13px; line-height: 1.6; }
#sidebar .nav-no-hits { margin: 13px; color: var(--side-muted); font-size: 14px; line-height: 1.6; }
#sidebar .sidebar-footer { gap: 8px; padding-top: 10px; border-color: var(--side-line); background: var(--side-bg); }
#sidebar .sidebar-footer-btn {
    justify-content: flex-start;
    gap: 13px;
    min-height: 44px;
    padding: 10px 13px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--side-muted);
    font-size: 14px;
    font-weight: 450;
    box-shadow: none;
    transform: none;
}
#sidebar .sidebar-footer-btn:hover { color: var(--side-ink); background: var(--side-hover); }
/* Der Eintrag "Plattform-Admin" ist ein Link (neuer Tab), sieht aber aus wie die Knoepfe daneben. */
#sidebar a.sidebar-footer-btn { text-decoration: none; }
#sidebar .sidebar-user-card {
    width: 100%;
    min-height: 68px;
    gap: 12px;
    padding: 11px;
    border: 1px solid var(--side-line);
    border-radius: 12px;
    background: var(--side-surface);
    color: var(--side-ink);
    text-align: left;
    box-shadow: 0 1px 2px #00000003;
    transform: none;
}
#sidebar .sidebar-user-card:hover { border-color: var(--side-accent-line); background: var(--side-surface); box-shadow: none; }
#sidebar .user-avatar {
    width: 40px;
    height: 40px;
    background: var(--side-selected);
    border-radius: 9px;
    color: var(--side-active-ink);
    box-shadow: none;
    font-size: 13px;
    font-weight: 600;
}
#sidebar .user-info { gap: 5px; }
#sidebar .user-name { color: var(--side-ink); font-family: inherit; font-size: 13px; font-weight: 600; }
#sidebar .user-role { gap: 7px; color: var(--side-muted); font-size: 11.5px; }
#sidebar .user-role > span { overflow: hidden; text-overflow: ellipsis; }
#sidebar .user-badge-pro { background: var(--side-hover); color: var(--side-muted); border-radius: 4px; padding: 3px 5px; box-shadow: none; font-size: 8.5px; font-weight: 600; letter-spacing: .04em; }
#sidebar .user-badge-pro:empty { display: none; }
#sidebar .user-card-chevron { flex: none; color: var(--side-muted); font-size: 9px; }

@media (max-width: 768px) {
    aside#sidebar { width: min(340px, calc(100vw - 24px)); padding-top: max(18px, env(safe-area-inset-top)); padding-bottom: max(14px, env(safe-area-inset-bottom)); }
    #sidebar .sidebar-close { display: flex; }
    #sidebar .brand { margin-bottom: 16px; }
    #sidebar .nav-item, #sidebar .nav-section-title-row, #sidebar .sidebar-footer-btn { min-height: 48px; }
    #sidebar .sidebar-history-heading { min-height: 36px; }
    #sidebar .search-box input { font-size: 16px; min-height: 46px; }
    #sidebar .search-box input::placeholder { font-size: 13px; }
    #sidebar .sidebar-search-clear { top: 5px; }
}
@media (pointer: coarse) {
    #sidebar .nav-item, #sidebar .nav-section-title-row { min-height: 48px; }
    #sidebar .hw-chat-weg { opacity: 1; min-width: 32px; min-height: 32px; }
}
@media (prefers-reduced-motion: reduce) {
    #sidebar, #sidebar * { transition: none !important; animation: none !important; }
}
