:root {
    --primary-dark: #111827;
    --secondary-dark: #1f2937;
    --primary-blue: #2563eb;
    --light-bg: #f5f7fb;
    --card-border: #e5e7eb;
    --text-muted: #6b7280;
    --sidebar-width: 270px;
    --mini-sidebar-width: 92px;
    --sub-sidebar-width: 272px;
    --nav-total-width: calc(var(--mini-sidebar-width) + var(--sub-sidebar-width));
    /* Context drawer palette (WCAG AA on #FFFFFF) */
    --ctx-text: #334155;
    --ctx-text-secondary: #64748b;
    --ctx-title: #1e293b;
    --ctx-heading: #0f172a;
    --ctx-caption: #6366f1;
    --ctx-icon: #475569;
    --ctx-accent: #4f46e5;
    --ctx-hover-bg: #f8fafc;
    --ctx-active-bg: #eef2ff;
    --ctx-border: #e2e8f0;
}

body {
    margin: 0;
    background: var(--light-bg);
    font-family: "Inter", "Segoe UI", sans-serif;
    color: #111827;
}

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

/* ─── Hostinger-style mini sidebar (icon + label) ─── */
.mini-sidebar {
    width: var(--mini-sidebar-width);
    background: #ffffff;
    border-right: 1px solid var(--ctx-border);
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 8px;
    overflow-y: auto;
}

.mini-sidebar-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--ctx-border);
    width: 100%;
}

.mini-sidebar-logo {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.mini-sidebar-brand-text {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.06em;
    color: var(--ctx-heading);
}

.mini-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    flex: 1;
}

.mini-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 6px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--ctx-text-secondary);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.mini-nav-item i {
    font-size: 1.25rem;
    color: var(--ctx-icon);
    transition: color 0.2s ease;
}

.mini-nav-item span {
    display: block;
    max-width: 76px;
    word-wrap: break-word;
}

.mini-nav-item:hover {
    background: var(--ctx-hover-bg);
    color: var(--ctx-title);
}

.mini-nav-item:hover i {
    color: var(--ctx-accent);
}

.mini-nav-item.active {
    background: var(--ctx-active-bg);
    color: var(--ctx-accent);
    box-shadow: inset 0 0 0 1px rgba(79, 70, 229, 0.12);
}

.mini-nav-item.active i {
    color: var(--ctx-accent);
}

/* ─── Second sidebar (sub-navigation panel) ─── */
.sub-sidebar {
    width: var(--sub-sidebar-width);
    background: #ffffff;
    border-right: 1px solid var(--ctx-border);
    position: fixed;
    top: 0;
    bottom: 0;
    left: var(--mini-sidebar-width);
    z-index: 1039;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 16px rgba(15, 23, 42, 0.04);
}

.sub-sidebar-header {
    padding: 20px 18px 12px;
    border-bottom: 1px solid var(--ctx-border);
}

.sub-sidebar-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--ctx-heading);
    line-height: 1.3;
}

.sub-sidebar-subtitle {
    margin: 6px 0 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--ctx-accent);
}

.sub-sidebar-breadcrumb {
    margin: 6px 0 0;
    font-size: 12px;
    color: var(--ctx-text-secondary);
    line-height: 1.4;
}

.sub-sidebar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 14px 0;
    padding: 8px 12px;
    background: #f8fafc;
    border: 1px solid var(--ctx-border);
    border-radius: 10px;
    color: var(--ctx-text-secondary);
}

.sub-sidebar-search input {
    border: none;
    background: transparent;
    width: 100%;
    font-size: 13px;
    color: var(--ctx-text);
    outline: none;
}

.sub-sidebar-search input::placeholder {
    color: var(--ctx-text-secondary);
}

.sub-sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 12px 10px 16px;
}

.sub-sidebar-empty {
    padding: 16px;
    font-size: 13px;
    color: var(--ctx-text-secondary);
    line-height: 1.5;
}

.sub-sidebar-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sub-sidebar-entry.is-filtered {
    display: none;
}

