/* ============================================================
   WorkGlass App UI — production design system (from mockup)
   ============================================================ */

:root {
    --brand: #5b4fe8;
    --brand-hover: #4a3fd4;
    --brand-soft: #eeecfd;
    --brand-ink: #3d36a8;
    --ink: #1a1d26;
    --muted: #6b7285;
    --muted-2: #9aa0b0;
    --line: #e6e8ef;
    --line-strong: #d5d8e3;
    --canvas: #f3f4f8;
    --surface: #ffffff;
    --success: #15803d;
    --success-soft: #e8f7ee;
    --warn: #c2410c;
    --warn-soft: #fff1e7;
    --danger: #b91c1c;
    --danger-soft: #fdecec;
    --info: #0369a1;
    --info-soft: #e8f4fb;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --shadow: 0 1px 2px rgba(26, 29, 38, 0.04), 0 8px 24px rgba(26, 29, 38, 0.04);
    --shadow-sm: 0 1px 2px rgba(26, 29, 38, 0.05);
    --sidebar-w: 248px;
    --header-h: 64px;
    --footer-h: 44px;
    --font: "Plus Jakarta Sans", "Segoe UI", sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, monospace;

    /* Back-compat aliases used by earlier app-ui rules */
    --wg-brand: var(--brand);
    --wg-brand-soft: var(--brand-soft);
    --wg-ink: var(--ink);
    --wg-muted: var(--muted);
    --wg-border: var(--line);
    --wg-surface: var(--surface);
    --wg-canvas: var(--canvas);
    --wg-radius: var(--radius);
    --wg-radius-sm: var(--radius-sm);
    --wg-shadow: var(--shadow-sm);
}

/* ---- Global auth chrome ---- */
body.g-sidenav-show {
    font-family: var(--font) !important;
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

body.g-sidenav-show.bg-gray-200 {
    background: var(--canvas) !important;
}

body.g-sidenav-show .main-content {
    font-family: var(--font);
}

.wg-app-shell {
    display: flex;
    min-height: 100vh;
    background: var(--canvas);
}

.wg-main {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    min-height: 100vh;
    margin-left: var(--sidebar-w);
    background: var(--canvas);
}

@media (max-width: 1199.98px) {
    .wg-main {
        margin-left: 0;
    }
}

.wg-main-body {
    flex: 1 0 auto;
    padding: 0.35rem 0 0;
}

.wg-topbar.navbar-main {
    height: auto;
    min-height: var(--header-h);
    margin: 0 !important;
    padding: 1rem 1.5rem !important;
    background: rgba(243, 244, 248, 0.9) !important;
    backdrop-filter: blur(8px);
    border-bottom: 1px solid transparent;
    border-radius: 0 !important;
    position: sticky;
    top: 0;
    z-index: 15;
    box-shadow: none !important;
    display: flex;
    align-items: flex-start;
}

.wg-topbar > .container-fluid {
    min-height: unset;
    align-items: flex-start;
}

.wg-topbar-start {
    min-width: 0;
    padding-top: 0.15rem;
}

.wg-sidenav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0.35rem !important;
    margin-top: 0.1rem;
}

.wg-topbar .page-title,
.breadcrumb-title {
    margin: 0 !important;
    color: var(--ink) !important;
    font-size: 1.25rem !important;
    font-weight: 720 !important;
    letter-spacing: -0.03em;
    font-family: var(--font) !important;
}

.wg-page-sub,
.page-sub {
    margin: 0.15rem 0 0;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 500;
}

.wg-footer.footer {
    height: var(--footer-h);
    min-height: var(--footer-h);
    display: flex;
    align-items: center;
    margin-top: auto;
    padding: 0 1.5rem !important;
    border-top: 1px solid var(--line);
    background: var(--canvas);
    flex-shrink: 0;
}

.wg-footer .copyright,
.wg-footer .text-muted {
    color: var(--muted-2) !important;
    font-size: 0.75rem !important;
}

.wg-footer a {
    color: var(--brand);
}

/* ---- Sidebar (mockup look over file-system tree) ---- */
.file-system-sidebar,
.file-system-sidebar.navbar,
#sidenav-main.file-system-sidebar {
    width: var(--sidebar-w) !important;
    max-width: var(--sidebar-w) !important;
    background: var(--surface) !important;
    border-right: 1px solid var(--line) !important;
    box-shadow: none !important;
    font-family: var(--font) !important;
    padding: 1rem 0.85rem !important;
}

.file-system-header {
    background: transparent !important;
    border-bottom: 1px solid var(--line) !important;
    padding: 0.35rem 0.55rem 1rem !important;
    margin-bottom: 0.85rem;
}

.file-system-header::after {
    display: none !important;
}

.file-system-header .navbar-brand {
    gap: 0.65rem;
    margin: 0 !important;
}

.file-system-header .navbar-brand-img {
    width: 34px !important;
    max-width: 34px !important;
    height: 34px !important;
    object-fit: contain;
}

.file-system-header .navbar-brand::after {
    content: none !important;
    display: none !important;
}

.file-system-sidebar .tree-children .tree-node::before,
.file-system-sidebar .tree-children .tree-node.active::before {
    display: none !important;
    content: none !important;
}

.file-system-sidebar .tree-children {
    padding-left: 0.5rem !important;
    margin-left: 0.35rem !important;
    border-left: 1px solid var(--line);
}

.file-system-sidebar .tree-node {
    border-radius: var(--radius-sm);
    color: var(--muted) !important;
    font-weight: 550;
    font-size: 0.9rem;
    padding: 0.55rem 0.7rem !important;
}

.file-system-sidebar .tree-node:hover {
    background: #f6f7fb !important;
    color: var(--ink) !important;
    border-radius: var(--radius-sm);
}

.file-system-sidebar .tree-node.active {
    background: var(--brand-soft) !important;
    color: var(--brand-ink) !important;
    border-radius: var(--radius-sm);
}

.file-system-sidebar .tree-icon {
    color: inherit !important;
    opacity: 0.9;
}

.file-system-sidebar .tree-label {
    color: inherit !important;
}

.file-system-sidebar .sidebar-logout,
.file-system-sidebar .btn-logout,
.file-system-sidebar [wire\:click*="logout"] .btn,
.file-system-sidebar .livewire-logout .btn {
    width: 100%;
    justify-content: center;
}

/* ---- Content / cards ---- */
.main-content .container-fluid.py-4,
.main-content .container-fluid.px-4 {
    padding-top: 1.5rem !important;
    padding-bottom: 1.25rem !important;
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
}

.main-content .card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: none;
    background: var(--surface);
}

.main-content .card.shadow-sm,
.main-content .card.my-4.shadow-sm {
    box-shadow: none !important;
}

.main-content .card:has(table.table) {
    box-shadow: none !important;
}

.main-content .card.my-4 {
    margin-top: 0.75rem !important;
    margin-bottom: 1rem !important;
}

.main-content .card .card-header {
    background: transparent;
    border-bottom: 1px solid var(--line);
    padding: 0.85rem 1.15rem;
}

.main-content .card .card-header.pb-0 {
    padding-bottom: 0.85rem !important;
    border-bottom: 0;
}

.main-content .container {
    max-width: 1100px;
}

/* ---- User chip ---- */
.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.3rem 0.55rem 0.3rem 0.3rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    box-shadow: var(--shadow-sm);
    max-width: 280px;
}

.user-chip__avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), #7c74f0);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-chip__meta {
    min-width: 0;
    line-height: 1.15;
}

