:root {
    --ms-blue: #0078d4;
    --ms-blue-dark: #005a9e;
    --ms-blue-light: #e3f0fb;
    --sidebar-width: 240px;
    --sidebar-bg: #1a1a2e;
    --sidebar-text: #c8ccd6;
    --sidebar-hover: rgba(255,255,255,0.08);
    --sidebar-active: rgba(0,120,212,0.25);
    --topbar-height: 56px;
}

/* ── Layout ── */
body {
    background: #f3f4f6;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 14px;
}

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    z-index: 100;
    transition: width .2s ease;
    overflow: hidden;
}

.sidebar.collapsed {
    width: 64px;
}

.sidebar-brand {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    gap: 10px;
    white-space: nowrap;
}

.sidebar-brand .brand-icon {
    width: 32px; height: 32px;
    background: var(--ms-blue);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-weight: 700; font-size: 14px; color: #fff;
}

.sidebar-brand .brand-name {
    font-size: 14px; font-weight: 600; color: #fff;
    overflow: hidden; text-overflow: ellipsis;
}

.sidebar-nav {
    flex: 1;
    min-height: 0;
    padding: 12px 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-section {
    padding: 8px 16px 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .8px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.5);
    white-space: nowrap;
}

.sidebar.collapsed .sidebar-section {
    display: none;
}

/* ── Collapsible sidebar groups ── */
.sidebar-section-toggle {
    display: flex;
    align-items: center;
    padding: 10px 16px 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .8px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.5);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: color .15s;
}
.sidebar-section-toggle:hover {
    color: rgba(255,255,255,0.8);
}
.sidebar-section-toggle .nav-group-label {
    flex: 1;
}
.sidebar-chevron {
    font-size: 9px;
    opacity: .5;
    transition: transform .2s ease, opacity .15s;
    flex-shrink: 0;
}
.sidebar-group.open > .sidebar-section-toggle .sidebar-chevron {
    transform: rotate(-180deg);
    opacity: .8;
}
.sidebar-group-items {
    overflow: hidden;
    max-height: 0;
    transition: max-height .25s ease;
}
.sidebar-group.open > .sidebar-group-items {
    max-height: 800px;
}
/* Collapsed sidebar: show all items, hide toggle labels */
.sidebar.collapsed .sidebar-section-toggle {
    justify-content: center;
    padding: 8px 0 4px;
}
.sidebar.collapsed .nav-group-label,
.sidebar.collapsed .sidebar-chevron {
    display: none;
}
.sidebar.collapsed .sidebar-group-items {
    max-height: none !important;
    overflow: visible;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 16px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 0;
    transition: background .15s;
    white-space: nowrap;
    cursor: pointer;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.nav-item.active {
    background: var(--sidebar-active);
    color: #fff;
    border-left: 3px solid var(--ms-blue);
}

.nav-item .nav-icon {
    width: 20px; height: 20px;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}

.nav-item .nav-label {
    font-size: 13.5px;
}

.sidebar.collapsed .nav-label,
.sidebar.collapsed .sidebar-brand .brand-name {
    display: none;
}

/* ── Main content ── */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-width: 0; /* allow shrinking below content min-width so nowrap tab bar can't blow out the page */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left .2s ease;
}

.main-content.collapsed {
    margin-left: 64px;
}

/* ── Topbar ── */
.topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
    gap: 12px;
}

.topbar .toggle-btn {
    background: none; border: none;
    color: #6b7280; cursor: pointer; padding: 6px;
    border-radius: 6px; display: flex;
}

.topbar .toggle-btn:hover { background: #f3f4f6; }

.topbar .breadcrumb-area {
    flex: 1;
    font-size: 13px; color: #6b7280;
}

.topbar .breadcrumb-area .page-title {
    font-size: 15px; font-weight: 600; color: #111827;
    display: block;
}

.topbar .topbar-right {
    display: flex; align-items: center; gap: 10px;
}

.topbar .refresh-badge {
    font-size: 11px; color: #9ca3af;
}

/* ── Quick-search trigger (topbar) ── */
.qs-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    color: #6b7280;
    font-size: 13px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    white-space: nowrap;
}
.qs-trigger:hover {
    background: #e9eaec;
    border-color: #d1d5db;
    color: #374151;
}
.qs-trigger kbd {
    font-size: 10px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 1px 5px;
    color: #9ca3af;
    font-family: inherit;
}
.qs-trigger-label {
    min-width: 80px;
}
@media (max-width: 640px) {
    .qs-trigger-label, .qs-trigger kbd { display: none; }
}

