/* ==========================================================================
   clexo Theme — Drop-in Replacement für ColorAdmin
   --------------------------------------------------------------------------
   Baut auf Bootstrap 5.3.7 auf. Bildet die ColorAdmin-spezifischen Klassen
   (.app, .app-header, .app-sidebar, .panel*, .menu*, .navbar-*, login*)
   schlank nach, sodass bestehende Views unverändert weiterlaufen.
   ========================================================================== */

/* ── Design-Tokens ──────────────────────────────────────────────────────── */
:root {
    /* Brand */
    --clexo-primary: #2563eb;
    --clexo-primary-hover: #1d4ed8;
    --clexo-teal: #14b8a6;
    --clexo-success: #16a34a;
    --clexo-warning: #d97706;
    --clexo-danger: #dc2626;
    --clexo-info: #0284c7;

    /* Layout */
    --clexo-header-height: 60px;
    --clexo-sidebar-width: 240px;
    --clexo-sidebar-width-minified: 60px;
    --clexo-topmenu-height: 44px;
    --clexo-content-bg: #f4f6f9;
    --clexo-surface: #ffffff;
    --clexo-border: #e5e7eb;
    --clexo-border-strong: #d1d5db;
    --clexo-muted: #6b7280;
    --clexo-text: #1f2937;
    --clexo-text-on-dark: #e5e7eb;

    /* Sidebar (dunkel) */
    --clexo-sidebar-bg: #1e293b;
    --clexo-sidebar-bg-hover: #334155;
    --clexo-sidebar-link: #cbd5e1;
    --clexo-sidebar-link-hover: #ffffff;
    --clexo-sidebar-link-active: #ffffff;
    --clexo-sidebar-section: #94a3b8;
    --clexo-sidebar-border: #334155;

    /* Header — sanftes Blassblau, das zum clexo-Branding passt */
    --clexo-header-bg: #eef4fb;
    --clexo-header-bg-strip: #e3edf8;
    --clexo-header-text: #1f2937;
    --clexo-header-border: #cbd6e5;

    /* Panel */
    --clexo-panel-bg: #ffffff;
    --clexo-panel-border: #e5e7eb;
    --clexo-panel-heading-bg: #f9fafb;
    --clexo-panel-heading-text: #1f2937;
    --clexo-panel-radius: 10px;
    --clexo-panel-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .03);
    --clexo-panel-shadow-hover: 0 4px 12px rgba(15, 23, 42, .08);

    /* Bootstrap-Theme-Override */
    --bs-primary: var(--clexo-primary);
    --bs-primary-rgb: 37, 99, 235;
    --bs-link-color: var(--clexo-primary);
    --bs-link-hover-color: var(--clexo-primary-hover);

    /* Akzent (User-wählbar via [data-accent]) */
    --accent: #2563eb;
    --accent-color: #2563eb;
}

/* ── Dark-Theme Overrides ───────────────────────────────────────────────── */
body.app-theme-dark,
body[data-theme-variant="transparent"],
body[data-theme-variant="blue"],
body[data-theme-variant="green"],
body[data-theme-variant="custom-red"] {
    --clexo-content-bg: #0f172a;
    --clexo-surface: #1e293b;
    --clexo-border: #334155;
    --clexo-border-strong: #475569;
    --clexo-text: #e5e7eb;
    --clexo-muted: #94a3b8;
    --clexo-header-bg: #1e293b;
    --clexo-header-text: #e5e7eb;
    --clexo-header-border: #334155;
    --clexo-panel-bg: #1e293b;
    --clexo-panel-border: #334155;
    --clexo-panel-heading-bg: #273449;
    --clexo-panel-heading-text: #e5e7eb;
    color-scheme: dark;
}

/* ── Base ───────────────────────────────────────────────────────────────── */
html, body {
    height: 100%;
}

body {
    margin: 0;
    background: var(--clexo-content-bg);
    color: var(--clexo-text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--clexo-primary);
    text-decoration: none;
}
a:hover { color: var(--clexo-primary-hover); text-decoration: underline; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, .35); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, .6); }

/* ── App-Shell ──────────────────────────────────────────────────────────── */
.app {
    min-height: 100vh;
    display: block;
}

#content.app-content {
    margin-left: 0;
    padding: 20px;
    padding-top: calc(var(--clexo-header-height) + 20px);
    min-height: 100vh;
    background: var(--clexo-content-bg);
    transition: margin-left .25s ease, padding-top .25s ease;
}