.user-chip__name {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-chip__role {
    display: block;
    font-size: 0.68rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.page-title-duplicate {
    display: none !important;
}

/* ---- Button system (map MD/Bootstrap to mockup) ---- */
.main-content .btn,
.wg-main .btn,
.file-system-sidebar .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    height: 38px;
    padding: 0 0.95rem;
    margin: 0 !important;
    border-radius: var(--radius-sm) !important;
    border: 1px solid transparent;
    font-weight: 650;
    font-size: 0.84rem;
    font-family: var(--font);
    box-shadow: none !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.main-content .btn.btn-sm,
.wg-main .btn.btn-sm {
    height: 32px;
    padding: 0 0.7rem;
    font-size: 0.78rem;
    border-radius: var(--radius-xs) !important;
}

.main-content .btn.bg-gradient-primary,
.main-content .btn.btn-primary,
.wg-main .btn.bg-gradient-primary,
.wg-main .btn.btn-primary {
    background: var(--brand) !important;
    background-image: none !important;
    color: #fff !important;
    border-color: transparent !important;
}

.main-content .btn.bg-gradient-primary:hover,
.main-content .btn.btn-primary:hover,
.wg-main .btn.bg-gradient-primary:hover,
.wg-main .btn.btn-primary:hover {
    background: var(--brand-hover) !important;
    color: #fff !important;
}

.main-content .btn.btn-outline-primary,
.main-content .btn.btn-outline-secondary,
.main-content .btn.btn-secondary,
.wg-main .btn.btn-outline-primary,
.wg-main .btn.btn-outline-secondary,
.wg-main .btn.btn-secondary {
    background: var(--surface) !important;
    border-color: var(--line-strong) !important;
    color: var(--ink) !important;
}

.main-content .btn.btn-outline-primary:hover,
.main-content .btn.btn-outline-secondary:hover,
.main-content .btn.btn-secondary:hover,
.wg-main .btn.btn-outline-primary:hover,
.wg-main .btn.btn-outline-secondary:hover,
.wg-main .btn.btn-secondary:hover {
    background: #f7f8fc !important;
    color: var(--ink) !important;
}

.main-content .btn.btn-danger,
.main-content .btn.bg-gradient-danger,
.wg-main .btn.btn-danger {
    background: var(--danger-soft) !important;
    background-image: none !important;
    color: var(--danger) !important;
    border-color: #f3c4c4 !important;
}

.main-content .btn.btn-link,
.main-content .btn.btn-ghost,
.wg-main .btn.btn-link,
.wg-main .btn.btn-ghost {
    background: transparent !important;
    color: var(--muted) !important;
    border-color: transparent !important;
}

.main-content .btn.btn-link:hover,
.main-content .btn.btn-ghost:hover,
.wg-main .btn.btn-link:hover,
.wg-main .btn.btn-ghost:hover {
    background: #f0f1f6 !important;
    color: var(--ink) !important;
}

.main-content .btn.btn-success,
.wg-main .btn.btn-success {
    background: var(--success-soft) !important;
    background-image: none !important;
    color: var(--success) !important;
    border-color: #bfe5cd !important;
}

/* KPI / metric card icons — style the BOX only, never the glyph itself.
   Material Dashboard uses .icon-shape i { position:relative; top:11px } / .icon-lg i { top:31% }
   which must be fully reset. Material Icons Round / FA glyphs also sit optically high in their
   em/viewBox, so a small translateY nudge is required for true visual centering. */
.main-content .card-header-icon.icon-shape,
.wg-main .card-header-icon.icon-shape {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    background: var(--brand-soft) !important;
    color: var(--brand) !important;
    box-shadow: none !important;
    border-radius: 10px !important;
    margin: 0 !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0;
    overflow: visible;
    position: relative;
    line-height: 0 !important;
}

.main-content .card .card-header.p-3.pt-2 {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.main-content .card-header-icon.icon-shape i,
.main-content .card-header-icon.icon-lg i,
.main-content .card-header-icon .material-icons,
.main-content .card-header-icon .dashboard-material-icon,
.wg-main .card-header-icon.icon-shape i,
.wg-main .card-header-icon.icon-lg i,
.wg-main .card-header-icon .material-icons,
.wg-main .card-header-icon .dashboard-material-icon {
    position: static !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    /* Optical center: Material Icons Round paints slightly high in the em-square */
    transform: translateY(1px) !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    display: block !important;
    width: auto !important;
    height: auto !important;
    max-width: none !important;
    max-height: none !important;
    font-size: 22px !important;
    line-height: 1 !important;
    overflow: visible !important;
    opacity: 1 !important;
    color: var(--brand) !important;
    text-align: center;
}

.main-content .card .card-header.p-3.pt-2 .mt-3.pt-1 {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

.main-content .card .card-header.p-3.pt-2 p.text-sm {
    font-size: 0.72rem !important;
    font-weight: 650;
    color: var(--muted) !important;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.15rem !important;
}

.main-content .card .card-header.p-3.pt-2 h4 {
    font-size: 1.25rem !important;
    font-weight: 750;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}

.main-content .card-footer.p-3 {
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.8rem;
}

.attachments-dropzone,
.wg-dropzone {
    border: 1.5px dashed var(--line-strong) !important;
    border-radius: var(--radius);
    background: #fafbfe !important;
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: var(--muted);
}

.form-card .card-header.bg-primary,
.upload-form-header {
    background: var(--brand-soft) !important;
    color: var(--brand-ink) !important;
    border-bottom: 1px solid var(--line);
}

.btn-split {
    padding-right: 0.35rem;
    gap: 0.25rem;
}

.btn-split .split {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-left: 0.2rem;
    border-left: 1px solid rgba(255, 255, 255, 0.28);
    padding-left: 0.35rem;
}

/* ---- Toolbars ---- */
.page-toolbar,
.wg-toolbar,
.list-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    margin: 0 0 0.85rem;
    padding: 0;
}

.page-toolbar__actions,
.wg-toolbar__actions,
.list-toolbar__actions {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.5rem;
    flex: 0 1 auto;
    min-width: 0;
}

/* Tip 5: date range chip matches toolbar button height + vertical center */
.page-toolbar__actions {
    align-items: center !important;
}

.page-toolbar__actions .dropdown {
    display: inline-flex !important;
    align-items: center;
    height: 38px;
}

.page-toolbar__actions .badge.bg-secondary,
.page-toolbar .toolbar-date-badge,
.toolbar-date-badge {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.4rem;
    height: 38px !important;
    min-height: 38px !important;
    max-height: 38px !important;
    padding: 0 0.95rem !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: var(--radius-sm) !important;
    font-family: var(--font);
    font-size: 0.84rem !important;
    font-weight: 650 !important;
    letter-spacing: 0.01em;
    line-height: 1 !important;
    white-space: nowrap;
    box-sizing: border-box !important;
    vertical-align: middle;
    text-transform: none !important;
}

.page-toolbar__actions .btn,
.page-toolbar__actions .btn.btn-primary,
.page-toolbar__actions .btn-split {
    height: 38px !important;
    min-height: 38px !important;
    max-height: 38px !important;
    margin: 0 !important;
    align-self: center;
}

.page-toolbar__actions .badge.bg-secondary .material-icons,
.page-toolbar .toolbar-date-badge .material-icons,
.toolbar-date-badge .material-icons,
.page-toolbar__actions .badge.bg-secondary .filter-icon-inline,
.page-toolbar .toolbar-date-badge .filter-icon-inline,
.toolbar-date-badge .filter-icon-inline {
    font-size: 18px !important;
    line-height: 1 !important;
    width: 18px;
    height: 18px;
    margin: 0 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
}

@media (max-width: 575.98px) {
    .page-toolbar__actions,
    .wg-toolbar__actions,
    .list-toolbar__actions {
        flex-wrap: wrap;
        width: 100%;
    }
}

.list-toolbar__search,
.wg-toolbar__search {
    position: relative;
    flex: 1 1 240px;
    max-width: 320px;
    margin: 0;
}

.list-toolbar__search .form-control,
.wg-toolbar__search .form-control {
    height: 40px;
    padding: 0 2.25rem 0 0.9rem;
    border-radius: var(--radius-sm) !important;
    border: 1px solid var(--line-strong) !important;
    font-size: 0.875rem;
    background: var(--surface) !important;
}

.list-toolbar__search .form-control:focus,
.wg-toolbar__search .form-control:focus {
    border-color: var(--brand) !important;
    box-shadow: 0 0 0 3px var(--brand-soft);
}

.list-toolbar__search .search-icon {
    position: absolute;
    right: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted-2);
    pointer-events: none;
}

.list-toolbar__actions .form-control,
.list-toolbar__actions .form-select:not(.selectize-dropdown):not(.selectize-control),
.audit-user-filter:not(.selectize-dropdown):not(.selectize-control) {
    height: 40px;
    width: auto;
    min-width: 160px;
    max-width: 220px;
    border-radius: var(--radius-sm) !important;
    border: 1px solid var(--line-strong) !important;
    background: var(--surface) !important;
    font-size: 0.85rem;
    padding: 0 0.75rem !important;
}

.audit-user-filter-wrap {
    min-width: 180px;
    max-width: 220px;
    flex: 0 0 200px;
}

.audit-user-filter-wrap .selectize-control {
    width: 100% !important;
}

.audit-user-filter-wrap .selectize-input {
    min-width: 0 !important;
    max-width: none !important;
    width: 100% !important;
}

.list-toolbar__actions input[type="date"] {
    min-width: 140px;
    max-width: 150px;
    flex: 0 0 145px;
    color: var(--ink);
    color-scheme: light;
}

/* ---- Fields / selects with custom chevron ----
   IMPORTANT: Selectize copies .form-select onto BOTH .selectize-control and
   .selectize-dropdown — never apply field chrome to those wrappers. */
.main-content .form-control.border,
.main-content .form-control:not(.selectize-dropdown):not(.selectize-control):not(.selectize-input),
.main-content .form-select:not(.selectize-dropdown):not(.selectize-control),
.wg-main .form-control:not(.selectize-dropdown):not(.selectize-control):not(.selectize-input),
.wg-main .form-select:not(.selectize-dropdown):not(.selectize-control) {
    height: 40px;
    padding-left: 0.9rem !important;
    padding-right: 0.9rem !important;
    border-radius: var(--radius-sm) !important;
    border-color: var(--line-strong) !important;
    font-family: var(--font);
    font-size: 0.86rem;
}

.main-content textarea.form-control,
.wg-main textarea.form-control {
    height: auto;
    min-height: 96px;
}

.main-content .form-control:not(.selectize-dropdown):not(.selectize-control):not(.selectize-input):focus,
.main-content .form-select:not(.selectize-dropdown):not(.selectize-control):focus,
.wg-main .form-control:not(.selectize-dropdown):not(.selectize-control):not(.selectize-input):focus,
.wg-main .form-select:not(.selectize-dropdown):not(.selectize-control):focus {
    border-color: var(--brand) !important;
    box-shadow: 0 0 0 3px var(--brand-soft);
}

/* Login fields: single border, no soft ring */
.main-content .login-form .login-field__input.form-control:focus,
.login-view .login-form .login-field__input.form-control:focus {
    border-color: #5b4fe8 !important;
    box-shadow: none !important;
    outline: none !important;
}

/* Tip 1: outline login fields handled in login.css (single continuous border) */
.main-content .input-group.input-group-outline .form-label:before,
.main-content .input-group.input-group-outline .form-label:after {
    display: none !important;
    content: none !important;
}

.main-content select.form-select,
.main-content select.form-control,
.wg-main select.form-select,
.wg-main select.form-control,
.list-toolbar__actions select:not(.selectized) {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 2.4rem !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7285' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.75rem center !important;
    background-size: 16px !important;
    background-color: var(--surface) !important;
}

.main-content .form-select.form-select-sm:not(.selectize-dropdown):not(.selectize-control),
.wg-main .form-select.form-select-sm:not(.selectize-dropdown):not(.selectize-control) {
    height: 40px !important;
    min-height: 40px !important;
    padding-top: 0.45rem !important;
    padding-bottom: 0.45rem !important;
    padding-left: 0.9rem !important;
    padding-right: 2.4rem !important;
    font-size: 0.86rem !important;
}

/* Global Selectize control reset — wins over page-local .form-select chrome */
.selectize-control.form-select,
.selectize-control.form-control,
.form-select.selectize-control,
.form-control.selectize-control {
    height: auto !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    overflow: visible !important;
    appearance: none !important;
    -webkit-appearance: none !important;
}

.main-content .selectize-input,
.wg-main .selectize-input {
    min-height: 40px !important;
    height: auto !important;
    padding: 0.45rem 2.25rem 0.45rem 0.9rem !important;
    border: 1px solid var(--line-strong) !important;
    border-radius: var(--radius-sm) !important;
    background: var(--surface) !important;
    background-image: none !important;
    box-shadow: none !important;
    font-family: var(--font);
    font-size: 0.86rem;
    line-height: 1.35 !important;
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.import-models-select {
    margin-bottom: 1.25rem !important;
}

.import-models-select .selectize-control {
    margin-bottom: 0.75rem !important;
}

.main-content .selectize-input.focus,
.wg-main .selectize-input.focus {
    border-color: var(--brand) !important;
    box-shadow: 0 0 0 3px var(--brand-soft) !important;
}

.main-content .selectize-input input,
.wg-main .selectize-input input {
    font-size: 0.86rem !important;
    line-height: 1.35 !important;
}

.main-content .selectize-dropdown,
.wg-main .selectize-dropdown,
.main-content .selectize-dropdown.form-select,
.wg-main .selectize-dropdown.form-select,
.main-content .selectize-dropdown.form-control,
.wg-main .selectize-dropdown.form-control {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 0 !important;
    margin-top: 4px !important;
    border: 1px solid var(--line-strong) !important;
    border-radius: var(--radius-sm) !important;
    background: #fff !important;
    background-color: #fff !important;
    background-image: none !important;
    box-shadow: 0 10px 28px rgba(26, 29, 38, 0.14) !important;
    z-index: 1080 !important;
    overflow: hidden !important;
    color: var(--ink) !important;
}

.main-content .selectize-dropdown-content,
.wg-main .selectize-dropdown-content {
    max-height: 260px !important;
    overflow-y: auto !important;
    background: #fff !important;
    padding: 0.35rem 0 !important;
}

.main-content .selectize-dropdown .option,
.main-content .selectize-dropdown .optgroup-header,
.main-content .selectize-dropdown .create,
.main-content .selectize-dropdown .no-results,
.wg-main .selectize-dropdown .option,
.wg-main .selectize-dropdown .optgroup-header,
.wg-main .selectize-dropdown .create,
.wg-main .selectize-dropdown .no-results {
    height: auto !important;
    min-height: 0 !important;
    padding: 0.55rem 0.95rem !important;
    line-height: 1.35 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    background: transparent !important;
    background-image: none !important;
    color: var(--ink) !important;
    border: 0 !important;
    border-radius: 0 !important;
}

.main-content .selectize-dropdown .option.active,
.main-content .selectize-dropdown .option:hover,
.wg-main .selectize-dropdown .option.active,
.wg-main .selectize-dropdown .option:hover {
    background: #f3f4f8 !important;
    color: var(--ink) !important;
}

.main-content .selectize-dropdown .option.selected,
.wg-main .selectize-dropdown .option.selected {
    background: var(--brand-soft) !important;
    color: var(--brand-ink) !important;
}

/* ---- Filters ---- */
.filters-section,
.wg-filters {
    background: var(--surface) !important;
    border: 1px solid var(--line) !important;
    border-radius: var(--radius) !important;
    margin-bottom: 0.85rem !important;
    padding: 1rem 1.1rem 1.15rem;
    box-shadow: var(--shadow-sm);
}

.filters-section .form-label,
.wg-filters .form-label {
    display: block;
    margin-bottom: 0.5rem !important;
    font-size: 0.78rem;
    font-weight: 650;
    color: var(--muted);
}

.filters-section .row.g-3,
.wg-filters .row.g-3 {
    --bs-gutter-x: 1.15rem;
    --bs-gutter-y: 1.15rem;
}

.filters-section .row + .row,
.filters-section .d-flex.flex-wrap.gap-2 + .row,
.filters-section .mb-3 + .row,
.filters-section .mb-4 + .row {
    margin-top: 0.35rem;
}

.filters-section .btn-group-presets,
.filters-section .quick-filter-tabs,
.payment-quick-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.filters-section.is-collapsed {
    padding: 0 !important;
}

.filters-section.is-collapsed > .filters-section__header {
    border-bottom: 0 !important;
    margin-bottom: 0 !important;
    padding: 0.65rem 0.9rem !important;
}

.filters-section__header,
.wg-filters__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.15rem 0 0.85rem;
    border-bottom: 1px solid var(--line);
    margin-bottom: 0.85rem;
}

.filters-section.is-collapsed .filters-section__header {
    margin-bottom: 0;
    padding-bottom: 0;
}

.filters-section__title,
.wg-filters__title {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--ink);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.filters-section__title .material-icons {
    font-size: 18px;
    color: var(--muted);
}

.card > .card-header.filters-card-header {
    padding: 0.65rem 1rem;
}

.card.is-filters-collapsed > .card-header.filters-card-header {
    border-bottom: 0;
}

.wg-filters-grid,
.filters-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

@media (max-width: 1100px) {
    .wg-filters-grid,
    .filters-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 700px) {
    .wg-filters-grid,
    .filters-grid {
        grid-template-columns: 1fr;
    }
}

.wg-seg,
.seg {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.25rem;
    background: #f1f2f7;
    border-radius: var(--radius-sm);
}

.wg-seg button,
.wg-seg .seg-btn,
.seg button,
.seg .seg-btn {
    border: 0;
    background: transparent;
    height: 32px;
    padding: 0 0.75rem;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 650;
    color: var(--muted);
    cursor: pointer;
}

.wg-seg button.active,
.wg-seg .seg-btn.active,
.wg-seg button.is-active,
.wg-seg .seg-btn.is-active,
.seg button.active,
.seg .seg-btn.active,
.seg button.is-active,
.seg .seg-btn.is-active {
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow-sm);
}

.hint {
    font-size: 0.75rem;
    color: var(--muted);
}

/* ---- Tables ---- */
.main-content .table thead th {
    font-size: 0.7rem !important;
    letter-spacing: 0.05em;
    color: var(--muted) !important;
    opacity: 1 !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    border-bottom: 1px solid var(--line) !important;
    padding: 0.7rem 0.9rem;
    background: #f8f9fc;
    white-space: nowrap;
}

.main-content .table tbody tr {
    transition: background-color 0.12s ease;
}

.main-content .table tbody tr:hover {
    background-color: #fafbfe;
}

.main-content .table tbody td {
    padding: 0.75rem 0.9rem;
    border-color: #eef0f5;
    vertical-align: middle;
    font-size: 0.86rem;
    color: var(--ink) !important;
    opacity: 1 !important;
}

.main-content .table tbody td.text-secondary,
.main-content .table tbody .text-secondary,
.main-content .table tbody .opacity-7,
.main-content .table tbody td.opacity-7,
.main-content .table tbody a.text-secondary {
    color: var(--ink) !important;
    opacity: 1 !important;
}

.main-content .table thead th.text-secondary,
.main-content .table thead .opacity-7 {
    color: var(--muted) !important;
    opacity: 1 !important;
}

.font-monospace,
.mono {
    font-family: var(--mono) !important;
    font-size: 0.8rem;
}

.role-badge,
.wg-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    height: 24px;
    padding: 0 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.role-badge,
.badge-brand,
.wg-badge.badge-brand {
    background: var(--brand-soft);
    color: var(--brand-ink);
}

.badge-neutral,
.wg-badge.badge-neutral,
.badge.badge-neutral {
    background: #eef0f5 !important;
    color: #4b5568 !important;
    border: 0 !important;
    box-shadow: none !important;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
}

.badge-success,
.wg-badge.badge-success,
.badge-status-success {
    background: var(--success-soft);
    color: var(--success);
}

.badge-warn,
.wg-badge.badge-warn,
.badge-status-warn {
    background: var(--warn-soft);
    color: var(--warn);
}

.badge-danger,
.wg-badge.badge-danger,
.badge-status-danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.badge-info,
.wg-badge.badge-info {
    background: var(--info-soft);
    color: var(--info);
}

.wg-dot,
.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.badge-status {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
}

.badge-status.overdue {
    background: var(--danger-soft);
    color: var(--danger);
}

/* ---- Pagination (rectangular) ---- */
.main-content .pagination,
.wg-main .pagination {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: #f3f4f8;
    padding: 0.2rem;
    border-radius: var(--radius-sm);
    margin: 0;
}

.main-content .pagination .page-item .page-link,
.wg-main .pagination .page-item .page-link,
.main-content .pagination .page-item span.page-link,
.wg-main .pagination .page-item span.page-link,
.main-content .pagination .page-item button.page-link,
.wg-main .pagination .page-item button.page-link {
    min-width: 32px !important;
    width: auto;
    height: 32px !important;
    min-height: 32px !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    border: 0 !important;
    background: transparent !important;
    border-radius: 6px !important;
    color: var(--muted) !important;
    font-size: 0.8rem;
    font-weight: 650;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 0.55rem !important;
    line-height: 1 !important;
    box-sizing: border-box;
    flex-shrink: 0;
}

.main-content .pagination .page-item.active .page-link,
.wg-main .pagination .page-item.active .page-link {
    background: var(--surface) !important;
    color: var(--ink) !important;
    box-shadow: var(--shadow-sm) !important;
}

.main-content .pagination .page-item.disabled .page-link,
.wg-main .pagination .page-item.disabled .page-link,
.main-content .pagination .page-item.disabled span.page-link,
.wg-main .pagination .page-item.disabled span.page-link {
    min-width: 32px !important;
    height: 32px !important;
    min-height: 32px !important;
    opacity: 0.55 !important;
    color: var(--muted) !important;
    pointer-events: none;
}

.main-content .pagination .page-item .page-link:hover,
.wg-main .pagination .page-item .page-link:hover {
    background: #e8eaf1 !important;
    color: var(--ink) !important;
}

.wg-pager,
.pager {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-top: 1px solid var(--line);
    width: 100%;
}

.wg-pager > *,
.pager > * {
    width: 100%;
    min-width: 0;
}

.wg-pager > nav,
.wg-pager > nav.d-flex,
.wg-pager nav.d-flex {
    width: 100% !important;
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start !important;
    gap: 0.75rem;
}

.wg-pager nav > .d-flex.justify-content-between,
.wg-pager nav > div.d-flex,
.wg-pager nav > .d-none.flex-sm-fill,
.wg-pager nav > .d-none.d-sm-flex,
.wg-pager nav > .justify-content-sm-between {
    width: 100% !important;
    flex: 1 1 100% !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 0.85rem !important;
}

.wg-pager nav p,
.wg-pager .small.text-muted,
.wg-pager p.small {
    margin: 0 !important;
    font-size: 0.8rem !important;
    color: var(--muted) !important;
    white-space: nowrap;
}

.wg-pager__meta,
.pager-meta {
    font-size: 0.8rem;
    color: var(--muted);
    white-space: nowrap;
}

/* Hide Laravel meta when a custom meta sibling exists (legacy) */
.wg-pager:has(.wg-pager__meta) nav > .d-flex > div:first-child:has(p),
.wg-pager:has(.wg-pager__meta) nav > .d-none.d-sm-flex > div:first-child:has(p) {
    display: none !important;
}

.wg-pager:has(.wg-pager__meta) nav > .d-flex,
.wg-pager:has(.wg-pager__meta) nav > .d-none.d-sm-flex {
    justify-content: flex-start !important;
}

/* Keep meta + controls as one left cluster (wide tables) */
.wg-pager .d-flex.justify-content-center:has(.pagination),
.wg-pager .justify-content-sm-between,
.wg-pager .justify-content-between {
    width: 100%;
    justify-content: flex-start !important;
    gap: 0.85rem !important;
}

/* Also catch bare Laravel links() outside wg-pager */
.wg-main nav.d-flex.justify-content-between,
.main-content nav.d-flex.justify-content-between {
    justify-content: flex-start !important;
    gap: 0.85rem;
}

.wg-main nav .justify-content-sm-between,
.main-content nav .justify-content-sm-between {
    justify-content: flex-start !important;
    gap: 0.85rem !important;
}

/* ---- Floating bulk bar ---- */
.floating-bulk-action-bar,
.float-bar {
    --bulk-bar-left: calc(var(--sidebar-w) + 1rem);
    position: fixed !important;
    left: var(--bulk-bar-left) !important;
    right: 1rem !important;
    bottom: max(1rem, calc(env(safe-area-inset-bottom, 0px) + 0.75rem)) !important;
    transform: none !important;
    display: block !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    padding: 0 !important;
    background: var(--ink) !important;
    color: #fff !important;
    border: 0 !important;
    border-radius: 1rem !important;
    box-shadow: 0 12px 32px rgba(26, 29, 38, 0.28) !important;
    backdrop-filter: none !important;
    z-index: 1080 !important;
    overflow: visible !important;
}

.floating-bulk-action-bar .floating-bulk-panel,
.floating-bulk-action-bar .floating-bulk-card {
    overflow: visible !important;
}

@media (max-width: 1199.98px) {
    .floating-bulk-action-bar,
    .float-bar {
        --bulk-bar-left: 1rem;
    }
}

.floating-bulk-chip {
    display: none !important;
}

.floating-bulk-scrim {
    display: none !important;
}

.floating-bulk-panel,
.floating-bulk-card {
    display: block;
    min-width: 0;
}

.floating-bulk-sheet-handle {
    display: none;
}

.floating-bulk-action-bar .bulk-action-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    width: 100%;
    min-width: 0;
    padding: 0.6rem 0.75rem 0.6rem 1.1rem !important;
    overflow: visible;
}