/* ── Command palette overlay ── */
.qs-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0,0,0,.45);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 80px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s;
}
.qs-overlay.open {
    opacity: 1;
    pointer-events: all;
}
.qs-palette {
    width: 100%;
    max-width: 600px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    overflow: hidden;
    transform: translateY(-8px);
    transition: transform .15s;
}
.qs-overlay.open .qs-palette {
    transform: translateY(0);
}
.qs-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid #f3f4f6;
}
.qs-input-icon {
    font-size: 16px;
    color: #9ca3af;
    flex-shrink: 0;
}
.qs-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 15px;
    color: #111827;
    background: transparent;
}
.qs-input::placeholder { color: #9ca3af; }
.qs-esc-hint {
    font-size: 10px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    padding: 2px 6px;
    color: #9ca3af;
    font-family: inherit;
}
.qs-results {
    max-height: 420px;
    overflow-y: auto;
    padding: 6px 0;
}
.qs-category {
    padding: 8px 16px 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .6px;
    text-transform: uppercase;
    color: #9ca3af;
}
.qs-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 16px;
    cursor: pointer;
    text-decoration: none;
    color: #111827;
    transition: background .1s;
}
.qs-item:hover, .qs-item.active {
    background: #f0f7ff;
    color: #0078d4;
}
.qs-item .qs-icon {
    width: 30px; height: 30px;
    border-radius: 7px;
    background: #f3f4f6;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
    color: #6b7280;
    flex-shrink: 0;
    transition: background .1s;
}
.qs-item.active .qs-icon, .qs-item:hover .qs-icon {
    background: #dbeafe;
    color: #0078d4;
}
.qs-item .qs-label {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
}
.qs-item .qs-label mark {
    background: #fef9c3;
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
}
.qs-empty {
    padding: 32px 16px;
    text-align: center;
    color: #9ca3af;
    font-size: 14px;
}

/* ── Page content ── */
.page-content {
    padding: 24px;
    flex: 1;
}

/* ── Metric Cards ── */
.metric-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px 24px;
    border: 1px solid #e5e7eb;
    transition: box-shadow .15s;
}

.metric-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,.06);
}

.metric-card .metric-label {
    font-size: 12px; color: #6b7280; text-transform: uppercase;
    letter-spacing: .5px; font-weight: 600; margin-bottom: 8px;
}

.metric-card .metric-value {
    font-size: 2rem; font-weight: 700; color: #111827;
    line-height: 1;
}

.metric-card .metric-sub {
    font-size: 12px; color: #6b7280; margin-top: 4px;
}

.metric-card .metric-icon {
    width: 44px; height: 44px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
}

/* ── Cards ── */
.content-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

/* Default inner padding for cards that don't use the explicit
   header-custom/body-custom wrappers. Modern browsers (Chrome/Edge/
   Safari/Firefox 121+) only — older browsers fall back to no padding,
   matching the previous behaviour. */
.content-card:not(:has(.card-header-custom)):not(:has(.card-body-custom)) {
    padding: 20px 24px;
}
.content-card.p-0 { padding: 0 !important; }

.content-card .card-header-custom {
    padding: 16px 20px;
    border-bottom: 1px solid #f3f4f6;
    display: flex; align-items: center; gap: 10px;
}

.content-card .card-header-custom h6 {
    margin: 0; font-size: 14px; font-weight: 600; color: #111827;
}

.content-card .card-body-custom {
    padding: 20px;
}