.has-double-sidebar .main-content {
    margin-left: var(--nav-total-width);
    width: calc(100% - var(--nav-total-width));
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--primary-dark);
    color: #fff;
    padding: 22px 18px;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.28s ease, padding 0.28s ease;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 34px;
}

.logo-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: var(--primary-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.sidebar-logo h5 {
    margin: 0;
    font-weight: 700;
}

.sidebar-logo span {
    font-size: 12px;
    color: #9ca3af;
}

.sidebar.is-compact {
    width: var(--sidebar-compact-width);
    padding: 22px 10px;
}

.sidebar.is-compact .sidebar-logo-text {
    display: none;
}

.sidebar.is-compact .sidebar-logo {
    justify-content: center;
    margin-bottom: 28px;
}

.sidebar.is-compact .sidebar-link-label,
.sidebar.is-compact .sidebar-group-text,
.sidebar.is-compact .sidebar-group-chevron,
.sidebar.is-compact .sidebar-badge {
    display: none;
}

.sidebar.is-compact .sidebar-link,
.sidebar.is-compact .sidebar-group-toggle {
    justify-content: center;
    padding: 13px 10px;
}

.sidebar.is-compact .sidebar-group-children {
    display: none !important;
}

.sidebar.is-compact .sidebar-group-label {
    justify-content: center;
}

/* Compact-mode flyout for grouped items */
.sidebar-flyout {
    position: fixed;
    left: calc(var(--sidebar-compact-width) + 8px);
    min-width: 220px;
    background: var(--secondary-dark);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
    z-index: 1055;
    padding: 10px;
    animation: flyoutIn 0.2s ease;
}

.sidebar-flyout[hidden] {
    display: none !important;
}

.sidebar-flyout-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #9ca3af;
    padding: 6px 10px 10px;
}

.sidebar-flyout-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