.floating-bulk-action-bar .bulk-action-left {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}

.floating-bulk-action-bar .bulk-action-meta {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.floating-bulk-action-bar .bulk-action-right {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    justify-content: flex-end;
    gap: 0.45rem;
    min-width: 0;
    flex-wrap: nowrap !important;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.floating-bulk-action-bar .bulk-action-right::-webkit-scrollbar {
    height: 4px;
}

.floating-bulk-action-bar .selected-count,
.float-bar strong {
    font-size: 0.84rem !important;
    font-weight: 600 !important;
    color: #fff !important;
    white-space: nowrap;
}

.floating-bulk-action-bar .selected-subtitle {
    font-size: 0.72rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.55);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 18rem;
}

.floating-bulk-close {
    display: none;
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

.floating-bulk-close:hover,
.floating-bulk-close:focus {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.bulk-action-group-label {
    display: none;
    width: 100%;
    margin: 0.15rem 0 0.05rem;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.42);
}

.floating-bulk-action-bar .bulk-action-btn.is-primary,
.floating-bulk-action-bar .bulk-action-btn.is-primary:link,
.floating-bulk-action-bar .bulk-action-btn.is-primary:visited,
.floating-bulk-action-bar a.bulk-action-btn.is-primary,
.floating-bulk-action-bar button.bulk-action-btn.is-primary {
    background: #fff !important;
    background-image: none !important;
    border-color: transparent !important;
    color: var(--ink) !important;
}

.floating-bulk-action-bar .bulk-action-btn.is-primary i,
.floating-bulk-action-bar .bulk-action-btn.is-primary span:not(.badge),
.floating-bulk-action-bar .bulk-action-btn.is-primary svg,
.floating-bulk-action-bar .bulk-action-btn.is-primary:hover i,
.floating-bulk-action-bar .bulk-action-btn.is-primary:hover span:not(.badge),
.floating-bulk-action-bar .bulk-action-btn.is-primary:hover svg {
    color: var(--ink) !important;
    fill: var(--ink) !important;
}

.floating-bulk-action-bar .bulk-action-btn.is-primary:hover,
.floating-bulk-action-bar .bulk-action-btn.is-primary:focus,
.floating-bulk-action-bar .bulk-action-btn.is-primary:focus-visible,
.floating-bulk-action-bar .bulk-action-btn.is-primary:active {
    background: #f3f4f8 !important;
    border-color: transparent !important;
    color: var(--ink) !important;
}

/* Default dark glass buttons — override material-dashboard white pills */
.floating-bulk-action-bar .bulk-action-btn,
.floating-bulk-action-bar .bulk-action-btn:link,
.floating-bulk-action-bar .bulk-action-btn:visited,
.floating-bulk-action-bar .bulk-action-btn:hover,
.floating-bulk-action-bar .bulk-action-btn:focus,
.floating-bulk-action-bar .bulk-action-btn:focus-visible,
.floating-bulk-action-bar .bulk-action-btn:active,
.floating-bulk-action-bar a.bulk-action-btn,
.floating-bulk-action-bar button.bulk-action-btn,
.floating-bulk-action-bar .btn,
.floating-bulk-action-bar .btn:hover,
.floating-bulk-action-bar .btn:focus,
.floating-bulk-action-bar .btn:active,
.floating-bulk-action-bar .btn:focus-visible,
.float-bar .btn,
.float-bar .btn:hover,
.float-bar .btn:focus,
.float-bar .btn:active {
    height: 34px !important;
    flex: 0 0 auto !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.4rem !important;
    padding: 0 0.85rem !important;
    border-radius: 999px !important;
    font-size: 0.72rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.02em;
    text-transform: uppercase !important;
    text-decoration: none !important;
    box-shadow: none !important;
    transform: none !important;
    margin: 0 !important;
    background: rgba(255, 255, 255, 0.1) !important;
    background-image: none !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    color: #fff !important;
    filter: none !important;
    outline: none !important;
    opacity: 1 !important;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap !important;
}

.floating-bulk-action-bar .bulk-action-btn i,
.floating-bulk-action-bar .bulk-action-btn span:not(.badge),
.floating-bulk-action-bar .bulk-action-btn svg,
.floating-bulk-action-bar .bulk-action-btn:hover i,
.floating-bulk-action-bar .bulk-action-btn:hover span:not(.badge),
.floating-bulk-action-bar .bulk-action-btn:hover svg,
.floating-bulk-action-bar .bulk-action-btn:focus i,
.floating-bulk-action-bar .bulk-action-btn:focus span:not(.badge),
.floating-bulk-action-bar .bulk-action-btn:active i,
.floating-bulk-action-bar .bulk-action-btn:active span:not(.badge),
.floating-bulk-action-bar .bulk-action-btn:active svg {
    color: #fff !important;
    fill: #fff !important;
}

.floating-bulk-action-bar .bulk-action-btn:hover,
.floating-bulk-action-bar .bulk-action-btn:focus,
.floating-bulk-action-bar .bulk-action-btn:focus-visible,
.floating-bulk-action-bar .bulk-action-btn:active,
.floating-bulk-action-bar .btn:hover,
.floating-bulk-action-bar .btn:focus,
.floating-bulk-action-bar .btn:active {
    background: rgba(255, 255, 255, 0.18) !important;
    background-image: none !important;
    border-color: rgba(255, 255, 255, 0.28) !important;
    color: #fff !important;
}

.floating-bulk-action-bar .bulk-action-btn.btn-danger,
.floating-bulk-action-bar .bulk-action-btn.delete-btn,
.floating-bulk-action-bar .btn-danger,
.floating-bulk-action-bar .delete-btn,
.floating-bulk-action-bar .delete-btn:hover,
.floating-bulk-action-bar .delete-btn:focus,
.floating-bulk-action-bar .delete-btn:active,
.floating-bulk-action-bar .delete-btn:focus-visible {
    background: #ef4444 !important;
    background-image: none !important;
    border-color: transparent !important;
    color: #fff !important;
}

.floating-bulk-action-bar .delete-btn:hover,
.floating-bulk-action-bar .delete-btn:focus,
.floating-bulk-action-bar .delete-btn:active {
    background: #dc2626 !important;
}

.floating-bulk-action-bar .bulk-action-btn.documents-btn {
    padding-right: 0.85rem !important;
}

/*
 * Phone + phone-landscape: chip → sheet.
 * iPhone landscape is ~874px wide, so max-width alone is not enough —
 * also match short landscape viewports (max-height).
 */
@media (max-width: 767.98px), (orientation: landscape) and (max-height: 520px) {
    .floating-bulk-action-bar:has(.floating-bulk-chip),
    .float-bar:has(.floating-bulk-chip) {
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        bottom: 0 !important;
        width: 100% !important;
        max-width: none !important;
        height: 0 !important;
        overflow: visible !important;
        background: transparent !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        pointer-events: none !important;
    }

    .floating-bulk-action-bar:has(.floating-bulk-chip).is-open {
        top: 0 !important;
        height: 100% !important;
        pointer-events: auto !important;
    }

    .floating-bulk-action-bar:not(:has(.floating-bulk-chip)),
    .float-bar:not(:has(.floating-bulk-chip)) {
        left: max(0.75rem, env(safe-area-inset-left, 0px)) !important;
        right: max(0.75rem, env(safe-area-inset-right, 0px)) !important;
        width: auto !important;
        max-width: none !important;
        bottom: max(0.75rem, calc(env(safe-area-inset-bottom, 0px) + 0.65rem)) !important;
        border-radius: 1.15rem !important;
    }

    .floating-bulk-action-bar:not(:has(.floating-bulk-chip)) .bulk-action-content {
        flex-direction: column;
        align-items: stretch;
        gap: 0.55rem;
        padding: 0.7rem 0.75rem !important;
    }

    .floating-bulk-action-bar:not(:has(.floating-bulk-chip)) .bulk-action-right {
        max-width: 100%;
        overflow-x: auto;
        justify-content: flex-start;
    }

    .floating-bulk-chip {
        pointer-events: auto !important;
        display: inline-flex !important;
        align-items: center;
        gap: 0.55rem;
        position: fixed !important;
        left: 50%;
        bottom: max(0.75rem, calc(env(safe-area-inset-bottom, 0px) + 0.65rem));
        transform: translateX(-50%);
        z-index: 1081;
        border: 0;
        background: var(--ink) !important;
        color: #fff !important;
        border-radius: 999px;
        padding: 0.65rem 1rem 0.65rem 0.65rem;
        box-shadow: 0 12px 32px rgba(26, 29, 38, 0.4);
        font: inherit;
        font-size: 0.82rem;
        font-weight: 700;
        cursor: pointer;
        white-space: nowrap;
    }

    .floating-bulk-chip__count {
        min-width: 24px;
        height: 24px;
        border-radius: 999px;
        background: var(--brand);
        color: #fff;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 0.72rem;
        font-weight: 700;
    }

    .floating-bulk-chip__chev {
        opacity: 0.7;
        font-size: 0.72rem;
    }

    .floating-bulk-action-bar.is-open .floating-bulk-chip {
        display: none !important;
    }

    .floating-bulk-action-bar:has(.floating-bulk-chip) .floating-bulk-panel {
        display: none;
        position: absolute;
        inset: 0;
        z-index: 1;
    }

    .floating-bulk-action-bar.is-open .floating-bulk-panel {
        display: block !important;
    }

    .floating-bulk-action-bar:has(.floating-bulk-chip) .floating-bulk-scrim {
        display: block !important;
        position: absolute;
        inset: 0;
        z-index: 1;
        border: 0;
        padding: 0;
        margin: 0;
        background: rgba(15, 17, 23, 0.48);
        cursor: pointer;
        pointer-events: auto !important;
    }

    .floating-bulk-action-bar:has(.floating-bulk-chip) .floating-bulk-card {
        display: block !important;
        position: absolute;
        left: max(0.65rem, env(safe-area-inset-left, 0px));
        right: max(0.65rem, env(safe-area-inset-right, 0px));
        bottom: max(0.55rem, calc(env(safe-area-inset-bottom, 0px) + 0.45rem));
        z-index: 2;
        max-height: min(78vh, calc(100% - 1rem));
        overflow: auto;
        -webkit-overflow-scrolling: touch;
        background: var(--ink) !important;
        color: #fff !important;
        border-radius: 1.35rem;
        box-shadow: 0 18px 44px rgba(0, 0, 0, 0.4);
        pointer-events: auto !important;
    }

    .floating-bulk-action-bar:has(.floating-bulk-chip) .bulk-action-content {
        flex-direction: column;
        align-items: stretch;
        gap: 0.65rem;
        padding: 0.85rem 0.8rem 0.95rem !important;
    }

    .floating-bulk-action-bar:has(.floating-bulk-chip) .bulk-action-left {
        width: 100%;
        justify-content: space-between;
        align-items: flex-start;
    }

    .floating-bulk-action-bar:has(.floating-bulk-chip) .floating-bulk-close {
        display: inline-flex !important;
    }

    .floating-bulk-action-bar:has(.floating-bulk-chip) .bulk-action-group-label {
        display: block;
    }

    .floating-bulk-action-bar:has(.floating-bulk-chip) .bulk-action-right {
        flex-direction: column;
        align-items: stretch;
        flex-wrap: nowrap !important;
        justify-content: flex-start;
        gap: 0.4rem;
        max-width: none;
        overflow: visible;
    }

    .floating-bulk-action-bar:has(.floating-bulk-chip) .bulk-action-btn,
    .floating-bulk-action-bar:has(.floating-bulk-chip) .btn {
        width: 100% !important;
        height: 44px !important;
        justify-content: flex-start !important;
        border-radius: 12px !important;
        font-size: 0.78rem !important;
        padding: 0 0.9rem !important;
        pointer-events: auto !important;
    }

    .floating-bulk-sheet-handle {
        display: block;
        width: 36px;
        height: 4px;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.22);
        margin: 0.15rem auto 0.35rem;
    }

    body:has(.floating-bulk-action-bar) .main-content,
    body:has(.floating-bulk-action-bar) .wg-main {
        padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px)) !important;
    }

    /* Phone landscape: right-docked side sheet + 2-col actions */
    @media (orientation: landscape) {
        .floating-bulk-action-bar:has(.floating-bulk-chip) .floating-bulk-card {
            left: auto;
            right: max(0.55rem, env(safe-area-inset-right, 0px));
            width: min(420px, 58vw);
            bottom: max(0.45rem, env(safe-area-inset-bottom, 0px));
            max-height: calc(100% - 0.9rem);
        }

        .floating-bulk-chip {
            left: auto;
            right: max(0.75rem, env(safe-area-inset-right, 0px));
            transform: none;
            bottom: max(0.55rem, calc(env(safe-area-inset-bottom, 0px) + 0.45rem));
        }

        .floating-bulk-sheet-handle {
            display: none;
        }

        .floating-bulk-action-bar:has(.floating-bulk-chip) .bulk-action-right {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 0.35rem;
        }

        .floating-bulk-action-bar:has(.floating-bulk-chip) .bulk-action-right .bulk-action-group-label,
        .floating-bulk-action-bar:has(.floating-bulk-chip) .bulk-action-right .clear-btn,
        .floating-bulk-action-bar:has(.floating-bulk-chip) .bulk-action-right .delete-btn,
        .floating-bulk-action-bar:has(.floating-bulk-chip) .bulk-action-right .view-btn,
        .floating-bulk-action-bar:has(.floating-bulk-chip) .bulk-action-right .is-primary {
            grid-column: 1 / -1;
        }
    }
}

