/*
 * VitaSuite Chrome — Marken-Band oben auf jeder Seite.
 * position:fixed macht den Header unabhängig vom body-Layout der Modul-Views
 * (Portal/Login haben flex-column-center, orga hat Browser-default-margin,
 * helpdesk hat eigene a:hover{underline}). Body bekommt padding-top, damit
 * Inhalte nicht verdeckt werden; text-decoration:none !important auf Links,
 * damit Modul-CSS den Hover-Zustand nicht unterkringelt.
 *
 * Zusätzlich: Design-Token-Defaults für die gesamte Seite (Sercon-Clean).
 * Aktives globales Theme bzw. modul-spezifisches theme-*.css überschreibt
 * --vs-primary und ggf. weitere Tokens.
 */
:root {
    --vs-bg:            #0f172a;
    --vs-surface:       #1e293b;
    --vs-surface-alt:   #334155;
    --vs-border:        rgba(255, 255, 255, 0.08);
    --vs-border-strong: rgba(255, 255, 255, 0.15);
    --vs-text:          #e2e8f0;
    --vs-text-muted:    #94a3b8;
    --vs-primary:       #6366f1;
    --vs-primary-hover: #4f46e5;
    --vs-on-primary:    #ffffff;
    --vs-success:       #22c55e;
    --vs-warning:       #f59e0b;
    --vs-danger:        #ef4444;
    --vs-info:          #3b82f6;
    --vs-font-sans:     system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --vs-font-mono:     "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, monospace;
    --vs-radius:        8px;
    --vs-radius-sm:     5px;
    --vs-radius-lg:     12px;
    --vs-shadow:        0 1px 2px rgba(0, 0, 0, 0.3);
    --vs-shadow-lg:     0 4px 12px rgba(0, 0, 0, 0.35);
    --vs-transition:    150ms;
}

.vs-suite-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 40px;
    z-index: 10000;
    background: #0b1220;
    color: #e2e8f0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 13px;
    line-height: 1;
    box-sizing: border-box;
}
.vs-suite-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 1rem;
    gap: 1rem;
    box-sizing: border-box;
}

.vs-suite-brand,
.vs-suite-link,
.vs-suite-logout {
    text-decoration: none !important;
}
.vs-suite-brand:hover,
.vs-suite-link:hover,
.vs-suite-logout:hover {
    text-decoration: none !important;
}

.vs-suite-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    min-width: 0;
}
.vs-suite-brand:hover { color: #f8fafc; }
.vs-suite-logo {
    font-weight: 300;
    letter-spacing: 0.04em;
    font-size: 15px;
    color: #f8fafc;
}
.vs-suite-logo strong { font-weight: 700; }
.vs-suite-sep { color: #475569; font-size: 16px; }
.vs-suite-mod-icon { font-size: 14px; }
.vs-suite-mod-label {
    color: #cbd5e1;
    font-weight: 500;
}

.vs-suite-right {
    display: inline-flex;
    align-items: center;
    gap: 0.9rem;
    white-space: nowrap;
}
.vs-suite-user {
    color: #94a3b8;
    font-size: 12px;
}

/* M8: Tenant-Switcher (Pill + Dropdown) */
.vs-suite-tenant-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.7rem;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    color: #f1f5f9;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    list-style: none;
    user-select: none;
    transition: background 0.15s, border-color 0.15s;
}
.vs-suite-tenant-pill::-webkit-details-marker { display: none; }
.vs-suite-tenant-pill:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}
.vs-suite-tenant-pill.is-static {
    cursor: default;
    background: transparent;
    border-color: rgba(255, 255, 255, 0.12);
}
.vs-suite-tenant-pill.is-static:hover {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.12);
}
.vs-suite-tenant-switcher {
    position: relative;
}
.vs-suite-tenant-switcher[open] .vs-suite-tenant-pill {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.35);
}
.vs-suite-tenant-menu {
    position: absolute;
    top: calc(100% + 0.4rem);
    right: 0;
    min-width: 220px;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 0.3rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    z-index: 100;
}
.vs-suite-tenant-item { margin: 0; padding: 0; }
.vs-suite-tenant-item button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.7rem;
    background: transparent;
    border: 0;
    border-radius: 5px;
    color: #f1f5f9;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: background 0.1s;
}
.vs-suite-tenant-item button:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
}
.vs-suite-tenant-item.is-active button {
    color: var(--vs-primary, #4ade80);
    cursor: default;
}
.vs-suite-tenant-item.is-active button:disabled { opacity: 1; }
.vs-suite-tenant-spacer { display: inline-block; width: 14px; }
.vs-suite-link {
    color: #cbd5e1;
    padding: 0.3rem 0.7rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 5px;
    font-size: 12px;
    transition: background 0.15s, border-color 0.15s;
}
.vs-suite-link:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.25);
    color: #f8fafc;
}
.vs-suite-logout {
    color: #fca5a5;
    padding: 0.3rem 0.7rem;
    border: 1px solid rgba(248, 113, 113, 0.3);
    border-radius: 5px;
    font-size: 12px;
    transition: background 0.15s, border-color 0.15s;
}
.vs-suite-logout:hover {
    background: rgba(248, 113, 113, 0.12);
    border-color: rgba(248, 113, 113, 0.5);
    color: #fecaca;
}