/* ── Tables ── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table thead th {
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    padding: 10px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: #6b7280;
    text-align: left;
    white-space: nowrap;
}

.data-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid #f3f4f6;
    color: #374151;
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: #f9fafb;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* ── Badges ── */
.badge-enabled   { background: #d1fae5; color: #065f46; padding: 3px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.badge-disabled  { background: #fee2e2; color: #991b1b; padding: 3px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.badge-warning   { background: #fef3c7; color: #92400e; padding: 3px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.badge-info      { background: #dbeafe; color: #1e40af; padding: 3px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.badge-neutral   { background: #f3f4f6; color: #374151; padding: 3px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.badge-success   { background: #d1fae5; color: #065f46; padding: 3px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.badge-danger    { background: #fee2e2; color: #991b1b; padding: 3px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.badge-secondary { background: #f3f4f6; color: #6b7280; padding: 3px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.badge-pill      { padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }

/* ── Progress bars ── */
.progress-custom {
    height: 6px; border-radius: 3px; background: #e5e7eb; overflow: hidden;
}
.progress-custom .bar {
    height: 100%; border-radius: 3px; background: var(--ms-blue);
    transition: width .4s ease;
}
.progress-custom .bar.warning { background: #f59e0b; }
.progress-custom .bar.danger  { background: #ef4444; }

/* ── Login page ── */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #0078d4 0%, #1a1a2e 100%);
    display: flex; align-items: center; justify-content: center;
}

.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    width: 100%; max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

/* ── Toolbar ── */
.table-toolbar {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 20px;
    border-bottom: 1px solid #f3f4f6;
}

.table-toolbar .search-box {
    flex: 1; max-width: 280px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 13px;
    outline: none;
}

.table-toolbar .search-box:focus {
    border-color: var(--ms-blue);
    box-shadow: 0 0 0 3px rgba(0,120,212,.1);
}

.pager-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 20px;
    border-top: 1px solid #f3f4f6;
    font-size: 13px;
}

/* ── Spinner ── */
.spinner-overlay {
    display: flex; align-items: center; justify-content: center;
    padding: 40px; color: #9ca3af;
}

/* ── Alert Toast ── */
.toast-container {
    position: fixed; bottom: 24px; right: 24px; z-index: 9999;
}

/* ── Page loading bar ── */
#page-loader {
    position: fixed; top: 0; left: 0; right: 0; height: 3px;
    background: var(--ms-blue); z-index: 9999;
    transform: scaleX(0); transform-origin: left;
    transition: transform .4s ease; pointer-events: none;
}
#page-loader.loading { animation: loader-pulse 1.2s ease infinite; }
@keyframes loader-pulse {
    0%   { transform: scaleX(0); opacity: 1; }
    60%  { transform: scaleX(.7); opacity: 1; }
    100% { transform: scaleX(1); opacity: 0; }
}

/* ── Skeleton loading ── */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.4s infinite;
    border-radius: 4px; display: inline-block;
}
@keyframes skeleton-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Empty state ── */
.empty-state {
    text-align: center; padding: 48px 24px; color: #9ca3af;
}
.empty-state i { font-size: 40px; display: block; margin-bottom: 12px; opacity: .4; }
.empty-state p { font-size: 14px; margin: 0; }

/* ── Scrollbar ── */
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

/* ── Module sub-tabs ── */
.module-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 0;
}
.module-tab {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
    text-decoration: none;
    border-radius: 6px 6px 0 0;
    border: 1px solid transparent;
    border-bottom: none;
    margin-bottom: -2px;
    transition: color .15s, background .15s;
}
.module-tab:hover {
    color: var(--ms-blue);
    background: #f0f7ff;
}
.module-tab.active {
    color: var(--ms-blue);
    background: #fff;
    border-color: #e5e7eb;
    border-bottom-color: #fff;
}

/* ── Sidebar Backdrop (nur unter md sichtbar) ── */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 99;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
}
.sidebar-backdrop.show {
    opacity: 1;
    pointer-events: auto;
}

/* ── Responsive ── */

/* Tablet (≤ 1024px): Sidebar verhält sich wie ".collapsed" auf Desktop —
   schmale Icon-Leiste, click auf Toggle erweitert sie vollständig. */