/* ---- KPI cards ---- */
.wg-kpi,
.metric-card-modern {
    border-radius: var(--radius);
}

.wg-kpi {
    padding: 1rem;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
}

.wg-kpi__icon,
.kpi-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--brand-soft);
    color: var(--brand);
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0;
    line-height: 0 !important;
    overflow: visible;
}

.wg-kpi__icon i,
.wg-kpi__icon .svg-inline--fa,
.kpi-icon i,
.kpi-icon .svg-inline--fa {
    width: 18px !important;
    height: 18px !important;
    max-width: 18px !important;
    max-height: 18px !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1 !important;
    /* FA/Material glyphs sit optically high — nudge down for visual center */
    transform: translateY(1px) !important;
    color: var(--brand) !important;
    display: block !important;
}

.metric-card-modern .card-header-icon {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.wg-kpi__label,
.kpi-label,
.policy-metric-label {
    font-size: 0.72rem;
    font-weight: 650;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.wg-kpi__value,
.kpi-value,
.policy-metric-value {
    font-size: 1.25rem;
    font-weight: 750;
    letter-spacing: -0.03em;
    margin-top: 0.15rem;
    font-variant-numeric: tabular-nums;
}

.metric-card-modern .card-header {
    border-bottom: 0;
}

.metric-card-modern .card-header-icon {
    background: var(--brand-soft) !important;
    box-shadow: none !important;
}

.wg-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem; }
.wg-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.85rem; }
.wg-grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.85rem; }
.wg-grid-5 { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.85rem; }