.app.app-header-fixed.app-sidebar-fixed #content.app-content {
    margin-left: var(--clexo-sidebar-width);
}

.app.app-with-top-menu.app-without-sidebar #content.app-content {
    margin-left: 0;
    padding-top: calc(var(--clexo-header-height) + var(--clexo-topmenu-height) + 20px);
}

.app.app-sidebar-minified.app-sidebar-fixed #content.app-content {
    margin-left: var(--clexo-sidebar-width-minified);
}

/* Embedded-Mode (Iframe ohne Header/Sidebar) */
.app.app-embedded-mode #content.app-content,
.app-embedded-mode #content.app-content {
    margin-left: 0 !important;
    padding-top: 0 !important;
    padding: 0 !important;
}
.app-embedded-mode #header,
.app-embedded-mode .app-sidebar,
.app-embedded-mode .app-top-menu,
.app-embedded-mode .app-footer,
.app-embedded-mode .theme-panel { display: none !important; }

/* ── Header ─────────────────────────────────────────────────────────────── */
#header.app-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--clexo-header-height);
    display: flex;
    align-items: center;
    background: linear-gradient(180deg, var(--clexo-header-bg) 0%, var(--clexo-header-bg-strip) 100%);
    color: var(--clexo-header-text);
    border-bottom: 1px solid var(--clexo-header-border);
    z-index: 1030;
    padding: 0 16px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .04);
}

.app-header .navbar-header {
    display: flex;
    align-items: center;
    width: var(--clexo-sidebar-width);
    flex-shrink: 0;
    padding-right: 12px;
}

.app-header .navbar-brand {
    display: flex;
    align-items: center;
    color: inherit;
    text-decoration: none;
    font-weight: 600;
    padding: 4px 8px;
    overflow: hidden;
}

.app-header .navbar-brand img {
    height: 36px;
    max-height: 100%;
    width: auto;
    object-fit: contain;
}

/* Mobile-Burger im Header */
.app-header .navbar-mobile-toggler {
    display: none;
    background: transparent;
    border: 0;
    color: inherit;
    padding: 6px 10px;
    margin-left: auto;
    font-size: 1.1rem;
}

/* Desktop-Sidebar-Toggle im Header — DEAKTIVIERT (Pfeil-Toggle ist an der Sidebar) */
.app-header .navbar-desktop-toggler { display: none !important; }

/* WICHTIG: Bootstrap-5-Default ist .navbar-nav { flex-direction: column }.
   Wir erzwingen row + nowrap, sonst stacken alle Header-Items vertikal. */
.app-header .navbar-nav {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    flex: 1 1 auto;
    min-width: 0;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 4px;
}