@keyframes flyoutIn {
    from {
        opacity: 0;
        transform: translateX(-6px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Secondary context drawer */
.context-drawer {
    position: fixed;
    top: 0;
    bottom: 0;
    left: var(--sidebar-compact-width);
    width: var(--context-drawer-width);
    background: #fff;
    border-left: 1px solid var(--ctx-border);
    border-right: 1px solid var(--ctx-border);
    z-index: 1038;
    display: flex;
    flex-direction: column;
    transform: translateX(-12px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s ease, opacity 0.28s ease;
    box-shadow: 6px 0 20px rgba(15, 23, 42, 0.08);
}

.has-context-drawer .context-drawer {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

.context-drawer-header {
    padding: 20px 18px 16px;
    border-bottom: 1px solid var(--ctx-border);
    background: #fff;
}

.context-drawer-eyebrow {
    display: block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ctx-caption);
    margin-bottom: 8px;
    line-height: 1.2;
}

.context-drawer-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--ctx-heading);
    line-height: 1.3;
}

.context-drawer-breadcrumb {
    margin: 10px 0 0;
    font-size: 14px;
    color: var(--ctx-text-secondary);
    line-height: 1.5;
    word-break: break-word;
}

.context-drawer-crumb-sep {
    margin: 0 6px;
    color: var(--ctx-text-secondary);
    font-weight: 400;
}

.context-drawer-crumb {
    color: var(--ctx-text-secondary);
}

.context-drawer-menu {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
    background: #fff;
}

.context-drawer-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.context-drawer-list > li {
    list-style: none;
}

/* Nested context sidebar navigation */
.context-sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ctx-text);
    text-decoration: none;
    background: transparent;
    border-radius: 0 10px 10px 0;
    border-left: 4px solid transparent;
    font-size: 14px;
    font-weight: 500;
    padding: 10px 14px 10px calc(12px + (var(--ctx-depth, 0) * 14px));
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.context-sidebar-link i.bi-dot,
.context-sidebar-link i.bi-circle-fill {
    font-size: 0.55rem;
}

.context-sidebar-link i:not(.bi-dot):not(.bi-circle-fill) {
    font-size: 0.95rem;
}

.context-sidebar-link i {
    color: var(--ctx-icon);
    flex-shrink: 0;
    transition: color 0.2s ease;
}

.context-sidebar-link:hover {
    background: var(--ctx-hover-bg);
    color: var(--ctx-title);
}

.context-sidebar-link:hover i {
    color: var(--ctx-accent);
}

.context-sidebar-link.active {
    background: var(--ctx-active-bg);
    border-left-color: var(--ctx-accent);
    color: var(--ctx-accent);
    font-weight: 600;
}

.context-sidebar-link.active i {
    color: var(--ctx-accent);
}

.context-sidebar-group {
    list-style: none;
}

.context-sidebar-group-toggle {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--ctx-text);
    padding: 10px 14px 10px calc(12px + (var(--ctx-depth, 0) * 14px));
    border-radius: 0 10px 10px 0;
    border-left: 4px solid transparent;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.context-sidebar-group-toggle:hover,
.context-sidebar-group-toggle.active {
    background: var(--ctx-hover-bg);
    color: var(--ctx-title);
}

.context-sidebar-group-toggle.active {
    background: var(--ctx-active-bg);
    border-left-color: var(--ctx-accent);
    color: var(--ctx-accent);
}

.context-sidebar-group-label {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.context-sidebar-group-label i {
    color: var(--ctx-icon);
    font-size: 0.95rem;
    flex-shrink: 0;
}

.context-sidebar-group-toggle.active .context-sidebar-group-label i {
    color: var(--ctx-accent);
}

.context-sidebar-group-chevron {
    flex-shrink: 0;
    font-size: 12px;
    color: var(--ctx-text-secondary);
    transition: transform 0.2s ease;
}

.context-sidebar-group.is-open .context-sidebar-group-chevron {
    transform: rotate(90deg);
}

.context-sidebar-group-children {
    list-style: none;
    margin: 2px 0 4px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.context-sidebar-group-children[hidden] {
    display: none !important;
}

.context-drawer .sidebar-link-context {
    color: var(--ctx-text);
    background: transparent;
    border-radius: 0 10px 10px 0;
    border-left: 4px solid transparent;
    font-size: 14px;
    font-weight: 500;
    padding: 11px 14px 11px 12px;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.context-drawer .sidebar-link-context i {
    color: var(--ctx-icon);
    font-size: 1.05rem;
    transition: color 0.2s ease;
}

.context-drawer .sidebar-link-context .sidebar-link-label {
    color: inherit;
}

.context-drawer .sidebar-link-context:hover {
    background: var(--ctx-hover-bg);
    color: var(--ctx-title);
}

.context-drawer .sidebar-link-context:hover i {
    color: var(--ctx-accent);
}

.context-drawer .sidebar-link-context.active {
    background: var(--ctx-active-bg);
    border-left-color: var(--ctx-accent);
    color: var(--ctx-accent);
    font-weight: 600;
}

.context-drawer .sidebar-link-context.active i {
    color: var(--ctx-accent);
}

.context-drawer .sidebar-link-context.active .sidebar-link-label {
    color: var(--ctx-accent);
    font-weight: 600;
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    margin-right: -4px;
}

.sidebar-menu::-webkit-scrollbar {
    width: 6px;
}

.sidebar-menu::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 6px;
}

.sidebar-menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-link {
    text-decoration: none;
    padding: 13px 15px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: 0.2s;
    font-size: 15px;
}

.sidebar .sidebar-link,
.sidebar-flyout .sidebar-link {
    color: #cbd5e1;
}

.sidebar .sidebar-link:hover,
.sidebar .sidebar-link.active,
.sidebar-flyout .sidebar-link:hover,
.sidebar-flyout .sidebar-link.active {
    background: var(--primary-blue);
    color: #fff;
}

.sidebar .sidebar-link:hover i,
.sidebar .sidebar-link.active i,
.sidebar-flyout .sidebar-link:hover i,
.sidebar-flyout .sidebar-link.active i {
    color: #fff;
}

.sidebar-link-nested {
    padding: 10px 14px 10px 42px;
    font-size: 14px;
    border-radius: 10px;
}

.sidebar-badge {
    margin-left: auto;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.15);
}

/* Collapsible groups */
.sidebar-group {
    list-style: none;
}

.sidebar-group-toggle {
    width: 100%;
    border: none;
    background: transparent;
    color: #cbd5e1;
    padding: 13px 15px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    text-align: left;
}

.sidebar-group-toggle:hover,
.sidebar-group-toggle.active {
    background: rgba(37, 99, 235, 0.35);
    color: #fff;
}

.sidebar-group-label {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.sidebar-group-label span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-group-chevron {
    flex-shrink: 0;
    font-size: 14px;
    transition: transform 0.25s ease;
}

.sidebar-group.is-open .sidebar-group-chevron {
    transform: rotate(180deg);
}

.sidebar-group-children {
    list-style: none;
    margin: 4px 0 6px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.28s ease, opacity 0.2s ease, margin 0.2s ease;
}

.sidebar-group.is-open .sidebar-group-children {
    max-height: 800px;
    opacity: 1;
}

.sidebar-group-children[hidden] {
    display: block !important;
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.55);
    z-index: 1035;
}

.sidebar-backdrop[hidden] {
    display: none !important;
}

body.sidebar-scroll-lock {
    overflow: hidden;
}

.main-content {
    margin-left: var(--nav-total-width);
    width: calc(100% - var(--nav-total-width));
    transition: margin-left 0.28s ease, width 0.28s ease;
}

.top-header {
    min-height: 82px;
    background: #fff;
    border-bottom: 1px solid var(--card-border);
    padding: 18px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top-header h4 {
    margin: 0;
    font-weight: 700;
}

.top-header p {
    margin: 3px 0 0;
    color: var(--text-muted);
    font-size: 14px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 18px;
}

.search-box {
    background: #f3f4f6;
    border-radius: 14px;
    padding: 10px 14px;
    align-items: center;
    gap: 8px;
}

.search-box input {
    border: none;
    outline: none;
    background: transparent;
    min-width: 220px;
}

.user-box {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--primary-blue);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.user-box span {
    display: block;
    color: var(--text-muted);
    font-size: 12px;
}

.content-wrapper {
    padding: 28px;
}

.portal-card {
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.page-action-btn {
    border-radius: 12px;
    padding: 10px 16px;
    font-weight: 600;
}

.table {
    vertical-align: middle;
}

.table thead th {
    color: #6b7280;
    font-size: 13px;
    text-transform: uppercase;
    background: #f9fafb;
}

.badge-status {
    padding: 7px 11px;
    border-radius: 20px;
    font-size: 12px;
}

.badge-active {
    background: #dcfce7;
    color: #166534;
}

.badge-inactive {
    background: #fee2e2;
    color: #991b1b;
}

.action-btn {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.form-control,
.form-select {
    border-radius: 12px;
    min-height: 46px;
}

textarea.form-control {
    min-height: 110px;
}

.custom-alert {
    border-radius: 14px;
}

.empty-state {
    padding: 45px;
    text-align: center;
    color: var(--text-muted);
}

@media (max-width: 991.98px) {
    .mini-sidebar,
    .sub-sidebar {
        transform: translateX(-110%);
        transition: transform 0.28s ease;
        box-shadow: none;
    }

    .mini-sidebar.is-mobile-open,
    .sub-sidebar.is-mobile-open {
        transform: translateX(0);
    }

    .sub-sidebar.is-mobile-open {
        left: var(--mini-sidebar-width);
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.12);
    }

    .mini-sidebar.is-mobile-open {
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.12);
        z-index: 1041;
    }

    .has-double-sidebar .main-content,
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .top-header {
        flex-wrap: wrap;
        gap: 15px;
    }

    .sidebar-mobile-toggle {
        flex-shrink: 0;
    }

    /* Legacy sidebar mobile rules (unused) */
    .sidebar {
        width: var(--sidebar-width);
        transform: translateX(-100%);
        transition: transform 0.28s ease;
        box-shadow: none;
    }

    .sidebar.is-compact {
        width: var(--sidebar-width);
        padding: 22px 18px;
    }

    .sidebar.is-compact .sidebar-logo-text,
    .sidebar.is-compact .sidebar-link-label,
    .sidebar.is-compact .sidebar-group-text,
    .sidebar.is-compact .sidebar-group-chevron,
    .sidebar.is-compact .sidebar-badge {
        display: block;
    }

    .sidebar.is-compact .sidebar-group-children {
        display: flex !important;
    }

    .sidebar.is-compact .sidebar-link,
    .sidebar.is-compact .sidebar-group-toggle {
        justify-content: flex-start;
        padding: 13px 15px;
    }

    .sidebar.is-compact .sidebar-group-label {
        justify-content: flex-start;
    }

    .sidebar-flyout {
        display: none !important;
    }

    .sidebar.is-mobile-open {
        transform: translateX(0);
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.25);
    }

    .context-drawer {
        left: 0;
        width: min(var(--context-drawer-width), 88vw);
        transform: translateX(-100%);
        z-index: 1039;
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.12);
    }

    .context-drawer.is-mobile-open {
        transform: translateX(0);
        opacity: 1;
        pointer-events: auto;
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .top-header {
        flex-wrap: wrap;
        gap: 15px;
    }

    .sidebar-mobile-toggle {
        flex-shrink: 0;
    }

    .context-drawer-mobile-toggle {
        flex-shrink: 0;
    }
}

.auth-body {
    background: linear-gradient(135deg, #111827, #2563eb);
    min-height: 100vh;
}

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
}

.auth-card {
    width: 100%;
    max-width: 430px;
    background: #fff;
    border-radius: 24px;
    padding: 34px;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.22);
}

.auth-card-wide {
    max-width: 620px;
}

.auth-card h3 {
    font-weight: 800;
    margin-bottom: 5px;
}

.auth-card p {
    color: #6b7280;
    margin-bottom: 24px;
}

.auth-card label {
    font-weight: 600;
    margin-bottom: 7px;
}

.sidebar-section-label {
    margin: 18px 0 6px;
    padding: 0 15px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6b7280;
}

.rbac-module-block {
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 18px;
    background: #fff;
}

.rbac-check-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--card-border);
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.rbac-check-card:hover {
    border-color: var(--primary-blue);
}