@media (max-width: 1200px) {
    .wg-grid-5 { grid-template-columns: repeat(3, 1fr); }
    .wg-grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .wg-grid-2,
    .wg-grid-3,
    .wg-grid-4,
    .wg-grid-5 { grid-template-columns: 1fr; }
}

/* ---- Forms & tabs ---- */
.form-card .card-header {
    font-size: 1rem;
    font-weight: 650;
    color: var(--ink);
}

.wg-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem 1.25rem;
}

@media (max-width: 991.98px) {
    .wg-form-grid {
        grid-template-columns: 1fr;
    }
}

.wg-form-grid .form-span-2 {
    grid-column: 1 / -1;
}

.main-content .nav-tabs {
    border-bottom: 1px solid var(--line);
    gap: 0.25rem;
}

.main-content .nav-tabs .nav-link {
    border: 0;
    border-radius: 0;
    color: var(--muted);
    font-weight: 650;
    font-size: 0.86rem;
    padding: 0.7rem 0.9rem;
    background: transparent;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.main-content .nav-tabs .nav-link.active {
    color: var(--brand);
    background: transparent;
    box-shadow: none;
    border-bottom-color: var(--brand);
}

/* ---- Dropzone / empty ---- */
.wg-dropzone,
.org-logo-dropzone,
.dropzone {
    border: 1.5px dashed var(--line-strong) !important;
    border-radius: var(--radius);
    background: #fafbfe !important;
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: var(--muted);
}

.wg-empty-state {
    text-align: center;
    padding: 2.5rem 1.5rem;
    color: var(--muted);
}

.wg-empty-state__icon {
    font-size: 2.5rem;
    opacity: 0.45;
    margin-bottom: 0.75rem;
}

/* ---- Display money / date ---- */
.display-money {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.display-money--positive { color: var(--success); }
.display-money--warning { color: var(--warn); }
.display-money--muted { color: var(--muted); }
.display-money--negative { color: var(--danger); }
.display-date { white-space: nowrap; }

.alert-session-flash { border: 0; }
.alert-session-flash .material-icons { vertical-align: middle; }

.policy-data-table { min-width: 1100px; }
.policy-data-table .table-select-checkbox { width: 18px; height: 18px; accent-color: var(--brand); }
.policy-data-table .table-select-label { font-size: 10px; }
.policy-data-table .date-col,
.policy-data-table .money-col { white-space: nowrap; }

.filter-icon-xs { font-size: 14px; }
.filter-icon-sm { font-size: 16px; }
.filter-icon-md { font-size: 20px; }
.filter-icon-inline { font-size: 15px; vertical-align: middle; }

.sortable-col,
.sortable-th { cursor: pointer; }

.table-responsive-x {
    overflow-x: auto;
    max-width: 100%;
    scrollbar-width: thin;
    scrollbar-color: #c9ceda transparent;
}

.table-responsive-x::-webkit-scrollbar {
    height: 8px;
}

.table-responsive-x::-webkit-scrollbar-thumb {
    background: #c9ceda;
    border-radius: 999px;
}

.chart-filters {
    display: flex !important;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1.15rem 1.35rem;
    grid-template-columns: none;
}

.chart-filters .filter-field {
    flex: 1 1 180px;
    min-width: 160px;
    max-width: 260px;
}

.chart-filters .filter-field .form-label {
    display: block !important;
    margin-bottom: 0.65rem !important;
    font-size: 0.78rem;
    font-weight: 650;
    color: var(--muted);
}

.chart-filters .filter-field .form-select:not(.selectize-dropdown):not(.selectize-control),
.chart-filters .filter-field .form-control:not(.selectize-dropdown):not(.selectize-control):not(.selectize-input) {
    height: 42px !important;
    padding: 0.6rem 2.5rem 0.6rem 1.1rem !important;
    border: 1px solid var(--line-strong) !important;
    border-radius: var(--radius-sm) !important;
    background-color: var(--surface) !important;
    line-height: 1.25 !important;
    text-indent: 0 !important;
}

.chart-filters .selectize-control,
.chart-filters .selectize-control.form-select,
.chart-filters .selectize-control.form-control {
    height: auto !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    overflow: visible !important;
}

.chart-filters .selectize-input {
    min-height: 42px !important;
    height: auto !important;
    padding: 0.55rem 2.25rem 0.55rem 0.9rem !important;
    border: 1px solid var(--line-strong) !important;
    border-radius: var(--radius-sm) !important;
    background: var(--surface) !important;
    line-height: 1.25 !important;
}

.chart-filters .filter-field--hidden {
    display: none !important;
}

.chart-filters .filter-field--action {
    flex: 0 0 48px;
    min-width: 48px;
    max-width: 48px;
    margin-left: 0.25rem;
}

.chart-filters .filter-field--action .btn {
    height: 42px;
    width: 48px;
    padding: 0;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Quick date presets: even gaps */
.quick-date-presets,
.filters-section .btn-group-presets,
.date-preset-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.wg-callout {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border-radius: var(--radius);
    background: var(--brand-soft);
    border: 1px solid rgba(91, 79, 232, 0.18);
    color: var(--brand-ink);
}

.wg-callout i {
    margin-top: 0.15rem;
    color: var(--brand);
}

.wg-callout p {
    margin: 0;
    font-size: 0.86rem;
    line-height: 1.45;
}

.report-stat-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.report-stat {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    background: #f3f4f8;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 650;
}

.report-stat strong {
    color: var(--ink);
    font-weight: 750;
}

.report-stat--brand {
    background: var(--brand-soft);
    color: var(--brand-ink);
}

.report-stat--danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.payment-meta-date {
    flex: 0 0 auto;
    white-space: nowrap;
}

.chart-canvas-lg { max-height: 400px; }
.chart-canvas-md { max-height: 300px; }

.main-content .chart {
    position: relative;
    width: 100%;
}

.main-content .chart-canvas {
    width: 100% !important;
    max-width: 100%;
}

@media (max-width: 991.98px) {
    .main-content .chart {
        min-height: 220px;
    }

    .main-content .chart-canvas {
        min-height: 220px !important;
        height: 220px !important;
    }
}

@media (max-width: 575.98px) {
    .main-content .chart {
        min-height: 260px;
    }

    .main-content .chart-canvas {
        min-height: 260px !important;
        height: 260px !important;
    }
}

.types-search {
    min-width: 220px;
    max-width: 280px;
}

.types-category-filter {
    min-width: 160px;
    max-width: 200px;
}

.types-confirm-modal { background: transparent; }
.types-confirm-modal .modal-content {
    border: 0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.portfolio-stat-value.display-money {
    font-size: 17px;
    font-weight: 700;
    color: var(--ink);
}

@media (max-width: 576px) {
    .portfolio-stat-value.display-money {
        font-size: 14px;
    }
}

.soft-card .card-header .btn .material-icons {
    font-size: 16px;
    vertical-align: middle;
}

.check,
input[type="checkbox"] {
    accent-color: var(--brand);
}

/* ---- Audit ---- */
.audit-user-filter {
    min-width: 180px;
    max-width: 220px;
}

.audit-view-btn {
    white-space: nowrap;
}

.audit-summary {
    font-size: 0.95rem;
    line-height: 1.45;
    color: var(--ink);
    background: #f8fafc !important;
    border-color: var(--line) !important;
}

.audit-changes-table .audit-old-value {
    color: var(--muted);
}

.audit-changes-table .audit-new-value {
    color: var(--ink);
    font-weight: 600;
}

.wg-alert {
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    background: var(--info-soft);
    color: var(--info);
    font-size: 0.86rem;
    border: 1px solid #cfe6f5;
}

.row-actions {
    display: flex;
    gap: 0.35rem;
    justify-content: flex-end;
}

/* ---- Force mockup shell widths over file-system-sidebar.css ---- */
aside.file-system-sidebar,
aside#sidenav-main.file-system-sidebar,
.file-system-sidebar.navbar.navbar-vertical,
#sidenav-main.file-system-sidebar {
    width: var(--sidebar-w) !important;
    min-width: var(--sidebar-w) !important;
    max-width: var(--sidebar-w) !important;
}

.g-sidenav-show .main-content,
.g-sidenav-show .wg-main.main-content {
    margin-left: var(--sidebar-w) !important;
}

@media (max-width: 1199.98px) {
    .g-sidenav-show .main-content,
    .g-sidenav-show .wg-main.main-content {
        margin-left: 0 !important;
    }
}

.file-system-sidebar .logout-btn,
.file-system-sidebar .btn.logout-btn {
    width: 100%;
    margin-top: 0.75rem;
    background: var(--danger-soft) !important;
    color: var(--danger) !important;
    border: 1px solid #f3c4c4 !important;
}

.file-system-sidebar .logout-btn:hover {
    background: #fadede !important;
}

.file-system-sidebar #sidenav-collapse-main {
    display: flex !important;
    flex-direction: column;
    height: calc(100vh - 5.5rem) !important;
    overflow: hidden;
}

.file-system-sidebar .file-system-tree {
    flex: 1;
    overflow: auto;
    padding-right: 0.15rem;
}

.portfolio-stat-total .portfolio-stat-icon,
.portfolio-stat-gross .portfolio-stat-icon,
.portfolio-stat-net .portfolio-stat-icon,
.portfolio-stat-paid .portfolio-stat-icon,
.portfolio-stat-outstanding .portfolio-stat-icon {
    background: var(--brand-soft) !important;
}

.portfolio-stat-icon .material-icons {
    color: var(--brand) !important;
}

.portfolio-stat-card {
    border-color: var(--line) !important;
    box-shadow: var(--shadow-sm) !important;
    border-radius: var(--radius-sm) !important;
}

.portfolio-stats-bar {
    background: var(--surface) !important;
    border-top: 1px solid var(--line) !important;
}

.portfolio-stat-label {
    color: var(--muted) !important;
}

.main-content .btn.btn-outline-primary:not(:hover),
.wg-main .btn.btn-outline-primary:not(:hover) {
    background: var(--surface) !important;
    border-color: var(--line-strong) !important;
    color: var(--ink) !important;
}

.main-content .btn.btn-outline-success,
.main-content .btn.btn-outline-danger,
.main-content .btn.btn-outline-warning,
.main-content .btn.btn-outline-info,
.wg-main .btn.btn-outline-success,
.wg-main .btn.btn-outline-danger,
.wg-main .btn.btn-outline-warning,
.wg-main .btn.btn-outline-info {
    background: var(--surface) !important;
    border-color: var(--line-strong) !important;
    color: var(--ink) !important;
}

.main-content .btn.btn-warning,
.wg-main .btn.btn-warning {
    background: var(--warn-soft) !important;
    color: var(--warn) !important;
    border-color: #f3d0b0 !important;
    background-image: none !important;
}

.main-content .badge.bg-primary,
.main-content .badge.bg-secondary,
.wg-main .badge.bg-primary {
    background: var(--brand-soft) !important;
    color: var(--brand-ink) !important;
}

.main-content .badge.bg-success {
    background: var(--success-soft) !important;
    color: var(--success) !important;
}

.main-content .badge.bg-danger {
    background: var(--danger-soft) !important;
    color: var(--danger) !important;
}

.main-content .badge.bg-warning {
    background: var(--warn-soft) !important;
    color: var(--warn) !important;
}



/* ============================================================
   Mockup-matching sidebar (replaces file-system tree chrome)
   ============================================================ */
.wg-sidebar.sidebar,
aside.wg-sidebar#sidenav-main {
    position: fixed !important;
    top: 0;
    left: 0;
    z-index: 20;
    width: var(--sidebar-w) !important;
    min-width: var(--sidebar-w) !important;
    max-width: var(--sidebar-w) !important;
    height: 100vh !important;
    background: var(--surface) !important;
    border-right: 1px solid var(--line) !important;
    box-shadow: none !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 1rem 0.85rem !important;
    font-family: var(--font) !important;
    overflow: hidden;
}

.wg-sidebar .brand {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.65rem;
    min-height: unset;
    padding: 0.15rem 0.55rem 0.85rem;
    border-bottom: 1px solid var(--line);
    margin-bottom: 0.85rem;
    box-sizing: border-box;
}

.wg-sidebar .brand-link {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    text-decoration: none !important;
    color: inherit;
    min-width: 0;
}

.wg-sidebar .brand img {
    width: 48px !important;
    height: 48px !important;
    max-width: 48px !important;
    object-fit: contain;
    flex-shrink: 0;
}

.wg-sidebar .brand-link--custom {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
}

.wg-sidebar .brand-link--custom > img {
    width: auto !important;
    max-width: 180px !important;
    height: 40px !important;
}

.wg-sidebar .brand-wordmark {
    font-weight: 800;
    font-size: 1.35rem;
    letter-spacing: -0.04em;
    color: var(--brand);
    line-height: 1;
}

.wg-sidebar .brand-trademark {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-weight: 500;
    font-size: 0.72rem;
    letter-spacing: -0.02em;
    color: var(--brand);
    line-height: 1;
    opacity: 0.9;
}

.wg-sidebar .brand-trademark__mark {
    width: 14px !important;
    height: 14px !important;
    max-width: 14px !important;
}

.wg-sidebar .brand span {
    font-weight: 800;
    font-size: 1.35rem;
    letter-spacing: -0.04em;
    color: var(--brand);
    line-height: 1;
}

.wg-sidebar .brand .brand-trademark {
    font-weight: 500;
    font-size: 0.72rem;
}

.wg-sidebar-close {
    border: 0;
    background: transparent;
    color: var(--muted);
    padding: 0.35rem;
}

.wg-sidebar .nav-scroll {
    flex: 1;
    overflow: auto;
    padding-right: 0.25rem;
    scrollbar-width: thin;
    scrollbar-color: #c9ceda transparent;
}

.wg-sidebar .nav-scroll::-webkit-scrollbar {
    width: 6px;
}

.wg-sidebar .nav-scroll::-webkit-scrollbar-thumb {
    background: #c9ceda;
    border-radius: 999px;
}

.wg-sidebar .nav-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.wg-sidebar .nav-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted-2);
    padding: 0.75rem 0.65rem 0.35rem;
}