/* Platz für den fixed Header in jedem body, unabhängig vom Modul-CSS. */
body {
    padding-top: 40px !important;
    /* F43-9 (2026-05-22): overflow: visible erzwingen, damit body NIE Scrolling-
     * Container wird. Sonst bricht position:sticky-Resolution fuer nested
     * .vs-module-topbar > .vs-modtopbar (Spalt zwischen Suite-Header und Topbar).
     * Sicherheitsnetz fuer alle Module — sollte Modul-CSS body { overflow:* }
     * setzen, gewinnt diese Suite-Regel via !important. */
    overflow: visible !important;
}

/* Vertikale Scrollbar dauerhaft anzeigen, damit Seiten-Wechsel mit/ohne
   vertikalen Overflow keine horizontale Verschiebung erzeugen.
   `scrollbar-gutter: stable` als Bonus fuer Browser, die overflow:scroll
   mit Overlay-Scrollbars rendern. */
html {
    overflow-y: scroll;
    scrollbar-gutter: stable;
}

/* Light/Dark-Toggle (Sun/Moon). Sichtbares Icon hängt am html[data-vs-mode]. */
.vs-suite-theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.vs-suite-theme-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
    color: #ffffff;
}
.vs-suite-theme-toggle svg { display: none; }
/* Aktueller Modus = Icon, das den NÄCHSTEN Zustand andeutet:
   dark → klick → light  (Sun-Icon)
   light → klick → auto  (Monitor-Icon)
   auto → klick → dark   (Moon-Icon) */
html[data-vs-mode="dark"]  .vs-suite-theme-toggle .vs-suite-icon-sun  { display: block; }
html[data-vs-mode="light"] .vs-suite-theme-toggle .vs-suite-icon-auto { display: block; }
html[data-vs-mode="auto"]  .vs-suite-theme-toggle .vs-suite-icon-moon { display: block; }
/* Fallback (kein data-vs-mode gesetzt): Sun-Icon */
html:not([data-vs-mode]) .vs-suite-theme-toggle .vs-suite-icon-sun { display: block; }

/* Mobile-Schutz: kein horizontaler Scroll auf html/body — verhindert,
   dass ein einzelnes überbreites Kind-Element (alte Tabelle, Grid mit
   min-width, …) den ganzen Viewport sprengt und den Suite-Header rechts
   abschneidet. Tabellen, die wirklich scrollen sollen, machen das in
   ihrem eigenen Wrapper (.modern-table, .activity-list etc. haben
   display: block + overflow-x: auto unter @media in vs-components.css). */
@media (max-width: 768px) {
    html, body { overflow-x: hidden; max-width: 100vw; }
}

@media (max-width: 640px) {
    .vs-suite-header { height: 36px; }
    body { padding-top: 36px !important; }
    .vs-suite-header-inner { padding: 0 0.6rem; gap: 0.5rem; }
    .vs-suite-user { display: none; }
    .vs-suite-link,
    .vs-suite-logout { padding: 0.25rem 0.5rem; font-size: 11px; }
    .vs-suite-mod-label { font-size: 12px; }
    .vs-suite-theme-toggle { width: 24px; height: 24px; }
    /* Modul-TopBar muss bei 36 px Suite-Header auch sticky-bei-36 px sein,
       sonst klafft eine 4 px Lücke zwischen den beiden. */
    .vs-modtopbar { top: 36px; }
    /* Detached-Submenu-Position bei kleinerer Suite-Chrome-Höhe nachziehen. */
    .vs-modtopbar-submenu-detached { top: calc(36px + 48px + 6px); }
}