.rbac-check-card input {
    margin-top: 4px;
}

.rbac-check-card input:checked + span strong {
    color: var(--primary-blue);
}

/* DataTables */
.datatable-toolbar {
    padding-top: 4px;
}

.datatable-loading {
    display: inline-flex;
    align-items: center;
    color: var(--text-muted);
}

table.dataTable {
    width: 100% !important;
}

table.dataTable thead th {
    font-size: 13px;
    font-weight: 700;
    color: #374151;
    border-bottom: 1px solid var(--card-border) !important;
}

table.dataTable tbody td {
    vertical-align: middle;
    font-size: 14px;
}

.datatable-actions {
    white-space: nowrap;
}

.dataTables_wrapper .dataTables_processing {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    border-radius: 10px;
    border-color: var(--card-border);
}

.rbac-bitwise-table thead th {
    background: #f8fafc;
    font-size: 13px;
}

.rbac-bitwise-table .form-check-input {
    width: 1.1rem;
    height: 1.1rem;
    cursor: pointer;
}

/* User dropdown (header) */
.user-dropdown .user-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--card-border);
    background: #fff;
    border-radius: 14px;
    padding: 6px 12px 6px 6px;
}

.user-dropdown .user-dropdown-toggle:hover,
.user-dropdown .user-dropdown-toggle:focus {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.user-dropdown-label strong {
    display: block;
    font-size: 14px;
    line-height: 1.2;
}

.user-dropdown-label span {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
}

.user-dropdown-menu {
    min-width: 260px;
    border-radius: 14px;
    border: 1px solid var(--card-border);
    padding: 8px;
}

.user-dropdown-header {
    text-align: center;
    padding: 12px 16px;
}

.user-avatar-lg {
    width: 56px;
    height: 56px;
    margin: 0 auto;
    font-size: 22px;
}

.user-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.user-dropdown-menu .dropdown-item {
    border-radius: 10px;
    padding: 8px 12px;
}

.user-dropdown-menu .dropdown-item.active {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-blue);
}