.wg-sidebar .nav-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    padding: 0.55rem 0.7rem;
    border-radius: var(--radius-sm);
    color: var(--muted) !important;
    font-weight: 550;
    font-size: 0.9rem;
    text-decoration: none !important;
    transition: background 0.15s, color 0.15s;
}

.wg-sidebar .nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.wg-sidebar .nav-item:hover {
    background: #f6f7fb;
    color: var(--ink) !important;
}

.wg-sidebar .nav-item.active {
    background: var(--brand-soft);
    color: var(--brand-ink) !important;
}

.wg-sidebar .nav-item.sub {
    padding-left: 2.35rem;
    font-size: 0.86rem;
    font-weight: 500;
}

.wg-sidebar .sidebar-foot {
    border-top: 1px solid var(--line);
    padding: 0.85rem 0.15rem 0.35rem;
    margin-top: auto;
}

.wg-sidebar .sidebar-foot .logout-btn,
.wg-sidebar .sidebar-foot .btn {
    width: 100%;
    justify-content: center;
    margin: 0 !important;
    line-height: 1.25 !important;
}

.wg-history-card .card-header.pb-0 {
    padding: 1rem 1.15rem 0.85rem !important;
}

@media (max-width: 1199.98px) {
    .wg-sidebar.sidebar,
    aside.wg-sidebar#sidenav-main {
        transform: translateX(-100%);
    }

    body.g-sidenav-pinned aside.wg-sidebar#sidenav-main,
    body.g-sidenav-pinned .wg-sidebar.sidebar,
    body.g-sidenav-show.g-sidenav-pinned aside.wg-sidebar#sidenav-main,
    body.g-sidenav-show.g-sidenav-pinned .wg-sidebar {
        transform: translateX(0);
    }
}