.app-header .navbar-item {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

/* Inline-<script>-Blöcke aus den Header-Partials sind Text-Knoten im Flex-Container —
   sie würden sonst eigenen Platz einnehmen / Layout-Glitches erzeugen. */
.app-header .navbar-nav > script,
.app-header > script { display: none; }

.app-header .navbar-item .nav-link {
    color: var(--clexo-header-text);
    padding: 6px 8px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.app-header .navbar-item .nav-link > i {
    font-size: 16px;
}
.app-header .navbar-item .nav-link:hover {
    background: rgba(15, 23, 42, .06);
    color: var(--clexo-primary);
}
/* User-Avatar-Dropdown: Username sichtbar, etwas kleiner */
.app-header .navbar-user .nav-link { font-size: 13px; }
.app-header .navbar-user .nav-link img { width: 28px; height: 28px; }

.app-theme-dark .app-header .navbar-item .nav-link:hover {
    background: rgba(255, 255, 255, .08);
}

.app-header .navbar-divider {
    width: 1px;
    height: 24px;
    background: var(--clexo-border);
    margin: 0 8px;
}

/* Header-Suche */
.app-header .navbar-form {
    flex: 1;
    max-width: 320px;
}
.app-header .navbar-form .form-control {
    background: var(--clexo-content-bg);
    border-color: var(--clexo-border);
    padding-right: 36px;
    height: 36px;
}
.app-header .btn-search {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: 0;
    color: var(--clexo-muted);
    padding: 6px 10px;
}

/* Helper-Klassen aus ColorAdmin, die in Views vorkommen */
.text-muted-300 { color: #94a3b8; }
.text-teal { color: var(--clexo-teal) !important; }
.text-purple { color: #7e22ce !important; }
.text-indigo { color: #4f46e5 !important; }
.bg-teal { background-color: var(--clexo-teal) !important; }
.text-theme { color: var(--clexo-teal) !important; }
.btn-theme {
    background: var(--clexo-teal);
    border-color: var(--clexo-teal);
    color: #fff;
}
.btn-theme:hover,
.btn-theme:focus {
    background: #0f9488;
    border-color: #0f9488;
    color: #fff;
}
.btn-theme:active {
    background: #0c7d72 !important;
    border-color: #0c7d72 !important;
    color: #fff !important;
}

/* ── ColorAdmin Pixel-Utilities (von Views weiterhin genutzt) ────────── */
/* margin-bottom */
.mb-5px  { margin-bottom: 5px !important; }
.mb-10px { margin-bottom: 10px !important; }
.mb-15px { margin-bottom: 15px !important; }
.mb-20px { margin-bottom: 20px !important; }
.mb-25px { margin-bottom: 25px !important; }
.mb-30px { margin-bottom: 30px !important; }
.mb-40px { margin-bottom: 40px !important; }
/* margin-top */
.mt-5px  { margin-top: 5px !important; }
.mt-10px { margin-top: 10px !important; }
.mt-15px { margin-top: 15px !important; }
.mt-20px { margin-top: 20px !important; }
.mt-30px { margin-top: 30px !important; }
/* padding */
.p-15px  { padding: 15px !important; }
.p-20px  { padding: 20px !important; }
.px-15px { padding-left: 15px !important; padding-right: 15px !important; }
.py-15px { padding-top: 15px !important; padding-bottom: 15px !important; }
/* font-size */
.fs-10px { font-size: 10px !important; }
.fs-11px { font-size: 11px !important; }
.fs-12px { font-size: 12px !important; }
.fs-13px { font-size: 13px !important; }
.fs-14px { font-size: 14px !important; }
.fs-15px { font-size: 15px !important; }
.fs-16px { font-size: 16px !important; }
.fs-18px { font-size: 18px !important; }
.fs-20px { font-size: 20px !important; }
.fs-24px { font-size: 24px !important; }
/* height */
.h-30px  { height: 30px !important; }
.h-35px  { height: 35px !important; }
.h-40px  { height: 40px !important; }
.h-45px  { height: 45px !important; }
.h-50px  { height: 50px !important; }
/* gray-Skala (Tailwind-/ColorAdmin-Aligned) */
.text-gray-100 { color: #f3f4f6 !important; }
.text-gray-200 { color: #e5e7eb !important; }
.text-gray-300 { color: #d1d5db !important; }
.text-gray-400 { color: #9ca3af !important; }
.text-gray-500 { color: #6b7280 !important; }
.text-gray-600 { color: #4b5563 !important; }
.text-gray-700 { color: #374151 !important; }
.text-gray-800 { color: #1f2937 !important; }
.bg-gray-100  { background-color: #f3f4f6 !important; }
.bg-gray-500  { background-color: #6b7280 !important; }

/* ── Sidebar (Pfeil-Toggle oben) ───────────────────────────────────────── */
.app-sidebar {
    position: fixed;
    top: var(--clexo-header-height);
    left: 0;
    bottom: 0;
    width: var(--clexo-sidebar-width);
    background: var(--clexo-sidebar-bg);
    color: var(--clexo-sidebar-link);
    z-index: 1020;
    display: flex;
    flex-direction: column;
    transition: width .25s ease, transform .25s ease;
}

.app-sidebar-content {
    flex: 1;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 8px 0 16px;
}

/* Mandantenname-Header oben in der Sidebar */
.app-sidebar-tenant {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, .04);
    border-bottom: 1px solid var(--clexo-sidebar-border);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    overflow: hidden;
}
.app-sidebar-tenant > i {
    color: var(--clexo-teal);
    font-size: 14px;
    flex-shrink: 0;
}
.app-sidebar-tenant-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.app.app-sidebar-minified .app-sidebar-tenant {
    justify-content: center;
    padding: 12px 0;
}
.app.app-sidebar-minified .app-sidebar-tenant-name { display: none; }

.app-sidebar-mobile-backdrop {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, .5);
    z-index: 1015;
    border: 0;
    padding: 0;
}

/* Pfeil-Toggle direkt an der Sidebar (oben rechts) */
.app-sidebar-toggle {
    position: absolute;
    top: 8px;
    right: -12px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--clexo-primary);
    color: #fff;
    border: 2px solid var(--clexo-header-bg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    z-index: 1025;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
    transition: transform .25s ease, background .15s ease;
    padding: 0;
}
.app-sidebar-toggle:hover { background: var(--clexo-primary-hover); }
.app.app-sidebar-minified .app-sidebar-toggle i {
    transform: rotate(180deg);
}

/* Menü innerhalb der Sidebar */
.app-sidebar .menu {
    list-style: none;
    margin: 0;
    padding: 0;
}
.app-sidebar .menu .menu-item { display: block; }

.app-sidebar .menu .menu-link {
    display: flex;
    align-items: center;
    padding: 8px 14px;
    color: var(--clexo-sidebar-link);
    text-decoration: none;
    font-size: 13.5px;
    line-height: 1.4;
    border-left: 3px solid transparent;
    transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.app-sidebar .menu .menu-link:hover {
    background: var(--clexo-sidebar-bg-hover);
    color: var(--clexo-sidebar-link-hover);
    text-decoration: none;
}
.app-sidebar .menu .menu-item.active > .menu-link,
.app-sidebar .menu .menu-link.active {
    background: rgba(37, 99, 235, .15);
    color: #fff;
    border-left-color: var(--clexo-primary);
}

.app-sidebar .menu .menu-icon {
    width: 22px;
    text-align: center;
    margin-right: 10px;
    font-size: 14px;
    flex-shrink: 0;
}
.app-sidebar .menu .menu-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.app-sidebar .menu .menu-caret {
    margin-left: auto;
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform .2s ease;
}
.app-sidebar .menu .menu-caret::before {
    content: "";
    display: inline-block;
    border-style: solid;
    border-width: 4px 0 4px 5px;
    border-color: transparent transparent transparent currentColor;
}
.app-sidebar .menu .has-sub-manual.expand > .menu-link .menu-caret { transform: rotate(90deg); }

.app-sidebar .menu .menu-submenu {
    background: rgba(0, 0, 0, .15);
    padding: 4px 0;
    display: none;
}
.app-sidebar .menu .has-sub-manual.expand > .menu-submenu { display: block; }

.app-sidebar .menu .menu-submenu .menu-link {
    padding: 5px 14px 5px 45px;
    font-size: 13px;
}

/* Shortcut-Stern (Favoriten) */
.menu-item .shortcut-toggle {
    opacity: 0;
    margin-left: auto;
    padding: 0 5px;
    cursor: pointer;
    transition: opacity .2s, transform .2s;
    font-size: .9em;
}
.menu-item:hover .shortcut-toggle { opacity: .55; }
.menu-item .shortcut-toggle:hover { opacity: 1; transform: scale(1.2); }
.menu-item.is-pinned .shortcut-toggle { opacity: 1; }

/* Sidebar minified: nur Icons */
.app.app-sidebar-minified .app-sidebar { width: var(--clexo-sidebar-width-minified); }
.app.app-sidebar-minified .app-sidebar .menu-text,
.app.app-sidebar-minified .app-sidebar .menu-caret,
.app.app-sidebar-minified .app-sidebar .shortcut-toggle,
.app.app-sidebar-minified .app-sidebar .menu-submenu { display: none !important; }
.app.app-sidebar-minified .app-sidebar .menu-link { justify-content: center; padding: 10px 0; }
.app.app-sidebar-minified .app-sidebar .menu-icon { margin-right: 0; }

/* ── Top Menu ───────────────────────────────────────────────────────────── */
.app-top-menu {
    position: fixed;
    top: var(--clexo-header-height);
    left: 0;
    right: 0;
    height: var(--clexo-topmenu-height);
    background: var(--clexo-sidebar-bg);
    color: var(--clexo-sidebar-link);
    z-index: 1015;
    padding: 0 16px;
    overflow-x: auto;
}

.app-top-menu .menu {
    display: flex;
    align-items: stretch;
    list-style: none;
    margin: 0;
    padding: 0;
    height: 100%;
    flex-wrap: nowrap;
}

.app-top-menu .menu-item { position: relative; display: flex; align-items: stretch; }

.app-top-menu .menu-link {
    display: flex;
    align-items: center;
    padding: 0 14px;
    color: var(--clexo-sidebar-link);
    text-decoration: none;
    font-size: 13.5px;
    white-space: nowrap;
}
.app-top-menu .menu-link:hover {
    background: var(--clexo-sidebar-bg-hover);
    color: #fff;
    text-decoration: none;
}

.app-top-menu .menu-icon { margin-right: 8px; font-size: 13px; }

.app-top-menu .has-sub > .menu-submenu {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--clexo-sidebar-bg);
    min-width: 220px;
    border: 1px solid var(--clexo-sidebar-border);
    border-top: 0;
    z-index: 1100;
    display: none;
    box-shadow: 0 6px 14px rgba(0, 0, 0, .2);
}
.app-top-menu .has-sub:hover > .menu-submenu,
.app-top-menu .has-sub.expand > .menu-submenu { display: block; }
.app-top-menu .has-sub .menu-submenu .menu-item { display: block; }
.app-top-menu .has-sub .menu-submenu .menu-link { padding: 8px 14px; }

.app-top-menu .menu-control { display: none; }

/* ── Panels (mit X / − / [] / ↻ Buttons) ───────────────────────────────── */
.panel {
    background: var(--clexo-panel-bg);
    border: 1px solid var(--clexo-panel-border);
    border-radius: var(--clexo-panel-radius);
    box-shadow: var(--clexo-panel-shadow);
    margin-bottom: 20px;
    overflow: hidden;
    transition: box-shadow .15s ease, border-color .15s ease;
}
.panel:hover { box-shadow: var(--clexo-panel-shadow-hover); }

.panel-heading {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: var(--clexo-panel-heading-bg);
    color: var(--clexo-panel-heading-text);
    border-bottom: 1px solid var(--clexo-panel-border);
    border-top-left-radius: calc(var(--clexo-panel-radius) - 1px);
    border-top-right-radius: calc(var(--clexo-panel-radius) - 1px);
    gap: 12px;
}

.panel-title {
    font-size: 14.5px;
    font-weight: 600;
    margin: 0;
    flex: 1;
    line-height: 1.3;
}

.panel-heading-btn {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-left: auto;
}

/* NUR die runden Steuer-Buttons (X / − / [] / ↻) als 22er Kreise stylen.
   Normale Action-Buttons im Header (z.B. "Neuer Termin") bleiben unangetastet
   und behalten ihr Bootstrap-Default-Aussehen. */
.panel-heading-btn .btn.btn-circle,
.panel-heading-btn .btn.btn-icon {
    width: 22px;
    height: 22px;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    line-height: 1;
    border: 0;
    color: #fff;
    cursor: pointer;
    transition: filter .12s ease, transform .12s ease;
    flex-shrink: 0;
}
.panel-heading-btn .btn.btn-circle.btn-default,
.panel-heading-btn .btn.btn-icon.btn-default { background: #6b7280; color: #fff; }
.panel-heading-btn .btn.btn-circle.btn-success,
.panel-heading-btn .btn.btn-icon.btn-success { background: var(--clexo-success); color: #fff; }
.panel-heading-btn .btn.btn-circle.btn-warning,
.panel-heading-btn .btn.btn-icon.btn-warning { background: var(--clexo-warning); color: #fff; }
.panel-heading-btn .btn.btn-circle.btn-danger,
.panel-heading-btn .btn.btn-icon.btn-danger { background: var(--clexo-danger); color: #fff; }
.panel-heading-btn .btn.btn-circle.btn-primary,
.panel-heading-btn .btn.btn-icon.btn-primary { background: var(--clexo-primary); color: #fff; }
.panel-heading-btn .btn.btn-circle.btn-info,
.panel-heading-btn .btn.btn-icon.btn-info { background: var(--clexo-info); color: #fff; }
.panel-heading-btn .btn.btn-circle:hover,
.panel-heading-btn .btn.btn-icon:hover { filter: brightness(1.08); transform: translateY(-1px); }
.panel-heading-btn .btn.btn-circle:active,
.panel-heading-btn .btn.btn-icon:active { transform: translateY(0); }

/* Allgemeine btn-xs / btn-icon / btn-circle / btn-default Hilfsklassen */
.btn-xs {
    --bs-btn-padding-y: 0.15rem;
    --bs-btn-padding-x: 0.45rem;
    --bs-btn-font-size: 0.72rem;
    --bs-btn-line-height: 1.4;
    --bs-btn-border-radius: 0.3rem;
}
.btn-icon { display: inline-flex; align-items: center; justify-content: center; }
.btn-circle { border-radius: 50%; }
.btn-default {
    background: #6b7280;
    border-color: #6b7280;
    color: #fff;
}
.btn-default:hover { background: #4b5563; border-color: #4b5563; color: #fff; }

/* Panel-Toolbar — Action-Bereich zwischen .panel-heading und .panel-body.
   Vorgesehen für Page-Actions (Anlegen, Import, Filter, Bulk-Operationen),
   die früher rechts im Panel-Header lagen und dort mit den Steuer-Buttons
   und dem Klickbereich des Headers kollidiert sind.

   Verwendung:
   <div class="panel ...">
       <div class="panel-heading">…Titel + .panel-heading-btn…</div>
       <div class="panel-toolbar">
           <a class="btn btn-primary btn-sm">Neuer Auftrag</a>
           <a class="btn btn-outline-secondary btn-sm">Import</a>
           <div class="ms-auto">…Filter rechts…</div>
       </div>
       <div class="panel-body">…</div>
   </div>
*/
.panel-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 16px;
    background: var(--clexo-panel-heading-bg);
    border-bottom: 1px solid var(--clexo-panel-border);
}
.panel-toolbar > .btn {
    flex-shrink: 0;
}
/* Optionaler Trenner zwischen Button-Gruppen innerhalb der Toolbar */
.panel-toolbar > .panel-toolbar-sep {
    width: 1px;
    align-self: stretch;
    background: var(--clexo-panel-border);
    margin: 2px 4px;
}
/* Toolbar wird mit dem Body weggeklappt, wenn das Panel collapsed ist */
.panel.panel-collapsed > .panel-toolbar { display: none; }

/* Auf schmalen Screens darf die Toolbar etwas enger werden */
@media (max-width: 575.98px) {
    .panel-toolbar { padding: 8px 12px; gap: 6px; }
    .panel-toolbar .ms-auto { margin-left: 0 !important; width: 100%; }
}

.panel-body {
    padding: 16px;
    color: var(--clexo-text);
}
.panel-footer {
    padding: 12px 16px;
    background: var(--clexo-panel-heading-bg);
    border-top: 1px solid var(--clexo-panel-border);
    border-bottom-left-radius: calc(var(--clexo-panel-radius) - 1px);
    border-bottom-right-radius: calc(var(--clexo-panel-radius) - 1px);
}

/* Panel-Color-Variants (panel-inverse, -primary, -success, -warning, -danger, -info) */
.panel.panel-inverse > .panel-heading {
    background: #2d3748;
    color: #fff;
    border-bottom-color: #2d3748;
}
.panel.panel-inverse > .panel-heading .panel-heading-btn .btn-default { background: rgba(255,255,255,.18); }
.panel.panel-primary > .panel-heading { background: var(--clexo-primary); color: #fff; border-bottom-color: var(--clexo-primary); }
.panel.panel-success > .panel-heading { background: var(--clexo-success); color: #fff; border-bottom-color: var(--clexo-success); }
.panel.panel-warning > .panel-heading { background: var(--clexo-warning); color: #fff; border-bottom-color: var(--clexo-warning); }
.panel.panel-danger  > .panel-heading { background: var(--clexo-danger);  color: #fff; border-bottom-color: var(--clexo-danger); }
.panel.panel-info    > .panel-heading { background: var(--clexo-info);    color: #fff; border-bottom-color: var(--clexo-info); }

.panel-heading.panel-accent { background: var(--accent); color: #fff; }

/* Panel-Collapse-State (von app.js gesteuert) */
.panel.panel-collapsed > .panel-body,
.panel.panel-collapsed > .panel-footer { display: none; }

/* Panel-Expand (Fullscreen-Mode) */
.panel.panel-expand {
    position: fixed;
    inset: 0;
    margin: 0;
    border-radius: 0;
    z-index: 1080;
    overflow: auto;
    box-shadow: none;
}
.panel.panel-expand > .panel-body { max-height: calc(100vh - 60px); overflow: auto; }

/* ── Widgets ────────────────────────────────────────────────────────────── */
.widget {
    background: var(--clexo-panel-bg);
    border: 1px solid var(--clexo-panel-border);
    border-radius: var(--clexo-panel-radius);
    padding: 14px 16px;
    margin-bottom: 16px;
    box-shadow: var(--clexo-panel-shadow);
}
.widget-header {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    font-weight: 600;
}
.widget-body { color: var(--clexo-text); }

/* Stat-Card: bunte Kachel mit großem Icon im Hintergrund (ColorAdmin-Look) */
.widget.widget-stats {
    color: #fff;
    background: #348fe2;
    border: 0;
    padding: 16px 18px 0;
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 6px 16px rgba(15, 23, 42, .08);
    transition: transform .15s ease, box-shadow .15s ease;
}
.widget.widget-stats:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(15, 23, 42, .14);
}
.widget.widget-stats .stats-icon {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-55%);
    font-size: 84px;
    line-height: 1;
    width: auto; height: auto;
    color: rgba(255, 255, 255, .25);
    pointer-events: none;
}
.widget.widget-stats .stats-info {
    position: relative;
    z-index: 1;
    padding-right: 80px;
}
.widget.widget-stats .stats-info h4 {
    color: rgba(255, 255, 255, .75);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin: 4px 0 6px;
}
.widget.widget-stats .stats-info p {
    color: #fff;
    font-size: 28px;
    font-weight: 600;
    line-height: 1.1;
    margin: 0 0 14px;
}
.widget.widget-stats .stats-info p small {
    font-size: 14px;
    font-weight: 400;
    opacity: .8;
    margin-left: 4px;
}
.widget.widget-stats .stats-link {
    position: relative;
    z-index: 1;
    display: block;
    margin: 0 -18px;
    padding: 8px 18px;
    background: rgba(0, 0, 0, .25);
    text-align: right;
    color: rgba(255, 255, 255, .85);
    font-size: 12.5px;
}
.widget.widget-stats .stats-link.shadow-none {
    background: transparent;
    text-align: left;
    font-style: italic;
    opacity: .8;
}
.widget.widget-stats .stats-link a {
    color: rgba(255, 255, 255, .9);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.widget.widget-stats .stats-link a:hover { color: #fff; text-decoration: none; }
.widget.widget-stats .stats-link.d-flex,
.widget.widget-stats .stats-link.justify-content-around { text-align: inherit; }

/* ColorAdmin-Farbpalette für bg-* (Tailwind-/ColorAdmin-Look) */
.bg-blue   { background-color: #348fe2 !important; }
.bg-indigo { background-color: #5b3ea7 !important; }
.bg-purple { background-color: #727cb6 !important; }
.bg-red    { background-color: #ff5b57 !important; }
.bg-pink   { background-color: #fb5597 !important; }
.bg-orange { background-color: #f59c1a !important; }
.bg-yellow { background-color: #ffd900 !important; color: #1f2937 !important; }
.bg-lime   { background-color: #90ca4b !important; }
.bg-green  { background-color: #32a932 !important; }
.bg-teal   { background-color: #00acac !important; }
.bg-aqua   { background-color: #49b6d6 !important; }
.bg-cyan   { background-color: #49b6d6 !important; }
.bg-grey, .bg-gray { background-color: #b6c2c9 !important; }
.bg-dark-blue { background-color: #2a72b5 !important; }

/* Helfer */
.text-white-50 { color: rgba(255,255,255,.5) !important; }

/* ── Theme-Panel (Floating rechts) ─────────────────────────────────────── */
.theme-panel {
    position: fixed;
    right: -290px;
    top: 80px;
    width: 280px;
    background: var(--clexo-panel-bg);
    border: 1px solid var(--clexo-panel-border);
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, .15);
    transition: right .25s ease;
    z-index: 1040;
}
.theme-panel.open { right: 16px; }
.theme-panel-header {
    padding: 10px 14px;
    border-bottom: 1px solid var(--clexo-panel-border);
    font-weight: 600;
}
.theme-panel-body { padding: 14px; }

/* ── Footer ─────────────────────────────────────────────────────────────── */
.app-footer {
    padding: 14px 20px;
    margin-top: 30px;
    border-top: 1px solid var(--clexo-border);
    color: var(--clexo-muted);
    font-size: 12px;
    background: transparent;
}

/* ── Status-Alerts: Auto-Dismiss Animation ────────────────────────────── */
.alert {
    border-radius: 8px;
    border-width: 1px;
}
.alert.fade.show { transition: opacity .35s ease, transform .35s ease; }
.alert.clexo-fading-out { opacity: 0; transform: translateY(-4px); }

/* Subtle alert-success default border, etwas leichter als Bootstrap-Default */
.alert-success {
    background-color: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
}
.alert-info {
    background-color: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}
.alert-warning {
    background-color: #fffbeb;
    border-color: #fde68a;
    color: #854d0e;
}
.alert-danger {
    background-color: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

/* ── Modals ─────────────────────────────────────────────────────────────── */
.modal-content {
    border: 0;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, .25);
}
.modal-header {
    border-bottom: 1px solid var(--clexo-border);
    padding: 14px 18px;
}
.modal-footer {
    border-top: 1px solid var(--clexo-border);
    padding: 12px 18px;
}
.modal-title { font-weight: 600; }

/* z-index-Korrektur (auch bei verschachtelten Modals) */
.modal { z-index: 2050; }
.modal-backdrop { z-index: 2000; }

/* ── DataTables Refinements (auf Bootstrap-5-Theme aufsetzend) ────────── */
table.dataTable {
    border-collapse: separate !important;
    border-spacing: 0;
}
table.dataTable thead th {
    background: var(--clexo-panel-heading-bg);
    color: var(--clexo-panel-heading-text);
    font-weight: 600;
    border-bottom: 1px solid var(--clexo-border-strong);
    font-size: 13px;
}
table.dataTable tbody tr:hover { background-color: rgba(37, 99, 235, .04); }
.dataTables_wrapper .row { align-items: center; }

/* ── Login-Layout (Drop-in für ColorAdmin login-with-news-feed) ───────── */
.login.login-with-news-feed {
    display: flex;
    min-height: 100vh;
    background: var(--clexo-content-bg);
}

.login.login-with-news-feed .news-feed {
    flex: 1;
    position: relative;
    overflow: hidden;
    color: #fff;
    background: #0f172a;
}
.login.login-with-news-feed .news-image {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}
.login.login-with-news-feed .news-image::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(15, 23, 42, .55) 0%, rgba(37, 99, 235, .35) 100%);
}
.login.login-with-news-feed .news-caption {
    position: absolute;
    left: 40px;
    right: 40px;
    bottom: 40px;
    z-index: 2;
}
.login.login-with-news-feed .news-caption .caption-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 8px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, .35);
}
.login.login-with-news-feed .news-caption p {
    font-size: 0.95rem;
    line-height: 1.5;
    text-shadow: 0 1px 4px rgba(0, 0, 0, .35);
    opacity: .9;
}

.login.login-with-news-feed .login-container {
    width: 100%;
    max-width: 460px;
    padding: 48px 40px;
    background: var(--clexo-surface);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login.login-with-news-feed .login-header {
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.login.login-with-news-feed .login-header .brand img {
    height: 42px;
    width: auto;
}
.login.login-with-news-feed .login-header .brand small {
    display: block;
    color: var(--clexo-muted);
    margin-top: 6px;
    font-size: 13px;
}
.login.login-with-news-feed .login-header .icon {
    color: var(--clexo-primary);
    font-size: 1.5rem;
    opacity: .65;
}

.login.login-with-news-feed .login-content { width: 100%; }

@media (max-width: 991.98px) {
    .login.login-with-news-feed .news-feed { display: none; }
    .login.login-with-news-feed .login-container { max-width: 100%; padding: 32px 24px; }
}

/* ── Developer/Period Bars ─────────────────────────────────────────────── */
#header.app-header + .developer-mode-indicator,
#header.app-header + #periodOverrideBar {
    margin-top: var(--clexo-header-height);
}

/* ── Mobile / Responsive ───────────────────────────────────────────────── */
@media (max-width: 767.98px) {
    .app-header .navbar-mobile-toggler { display: inline-flex; align-items: center; justify-content: center; }
    .app-header .navbar-header { width: auto; flex: 1; }

    .app-sidebar {
        transform: translateX(-100%);
    }
    .app.app-sidebar-mobile-toggled .app-sidebar {
        transform: translateX(0);
    }
    .app.app-sidebar-mobile-toggled .app-sidebar-mobile-backdrop { display: block; }

    .app.app-header-fixed.app-sidebar-fixed #content.app-content,
    .app.app-sidebar-minified.app-sidebar-fixed #content.app-content { margin-left: 0; }

    .app-sidebar-toggle { display: none; }

    .app-header .navbar-form { max-width: none; }
}

/* ── Print ──────────────────────────────────────────────────────────────── */
@media print {
    #header.app-header,
    .app-sidebar,
    .app-top-menu,
    .app-footer,
    .theme-panel,
    .app-sidebar-toggle,
    #periodOverrideBar,
    .developer-mode-indicator { display: none !important; }
    #content.app-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }
    .panel { box-shadow: none !important; border: 1px solid #ccc !important; break-inside: avoid; }
}

/* ── Notification-Bell (kompatibel zu site.css-Pattern) ──────────────── */
.notification-bell { cursor: pointer; transition: color .2s; }
.notification-bell:hover { color: var(--clexo-primary) !important; }

/* ── Pace-Top (Top-Loading-Bar, falls noch genutzt) ──────────────────── */
body.pace-top { /* legacy, kein eigener Loader nötig */ }