.user-dropdown-menu form .dropdown-item {
    border: none;
    background: transparent;
    text-align: left;
}

/* Account pages */
.account-nav .nav-link {
    border-radius: 10px;
    font-weight: 600;
    color: #475569;
}

.account-nav .nav-link.active {
    background: var(--primary-blue);
    color: #fff;
}

.account-profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--primary-blue);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 42px;
    font-weight: 700;
    overflow: hidden;
}

.account-profile-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.account-security-note {
    background: #f8fafc;
    border-color: #e2e8f0;
}

.account-activity-filters .form-label {
    margin-bottom: 4px;
}

/* Notifications */
.notification-bell-btn {
    border-radius: 12px;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-badge {
    font-size: 10px;
    min-width: 18px;
}

.notification-dropdown-menu {
    width: 360px;
    max-width: 95vw;
    border-radius: 14px;
    overflow: hidden;
}

.notification-dropdown-list {
    max-height: 320px;
    overflow-y: auto;
}

.notification-dropdown-item:hover {
    background: #f8fafc;
}

.notification-pref-table thead th {
    font-size: 13px;
    vertical-align: middle;
}

.notification-pref-table .form-switch .form-check-input {
    width: 2.5em;
    height: 1.25em;
    cursor: pointer;
}

.notification-table thead th {
    background: #1e293b;
    color: #fff;
}

/* Organization context selector */
.organization-context-selector {
    position: relative;
}

.context-selector-toggle {
    display: flex;
    align-items: center;
    border-radius: 12px;
    padding: 8px 14px;
    min-width: 220px;
    max-width: 280px;
    text-align: left;
}

.context-selector-hint {
    font-size: 10px;
    line-height: 1.2;
}

.context-selector-value {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
    display: inline-block;
}

.context-selector-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 360px;
    max-height: 420px;
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.12);
    z-index: 1050;
    display: flex;
    flex-direction: column;
}