/* ---- Role permissions accordion ---- */
.role-body {
    padding-top: 1.1rem;
}

.role-form-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.1rem;
}

.role-form-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 720;
    letter-spacing: -0.02em;
    color: var(--ink);
}

.role-form-subtitle {
    margin: 0.25rem 0 0;
    font-size: 0.82rem;
    color: var(--muted);
}

.role-perm-panel {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
}

.role-perm-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.9rem 1.05rem;
    border-bottom: 1px solid var(--line);
    background: #f8f9fc;
}

.role-perm-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 720;
    color: var(--ink);
}

.role-perm-meta {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.role-selected-chip {
    font-size: 0.78rem;
    font-weight: 650;
    color: var(--brand-ink);
    background: var(--brand-soft);
    border-radius: 999px;
    padding: 0.2rem 0.65rem;
}

.role-perm-select-all .form-check-label,
.role-group-select .form-check-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--ink);
}

.role-perm-empty {
    padding: 1.5rem 1.05rem;
    text-align: center;
    color: var(--muted);
    font-size: 0.86rem;
}

.role-perm-empty p {
    margin: 0;
}

.role-accordion {
    display: flex;
    flex-direction: column;
}

.role-group {
    border-bottom: 1px solid var(--line);
}

.role-group:last-child {
    border-bottom: 0;
}