@media (max-width: 1024px) and (min-width: 769px) {
    .sidebar:not(.expanded) { width: 64px; }
    .sidebar:not(.expanded) .nav-label,
    .sidebar:not(.expanded) .sidebar-brand .brand-name,
    .sidebar:not(.expanded) .sidebar-section,
    .sidebar:not(.expanded) .sidebar-section-toggle .nav-group-label,
    .sidebar:not(.expanded) .sidebar-chevron {
        display: none;
    }
    .sidebar:not(.expanded) .sidebar-section-toggle { padding: 8px 0 4px; justify-content: center; }
    .sidebar:not(.expanded) .sidebar-group-items { display: block !important; max-height: none; }
    .main-content { margin-left: 64px; }
    .topbar { padding: 0 16px; }
    .page-content { padding: 16px; }
}

/* Phone (≤ 768px): Sidebar ist standardmäßig komplett ausgeblendet, lässt
   sich per Burger-Klick als Off-Canvas einblenden. Hauptinhalt nutzt die
   gesamte Breite. */
@media (max-width: 768px) {
    .sidebar {
        width: 260px;
        transform: translateX(-100%);
        transition: transform .25s ease;
        box-shadow: 0 0 18px rgba(0,0,0,0.25);
    }
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    /* Im Mobile-Modus immer "expanded" anzeigen (volle Labels) */
    .sidebar .nav-label,
    .sidebar .sidebar-brand .brand-name,
    .sidebar .sidebar-section,
    .sidebar .sidebar-section-toggle .nav-group-label,
    .sidebar .sidebar-chevron {
        display: revert;
    }
    .main-content { margin-left: 0 !important; }
    .topbar { padding: 0 12px; gap: 8px; }
    .topbar .breadcrumb-area .page-title { font-size: 14px; }
    .topbar .breadcrumb-area span:not(.page-title) { display: none; }
    .topbar .qs-trigger { padding: 6px 8px; }
    .topbar .qs-trigger .qs-trigger-label,
    .topbar .qs-trigger kbd { display: none; }
    .topbar .refresh-badge { display: none; }
    .topbar-right { gap: 6px; }
    .page-content { padding: 12px; }
    .content-card { border-radius: 10px; }
    .metric-card { padding: 14px; }
    .metric-value { font-size: 22px !important; }
    /* tables don't overflow off-screen */
    .table-responsive { -webkit-overflow-scrolling: touch; }
    .card-body-custom { padding: 14px; }
    .card-header-custom { padding: 12px 14px; }
    /* offcanvas should not exceed viewport */
    .offcanvas { max-width: 90vw; }
    /* modals get more breathing room */
    .modal-dialog { margin: .5rem; }
    .modal-dialog-centered { min-height: calc(100% - 1rem); }

    /* ── Mobile Safety-Net gegen horizontalen Overflow ───────────────────
       Kein overflow:hidden mehr — Inhalte sollen erreichbar bleiben.
       Strategie: jedes potentiell zu breite Element bekommt seinen
       eigenen scroll-Container ODER bricht/skaliert; .main-content
       fängt als Fallback alles ab was trotzdem übersteht. */

    /* Hauptcontainer als letzte Auffang-Scroll-Box (nicht clipping). */
    .main-content { overflow-x: auto; min-width: 0; }

    /* Bootstrap-Rows: ein direktes Kind mit Inhalts-min-content darf
       die Row nicht sprengen — gewohnter Flex-Trick. */
    .row > * { min-width: 0; }

    /* Cards begrenzen sich aufs verfügbare und scrollen ihren Inhalt. */
    .content-card,
    .card { max-width: 100%; }
    .content-card,
    .card-body-custom,
    .card-body { overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* Jede <table> im Hauptcontent bekommt einen scroll-Wrapper als
       Fallback. Tables, die schon in einem .table-responsive sitzen,
       bleiben unverändert (display:table wieder herstellen). */
    .page-content table { display: block; max-width: 100%; overflow-x: auto; }
    .page-content table > thead,
    .page-content table > tbody,
    .page-content table > tfoot { display: table; width: 100%; }
    .page-content .table-responsive > table { display: table; overflow: visible; max-width: none; }

    /* Lange UPNs/URLs/IDs brechen statt sprengen. */
    .page-content td, .page-content th { overflow-wrap: anywhere; word-break: break-word; }
    .page-content pre, .page-content code { overflow-x: auto; max-width: 100%; word-break: break-word; }

    /* Inline-min-width-Container respektieren den Viewport.
       Buttons sind ausgenommen, damit Pager-Buttons (min-width:32px) ok bleiben. */
    .page-content [style*="min-width"]:not(button):not(.btn):not(.pager-btn) { max-width: 100%; }

    /* SVG-Charts/Score-Circles dürfen nicht sprengen. */
    .page-content svg { max-width: 100%; height: auto; }

    /* Input-Groups dürfen wrappen, ihre Kinder dürfen shrinken. */
    .input-group { flex-wrap: wrap; }
    .input-group > * { min-width: 0; }

    /* Pre-formatted JSON/Logs sollen scrollen, nicht sprengen. */
    .page-content pre { white-space: pre-wrap; word-break: break-word; }
}

/* Larger touch targets on coarse pointers (covers phone+tablet) */
@media (pointer: coarse) {
    .nav-item { padding: 12px 16px; }
    .btn-sm { min-height: 36px; }
    .form-control, .form-select { min-height: 38px; }
}

/* ── Print styles ─────────────────────────────── */
@media print {
    .sidebar, .topbar, .btn, .table-toolbar, #widgetConfig,
    .alert-dismissible .btn-close, nav, .offcanvas { display: none !important; }
    .main-content { margin: 0 !important; padding: 0 !important; }
    .content-card { border: 1px solid #ccc; box-shadow: none; page-break-inside: avoid; }
    body { font-size: 11px; }
    a[href]:after { content: none; }
}

/* ── Inline help tooltips ───────────────────────── */
.help-tip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px; height: 18px;
    margin-left: 4px;
    border-radius: 50%;
    color: #6b7280;
    cursor: help;
    background: transparent;
    transition: color .15s ease, background-color .15s ease;
    font-size: 13px;
    line-height: 1;
    vertical-align: middle;
}
.help-tip:hover, .help-tip:focus { color: var(--ms-blue); background: #eef5ff; outline: none; }
.help-tip i { line-height: 1; }

.tooltip-inner { max-width: 360px; text-align: left; padding: 10px 12px; font-size: 12.5px; line-height: 1.45; }
.tooltip-inner strong { display: inline-block; margin-bottom: 4px; }

/* ── Notification bell ──────────────────────────── */
.notify-trigger {
    position: relative;
    background: none; border: 0; padding: 6px 8px;
    color: #4b5563; cursor: pointer; border-radius: 6px;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background .15s ease, color .15s ease;
}
.notify-trigger:hover { background: #f3f4f6; color: var(--ms-blue); }
.notify-trigger .notify-badge {
    position: absolute; top: 2px; right: 2px;
    min-width: 16px; height: 16px;
    padding: 0 4px;
    background: #ef4444; color: #fff;
    border-radius: 10px;
    font-size: 10px; font-weight: 700; line-height: 16px;
    text-align: center;
    border: 1.5px solid #fff;
}
.notify-panel {
    position: absolute;
    top: calc(var(--topbar-height) - 8px); right: 16px;
    width: 380px; max-width: calc(100vw - 32px);
    max-height: 70vh; overflow-y: auto;
    background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.15);
    z-index: 200;
    display: none;
}
.notify-panel.open { display: block; }
.notify-panel-head {
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    display: flex; justify-content: space-between; align-items: center;
    position: sticky; top: 0; background: #fff; z-index: 1;
}
.notify-panel-head strong { font-size: 14px; }
.notify-panel-head a { font-size: 12px; color: var(--ms-blue); text-decoration: none; }
.notify-item {
    padding: 10px 16px;
    border-bottom: 1px solid #f3f4f6;
    display: flex; gap: 10px;
    cursor: pointer;
    transition: background .1s ease;
}
.notify-item:hover { background: #f9fafb; }
.notify-item.unread { background: #eff6ff; }
.notify-item.unread:hover { background: #dbeafe; }
.notify-item-icon {
    width: 32px; height: 32px; flex-shrink: 0;
    border-radius: 50%; background: #e5e7eb;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; color: #4b5563;
}
.notify-item.severity-warn .notify-item-icon { background: #fef3c7; color: #b45309; }
.notify-item.severity-critical .notify-item-icon { background: #fee2e2; color: #b91c1c; }
.notify-item.severity-info .notify-item-icon { background: #dbeafe; color: #1d4ed8; }
.notify-item.severity-success .notify-item-icon { background: #d1fae5; color: #047857; }
.notify-item-body { flex: 1; min-width: 0; }
.notify-item-title { font-size: 13px; font-weight: 600; color: #111827; line-height: 1.3; }
.notify-item-text { font-size: 12px; color: #4b5563; line-height: 1.4; margin-top: 2px;
    overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;}
.notify-item-time { font-size: 11px; color: #9ca3af; margin-top: 4px; }
.notify-empty { padding: 40px 16px; text-align: center; color: #9ca3af; font-size: 13px; }

/* ── Sparklines ──────────────────────────────────── */
.sparkline-wrap {
    display: inline-flex; align-items: center; gap: 8px;
    margin-left: 8px;
}
.sparkline-canvas { width: 80px; height: 24px; }
.sparkline-delta {
    font-size: 11px; font-weight: 600;
    padding: 2px 6px; border-radius: 10px;
    background: #f3f4f6; color: #6b7280;
}
.sparkline-delta.up   { background: #d1fae5; color: #047857; }
.sparkline-delta.down { background: #fee2e2; color: #b91c1c; }
.sparkline-delta.flat { background: #f3f4f6; color: #6b7280; }

/* ── Setup-Wizard ────────────────────────────────── */
.wizard-shell {
    max-width: 720px; margin: 0 auto;
    background: #fff; border-radius: 14px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.08);
    overflow: hidden;
}
.wizard-head {
    padding: 28px 32px 20px;
    background: linear-gradient(135deg, var(--ms-blue) 0%, var(--ms-blue-dark) 100%);
    color: #fff;
}
.wizard-head h2 { margin: 0 0 6px; font-weight: 600; font-size: 22px; }
.wizard-head p  { margin: 0; opacity: 0.92; font-size: 14px; }
.wizard-steps {
    display: flex; justify-content: space-between;
    padding: 16px 32px;
    background: #f8fafc; border-bottom: 1px solid #e5e7eb;
    gap: 8px;
}
.wizard-step {
    flex: 1; min-width: 0;
    text-align: center;
    font-size: 11px; font-weight: 500; color: #6b7280;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.wizard-step .step-dot {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: #e5e7eb; color: #6b7280;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 12px;
}
.wizard-step.active .step-dot { background: var(--ms-blue); color: #fff; }
.wizard-step.done   .step-dot { background: #10b981; color: #fff; }
.wizard-step.active .step-label,
.wizard-step.done   .step-label { color: #111827; }
.wizard-body { padding: 28px 32px; min-height: 280px; }
.wizard-body h3 { font-size: 18px; margin: 0 0 12px; }
.wizard-foot {
    padding: 16px 32px;
    border-top: 1px solid #e5e7eb;
    background: #f8fafc;
    display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.wizard-check-row {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f3f4f6;
}
.wizard-check-row:last-child { border-bottom: 0; }
.wizard-check-icon {
    width: 28px; height: 28px; flex-shrink: 0;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
}
.wizard-check-icon.ok    { background: #d1fae5; color: #047857; }
.wizard-check-icon.warn  { background: #fef3c7; color: #b45309; }
.wizard-check-icon.fail  { background: #fee2e2; color: #b91c1c; }
.wizard-check-icon.info  { background: #dbeafe; color: #1d4ed8; }
.wizard-check-text strong { display: block; color: #111827; font-size: 14px; }
.wizard-check-text span { display: block; color: #4b5563; font-size: 12.5px; line-height: 1.45; margin-top: 2px; }

/* ── Compliance profile picker ──────────────────── */
.profile-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.profile-card {
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    padding: 16px;
    background: #fff;
    cursor: pointer;
    transition: border-color .15s ease, transform .1s ease, box-shadow .15s ease;
    position: relative;
}
.profile-card:hover { border-color: var(--ms-blue); transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,.06); }
.profile-card.selected { border-color: var(--ms-blue); background: var(--ms-blue-light); }
.profile-card .profile-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; color: #fff;
    margin-bottom: 12px;
}
.profile-card h5 { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.profile-card p { margin: 0; color: #6b7280; font-size: 12.5px; line-height: 1.4; }
.profile-card ul { margin: 12px 0 0; padding-left: 18px; color: #4b5563; font-size: 12px; }
.profile-card ul li { line-height: 1.5; }

/* ── Audit-Diff ──────────────────────────────────── */
.diff-line { display: grid; grid-template-columns: 24px 1fr 1fr; gap: 8px; padding: 6px 12px; font-size: 13px; align-items: center; }
.diff-line.add  { background: #f0fdf4; }
.diff-line.del  { background: #fef2f2; }
.diff-line.mod  { background: #fffbeb; }
.diff-line.unchanged { color: #9ca3af; }
.diff-marker { font-family: monospace; font-weight: 700; }
.diff-line.add .diff-marker { color: #047857; }
.diff-line.del .diff-marker { color: #b91c1c; }
.diff-line.mod .diff-marker { color: #b45309; }
.diff-value-old { color: #6b7280; text-decoration: line-through; font-family: monospace; }
.diff-value-new { color: #111827; font-family: monospace; }

/* ── Hub navigation (sidebar hub list + content tab bar) ─────────────── */
.sidebar-hub-label {
    padding: 14px 16px 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.30);
}
.sidebar.collapsed .sidebar-hub-label { display: none; }

.hub-tabs {
    display: flex;
    align-items: stretch;
    min-width: 0;
    max-width: 100%;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 0 16px;
}
.hub-tabs-list {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
}
.hub-tabs-list::-webkit-scrollbar { display: none; }
.hub-tabs-more { flex: 0 0 auto; position: relative; }
.hub-more-btn { background: transparent; border: 0; cursor: pointer; }
.hub-more-btn.has-active { color: var(--ms-blue); font-weight: 600; }
.hub-more-caret { font-size: 11px !important; opacity: .7; }
.hub-more-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    min-width: 230px;
    max-height: 70vh;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 10px 28px rgba(0,0,0,.14);
    padding: 6px;
    z-index: 60;
}
.hub-more-menu.open { display: flex; flex-direction: column; }
.hub-more-menu .hub-tab {
    border-bottom: 0 !important;
    border-radius: 6px;
    padding: 9px 12px;
    width: 100%;
}
.hub-more-menu .hub-tab.active { background: var(--ms-blue-light); }
.hub-tabs .hub-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    padding: 12px 14px;
    font-size: 13px;
    color: #4b5563;
    text-decoration: none;
    border-bottom: 2px solid transparent;
}
.hub-tabs .hub-tab:hover { color: var(--ms-blue); background: #f8fafc; }
.hub-tabs .hub-tab.active {
    color: var(--ms-blue);
    border-bottom-color: var(--ms-blue);
    font-weight: 600;
}
.hub-tabs .hub-tab i { font-size: 14px; }
@media print { .hub-tabs { display: none; } }

/* ── Favorites ───────────────────────────────────────────────────────── */
#favToggle.is-fav { color: #f59e0b; border-color: #f59e0b; }
.fav-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    text-decoration: none;
    color: #111827;
    transition: box-shadow .15s, border-color .15s;
}
.fav-card:hover { border-color: var(--ms-blue); box-shadow: 0 4px 14px rgba(0,0,0,.08); }
.fav-card-icon {
    flex: 0 0 auto;
    width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    background: var(--ms-blue-light);
    color: var(--ms-blue);
    border-radius: 8px;
    font-size: 18px;
}
.fav-card-label { font-weight: 600; font-size: 14px; word-break: break-word; }
.fav-remove {
    position: absolute;
    top: 8px; right: 8px;
    width: 26px; height: 26px;
    border: 0; border-radius: 6px;
    background: transparent; color: #9ca3af;
    cursor: pointer; font-size: 12px;
    display: flex; align-items: center; justify-content: center;
}
.fav-remove:hover { background: #fee2e2; color: #dc2626; }
