/* RUESS Hub 3.1.0 - Menue-Aufbau (Marvin 13.11.): ZWEI Ebenen, EIN Scrollbereich, einheitliche Gestaltung. Laedt nach allen Menue-Dateien,
   vor ruess-design-system.css. Nur Tokens des Design-Systems (--ds-*). Steuerung: public/menue.js.
   Ebene 1 = Bereich (Symbol + Name + Pfeil, immer nur einer offen). Ebene 2 = Seite (gleiche Hoehe, gleicher Einzug, KEIN eigenes Symbol).
   Fruehere Gruppen (Vertrieb, Kommissionierung, Inventar ...) = kleine Zwischenueberschrift, nicht mehr aufklappbar. */

/* --- Ein Scrollbereich: Liste fuellt die Hoehe, unten nur Dunkelmodus + Logout --- */
.app-sidebar .sidebar-nav .sidebar-nav-head #navToggleAll { display: none !important; } /* "alles auf/zu" passt nicht zu "ein Bereich offen" */
.app-sidebar .sidebar-footer-nav > .sidebar-nav-divider { display: none; }
.app-sidebar .sidebar-footer-nav { gap: 2px; }

/* --- Ebene 2: alle Seiten gleich (Unterpunkte, Uebersicht, Tickets, Analyse, Wissensbank, Admin-Punkte, Fuhrpark) --- */
.app-sidebar .sidebar-nav :is(.sidebar-subnav > button, #startNav, #ticketsNav, #analyticsNav, #knowledgeNav, #ablaeufeLeitungNav, #usersNav, #ideasNav, #itKostenNav):not(.bereich-einzeln),
.app-sidebar .sidebar-nav #fleetSubnav > button {
  min-height: 36px !important; height: auto; margin: 0 !important; padding: 7px 26px 7px 34px !important;
  border-radius: var(--ds-radius-md) !important; font-size: var(--ds-font-sm) !important; font-weight: 600 !important; line-height: 1.3;
  white-space: normal !important; overflow: visible !important; text-overflow: clip !important; overflow-wrap: anywhere; text-align: left;
  color: var(--ds-text) !important; background: transparent !important; box-shadow: none !important;
}
.app-sidebar .sidebar-nav :is(.sidebar-subnav > button, #startNav, #ticketsNav, #analyticsNav, #knowledgeNav, #ablaeufeLeitungNav, #usersNav, #ideasNav, #itKostenNav):not(.bereich-einzeln)::before,
.app-sidebar .sidebar-nav #fleetSubnav > button::before { display: none !important; }
.app-sidebar .sidebar-nav :is(.sidebar-subnav > button, #startNav, #ticketsNav, #analyticsNav, #knowledgeNav, #ablaeufeLeitungNav, #usersNav, #ideasNav, #itKostenNav):not(.bereich-einzeln) > span:first-child { overflow: visible; text-overflow: clip; white-space: normal; }
.app-sidebar .sidebar-nav :is(.sidebar-subnav > button, #startNav, #ticketsNav, #analyticsNav, #knowledgeNav, #ablaeufeLeitungNav, #usersNav, #ideasNav, #itKostenNav):not(.bereich-einzeln):hover { background: var(--ds-surface-hover) !important; }
/* aktiv = nur der Punkt der offenen Seite (menue.js setzt nav-aktuell); ein von app.js stehengelassenes "active" sieht aus wie normal */
.app-sidebar .sidebar-nav :is(.sidebar-subnav > button, #startNav, #ticketsNav, #analyticsNav, #knowledgeNav, #ablaeufeLeitungNav, #usersNav, #ideasNav, #itKostenNav).active:not(.nav-aktuell):not(.bereich-einzeln),
.app-sidebar .sidebar-nav #fleetSubnav > button.active:not(.nav-aktuell) {
  background: transparent !important; box-shadow: none !important; font-weight: 600 !important; color: var(--ds-text) !important;
}
.app-sidebar .sidebar-nav :is(.sidebar-subnav > button, #startNav, #ticketsNav, #analyticsNav, #knowledgeNav, #ablaeufeLeitungNav, #usersNav, #ideasNav, #itKostenNav).nav-aktuell:not(.bereich-einzeln),
.app-sidebar .sidebar-nav #fleetSubnav > button.nav-aktuell {
  background: var(--ds-brand-soft) !important; color: var(--ds-ink) !important; box-shadow: inset 3px 0 0 var(--ds-brand) !important; font-weight: 700 !important;
}
.app-sidebar .sidebar-nav :is(.sidebar-subnav > button, #startNav, #ticketsNav, #analyticsNav, #knowledgeNav, #ablaeufeLeitungNav, #usersNav, #ideasNav, #itKostenNav)::after { display: none !important; } /* kein Extra-Punkt, der Balken links zeigt "aktiv" */
.app-sidebar .sidebar-nav #ticketsNav .sidebar-nav-chevron { display: none !important; }

/* --- Gruppen: Unterpunkte stehen direkt im offenen Bereich (kein Einzug, keine Linie), Gruppenkopf = Zwischenueberschrift --- */
.app-sidebar .sidebar-nav .sidebar-nav-group:not(.bereich-zu) > .sidebar-subnav,
.app-sidebar .sidebar-nav .sidebar-nav-group:not(.bereich-zu) > .sidebar-subnav.hidden {
  display: flex !important; flex-direction: column; gap: 1px; margin: 0 !important; padding: 0 !important; border: 0 !important; opacity: 1 !important; transform: none !important;
}
.app-sidebar .sidebar-nav #ticketsNavGroup > #ticketsSubnav { display: none !important; }
.app-sidebar .sidebar-nav .sidebar-nav-group:has(> .sidebar-subnav > button:not(.hidden):not(.right-hidden)) > .sidebar-nav-parent:not(#fleetNav) {
  pointer-events: none; min-height: 0 !important; margin: 6px 0 1px !important; padding: 4px 12px 2px 34px !important;
  background: transparent !important; box-shadow: none !important; color: var(--ds-muted) !important;
  font-size: 10.5px !important; font-weight: 800 !important; letter-spacing: .08em; text-transform: uppercase;
}
.app-sidebar .sidebar-nav .sidebar-nav-group:has(> .sidebar-subnav > button:not(.hidden):not(.right-hidden)) > .sidebar-nav-parent:not(#fleetNav)::before,
.app-sidebar .sidebar-nav .sidebar-nav-group:has(> .sidebar-subnav > button:not(.hidden):not(.right-hidden)) > .sidebar-nav-parent:not(#fleetNav)::after,
.app-sidebar .sidebar-nav .sidebar-nav-group:has(> .sidebar-subnav > button:not(.hidden):not(.right-hidden)) > .sidebar-nav-parent .sidebar-nav-chevron { display: none !important; }
.app-sidebar .sidebar-nav .sidebar-nav-group:has(> .sidebar-subnav > button:not(.hidden):not(.right-hidden)) > .sidebar-nav-parent > span:first-child { overflow: visible !important; white-space: normal !important; }
/* erste Zwischenueberschrift direkt unter dem Bereich: weniger Abstand */
.app-sidebar .sidebar-nav .sidebar-bereich-titel + .sidebar-nav-group > .sidebar-nav-parent { margin-top: 2px !important; }

/* --- Bereich mit genau einem Punkt (Recruiting -> Bewerbungen): Punkt sieht aus wie ein Bereich, mit eigenem Symbol --- */
.app-sidebar .sidebar-nav .sidebar-module-nav > button.bereich-einzeln {
  min-height: 40px !important; margin: 2px 0 0 !important; padding: 8px 34px 8px 40px !important; border-radius: var(--ds-radius-md) !important;
  font-size: var(--ds-font-md) !important; font-weight: 700 !important; color: var(--ds-text) !important; background: transparent !important; box-shadow: none !important;
}
.app-sidebar .sidebar-nav .sidebar-module-nav > button.bereich-einzeln:hover { background: var(--ds-surface-hover) !important; }
.app-sidebar .sidebar-nav .sidebar-module-nav > button.bereich-einzeln.active { background: var(--ds-brand-soft) !important; box-shadow: inset 3px 0 0 var(--ds-brand) !important; }
.app-sidebar .sidebar-nav .sidebar-module-nav > button.bereich-einzeln::before {
  display: block !important; left: 12px; width: 18px; height: 18px; border-radius: 0; background: transparent center/18px 18px no-repeat;
}
.app-sidebar .sidebar-nav #bewerbungenNav.bereich-einzeln::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23323a3b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16'/%3E%3Crect width='20' height='14' x='2' y='6' rx='2'/%3E%3C/svg%3E");
}
.app-sidebar .sidebar-nav #usersNav.bereich-einzeln::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23323a3b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z'/%3E%3Cpath d='m9 12 2 2 4-4'/%3E%3C/svg%3E");
}

/* --- Favoriten: Stern an JEDEM Menuepunkt beim Darueberfahren; leer = nur eine kurze Zeile --- */
.app-sidebar .sidebar-module-nav button:hover > .nav-stern { opacity: 1; }
.app-sidebar .sidebar-favoriten.leer { margin: 0 0 4px !important; padding: 0 0 4px !important; }
.app-sidebar .sidebar-favoriten.leer .sidebar-favoriten-hinweis { margin: 2px 12px 2px; font-size: var(--ds-font-xs); color: var(--ds-muted); }

/* --- Namen nicht abschneiden: Profilname darf zweizeilig werden --- */
.app-sidebar .sidebar-profile-copy strong { white-space: normal !important; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.25; }

/* --- Schnellsuche (public/schnellsuche.js): Feld oben im Menue + Fenster --- */
.app-sidebar .sidebar-nav .sidebar-nav-head { gap: 8px; }
.app-sidebar .sidebar-nav button.sidebar-suche {
  display: flex !important; align-items: center; gap: 8px; width: auto !important; flex: 1 1 auto; min-height: 34px !important; margin: 0 !important; padding: 0 10px !important;
  border: 1px solid var(--ds-line-strong) !important; border-radius: var(--ds-radius-md) !important; background: var(--ds-surface) !important; box-shadow: none !important;
  color: var(--ds-muted) !important; font-size: var(--ds-font-sm) !important; font-weight: 500 !important; text-align: left; cursor: text;
}
.app-sidebar .sidebar-nav button.sidebar-suche::before, .app-sidebar .sidebar-nav button.sidebar-suche::after { display: none !important; }
.app-sidebar .sidebar-nav button.sidebar-suche:hover { border-color: var(--ds-focus) !important; }
.sidebar-suche kbd, .ruess-suche kbd { margin-left: auto; padding: 1px 6px; border: 1px solid var(--ds-line-strong); border-radius: var(--ds-radius-sm); background: var(--ds-surface-2); color: var(--ds-muted); font: 600 11px/1.4 inherit; }
.ruess-suche-overlay { position: fixed; inset: 0; z-index: var(--z-modal-nested, 10020); display: flex; align-items: flex-start; justify-content: center; padding: 12vh 16px 16px; background: var(--ds-backdrop); }
.ruess-suche { width: min(560px, 100%); max-height: 70vh; display: flex; flex-direction: column; overflow: hidden; border-radius: var(--ds-radius-xl); background: var(--ds-surface); box-shadow: var(--ds-shadow-3); }
.ruess-suche-kopf { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--ds-line); }
.ruess-suche-kopf svg { width: 18px; height: 18px; flex: 0 0 18px; color: var(--ds-muted); }
.ruess-suche-kopf input { flex: 1 1 auto; min-width: 0; height: 36px !important; margin: 0 !important; border: 0 !important; box-shadow: none !important; padding: 0 !important; font-size: var(--ds-font-lg); background: transparent; }
.ruess-suche-liste { list-style: none; margin: 0; padding: 6px; overflow-y: auto; }
.ruess-suche-liste li { display: flex; align-items: baseline; gap: 10px; padding: 9px 12px; border-radius: var(--ds-radius-md); cursor: pointer; color: var(--ds-text); }
.ruess-suche-liste li strong { font-weight: 700; font-size: var(--ds-font-md); }
.ruess-suche-liste li span { margin-left: auto; font-size: var(--ds-font-xs); color: var(--ds-muted); text-align: right; }
.ruess-suche-liste li[aria-selected="true"] { background: var(--ds-brand-soft); box-shadow: inset 3px 0 0 var(--ds-brand); }
.ruess-suche-leer { padding: 18px; text-align: center; color: var(--ds-muted); font-size: var(--ds-font-sm); }
.ruess-suche-fuss { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--ds-line); color: var(--ds-muted); font-size: var(--ds-font-xs); }

/* --- Startseite (public/start.js) --- */
#startView .start-kopf { margin: 0 0 var(--ds-space-4); }
#startView .start-kopf h2 { margin: 0; font-size: var(--ds-font-xl); color: var(--ds-ink); }
#startView .start-kopf p { margin: 4px 0 0; color: var(--ds-muted); font-size: var(--ds-font-sm); }
#startView .start-kacheln { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--ds-space-3); margin-bottom: var(--ds-space-6); }
#startView .start-kachel {
  display: flex !important; flex-direction: column; align-items: flex-start; gap: 4px; width: auto !important; min-height: 96px; margin: 0 !important; padding: var(--ds-space-4) !important;
  border: 1px solid var(--ds-line) !important; border-radius: var(--ds-radius-lg) !important; background: var(--ds-surface) !important; color: var(--ds-text) !important;
  box-shadow: var(--ds-shadow-1) !important; text-align: left; font-weight: 600 !important;
}
#startView .start-kachel:hover { border-color: var(--ds-line-strong) !important; box-shadow: var(--ds-shadow-2) !important; }
#startView .start-kachel strong { font-size: 28px; line-height: 1.1; color: var(--ds-ink); font-variant-numeric: tabular-nums; }
#startView .start-kachel span { font-size: var(--ds-font-sm); color: var(--ds-muted); font-weight: 600; }
#startView .start-kachel.dringend strong { color: var(--ds-danger); }
#startView .start-kachel.laedt strong { color: var(--ds-muted); }
#startView h3 { margin: 0 0 var(--ds-space-2); font-size: var(--ds-font-md); color: var(--ds-ink); }
#startView .start-liste { display: flex; flex-wrap: wrap; gap: var(--ds-space-2); margin: 0 0 var(--ds-space-6); padding: 0; list-style: none; }
#startView .start-liste button {
  display: inline-flex !important; align-items: center; gap: 8px; width: auto !important; min-height: 38px !important; margin: 0 !important; padding: 0 14px !important;
  border: 1px solid var(--ds-line-strong) !important; border-radius: var(--ds-radius-md) !important; background: var(--ds-surface) !important; color: var(--ds-text) !important; font-weight: 600 !important; box-shadow: none !important;
}
#startView .start-liste button small { color: var(--ds-muted); font-weight: 500; }
#startView .start-liste button:hover { background: var(--ds-surface-hover) !important; }
#startView .start-leer { margin: 0 0 var(--ds-space-6); color: var(--ds-muted); font-size: var(--ds-font-sm); }
@media (hover: none) { .app-sidebar .sidebar-nav button.sidebar-suche kbd, .start-kopf .start-tipp { display: none; } } /* Touch-Geraete haben kein Strg+K */

/* 3.3.0 (17.11.): Datensuche in Strg+K – Gruppen (Seiten, Bestellungen, Lieferscheine, …), Daten-Treffer zweizeilig, Fenster breiter */
.ruess-suche { width: min(720px, 100%); }
.ruess-suche-liste .ruess-suche-gruppe { cursor: default; padding: 12px 12px 4px; font: 600 11.5px/1.2 var(--lp-mono, ui-monospace, monospace); letter-spacing: .05em; text-transform: uppercase; color: var(--ds-muted); background: none !important; box-shadow: none !important; }
.ruess-suche-liste .ruess-suche-daten { flex-direction: column; align-items: flex-start; gap: 2px; }
.ruess-suche-liste .ruess-suche-daten strong { font-weight: 600; }
.ruess-suche-liste .ruess-suche-daten span { margin-left: 0; text-align: left; }
.ruess-suche-liste .ruess-suche-hinweis { cursor: default; justify-content: center; padding: 10px 12px; font-size: var(--ds-font-sm); color: var(--ds-muted); background: none !important; box-shadow: none !important; }