.role-group-bar {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.55rem 0.75rem 0.55rem 0.35rem;
    background: #f3f5fb;
    transition: background 0.15s;
}

.role-group-bar:hover {
    background: #eceff8;
}

.role-group-head {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex: 1;
    min-width: 0;
    padding: 0.3rem 0.3rem 0.3rem 0.7rem;
    border: 0;
    background: transparent;
    cursor: pointer;
    text-align: left;
    border-radius: var(--radius-xs, 6px);
    color: inherit;
}

.role-group-head:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 1px;
}

.role-group-chevron {
    font-size: 1.15rem !important;
    width: 1.15rem;
    height: 1.15rem;
    line-height: 1;
    color: var(--muted);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

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

.role-group-title {
    font-size: 0.78rem;
    font-weight: 780;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--brand-ink);
}

.role-group-count {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 0.5rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    background: var(--brand-soft);
    color: var(--brand-ink);
}

.role-group-select {
    margin-left: auto;
    margin-right: 0.35rem;
    flex-shrink: 0;
}

.role-group-select .form-check-label {
    font-size: 0.75rem;
    color: var(--muted);
}

.role-group-body {
    display: none;
    border-top: 1px solid var(--line);
}

.role-group.is-open .role-group-body,
.role-group.is-search-open .role-group-body {
    display: block;
}

.role-group.is-search-hidden,
.role-perm-table tbody tr.is-search-hidden {
    display: none !important;
}

.role-perm-empty-search {
    display: none;
}

.role-perm-panel.has-no-search-matches .role-perm-empty-search {
    display: block;
}

.role-perm-panel.has-no-search-matches .role-accordion {
    display: none;
}

.role-perm-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.role-perm-table thead th {
    text-align: left;
    font-size: 0.68rem;
    font-weight: 720;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
    background: #fafbfe;
    border-bottom: 1px solid var(--line);
    padding: 0.55rem 1.05rem;
}

.role-perm-table tbody tr {
    border-bottom: 1px solid #eef0f5;
}

.role-perm-table tbody tr:nth-child(even) {
    background: #fafbfe;
}

.role-perm-table tbody tr:last-child {
    border-bottom: 0;
}

.role-perm-table tbody tr:hover {
    background: #f3f5fb;
}

.role-perm-table td {
    padding: 0.8rem 1.05rem;
    vertical-align: top;
    font-size: 0.86rem;
}

.role-perm-table .perm-col {
    width: 34%;
    min-width: 200px;
}

.role-perm-table .desc-col {
    width: 66%;
}

.role-perm-check .role-perm-key {
    font-family: var(--mono, "IBM Plex Mono", ui-monospace, monospace);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ink);
}

.role-perm-desc {
    margin: 0;
    color: var(--muted);
    line-height: 1.45;
    font-size: 0.84rem;
}

.role-form-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.55rem;
    margin-top: 1.1rem;
}

.role-form-loading {
    display: inline-flex;
    align-items: center;
}

@media (max-width: 720px) {
    .role-form-head {
        flex-direction: column;
    }

    .role-perm-table .perm-col,
    .role-perm-table .desc-col {
        display: block;
        width: 100%;
    }

    .role-perm-table thead {
        display: none;
    }

    .role-perm-table tbody tr {
        display: block;
        padding: 0.35rem 0;
    }

    .role-perm-table td {
        display: block;
        padding: 0.35rem 1.05rem;
    }

    .role-perm-table .desc-col {
        padding-top: 0;
        padding-left: 2.55rem;
    }
}

/*
 * Floating-bar document count — dedicated class (not Bootstrap .badge/.bg-danger).
 * Inline (not absolute) so .bulk-action-right overflow cannot clip it behind the bar.
 */
.floating-bulk-action-bar .documents-btn .documents-count-badge {
    position: static !important;
    top: auto !important;
    right: auto !important;
    left: auto !important;
    bottom: auto !important;
    transform: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 auto !important;
    box-sizing: border-box !important;
    width: 1.15rem !important;
    min-width: 1.15rem !important;
    height: 1.15rem !important;
    padding: 0 !important;
    margin: 0 0 0 0.15rem !important;
    border-radius: 999px !important;
    border: 1.5px solid rgba(255, 255, 255, 0.35) !important;
    background: #ef4444 !important;
    background-image: none !important;
    color: #fff !important;
    font-size: 0.65rem !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
    white-space: nowrap !important;
    overflow: visible !important;
    box-shadow: none !important;
    z-index: 1;
}