/* ============================================================
 * Profile-Dropdown (2026-05-27): Tenant-Switcher + E-Mail + Logout
 * konsolidiert in einem Avatar-Button rechts in der Suite-Leiste.
 * Tenant-Switcher-Logik bleibt funktional gleich (Form-POST mit CSRF).
 * ============================================================ */
.vs-suite-profile {
    position: relative;
}
.vs-suite-profile-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    color: #f1f5f9;
    cursor: pointer;
    list-style: none;
    transition: background 0.15s, border-color 0.15s;
}
.vs-suite-profile-btn::-webkit-details-marker { display: none; }
.vs-suite-profile-btn::marker { content: ''; }
.vs-suite-profile-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.35);
}
.vs-suite-profile[open] .vs-suite-profile-btn {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
}
.vs-suite-profile-menu {
    position: absolute;
    top: calc(100% + 0.4rem);
    right: 0;
    min-width: 240px;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 0.3rem;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
    z-index: 1000;
    font-size: 13px;
}
.vs-suite-profile-mail {
    padding: 0.55rem 0.7rem 0.4rem;
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 500;
    word-break: break-all;
    line-height: 1.3;
}
.vs-suite-profile-sep {
    height: 1px;
    margin: 0.3rem 0.2rem;
    background: rgba(255, 255, 255, 0.1);
}
.vs-suite-profile-tenant {
    padding: 0.2rem 0.2rem 0.2rem;
}
.vs-suite-profile-tenant-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.5rem 0.2rem;
    color: #94a3b8;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.vs-suite-profile-tenant-static {
    padding: 0.3rem 0.55rem 0.4rem;
    color: #f1f5f9;
    font-size: 13px;
}
.vs-suite-profile-tenant-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.vs-suite-profile-tenant-item { margin: 0; padding: 0; }
.vs-suite-profile-tenant-item button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.45rem 0.55rem;
    background: transparent;
    border: 0;
    border-radius: 5px;
    color: #f1f5f9;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: background 0.1s;
}
.vs-suite-profile-tenant-item button:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
}
.vs-suite-profile-tenant-item.is-active button {
    color: var(--vs-primary, #4ade80);
    cursor: default;
}
.vs-suite-profile-tenant-item.is-active button:disabled { opacity: 1; }
.vs-suite-profile-tenant-spacer { display: inline-block; width: 12px; }

.vs-suite-profile-link {
    display: flex !important;
    align-items: center;
    gap: 0.55rem;
    padding: 0.5rem 0.55rem;
    color: #f1f5f9 !important;
    border-radius: 5px;
    text-decoration: none !important;
    font-size: 13px;
    transition: background 0.1s;
}
.vs-suite-profile-link:hover {
    background: rgba(255, 255, 255, 0.08);
}
.vs-suite-profile-link-danger {
    color: #fca5a5 !important;
}
.vs-suite-profile-link-danger:hover {
    background: rgba(239, 68, 68, 0.12);
}
.vs-suite-profile-version {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.7rem 0.45rem;
    color: #64748b;
    font-size: 11px;
}


/* Tenant-Section: nested <details> Toggle (2026-05-27) */
.vs-suite-profile-tenant-toggle {
    margin: 0.15rem 0;
}
.vs-suite-profile-tenant-summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.55rem;
    border-radius: 5px;
    color: #f1f5f9;
    font-size: 13px;
    cursor: pointer;
    list-style: none;
    transition: background 0.1s;
}
.vs-suite-profile-tenant-summary::-webkit-details-marker { display: none; }
.vs-suite-profile-tenant-summary::marker { content: ''; }
.vs-suite-profile-tenant-summary:hover {
    background: rgba(255, 255, 255, 0.08);
}
.vs-suite-profile-tenant-summary .vs-suite-icon-chevron {
    margin-left: auto;
    transition: transform 0.15s;
}
.vs-suite-profile-tenant-toggle[open] .vs-suite-icon-chevron {
    transform: rotate(180deg);
}
.vs-suite-profile-tenant-name {
    flex: 1;
}
.vs-suite-profile-tenant-toggle .vs-suite-profile-tenant-list {
    margin-top: 0.2rem;
    margin-left: 0.7rem;
    padding-left: 0.4rem;
    border-left: 2px solid rgba(255, 255, 255, 0.1);
    max-height: 240px;
    overflow-y: auto;
}
.vs-suite-profile-tenant-static-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.55rem;
    color: #cbd5e1;
    font-size: 13px;
}