.context-selector-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border-bottom: 1px solid var(--card-border);
}

.context-selector-search input {
    border: none;
    box-shadow: none;
}

.context-selector-actions {
    padding: 8px 12px;
    border-bottom: 1px solid var(--card-border);
}

.context-selector-tree {
    overflow-y: auto;
    padding: 8px 0;
    max-height: 300px;
}

.context-tree-item {
    display: flex;
    align-items: center;
    width: 100%;
    border: none;
    background: transparent;
    text-align: left;
    padding: 8px 16px;
    font-size: 13px;
    color: #111827;
    gap: 6px;
}

.context-tree-item:hover,
.context-tree-item.is-selected {
    background: #eff6ff;
    color: var(--primary-blue);
}

.context-tree-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.context-tree-type {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #6b7280;
    background: #f3f4f6;
    border-radius: 4px;
    padding: 2px 6px;
}

.context-tree-item.is-selected .context-tree-type {
    background: #dbeafe;
    color: var(--primary-blue);
}

.organization-context-selector.is-loading {
    opacity: 0.7;
    pointer-events: none;
}

.context-indent-0 { padding-left: 16px; font-weight: 600; }
.context-indent-1 { padding-left: 32px; }
.context-indent-2 { padding-left: 48px; }

.context-breadcrumb {
    max-width: 320px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
}

@media (max-width: 991.98px) {
    .context-selector-toggle {
        min-width: auto;
        max-width: 180px;
    }

    .context-selector-value {
        max-width: 100px;
    }
}

/* ─── Brand Media Library ─── */
.brand-media-library .brand-media-dropzone {
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.brand-media-library .brand-media-dropzone:hover,
.brand-media-library .brand-media-dropzone.bg-light {
    background: #f8fafc;
    border-color: var(--primary-blue) !important;
}

.brand-media-grid .brand-media-card {
    cursor: pointer;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
    min-height: 100px;
}

.brand-media-grid .brand-media-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.brand-media-grid .brand-media-card img {
    aspect-ratio: 1;
    object-fit: cover;
    width: 100%;
}

.brand-media-grid .brand-media-card.border-primary {
    box-shadow: 0 0 0 2px var(--primary-blue);
}

#media-detail-panel {
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
}