/**
 * erp-overrides.css — Slice 22 Full UI/UX Hardening
 * Loaded AFTER app.min.css. Never modifies Minia core files.
 * Version: Slice 22 (production-grade patch)
 */

/* ============================================================
   1. AUTH PAGES — login centering fix (primary reported issue)
   ============================================================ */

body.auth-fullpage {
    background-color: #f3f3f9;
}

body.auth-fullpage #layout-wrapper,
body.auth-fullpage .main-content {
    margin-left: 0 !important;
    padding-left: 0 !important;
}

body.auth-fullpage .page-content {
    padding: 0 !important;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.auth-fullpage .page-content > div {
    width: 100%;
    padding: 24px 16px;
}

body.auth-fullpage .card {
    box-shadow: 0 4px 28px rgba(0, 0, 0, 0.10);
    border: 1px solid #e9e9ef;
    border-radius: .75rem;
}

body.auth-fullpage .card .card-body {
    padding: 2rem;
}

body.auth-fullpage .col-xl-5,
body.auth-fullpage .col-lg-6 {
    max-width: 480px;
}

body.auth-fullpage .text-primary.fw-bold {
    font-size: 1.5rem;
    letter-spacing: -.01em;
}

/* ============================================================
   2. NO-SIDEBAR (wizard, installer, setup, maintenance)
   ============================================================ */

body.no-sidebar .main-content  { margin-left: 0 !important; }
body.no-sidebar .footer        { left:        0 !important; }
body.no-sidebar #page-topbar   { left:        0 !important; }

/* ============================================================
   3. MOBILE — always collapse sidebar offset (<=991px)
   ============================================================ */

@media (max-width: 991.98px) {
    .main-content  { margin-left: 0 !important; }
    .footer        { left:        0 !important; }
    #page-topbar   { left:        0 !important; }

    /*
     * Replace app.min.css display:none/block with a slide-in animation.
     * Sidebar always stays in the DOM (display:block) but starts off-screen.
     * body.sidebar-enable slides it into view.
     *
     * z-index: 1005 !important — overrides app.min.css sm-mode rule
     * (body[data-sidebar-size=sm] .vertical-menu { z-index:5 }) so that
     * the sidebar is ALWAYS above the overlay regardless of saved sidebar size.
     */
    .vertical-menu {
        display: block !important;   /* override app.min.css display:none */
        left: 0;
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        will-change: transform;
        position: fixed !important;  /* override sm-mode position:absolute */
    }
    body.sidebar-enable .vertical-menu {
        transform: translateX(0);
        z-index: 1005 !important;    /* above overlay (999) and topbar (1002) */
    }
}

/* ============================================================
   4. OVERFLOW SAFETY
   ============================================================ */

html, body { overflow-x: hidden; }

.main-content    { overflow-x: hidden; min-height: calc(100vh - 70px); }
.container-fluid { min-width: 0; }

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

/* ============================================================
   5. DOUBLE page-content WRAP GUARD
   ============================================================ */

.page-content > .page-content {
    padding: 0 !important;
    min-height: unset !important;
}

.page-content > .page-content > .container-fluid {
    padding-left:  0 !important;
    padding-right: 0 !important;
}

/* ============================================================
   6. PAGE-TITLE-BOX
   ============================================================ */

.page-title-box {
    padding-bottom: 16px;
    margin-bottom: 0;
}

.page-title-box .text-muted.small,
.page-title-sub {
    font-size: .8125rem;
    color: #74788d;
    margin-top: 2px;
    line-height: 1.4;
}

@media (max-width: 576px) {
    .page-title-box {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: .5rem;
    }
    .page-title-box .d-flex.gap-2 { flex-wrap: wrap; }
}

/* ============================================================
   7. CARDS
   ============================================================ */

.card {
    border: 1px solid #e9e9ef;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .05);
    margin-bottom: 1.25rem;
    min-width: 0;
}

.card-header {
    background-color: #fafafa;
    border-bottom: 1px solid #e9e9ef;
    padding: .75rem 1.25rem;
    font-weight: 600;
    font-size: .9rem;
}

@media (max-width: 576px) {
    .card-body { padding: .875rem; }
}

/* ============================================================
   8. TABLES
   ============================================================ */

.table td,
.table th {
    padding: .5rem .75rem;
    vertical-align: middle;
}

.table td {
    word-break: break-word;
    max-width: 300px;
}

.table tbody tr:only-child td[colspan] {
    padding: 2rem 1rem;
    color: #adb5bd !important;
    text-align: center;
    font-size: .9rem;
}

.table-sticky-header thead th {
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
    box-shadow: 0 1px 0 #e9e9ef;
}

/* ============================================================
   9. BADGES
   ============================================================ */

.badge {
    font-size: .72em;
    font-weight: 600;
    letter-spacing: .02em;
    padding: .3em .6em;
}

.bg-soft-primary   { background-color: rgba(81, 86, 190, .12)  !important; color: #5156be !important; }
.bg-soft-success   { background-color: rgba(42, 181, 125, .12) !important; color: #2ab57d !important; }
.bg-soft-danger    { background-color: rgba(253, 98, 94, .12)  !important; color: #fd625e !important; }
.bg-soft-warning   { background-color: rgba(255, 191, 83, .12) !important; color: #e6a817 !important; }
.bg-soft-info      { background-color: rgba(75, 166, 239, .12) !important; color: #4ba6ef !important; }
.bg-soft-secondary { background-color: rgba(116, 120, 141, .12)!important; color: #74788d !important; }

/* ============================================================
   10. FORMS
   ============================================================ */

.form-label {
    font-weight: 500;
    font-size: .875rem;
    margin-bottom: .35rem;
    color: #495057;
}

.form-text {
    font-size: .78rem;
    color: #74788d;
}

input[readonly].form-control,
input[disabled].form-control,
select[disabled].form-select,
textarea[readonly].form-control {
    background-color: #f8f9fa !important;
    cursor: default;
}

.text-danger.small {
    font-size: .78rem;
    margin-top: .2rem;
}

.card .row.g-2 .form-control,
.card .row.g-2 .form-select,
.card-body .row.g-2 .form-control,
.card-body .row.g-2 .form-select {
    font-size: .875rem;
}

/* ============================================================
   11. ACTION BUTTONS in tables
   ============================================================ */

.table .btn-sm {
    padding: .2rem .55rem;
    font-size: .78rem;
    white-space: nowrap;
}

.table .d-flex.gap-1 {
    flex-wrap: nowrap;
}

.table .erp-table-action-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 2rem !important;
    min-height: 2rem !important;
    padding: 0 .5rem !important;
    line-height: 1 !important;
    text-align: center !important;
    white-space: nowrap !important;
    margin: 0 !important;
}

/* Form is transparent to flex — its button joins the stack directly */
.table .erp-table-action-stack form {
    display: contents !important;
}

/* Base fallback: inline-flex row for browsers without :has() support (Chromium < 105, old Edge) */
.table .erp-table-action-stack {
    display: inline-flex;
    flex-direction: row;
    justify-content: flex-end;
    gap: 3px;
    width: auto;
}

/* 1–2 items: single row, side by side; push content to the right like text-end */
.table .erp-table-action-stack:not(:has(> :nth-child(3))) {
    display: inline-flex;
    flex-direction: row;
    justify-content: flex-end;
    gap: 3px;
    width: auto;
}

/* Solo button: natural width, don't stretch to fill the row */
.table .erp-table-action-stack:not(:has(> :nth-child(2))) > .btn,
.table .erp-table-action-stack:not(:has(> :nth-child(2))) > form > .btn {
    flex: 0 0 auto;
}

/* 3+ items: 2-row grid, RTL fill so the 2-stack lands on the right, lone button on the left */
.table .erp-table-action-stack:has(> :nth-child(3)) {
    display: inline-grid;
    grid-template-rows: 2rem 2rem;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    gap: 3px;
    direction: rtl;
    justify-content: start;
}

/* Restore LTR inside each button so text/icons render correctly */
.table .erp-table-action-stack:has(> :nth-child(3)) > .btn,
.table .erp-table-action-stack:has(> :nth-child(3)) > form > .btn {
    direction: ltr;
}

.table .erp-table-action-stack > .btn,
.table .erp-table-action-stack > form > .btn {
    flex: 0 0 auto;
    display: flex !important;
    align-items: center;
    justify-content: center;
    height: 2rem !important;
    min-height: 2rem !important;
    padding: 0 .5rem;
    margin: 0;
    text-align: center;
    white-space: nowrap;
}

.table th.erp-table-action-col,
.table td.erp-table-action-col,
.table td.erp-table-actions {
    max-width: none;
    white-space: nowrap;
}

.table td.erp-table-actions {
    text-align: right;
}

/* ============================================================
   12. TOPBAR
   ============================================================ */

@media (max-width: 1440px) {
    .navbar-header select.form-select {
        min-width: 160px !important;
        max-width: 200px;
        font-size: .8rem;
    }
}

.navbar-header {
    display: flex;
    align-items: center;
}

/* ============================================================
   13. SIDEBAR active child
   ============================================================ */

#sidebar-menu ul li ul.sub-menu li a.active {
    color: #5156be;
    font-weight: 600;
}

#sidebar-menu > .p-3 {
    border-top: 1px solid rgba(0, 0, 0, .05);
}

/* ============================================================
   15. DASHBOARD KPI
   ============================================================ */

.avatar-sm .avatar-title { font-size: 1.1rem; }

.fs-4.fw-semibold {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================================
   16. CODE SNIPPETS
   ============================================================ */

code {
    font-size: .82em;
    color: #5156be;
    background-color: rgba(81, 86, 190, .08);
    padding: .15em .4em;
    border-radius: 3px;
}

/* ============================================================
   17. ALERTS inside cards
   ============================================================ */

.card-body > .alert:last-child,
.card-body > .alert:only-child {
    margin-bottom: 0;
}

/* ============================================================
   18. PAGINATION
   ============================================================ */

.pagination .page-link {
    font-size: .85rem;
    padding: .35rem .65rem;
}

/* ============================================================
   19. FOOTER
   ============================================================ */

.footer {
    background: #f8f8fb;
    border-top: 1px solid #e9e9ef;
    font-size: .82rem;
    color: #74788d;
}

/* Prevent floating chat button from overlapping footer right text */
.footer .text-sm-end {
    padding-right: 88px;
}

/* ============================================================
   20. CHAT MODULE — room view responsive
   ============================================================ */

#chat-scroll {
    height: 58vh !important;
    min-height: 200px;
    max-height: calc(100vh - 320px);
}

@media (max-width: 768px) {
    #chat-scroll {
        height: 45vh !important;
        max-height: calc(100vh - 280px);
    }
}

/* ============================================================
   22. ERROR PAGES vertical centering
   ============================================================ */

body.no-sidebar .main-content .row.justify-content-center > [class*="col"] > .text-center.mt-5 {
    margin-top: 0 !important;
    padding-top: 10vh;
}

/* ============================================================
   23. RESPONSIVE BREAKPOINTS
   ============================================================ */

/* 1366×768 laptop — tighten sidebar slightly */
@media (max-width: 1399px) {
    .vertical-menu { width: 230px; }
    .navbar-brand-box { width: 230px; }
    body[data-sidebar-size="default"] .main-content { margin-left: 230px; }
    body[data-sidebar-size="default"] .footer        { left: 230px; }
    body[data-sidebar-size="default"] #page-topbar   { left: 230px; }
}

/* 1920×1080 — cap container width for readability */
@media (min-width: 1600px) {
    .page-content > .container-fluid { max-width: 1800px; }
}

/* Mobile 480px and below */
@media (max-width: 480px) {
    .card-body .row.g-2 > [class*="col-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }
    .table-line-items { min-width: 600px; }
}

/* ============================================================
   24. PRINT
   ============================================================ */

@media print {
    #page-topbar,
    .vertical-menu,
    .footer,
    .btn,
    form.filter-bar { display: none !important; }

    .main-content { margin-left: 0 !important; }
    .card         { box-shadow: none !important; border: 1px solid #ccc !important; }
    .table td,
    .table th     { padding: .25rem .5rem; }
}

/* ============================================================
   25. SIDEBAR — HOVER HIGHLIGHT
   (Canonical block is section "Layout Minia" near end of file.)
   ============================================================ */

/* ============================================================
   26. TABLE ROW HOVER
   ============================================================ */

/* All data tables get row hover — smooth, subtle */
.table tbody tr {
    transition: background .13s ease;
}
.table tbody tr:hover > td {
    background-color: rgba(81, 86, 190, 0.045) !important;
    cursor: default;
}
/* Striped + hover: override stripe on hover */
.table-striped > tbody > tr:hover > td {
    background-color: rgba(81, 86, 190, 0.07) !important;
}

/* ============================================================
   27. STATUS BADGE COLORS — consistent across all modules
   ============================================================ */

/* Replace the flat Bootstrap badges with pill style + proper colors */
.badge {
    padding: .32em .7em;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .02em;
}

.page-title-box h1 .erp-page-title-id,
.page-title-box h2 .erp-page-title-id,
.page-title-box h3 .erp-page-title-id,
.page-title-box h4 .erp-page-title-id,
.page-title-box h5 .erp-page-title-id,
.page-title-box h6 .erp-page-title-id {
    display: block;
    margin-top: 4px;
    color: #64748b;
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .01em;
    line-height: 1.35;
}

/* DRAFT — neutral grey */
.badge.bg-secondary {
    background-color: #e2e8f0 !important;
    color: #475569 !important;
}
/* SUBMITTED / PENDING — amber */
.badge.bg-warning {
    background-color: #fef3c7 !important;
    color: #92400e !important;
}
/* APPROVED / CLOSED / SUCCESS — green */
.badge.bg-success {
    background-color: #dcfce7 !important;
    color: #166534 !important;
}
/* REJECTED / DANGER — red */
.badge.bg-danger {
    background-color: #fee2e2 !important;
    color: #991b1b !important;
}
/* PARTIAL / INFO — blue */
.badge.bg-info {
    background-color: #dbeafe !important;
    color: #1e40af !important;
}
/* CANCELLED — slate */
.badge.bg-dark {
    background-color: #f1f5f9 !important;
    color: #64748b !important;
}
/* POSTED — indigo */
.badge.bg-primary {
    background-color: #e0e7ff !important;
    color: #3730a3 !important;
}
/* LIGHT — keep readable */
.badge.bg-light {
    background-color: #f8fafc !important;
    color: #64748b !important;
    border: 1px solid #e2e8f0;
}

/* bg-soft variants (used in manufacturing/finance) */
.badge.bg-soft-primary  { background-color: #e0e7ff !important; color: #3730a3 !important; border-radius: 20px; }
.badge.bg-soft-success  { background-color: #dcfce7 !important; color: #166534 !important; border-radius: 20px; }
.badge.bg-soft-warning  { background-color: #fef3c7 !important; color: #92400e !important; border-radius: 20px; }
.badge.bg-soft-danger   { background-color: #fee2e2 !important; color: #991b1b !important; border-radius: 20px; }
.badge.bg-soft-info     { background-color: #dbeafe !important; color: #1e40af !important; border-radius: 20px; }
.badge.bg-soft-secondary{ background-color: #e2e8f0 !important; color: #475569 !important; border-radius: 20px; }

/* ============================================================
   28. BUTTON HOVER — action buttons in tables
   ============================================================ */

.btn-outline-primary:hover,
.btn-outline-success:hover,
.btn-outline-warning:hover,
.btn-outline-danger:hover,
.btn-outline-secondary:hover,
.btn-outline-info:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0,0,0,.12) !important;
    transition: transform .13s ease, box-shadow .13s ease !important;
}
.btn-primary:hover,
.btn-success:hover,
.btn-warning:hover,
.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0,0,0,.15) !important;
    transition: transform .13s ease, box-shadow .13s ease !important;
}
.btn {
    transition: transform .13s ease, box-shadow .13s ease, background .13s ease !important;
}

/* ============================================================
   29. NAV TABS HOVER (purchasing / sales process tabs)
   ============================================================ */

.nav-tabs .nav-link {
    transition: color .15s ease, border-color .15s ease, background .15s ease !important;
}
.nav-tabs .nav-link:not(.active):hover {
    color: #5156be !important;
    border-bottom-color: #5156be !important;
    background-color: rgba(81,86,190,.05) !important;
}

/* ============================================================
   30. CARD HOVER (index page cards & KPI cards)
   ============================================================ */

.card:not(.no-hover) {
    transition: box-shadow .18s ease, transform .18s ease !important;
}
.card:not(.no-hover):hover {
    box-shadow: 0 6px 24px rgba(0,0,0,.09) !important;
    transform: translateY(-2px) !important;
}

/* ============================================================
   31. FORM INPUT FOCUS — visible ring
   ============================================================ */

.form-control:focus,
.form-select:focus {
    border-color: #818cf8 !important;
    box-shadow: 0 0 0 3px rgba(99,102,241,.15) !important;
    transition: border-color .15s ease, box-shadow .15s ease !important;
}

/* ============================================================
   32. FULL DARK MODE — custom ERP elements
   (Minia handles Bootstrap base; we patch what it misses)
   ============================================================ */

/* ── Variables / shorthand ─────────────────────────────────── */
/* bg surfaces */
/* --dk-bg1: #1e2022  (deepest, body bg) */
/* --dk-bg2: #252829  (card bg)          */
/* --dk-bg3: #2d3133  (input bg)         */
/* --dk-border: #3a3f42                  */
/* --dk-text: #d1d5db  (body text)       */
/* --dk-muted: #6b7280                   */

/* ── Main content background ───────────────────────────────── */
body[data-layout-mode=dark] {
    background-color: #1a1d1f !important;
    --erp-ink: #e6edf3;
    --erp-border: #30363d;
    --erp-surface: #23272a;
    --erp-surface-soft: #2a2e33;
    --erp-muted-soft: #8b949e;
}
body[data-layout-mode=dark] .main-content {
    background-color: #1a1d1f;
}
body[data-layout-mode=dark] .page-content {
    background-color: #1a1d1f;
}

/* ── Cards ─────────────────────────────────────────────────── */
body[data-layout-mode=dark] .card {
    background-color: #23272a !important;
    border: 1px solid #2e3338 !important;
    box-shadow: 0 1px 4px rgba(0,0,0,.3) !important;
}
body[data-layout-mode=dark] .card-header {
    background-color: #23272a !important;
    border-bottom-color: #2e3338 !important;
    color: #c9d1d9 !important;
}
body[data-layout-mode=dark] .card-body { color: #c9d1d9; }
body[data-layout-mode=dark] .card-footer {
    background-color: #23272a !important;
    border-top-color: #2e3338 !important;
}

/* ── Page title & headings ─────────────────────────────────── */
body[data-layout-mode=dark] .page-title-box h4,
body[data-layout-mode=dark] h1, body[data-layout-mode=dark] h2,
body[data-layout-mode=dark] h3, body[data-layout-mode=dark] h4,
body[data-layout-mode=dark] h5, body[data-layout-mode=dark] h6 {
    color: #e6edf3 !important;
}
body[data-layout-mode=dark] .text-dark { color: #c9d1d9 !important; }
body[data-layout-mode=dark] label,
body[data-layout-mode=dark] .form-label { color: #adb5bd !important; }

/* ── Tables ─────────────────────────────────────────────────── */
body[data-layout-mode=dark] .table {
    color: #c9d1d9 !important;
    border-color: #2e3338 !important;
}
body[data-layout-mode=dark] .table thead th {
    background-color: #1e2225 !important;
    color: #8b949e !important;
    border-color: #2e3338 !important;
}
body[data-layout-mode=dark] .table td,
body[data-layout-mode=dark] .table th {
    border-color: #2e3338 !important;
}
body[data-layout-mode=dark] .table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: rgba(255,255,255,.025) !important;
    color: #c9d1d9 !important;
}
body[data-layout-mode=dark] .table tbody tr:hover > td {
    background-color: rgba(99,102,241,.12) !important;
    color: #e6edf3 !important;
}
body[data-layout-mode=dark] .table-responsive {
    border-color: #2e3338;
}

/* ── Forms ─────────────────────────────────────────────────── */
body[data-layout-mode=dark] .form-control {
    background-color: #161b22 !important;
    border-color: #30363d !important;
    color: #c9d1d9 !important;
}
body[data-layout-mode=dark] .form-control:focus {
    background-color: #161b22 !important;
    border-color: #818cf8 !important;
    box-shadow: 0 0 0 3px rgba(99,102,241,.2) !important;
    color: #e6edf3 !important;
}
body[data-layout-mode=dark] .form-control::placeholder { color: #484f58 !important; }
body[data-layout-mode=dark] .form-select {
    background-color: #161b22 !important;
    border-color: #30363d !important;
    color: #c9d1d9 !important;
}
body[data-layout-mode=dark] .input-group-text {
    background-color: #21262d !important;
    border-color: #30363d !important;
    color: #8b949e !important;
}

/* ── Topbar ────────────────────────────────────────────────── */
body[data-layout-mode=dark] #page-topbar {
    background-color: #161b22 !important;
    border-bottom-color: #21262d !important;
}
body[data-layout-mode=dark] .navbar-brand-box {
    background-color: #161b22 !important;
    border-right-color: #21262d !important;
}
body[data-layout-mode=dark] .header-icon-btn {
    color: #8b949e !important;
}
body[data-layout-mode=dark] .header-icon-btn:hover {
    background: #21262d !important;
    color: #e6edf3 !important;
}

/* ── Sidebar refinements ───────────────────────────────────── */
body[data-layout-mode=dark] .vertical-menu {
    background: #161b22 !important;
    border-right-color: #21262d !important;
}
body[data-layout-mode=dark] #sidebar-menu ul li > a {
    color: #8b949e !important;
}
body[data-layout-mode=dark] #sidebar-menu ul li > a i {
    color: #6e7681 !important;
}
body[data-layout-mode=dark]:not([data-sidebar-size=sm]) #sidebar-menu ul li > a:hover {
    background-color: rgba(99,102,241,.12) !important;
    color: #a5b4fc !important;
    box-shadow: inset 3px 0 0 #818cf8 !important;
}
body[data-layout-mode=dark]:not([data-sidebar-size=sm]) #sidebar-menu ul li > a:hover i { color: #a5b4fc !important; }
body[data-layout-mode=dark] #sidebar-menu ul li ul.sub-menu li a {
    color: #6e7681 !important;
}
body[data-layout-mode=dark] #sidebar-menu ul li ul.sub-menu li a:hover {
    background-color: rgba(99,102,241,.08) !important;
    color: #a5b4fc !important;
}
body[data-layout-mode=dark] #sidebar-menu ul li ul.sub-menu li a.active {
    color: #a5b4fc !important;
    background-color: rgba(99,102,241,.12) !important;
    box-shadow: inset 3px 0 0 #818cf8 !important;
}
body[data-layout-mode=dark] .mm-active > a,
body[data-layout-mode=dark] .mm-active > a i {
    color: #a5b4fc !important;
}

/* ── Badges in dark mode ───────────────────────────────────── */
body[data-layout-mode=dark] .badge.bg-secondary  { background-color: #2d333b !important; color: #8b949e !important; }
body[data-layout-mode=dark] .badge.bg-success    { background-color: #1a3626 !important; color: #3fb950 !important; }
body[data-layout-mode=dark] .badge.bg-warning    { background-color: #3d2d0a !important; color: #d29922 !important; }
body[data-layout-mode=dark] .badge.bg-danger     { background-color: #3d1a1a !important; color: #f85149 !important; }
body[data-layout-mode=dark] .badge.bg-info       { background-color: #1a2d3d !important; color: #58a6ff !important; }
body[data-layout-mode=dark] .badge.bg-primary    { background-color: #2a2559 !important; color: #a5b4fc !important; }
body[data-layout-mode=dark] .badge.bg-dark       { background-color: #2d333b !important; color: #6e7681 !important; }
body[data-layout-mode=dark] .badge.bg-light      { background-color: #21262d !important; color: #8b949e !important; border-color: #30363d !important; }
body[data-layout-mode=dark] .badge.bg-soft-primary   { background-color: #2a2559 !important; color: #a5b4fc !important; }
body[data-layout-mode=dark] .badge.bg-soft-success   { background-color: #1a3626 !important; color: #3fb950 !important; }
body[data-layout-mode=dark] .badge.bg-soft-secondary { background-color: #2d333b !important; color: #8b949e !important; }
body[data-layout-mode=dark] .page-title-box h1 .erp-page-title-id,
body[data-layout-mode=dark] .page-title-box h2 .erp-page-title-id,
body[data-layout-mode=dark] .page-title-box h3 .erp-page-title-id,
body[data-layout-mode=dark] .page-title-box h4 .erp-page-title-id,
body[data-layout-mode=dark] .page-title-box h5 .erp-page-title-id,
body[data-layout-mode=dark] .page-title-box h6 .erp-page-title-id {
    color: #94a3b8;
}

/* ── Nav tabs ──────────────────────────────────────────────── */
body[data-layout-mode=dark] .nav-tabs {
    border-bottom-color: #30363d !important;
}
body[data-layout-mode=dark] .nav-tabs .nav-link {
    color: #8b949e !important;
    border-color: transparent !important;
}
body[data-layout-mode=dark] .nav-tabs .nav-link.active {
    background-color: #23272a !important;
    border-color: #30363d #30363d #23272a !important;
    color: #a5b4fc !important;
}
body[data-layout-mode=dark] .nav-tabs .nav-link:not(.active):hover {
    color: #a5b4fc !important;
    border-bottom-color: #818cf8 !important;
    background-color: rgba(99,102,241,.08) !important;
}

/* ── Dropdowns ─────────────────────────────────────────────── */
body[data-layout-mode=dark] .dropdown-menu {
    background-color: #1c2128 !important;
    border-color: #30363d !important;
    box-shadow: 0 8px 24px rgba(0,0,0,.4) !important;
}
body[data-layout-mode=dark] .dropdown-item {
    color: #c9d1d9 !important;
}
body[data-layout-mode=dark] .dropdown-item:hover,
body[data-layout-mode=dark] .dropdown-item:focus {
    background-color: #2d333b !important;
    color: #e6edf3 !important;
}
body[data-layout-mode=dark] .dropdown-divider { border-color: #30363d !important; }

/* ── Alerts ────────────────────────────────────────────────── */
body[data-layout-mode=dark] .alert-success  { background-color: #1a3626 !important; border-color: #2ea043 !important; color: #3fb950 !important; }
body[data-layout-mode=dark] .alert-warning  { background-color: #3d2d0a !important; border-color: #9e6a03 !important; color: #d29922 !important; }
body[data-layout-mode=dark] .alert-danger   { background-color: #3d1a1a !important; border-color: #da3633 !important; color: #f85149 !important; }
body[data-layout-mode=dark] .alert-info     { background-color: #1a2d3d !important; border-color: #1f6feb !important; color: #58a6ff !important; }

/* ── Buttons in dark ───────────────────────────────────────── */
body[data-layout-mode=dark] .btn-outline-secondary {
    color: #8b949e !important;
    border-color: #30363d !important;
}
body[data-layout-mode=dark] .btn-outline-secondary:hover {
    background-color: #2d333b !important;
    color: #c9d1d9 !important;
}

/* ── code / pre ────────────────────────────────────────────── */
body[data-layout-mode=dark] code {
    background-color: #2d333b !important;
    color: #ff7b72 !important;
    border-radius: 4px;
    padding: 1px 5px;
}

/* ── Dashboard custom classes ──────────────────────────────── */
body[data-layout-mode=dark] .kpi-card {
    background-color: #23272a !important;
    box-shadow: 0 1px 4px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.2) !important;
}
body[data-layout-mode=dark] .kpi-value   { color: #e6edf3 !important; }
body[data-layout-mode=dark] .kpi-label   { color: #6e7681 !important; }
body[data-layout-mode=dark] .kpi-sub     { color: #6e7681 !important; }
body[data-layout-mode=dark] .sec-card    { background-color: #23272a !important; }
body[data-layout-mode=dark] .sec-card .card-header {
    border-bottom-color: #2e3338 !important;
    color: #e6edf3 !important;
}
body[data-layout-mode=dark] .purch-stat  { background: #1e2225 !important; }
body[data-layout-mode=dark] .purch-stat .num { color: #e6edf3 !important; }
body[data-layout-mode=dark] .purch-stat .lbl { color: #6e7681 !important; }
body[data-layout-mode=dark] .stock-row   { border-bottom-color: #2e3338 !important; }
body[data-layout-mode=dark] .stock-bar   { background: #2d333b !important; }
.mod-chip.on  { background: #dcfce7 !important; color: #166534 !important; border: 1px solid #bbf7d0 !important; }
.mod-chip.off { background: #fee2e2 !important; color: #991b1b !important; border: 1px solid #fecaca !important; }
.mod-chip.on i  { color: #16a34a !important; }
.mod-chip.off i { color: #dc2626 !important; }
body[data-layout-mode=dark] .mod-chip.on  { background: #1a3626 !important; color: #3fb950 !important; }
body[data-layout-mode=dark] .mod-chip.off { background: #3d1a1a !important; color: #f85149 !important; }

/* ── KPI icon pills ────────────────────────────────────────── */
body[data-layout-mode=dark] .ki-blue   { background: #1a2d3d !important; color: #58a6ff !important; }
body[data-layout-mode=dark] .ki-green  { background: #1a3626 !important; color: #3fb950 !important; }
body[data-layout-mode=dark] .ki-amber  { background: #3d2d0a !important; color: #d29922 !important; }
body[data-layout-mode=dark] .ki-red    { background: #3d1a1a !important; color: #f85149 !important; }
body[data-layout-mode=dark] .ki-purple { background: #2a2559 !important; color: #a5b4fc !important; }
body[data-layout-mode=dark] .ki-teal   { background: #0d2d27 !important; color: #2dd4bf !important; }
body[data-layout-mode=dark] .ki-rose   { background: #3d1a26 !important; color: #fb7185 !important; }
body[data-layout-mode=dark] .ki-indigo { background: #1e2459 !important; color: #818cf8 !important; }

/* ── Page title box ────────────────────────────────────────── */
body[data-layout-mode=dark] .page-title-box { border-bottom-color: #2e3338; }

/* ── Footer ────────────────────────────────────────────────── */
body[data-layout-mode=dark] .footer {
    background-color: #161b22 !important;
    border-top-color: #21262d !important;
    color: #6e7681 !important;
}

/* ── Scrollbar (webkit — Chrome/Edge/Safari) ───────────────── */
body[data-layout-mode=dark] ::-webkit-scrollbar { width: 6px; height: 6px; }
body[data-layout-mode=dark] ::-webkit-scrollbar-track { background: #1a1d1f; }
body[data-layout-mode=dark] ::-webkit-scrollbar-thumb { background: #30363d; border-radius: 4px; }
body[data-layout-mode=dark] ::-webkit-scrollbar-thumb:hover { background: #484f58; }

/* ── Scrollbar (Firefox standard) ─────────────────────────── */
body[data-layout-mode=dark] {
    scrollbar-width: thin;
    scrollbar-color: #30363d #1a1d1f;
}

/* ============================================================
   33. TOPBAR — targeted fixes (burger, badge, logo)
   ============================================================ */

/* Burger: saat sidebar collapsed (sm), Minia pakai margin-left negatif
   tapi hanya saat desktop. Kita pastikan tidak ter-override. */
@media (min-width: 992px) {
    body[data-sidebar-size="sm"] #vertical-menu-btn {
        margin-left: 0 !important;
    }
}

/* Geser lonceng sedikit ke kiri agar badge tidak ketutup tombol profile */
#notif-btn { margin-right: 6px; isolation: isolate; }
#notif-badge { z-index: 10; }

/* Arva logo navbar */
.navbar-brand-box {
    height: 70px;           /* pin tepat sama dengan topbar */
}
a.logo .logo-lg {
    display: inline-flex;
    align-items: center;
    height: 70px;
}
@media (max-width: 992px) {
    a.logo .logo-lg { display: none !important; }
    a.logo .logo-sm { display: inline-block !important; }
    .navbar-brand-box {
        width: auto !important;
        min-width: 0 !important;
        padding-left: 16px !important;
        padding-right: 8px !important;
    }
}
.arva-logo-navbar {
    height: 40px;
    width: auto;
    object-fit: contain;
    display: block;
}

/* ============================================================
   Sidebar footer info (company + user)
   ============================================================ */
.sidebar-footer-info {
    margin: 8px 0 4px;
    padding: 10px 14px;
    border-top: 1px solid rgba(0,0,0,.07);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.sfi-user {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}
.sfi-icon {
    font-size: 1rem;
    flex-shrink: 0;
    color: #74788d;
}
.sfi-text {
    font-size: .75rem;
    color: #74788d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}
.sfi-badge {
    font-size: .62rem;
    font-weight: 600;
    letter-spacing: .4px;
    padding: 1px 5px;
    border-radius: 4px;
    background: rgba(81,86,190,.1);
    color: #5156be;
    flex-shrink: 0;
    text-transform: uppercase;
}
.sfi-badge-super {
    background: rgba(220,53,69,.1);
    color: #dc3545;
}

/* Dark sidebar variants */
body[data-sidebar=dark] .sidebar-footer-info,
body[data-layout-mode=dark] .sidebar-footer-info {
    border-top-color: rgba(255,255,255,.08);
}
body[data-sidebar=dark] .sfi-icon,
body[data-sidebar=dark] .sfi-text,
body[data-layout-mode=dark] .sfi-icon,
body[data-layout-mode=dark] .sfi-text {
    color: #99a4b1;
}
body[data-sidebar=dark] .sfi-badge,
body[data-layout-mode=dark] .sfi-badge {
    background: rgba(255,255,255,.1);
    color: #c0c6d4;
}

/* Hidden when sidebar collapsed */
body[data-sidebar-size=sm] .sidebar-footer-info {
    display: none;
}

/* ============================================================
   34. SIDEBAR COLLAPSED — flyout submenu background
   ============================================================ */

/* Light mode: floating card, semua sudut tumpul */
body[data-sidebar-size=sm] .vertical-menu #sidebar-menu > ul ul {
    background-color: #fff !important;
    box-shadow: 0 4px 20px rgba(0,0,0,.15) !important;
    border-radius: 8px !important;
    border: 1px solid #e9e9ef;
    overflow: hidden;
}
/* Prevent hover highlight from bleeding outside the flyout box */
body[data-sidebar-size=sm] .vertical-menu #sidebar-menu > ul ul a {
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Dark mode: flyout gelap, semua sudut tumpul */
body[data-layout-mode=dark][data-sidebar-size=sm] .vertical-menu #sidebar-menu > ul ul {
    background-color: #1c2128 !important;
    border-color: #30363d !important;
    box-shadow: 0 4px 20px rgba(0,0,0,.4) !important;
    border-radius: 8px !important;
    overflow: hidden;
}
body[data-layout-mode=dark][data-sidebar-size=sm] .vertical-menu #sidebar-menu > ul ul a {
    color: #c9d1d9 !important;
}
body[data-layout-mode=dark][data-sidebar-size=sm] .vertical-menu #sidebar-menu > ul ul a:hover {
    color: #a5b4fc !important;
    background-color: rgba(99,102,241,.1) !important;
}

/* ============================================================
   35. SIDEBAR COLLAPSED — parent hover item
   ============================================================ */

/* Light mode: parent hover — solid background + round kiri */
body[data-sidebar-size=sm] .vertical-menu #sidebar-menu > ul > li {
    position: relative !important;
    overflow: visible !important;
    width: 70px !important;
}

body[data-sidebar-size=sm] .vertical-menu #sidebar-menu > ul > li > a {
    display: flex !important;
    align-items: center !important;
    width: 70px !important;
    min-height: 52px !important;
    padding: 15px 20px !important;
    box-sizing: border-box !important;
    overflow: visible !important;
}

/* Collapsed sidebar: badge sits on top-right of icon, outside the waves-effect overflow:hidden anchor */
body[data-sidebar-size=sm] .vertical-menu #sidebar-menu > ul > li > .menu-badge {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 4px;
    right: 6px;
    transform: none;
    min-width: 16px;
    height: 16px;
    width: auto;
    padding: 0 4px;
    border-radius: 99px;
    border: 1.5px solid #fff;
    font-size: .58rem;
    font-weight: 700;
    line-height: 1;
    margin: 0;
    z-index: 20;
}

body[data-sidebar-size=sm] .vertical-menu #sidebar-menu > ul ul .sub-badge {
    display: inline-block !important;
}

body[data-sidebar-size=sm] .vertical-menu #sidebar-menu > ul > li:hover > a {
    background-color: #ebe6ff !important;
    border-radius: 8px 0 0 8px !important;
    color: #5156be !important;
}

body[data-sidebar-size=sm] .vertical-menu #sidebar-menu > ul > li:hover > a i,
body[data-sidebar-size=sm] .vertical-menu #sidebar-menu > ul > li:hover > a svg {
    color: #5156be !important;
}

/* Dark mode: parent hover — background gelap solid */
body[data-layout-mode=dark][data-sidebar-size=sm] .vertical-menu #sidebar-menu > ul > li:hover > a {
    background-color: #1c2128 !important;
    color: #a5b4fc !important;
    box-shadow: none !important;
    border-radius: 8px 0 0 8px !important;
}
body[data-layout-mode=dark][data-sidebar-size=sm] .vertical-menu #sidebar-menu > ul > li:hover > a i {
    color: #a5b4fc !important;
}

body[data-sidebar-size=sm] .vertical-menu #sidebar-menu > ul > li:hover > a {
    width: 70px !important;
}

body[data-sidebar-size=sm] .vertical-menu #sidebar-menu > ul > li:hover > ul,
body[data-sidebar-size=sm] .vertical-menu #sidebar-menu > ul ul li:hover > ul {
    display: none !important;
}

body[data-sidebar-size=sm] .vertical-menu #sidebar-menu > ul > li:hover > ul a,
body[data-sidebar-size=sm] .vertical-menu #sidebar-menu > ul ul li:hover > ul a {
    width: auto !important;
}

body[data-sidebar-size=sm] .vertical-menu #sidebar-menu > ul ul li:hover > ul {
    left: auto !important;
}

/* ============================================================
   36. SIDEBAR COLLAPSED — enable icon scrolling
   ============================================================ */

/*
 * Minia sets overflow:visible on the simplebar wrapper so the 260px
 * label expansion and flyout submenus bleed outside the 70px sidebar —
 * we must NOT touch overflow or both would break.
 * Instead, clip-path clips content above/below the sidebar vertically
 * while the large negative right value (-300px) lets the hover label
 * and flyout overflow horizontally as Minia intends.
 * JS (initCollapsedSidebarScroll) scrolls via marginTop on the content.
 */
body[data-sidebar-size=sm] .vertical-menu {
    height: calc(100vh - 70px) !important;
    overflow-y: auto !important;
    overflow-x: visible !important;
    overscroll-behavior: contain;
    scrollbar-width: none;
    -ms-overflow-style: none;
    z-index: 1030 !important;
}

body[data-sidebar-size=sm] .vertical-menu::-webkit-scrollbar {
    display: none;
}

body[data-sidebar-size=sm] .vertical-menu .h-100,
body[data-sidebar-size=sm] .vertical-menu .simplebar-wrapper,
body[data-sidebar-size=sm] .vertical-menu .simplebar-mask,
body[data-sidebar-size=sm] .vertical-menu .simplebar-offset,
body[data-sidebar-size=sm] .vertical-menu .simplebar-content-wrapper,
body[data-sidebar-size=sm] .vertical-menu .simplebar-content {
    height: auto !important;
    min-height: 100% !important;
    overflow: visible !important;
}

body[data-sidebar-size=sm] .vertical-menu .simplebar-content,
body[data-sidebar-size=sm] .vertical-menu #sidebar-menu {
    transform: none !important;
    will-change: auto;
}

body[data-sidebar-size=sm] .vertical-menu .simplebar-content-wrapper {
    overscroll-behavior: contain;
}

body[data-sidebar-size=sm] .vertical-menu #sidebar-menu > ul > li:hover > a,
body[data-sidebar-size=sm] .vertical-menu #sidebar-menu > ul > li:hover > ul,
body[data-sidebar-size=sm] .vertical-menu #sidebar-menu > ul ul li:hover > ul {
    z-index: 1040 !important;
}

body[data-sidebar-size=sm] .vertical-menu #sidebar-menu > ul > li:hover > a span,
body[data-sidebar-size=sm] .vertical-menu #sidebar-menu > ul > li:hover > ul {
    display: none !important;
}

body[data-sidebar-size=sm] .vertical-menu #sidebar-menu > ul > li > a[data-erp-label]:hover::after,
body[data-sidebar-size=sm] .vertical-menu #sidebar-menu > ul > li:hover > a[data-erp-label]::after {
    content: attr(data-erp-label);
    position: fixed !important;
    left: var(--erp-sidebar-flyout-left, 70px) !important;
    top: var(--erp-sidebar-hover-top, 80px) !important;
    z-index: 2147482999 !important;
    display: block !important;
    min-width: 180px;
    max-width: 260px;
    min-height: 52px;
    padding: 15px 18px;
    color: #5156be;
    font-size: .86rem;
    font-weight: 700;
    line-height: 1.45;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    background: #ebe6ff;
    border: 1px solid #e9e9ef;
    border-left: 0;
    border-radius: 0 8px 8px 0;
    box-shadow: 12px 8px 24px rgba(15, 23, 42, .14);
    pointer-events: none;
}

body[data-sidebar-size=sm] .main-content {
    position: relative;
}

.erp-sidebar-flyout-panel {
    position: fixed !important;
    z-index: 2147483000 !important;
    display: block !important;
    background-color: #fff !important;
    border: 1px solid #e9e9ef !important;
    border-left: 0 !important;
    border-radius: 0 8px 8px 0 !important;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .18) !important;
    padding: 0 0 6px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    pointer-events: auto !important;
    transform: translateZ(0);
    isolation: isolate;
}

.erp-sidebar-flyout-title {
    display: flex !important;
    align-items: center !important;
    min-height: 52px !important;
    padding: 15px 18px !important;
    color: #5156be !important;
    background: #ebe6ff !important;
    font-size: .82rem !important;
    font-weight: 700 !important;
    border-bottom: 1px solid #e2ddff !important;
    margin-bottom: 6px !important;
    border-radius: 0 8px 0 0 !important;
}

.erp-sidebar-flyout-panel.is-direct {
    padding-bottom: 0 !important;
}

.erp-sidebar-flyout-panel.is-direct a {
    min-height: 52px !important;
    padding: 15px 18px !important;
    color: #5156be !important;
    background: #ebe6ff !important;
    font-weight: 700 !important;
    border-radius: 0 8px 8px 0 !important;
}

.erp-sidebar-flyout-panel a {
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 8px 18px !important;
    color: #545a6d !important;
    white-space: nowrap !important;
    text-decoration: none !important;
    gap: 6px;
}

.erp-sidebar-flyout-panel a span:not(.sub-badge) {
    display: inline !important;
    padding-left: 0 !important;
    color: inherit !important;
}

.erp-sidebar-flyout-panel a .sub-badge {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    flex-shrink: 0;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 99px;
    background: #ef4444 !important;
    color: #fff !important;
    font-size: .62rem;
    font-weight: 700;
    line-height: 1;
}

.erp-sidebar-flyout-panel i,
.erp-sidebar-flyout-panel svg {
    display: none !important;
}

.erp-sidebar-flyout-panel a:hover,
.erp-sidebar-flyout-panel a.active {
    background: rgba(81, 86, 190, .08) !important;
    color: #5156be !important;
}

body[data-layout-mode=dark] .erp-sidebar-flyout-panel {
    background-color: #1c2128 !important;
    border-color: #30363d !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .45) !important;
}

body[data-layout-mode=dark][data-sidebar-size=sm] .vertical-menu #sidebar-menu > ul > li > a[data-erp-label]:hover::after,
body[data-layout-mode=dark][data-sidebar-size=sm] .vertical-menu #sidebar-menu > ul > li:hover > a[data-erp-label]::after {
    color: #a5b4fc;
    background: #1c2128;
    border-color: #30363d;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
}

body[data-layout-mode=dark] .erp-sidebar-flyout-title {
    color: #a5b4fc !important;
    background: #1c2128 !important;
    border-bottom-color: #30363d !important;
}

body[data-layout-mode=dark] .erp-sidebar-flyout-panel.is-direct a {
    color: #a5b4fc !important;
    background: #1c2128 !important;
}

body[data-layout-mode=dark] .erp-sidebar-flyout-panel a {
    color: #c9d1d9 !important;
}

body[data-layout-mode=dark] .erp-sidebar-flyout-panel a:hover,
body[data-layout-mode=dark] .erp-sidebar-flyout-panel a.active {
    background-color: rgba(99,102,241,.12) !important;
    color: #a5b4fc !important;
}

/* ============================================================
   DARK MODE TRANSITION — smooth light ↔ dark switch
   ============================================================ */

/*
 * body.theme-transitioning briefly applied during toggle.
 * Only color/background properties are transitioned — never
 * layout properties (width, height, transform) which cause
 * reflow and jank.
 */
body.theme-transitioning,
body.theme-transitioning *,
body.theme-transitioning *::before,
body.theme-transitioning *::after {
    transition:
        background-color 220ms ease,
        border-color     220ms ease,
        color            180ms ease,
        box-shadow       220ms ease !important;
}

/* Exclude elements where transition looks wrong */
body.theme-transitioning .bx,
body.theme-transitioning [class*=" bx-"],
body.theme-transitioning [class^="bx-"],
body.theme-transitioning img,
body.theme-transitioning svg,
body.theme-transitioning video,
body.theme-transitioning canvas,
body.theme-transitioning .erp-nav-bar {
    transition: none !important;
}

/* ============================================================
   33. MOBILE — TABLE AUTO-SCROLL
   ============================================================ */

/*
 * Tables inside card-body / page content automatically scroll
 * horizontally on mobile instead of breaking the layout.
 * Uses display:block trick — table content (thead/tbody/tr/td)
 * retains native display; only the outer table becomes a
 * scrollable block container.
 */
@media (max-width: 767.98px) {
    .card-body .table,
    .page-content .table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
    }

    /* Prevent action-button column from wrapping on mobile */
    .card-body .table td,
    .card-body .table th {
        white-space: nowrap;
    }

    /* Restore wrapping for description / address / notes columns */
    .card-body .table td.text-wrap,
    .card-body .table td[class*="col-"],
    .card-body .table td.wrap {
        white-space: normal;
    }
}

/* ============================================================
   34. MOBILE SIDEBAR OVERLAY
   ============================================================ */

/*
 * #sidebar-overlay is injected by app.js into <body>.
 * Must sit BELOW .vertical-menu (z-index 1001) and #page-topbar (1002)
 * so that both the sidebar menu and the hamburger button remain clickable
 * while the overlay covers the main content behind the open sidebar.
 */
#sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .4);
    z-index: 999;    /* below sidebar (1005 when open) and topbar (1002) */
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
}

@media (max-width: 991.98px) {
    body.sidebar-enable #sidebar-overlay {
        display: block;
    }
    /* Prevent body scroll while overlay is open */
    body.sidebar-enable {
        overflow: hidden;
    }
}

/* ============================================================
   35. ERP THEME TOKENS
   ============================================================ */

:root {
    /* ── Font stacks ─────────────────────────────────────────
     * UI font  : system-ui stack — no external dependency.
     *            Renders as Segoe UI (Windows), SF Pro (macOS/iOS),
     *            Roboto (Android/Chrome OS). Clean and highly readable
     *            at all sizes in both light and dark mode.
     * Mono font: ui-monospace → Cascadia Code/SF Mono → Consolas/Menlo.
     *            Used for code, doc numbers, permission slugs, CLI text.
     * ------------------------------------------------------- */
    --erp-font-ui:   system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
                     Roboto, "Helvetica Neue", Arial, sans-serif;
    --erp-font-mono: ui-monospace, "Cascadia Code", "Fira Code", SFMono-Regular,
                     Menlo, Consolas, "Liberation Mono", monospace;

    /* Override Bootstrap's IBM Plex Sans (not loaded) with the system stack */
    --bs-font-sans-serif: var(--erp-font-ui);
    --bs-font-monospace:  var(--erp-font-mono);

    /* ── Color tokens ──────────────────────────────────────── */
    --erp-brand: #5156be;
    --erp-brand-strong: #4348a4;
    --erp-brand-soft: #eef2ff;
    --erp-accent: #10b981;
    --erp-accent-strong: #047857;
    --erp-page: #f4f6fb;
    --erp-surface: #ffffff;
    --erp-surface-soft: #f8fafc;
    --erp-border: #e2e8f0;
    --erp-border-strong: #cbd5e1;
    --erp-ink: #0f172a;
    --erp-text: #334155;
    --erp-muted: #64748b;
    --erp-muted-soft: #94a3b8;
    --erp-success-soft: #dcfce7;
    --erp-warning-soft: #fef3c7;
    --erp-danger-soft: #fee2e2;
    --erp-shadow: 0 18px 48px rgba(15, 23, 42, .14);
    --erp-shadow-soft: 0 8px 24px rgba(15, 23, 42, .08);
}

body {
    font-family: var(--erp-font-ui);
    background: var(--erp-page);
    color: var(--erp-text);
}

.text-teal {
    color: #0f766e !important;
}

/* ============================================================
   36. AUTH FLOWS
   ============================================================ */

.lp-wrap,
.fp-wrap,
.cp-wrap {
    margin: 0 auto;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--erp-shadow);
}

.lp-wrap {
    display: flex;
    width: 100%;
    max-width: 920px;
    min-height: 580px;
}

.lp-left {
    flex: 1;
    display: none;
    position: relative;
    overflow: hidden;
    background: #0f172a;
}

@media (min-width: 780px) {
    .lp-left {
        display: flex;
        flex-direction: column;
    }
}

.lp-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 15% 85%, rgba(81, 86, 190, .22) 0%, transparent 65%),
        radial-gradient(ellipse 60% 50% at 85% 15%, rgba(16, 185, 129, .12) 0%, transparent 60%);
}

.lp-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(81, 86, 190, .06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(81, 86, 190, .06) 1px, transparent 1px);
    background-size: 44px 44px;
}

.lp-shapes {
    position: absolute;
    inset: 0;
}

.lp-shapes span {
    position: absolute;
    border-radius: 50%;
    background: rgba(81, 86, 190, .07);
    border: 1px solid rgba(81, 86, 190, .14);
}

.lp-s1 { width: 280px; height: 280px; top: -70px; left: -70px; }
.lp-s2 { width: 160px; height: 160px; top: 38%; right: -50px; background: rgba(16, 185, 129, .06); border-color: rgba(16, 185, 129, .12); }
.lp-s3 { width: 100px; height: 100px; bottom: 18%; left: 18%; background: rgba(99, 102, 241, .08); border-color: rgba(99, 102, 241, .16); }

.lp-content {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 40px 36px;
}

.lp-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lp-logo-icon-img {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}

.lp-logo-name {
    font-size: 1.2rem;
    font-weight: 800;
    color: #fff;
    line-height: 1;
}

.lp-logo-sub {
    margin-top: 3px;
    font-size: .68rem;
    color: rgba(255, 255, 255, .38);
}

.lp-tagline h2 {
    margin-bottom: 12px;
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -.4px;
    color: #fff;
    background: linear-gradient(135deg, #fff 55%, rgba(255, 255, 255, .45));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.lp-tagline p {
    font-size: .82rem;
    line-height: 1.7;
    color: rgba(255, 255, 255, .5);
}

.lp-modules {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.lp-module-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lp-module-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lp-mod-title {
    font-size: .66rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .36);
}

.lp-mod {
    padding: 4px 10px;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 99px;
    background: rgba(255, 255, 255, .07);
    color: rgba(255, 255, 255, .55);
    font-size: .68rem;
}

.lp-mod-enterprise {
    border-color: rgba(129, 140, 248, .2);
    background: rgba(99, 102, 241, .12);
    color: rgba(224, 231, 255, .86);
}

.lp-right,
.fp-wrap,
.cp-card {
    background: var(--erp-surface);
}

.lp-right {
    width: 380px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    padding: 44px 36px;
}

@media (max-width: 779px) {
    .lp-right {
        width: 100%;
        max-width: 400px;
        border-radius: 20px;
    }
}

.lp-right::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(180deg, var(--erp-brand), #6366f1 50%, var(--erp-accent));
}

.lp-head,
.fp-head {
    margin-bottom: 28px;
}

.fp-head {
    text-align: center;
}

.lp-head .eyebrow,
.fp-eyebrow {
    margin-bottom: 6px;
    color: var(--erp-brand);
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.lp-head h1,
.fp-head h1 {
    margin-bottom: 6px;
    color: var(--erp-ink);
    font-size: 1.55rem;
    font-weight: 700;
    letter-spacing: -.3px;
}

.lp-head p,
.fp-head p {
    color: var(--erp-muted-soft);
    font-size: .82rem;
}

.lp-label,
.fp-label {
    display: block;
    margin-bottom: 6px;
    color: var(--erp-text);
    font-size: .78rem;
    font-weight: 600;
}

.lp-field,
.fp-group {
    position: relative;
    margin-bottom: 16px;
}

.lp-field .fi {
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    color: var(--erp-muted-soft);
    font-size: .95rem;
    pointer-events: none;
}

.lp-field input,
.fp-input,
.cp-card .form-control {
    width: 100%;
    border: 1.5px solid var(--erp-border);
    border-radius: 10px;
    background: var(--erp-surface-soft);
    color: var(--erp-ink);
    transition: border-color .15s, box-shadow .15s, background .15s;
}

.lp-field input {
    padding: 10px 38px 10px 36px;
    font-size: .88rem;
}

.fp-input,
.cp-card .form-control {
    padding: 10px 14px;
    font-size: .9rem;
}

.lp-field input:focus,
.fp-input:focus,
.cp-card .form-control:focus {
    outline: none;
    border-color: var(--erp-brand);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(81, 86, 190, .12);
}

.lp-eye {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    padding: 2px 4px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--erp-muted-soft);
    cursor: pointer;
    transition: color .12s;
}

.lp-eye:hover,
.toggle-pw:hover {
    color: var(--erp-brand);
}

.lp-btn,
.fp-btn,
.btn-submit {
    width: 100%;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--erp-brand), #6366f1);
    color: #fff;
    font-size: .9rem;
    font-weight: 700;
    box-shadow: 0 8px 22px rgba(81, 86, 190, .24);
    transition: opacity .15s, transform .12s, box-shadow .12s;
}

.lp-btn,
.fp-btn {
    padding: 11px;
}

.btn-submit {
    padding: 11px 24px;
}

.lp-btn:hover,
.fp-btn:hover,
.btn-submit:hover {
    opacity: .94;
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(81, 86, 190, .28);
}

.lp-btn:active,
.fp-btn:active,
.btn-submit:active {
    transform: translateY(0);
}

.lp-flash-ok,
.fp-flash-ok,
.flash-ok,
.lp-flash-err,
.fp-flash-err,
.flash-err,
.cp-notice {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: .8rem;
    line-height: 1.55;
}

.lp-flash-ok,
.fp-flash-ok,
.flash-ok {
    margin-bottom: 14px;
    border: 1px solid #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.lp-flash-err,
.fp-flash-err,
.flash-err {
    margin-bottom: 14px;
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.lp-flash-icon,
.fp-flash-icon {
    flex-shrink: 0;
}

.lp-locked-help {
    margin-top: 6px;
    font-size: .78rem;
}

.lp-locked-link {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
}

.is-hidden {
    display: none !important;
}

.lp-hint-box,
.fp-info,
.cp-notice {
    border-radius: 10px;
}

.lp-hint-box {
    margin-bottom: 18px;
    border: 1px solid #fde68a;
    background: #fffbeb;
    color: #78350f;
    font-size: .76rem;
    padding: 12px 14px;
}

.lp-hint-box strong,
.fp-info strong {
    display: block;
    margin-bottom: 6px;
}

.lp-cred {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 5px;
}

.lp-cred-lbl {
    width: 66px;
    color: #a16207;
    font-weight: 600;
}

.lp-cred-val {
    border-radius: 4px;
    background: rgba(15, 23, 42, .06);
    padding: 1px 6px;
    font-family: var(--erp-font-mono);
    font-size: .74rem;
}

.lp-hint-btn {
    padding: 1px 7px;
    border: 1px solid #d97706;
    border-radius: 4px;
    background: transparent;
    color: #b45309;
    font-size: .68rem;
    cursor: pointer;
}

.lp-hint-btn:hover {
    background: #fef3c7;
}

.lp-hint-note {
    margin-top: 7px;
    color: #a16207;
    font-size: .71rem;
}

.lp-forgot {
    margin-top: 12px;
    text-align: center;
    font-size: .82rem;
}

.lp-forgot a {
    color: #94a3b8;
    text-decoration: none;
}

.lp-forgot a:hover {
    color: #e2e8f0;
    text-decoration: underline;
}

.lp-footer {
    margin-top: 24px;
    text-align: center;
    color: #cbd5e1;
    font-size: .7rem;
}

.fp-wrap {
    width: 100%;
    max-width: 460px;
}

.fp-inner {
    width: 100%;
    display: flex;
    flex-direction: column;
    padding: 48px 44px 40px;
}

.fp-icon-wrap {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: var(--erp-brand-soft);
}

.fp-icon-wrap i {
    color: var(--erp-brand);
    font-size: 1.8rem;
}

.fp-back {
    margin-top: 20px;
    text-align: center;
    color: var(--erp-muted);
    font-size: .82rem;
}

.fp-back a {
    color: var(--erp-brand);
    font-weight: 600;
    text-decoration: none;
}

.fp-back a:hover {
    text-decoration: underline;
}

.fp-info {
    margin-bottom: 22px;
    border: 1px solid #bae6fd;
    background: #f0f9ff;
    color: #0c4a6e;
    font-size: .8rem;
    padding: 14px 16px;
}

body.erp-change-password-page {
    min-height: 100vh;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
    font-family: var(--erp-font-ui);
}

.cp-wrap {
    width: 100%;
    max-width: 480px;
}

.cp-brand {
    margin-bottom: 28px;
    text-align: center;
}

.cp-brand-name {
    color: #fff;
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -.5px;
}

.cp-brand-sub,
.cp-footer {
    color: rgba(255, 255, 255, .45);
}

.cp-brand-sub {
    margin-top: 4px;
    font-size: .82rem;
}

.cp-card {
    border: none;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
}

.cp-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 28px 18px;
    background: linear-gradient(135deg, #1e3a5f, #2d4f7f);
}

.cp-card-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    font-size: 1.2rem;
}

.cp-card-title {
    margin: 0;
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
}

.cp-card-sub {
    margin: 2px 0 0;
    color: rgba(255, 255, 255, .6);
    font-size: .78rem;
}

.cp-card-body {
    padding: 28px;
}

.cp-notice {
    margin-bottom: 24px;
    border: 1px solid #fde047;
    background: #fef9c3;
    color: #854d0e;
    font-size: .82rem;
}

.cp-notice i {
    margin-top: 1px;
    flex-shrink: 0;
    font-size: 1.1rem;
}

.cp-card .form-label {
    color: #374151;
    font-size: .85rem;
    font-weight: 600;
}

.cp-card .form-control.is-invalid {
    border-color: #ef4444;
}

.cp-card .invalid-feedback {
    margin-top: 4px;
    color: #ef4444;
    font-size: .78rem;
}

.cp-card .input-group .form-control {
    border-radius: 0 10px 10px 0;
}

.cp-card .input-group-text {
    border: 1.5px solid var(--erp-border);
    border-right: none;
    border-radius: 10px 0 0 10px;
    background: var(--erp-surface-soft);
    color: var(--erp-muted);
}

.cp-rules {
    margin-top: 8px;
    color: var(--erp-muted);
    font-size: .76rem;
    line-height: 1.6;
}

.cp-rules ul {
    margin: 4px 0 0;
    padding-left: 18px;
}

.toggle-pw {
    cursor: pointer;
    user-select: none;
}

.cp-footer {
    margin-top: 20px;
    text-align: center;
    font-size: .73rem;
}

/* ============================================================
   37. DASHBOARD
   ============================================================ */

.db-hero {
    position: relative;
    overflow: hidden;
    margin-bottom: 22px;
    padding: 24px 28px;
    border-radius: 14px;
    color: #fff;
}

.db-hero::before {
    content: "";
    position: absolute;
    top: -60px;
    right: -60px;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .05);
}

.db-hero-operational { background: linear-gradient(135deg, #052e16 0%, #065f46 55%, #059669 100%); }
.db-hero-finance     { background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 55%, #0369a1 100%); }
.db-hero-superadmin  { background: linear-gradient(135deg, #1e1b4b 0%, #312e81 55%, #4f46e5 100%); }

.db-hero .greeting {
    font-size: .75rem;
    letter-spacing: .07em;
    text-transform: uppercase;
    opacity: .65;
}

.db-hero .name {
    margin: 2px 0 3px;
    font-size: 1.55rem;
    font-weight: 700;
    line-height: 1.2;
}

.db-hero .sub {
    font-size: .78rem;
    opacity: .58;
}

.db-badge,
.db-template-badge {
    display: inline-block;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 999px;
    background: rgba(255, 255, 255, .16);
    color: #fff;
}

.db-badge {
    padding: 4px 14px;
    font-size: .78rem;
}

.db-template-badge {
    margin-top: 6px;
    padding: 2px 10px;
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .05em;
}

.db-live-meta {
    margin-top: 4px;
    font-size: .72rem;
    opacity: .58;
}

.kpi-card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .06), 0 4px 14px rgba(0, 0, 0, .04);
    transition: transform .18s, box-shadow .18s;
}

.kpi-card:hover,
.kpi-card-link:hover .kpi-card {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, .09);
}

.kpi-card-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.erp-dashboard-page .kpi-card-link {
    height: 100%;
}

.erp-dashboard-page .kpi-card {
    min-height: 108px;
}

.erp-dashboard-page .kpi-card > .card-body {
    height: 100%;
}

.erp-dashboard-page .kpi-card-link > .kpi-card {
    height: 100%;
}

@media (max-width: 767.98px) {
    .erp-dashboard-page .kpi-card {
        min-height: 96px;
    }
}

.kpi-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 11px;
    font-size: 1.25rem;
}

.kpi-icon-sm {
    width: 38px;
    height: 38px;
    font-size: 1.1rem;
}

.ki-blue    { background: #dbeafe; color: #1d4ed8; }
.ki-green   { background: #dcfce7; color: #16a34a; }
.ki-amber   { background: #fef9c3; color: #ca8a04; }
.ki-red     { background: #fee2e2; color: #dc2626; }
.ki-purple  { background: #ede9fe; color: #7c3aed; }
.ki-teal    { background: #ccfbf1; color: #0f766e; }
.ki-rose    { background: #ffe4e6; color: #e11d48; }
.ki-indigo  { background: #e0e7ff; color: #4338ca; }
.ki-slate   { background: #f1f5f9; color: #475569; }
.ki-orange  { background: #ffedd5; color: #c2410c; }
.ki-emerald { background: #d1fae5; color: #065f46; }

.kpi-label {
    color: var(--erp-muted-soft);
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.kpi-value {
    color: var(--erp-ink);
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.2;
}

.kpi-value-sm {
    font-size: 1.15rem;
}

.kpi-value-tight {
    font-size: .95rem;
}

.kpi-sub {
    margin-top: 1px;
    color: var(--erp-muted);
    font-size: .71rem;
    line-height: 1.3;
}

.kpi-overdue {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-top: 2px;
    color: #ef4444;
    font-size: .66rem;
    font-weight: 600;
}

.kpi-overdue-warning {
    color: #d97706;
}

.kpi-overdue-icon {
    font-size: .75rem;
}

.sec-card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .06), 0 4px 14px rgba(0, 0, 0, .04);
}

.sec-card .card-header {
    padding: 13px 16px 9px;
    border-bottom: 1px solid #f1f5f9;
    background: transparent;
    color: var(--erp-ink);
    font-size: .88rem;
    font-weight: 700;
}

.purch-stat {
    padding: 8px 4px;
    border-radius: 9px;
    background: var(--erp-surface-soft);
    text-align: center;
}

.purch-stat .num {
    color: var(--erp-ink);
    font-size: 1.3rem;
    font-weight: 700;
}

.purch-stat .lbl,
.db-muted-caps {
    color: var(--erp-muted-soft);
    font-size: .65rem;
    font-weight: 600;
    text-transform: uppercase;
}

.purch-stat .lbl {
    margin-top: 1px;
}

.stock-row {
    display: flex;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid #f8fafc;
}

.stock-row:last-child,
.company-row:last-child,
.cb-row:last-child {
    border-bottom: none;
}

.stock-meta {
    min-width: 90px;
    max-width: 90px;
}

.stock-item-name {
    overflow: hidden;
    color: var(--erp-text);
    font-size: .73rem;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.stock-item-code {
    color: var(--erp-muted-soft);
    font-size: .63rem;
}

.stock-bar {
    flex: 1;
    height: 4px;
    margin: 0 8px;
    overflow: hidden;
    border-radius: 99px;
    background: var(--erp-border);
}

.stock-bar-fill {
    height: 100%;
    border-radius: 99px;
}

.stock-qty {
    min-width: 44px;
    text-align: right;
    color: var(--erp-text);
    font-size: .76rem;
    font-weight: 700;
}

.stock-empty {
    color: var(--erp-muted);
    font-size: .8rem;
}

.company-row,
.cb-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 0;
    border-bottom: 1px solid #f8fafc;
    font-size: .82rem;
}

.company-name {
    font-size: .83rem;
}

.company-code,
.company-id,
.db-xs-muted {
    color: var(--erp-muted-soft);
    font-size: .72rem;
}

.company-code {
    margin-left: 6px;
}

.inbox-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: .9rem;
    font-weight: 700;
}

.inbox-zero { background: #dcfce7; color: #15803d; }
.inbox-has  { background: #fee2e2; color: #dc2626; }

.cb-type-cash,
.cb-type-bank {
    padding: 1px 6px;
    border-radius: 4px;
    font-size: .63rem;
    font-weight: 700;
    text-transform: uppercase;
}

.cb-type-cash {
    background: #fef9c3;
    color: #92400e;
}

.cb-type-bank {
    background: #dbeafe;
    color: #1e40af;
}

.db-mini-chart {
    height: 160px;
}

.db-chart-md {
    height: 184px;
}

.db-chart-lg {
    height: 296px;
}

.db-chart-shell {
    position: relative;
}

.db-chart-summary {
    display: grid;
    gap: .7rem;
    margin-bottom: .9rem;
}

.db-chart-summary-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.db-chart-pill {
    padding: .75rem .8rem;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: var(--erp-surface-soft);
}

.db-chart-pill-label {
    color: var(--erp-muted-soft);
    font-size: .64rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.db-chart-pill-value {
    margin-top: .18rem;
    color: var(--erp-ink);
    font-size: .98rem;
    font-weight: 700;
    line-height: 1.25;
}

.db-chart-pill-sub {
    margin-top: .12rem;
    color: var(--erp-muted);
    font-size: .69rem;
    line-height: 1.35;
}

.db-chart-pill-income {
    background: #ecfdf5;
    border-color: #bbf7d0;
}

.db-chart-pill-expense {
    background: #fef2f2;
    border-color: #fecaca;
}

.db-chart-pill-net {
    background: #eff6ff;
    border-color: #bfdbfe;
}

.db-chart-pill-cash {
    background: #ecfeff;
    border-color: #bae6fd;
}

.db-chart-pill-bank {
    background: #eef2ff;
    border-color: #c7d2fe;
}

.db-chart-pill-total {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.db-section-note {
    color: var(--erp-muted);
    font-size: .78rem;
    text-align: center;
}

.db-aging-table {
    margin-top: .7rem;
}

.db-aging-table td {
    padding-top: .36rem;
    padding-bottom: .36rem;
    vertical-align: middle;
}

.db-alert-code {
    font-size: .75rem;
}

.db-card-border-alert {
    border: 1.5px solid #fca5a5 !important;
}

.db-kas-value {
    color: #065f46;
    font-size: .88rem;
}

.db-bank-value {
    color: #1d4ed8;
    font-size: .88rem;
}

.db-total-value {
    color: var(--erp-ink);
    font-size: 1rem;
}

.cb-account-name,
.cb-account-balance,
.db-session-name,
.db-session-email {
    font-size: .78rem;
}

.cb-account-name {
    max-width: 90px;
}

.db-session-name {
    font-size: .82rem;
}

.db-session-key {
    width: 40%;
}

/* Aging summary cards */
.aging-bucket-card {
    border: 1px solid transparent !important;
    border-radius: 14px !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45);
}

.aging-bucket-label {
    color: #334155;
    font-size: .76rem;
    font-weight: 700;
    letter-spacing: .02em;
}

.aging-bucket-amount {
    color: #0f172a;
    font-size: 1rem;
    font-weight: 700;
}

.aging-bucket-meta {
    color: #475569;
    font-size: .74rem;
    font-weight: 600;
}

.aging-bucket-total {
    background: linear-gradient(180deg, #eef2ff 0%, #e0e7ff 100%) !important;
    border-color: rgba(81, 86, 190, .18) !important;
}

.aging-bucket-success {
    background: linear-gradient(180deg, #f0fdf4 0%, #dcfce7 100%) !important;
    border-color: rgba(22, 101, 52, .12) !important;
}

.aging-bucket-warning {
    background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%) !important;
    border-color: rgba(146, 64, 14, .12) !important;
}

.aging-bucket-warning-strong {
    background: linear-gradient(180deg, #fef3c7 0%, #fde68a 100%) !important;
    border-color: rgba(146, 64, 14, .16) !important;
}

.aging-bucket-danger {
    background: linear-gradient(180deg, #fff1f2 0%, #ffe4e6 100%) !important;
    border-color: rgba(190, 24, 93, .12) !important;
}

.aging-bucket-danger-strong {
    background: linear-gradient(180deg, #ffe4e6 0%, #fecdd3 100%) !important;
    border-color: rgba(190, 24, 93, .18) !important;
}

body[data-layout-mode=dark] .aging-bucket-card {
    box-shadow: none;
}

body[data-layout-mode=dark] .aging-bucket-label {
    color: #dbe4f0;
}

body[data-layout-mode=dark] .aging-bucket-amount {
    color: #f8fafc;
}

body[data-layout-mode=dark] .aging-bucket-meta {
    color: #cbd5e1;
}

body[data-layout-mode=dark] .aging-bucket-total {
    background: linear-gradient(180deg, rgba(81, 86, 190, .28) 0%, rgba(81, 86, 190, .18) 100%) !important;
    border-color: rgba(165, 180, 252, .24) !important;
}

body[data-layout-mode=dark] .aging-bucket-success {
    background: linear-gradient(180deg, rgba(34, 197, 94, .22) 0%, rgba(22, 163, 74, .14) 100%) !important;
    border-color: rgba(74, 222, 128, .22) !important;
}

body[data-layout-mode=dark] .aging-bucket-warning {
    background: linear-gradient(180deg, rgba(245, 158, 11, .22) 0%, rgba(217, 119, 6, .14) 100%) !important;
    border-color: rgba(251, 191, 36, .22) !important;
}

body[data-layout-mode=dark] .aging-bucket-warning-strong {
    background: linear-gradient(180deg, rgba(245, 158, 11, .28) 0%, rgba(217, 119, 6, .18) 100%) !important;
    border-color: rgba(251, 191, 36, .28) !important;
}

body[data-layout-mode=dark] .aging-bucket-danger {
    background: linear-gradient(180deg, rgba(244, 63, 94, .22) 0%, rgba(225, 29, 72, .14) 100%) !important;
    border-color: rgba(251, 113, 133, .24) !important;
}

body[data-layout-mode=dark] .aging-bucket-danger-strong {
    background: linear-gradient(180deg, rgba(244, 63, 94, .28) 0%, rgba(225, 29, 72, .18) 100%) !important;
    border-color: rgba(251, 113, 133, .3) !important;
}

body[data-layout-mode=dark] .db-chart-pill {
    background: #1e2225;
    border-color: #343c46;
}

body[data-layout-mode=dark] .db-chart-pill-label {
    color: #9aa4af;
}

body[data-layout-mode=dark] .db-chart-pill-value {
    color: #e6edf3;
}

body[data-layout-mode=dark] .db-chart-pill-sub,
body[data-layout-mode=dark] .db-section-note {
    color: #9aa4af;
}

body[data-layout-mode=dark] .db-chart-pill-income {
    background: rgba(16, 185, 129, .12);
    border-color: rgba(16, 185, 129, .24);
}

body[data-layout-mode=dark] .db-chart-pill-expense {
    background: rgba(239, 68, 68, .12);
    border-color: rgba(239, 68, 68, .24);
}

body[data-layout-mode=dark] .db-chart-pill-net {
    background: rgba(59, 130, 246, .12);
    border-color: rgba(59, 130, 246, .24);
}

body[data-layout-mode=dark] .db-chart-pill-cash {
    background: rgba(14, 165, 233, .12);
    border-color: rgba(14, 165, 233, .24);
}

body[data-layout-mode=dark] .db-chart-pill-bank {
    background: rgba(99, 102, 241, .12);
    border-color: rgba(99, 102, 241, .24);
}

body[data-layout-mode=dark] .db-chart-pill-total {
    background: rgba(148, 163, 184, .12);
    border-color: rgba(148, 163, 184, .22);
}

/* Executive dashboard summary cards */
.exec-dashboard .card-header {
    background: linear-gradient(180deg, #ffffff 0%, var(--erp-surface-soft) 100%);
    border-bottom: 1px solid var(--erp-border);
}

.exec-kpi-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: .9rem;
    min-height: 184px;
    padding: 1rem 1.05rem 1rem;
    border: 1px solid var(--exec-border, #e2e8f0);
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .06), 0 4px 14px rgba(0, 0, 0, .04);
    transition: transform .18s, box-shadow .18s;
    overflow: hidden;
}

.exec-kpi-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: var(--exec-accent, #94a3b8);
}

.exec-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, .09);
}

.exec-kpi-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}

.exec-kpi-label {
    color: var(--erp-muted-soft);
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    line-height: 1.35;
}

.exec-kpi-value {
    margin-top: .28rem;
    color: var(--erp-ink);
    font-size: 1.34rem;
    font-weight: 700;
    line-height: 1.2;
}

.exec-kpi-sub {
    color: var(--erp-muted);
    font-size: .72rem;
    line-height: 1.52;
    padding-right: .2rem;
}

.exec-kpi-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 11px;
    border: none;
    background: var(--exec-soft, #f1f5f9);
    color: var(--exec-accent, #475569);
    box-shadow: none;
    font-size: 1.25rem;
    flex: 0 0 auto;
}

.exec-kpi-facts {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    margin-top: auto;
    padding-top: .25rem;
}

.exec-kpi-fact {
    display: inline-flex;
    align-items: center;
    gap: .42rem;
    min-height: 30px;
    padding: .35rem .62rem;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    background: var(--erp-surface-soft);
    color: var(--erp-muted);
    font-size: .69rem;
    line-height: 1;
}

.exec-kpi-fact span {
    color: var(--erp-muted-soft);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.exec-kpi-fact strong {
    color: var(--erp-ink);
    font-weight: 700;
}

.exec-kpi-indigo {
    --exec-accent: #4338ca;
    --exec-soft: #e0e7ff;
    --exec-border: #c7d2fe;
}

.exec-kpi-green {
    --exec-accent: #047857;
    --exec-soft: #d1fae5;
    --exec-border: #a7f3d0;
}

.exec-kpi-amber {
    --exec-accent: #b45309;
    --exec-soft: #fef3c7;
    --exec-border: #fde68a;
}

.exec-kpi-rose {
    --exec-accent: #be123c;
    --exec-soft: #ffe4e6;
    --exec-border: #fecdd3;
}

/* Compact variant — for report summary rows where full height is excessive */
.exec-kpi-card--sm {
    min-height: 0;
    gap: .5rem;
    padding: .7rem .8rem;
}
.exec-kpi-card--sm .exec-kpi-value {
    font-size: 1.1rem;
    margin-top: .12rem;
}
.exec-kpi-card--sm .exec-kpi-icon {
    width: 36px;
    height: 36px;
    font-size: 1rem;
}
.exec-kpi-card--sm .exec-kpi-sub {
    font-size: .68rem;
}

body[data-layout-mode=dark] .exec-dashboard .card-header {
    background: linear-gradient(180deg, #30353a 0%, #2a2f35 100%);
    border-bottom-color: #3f4650;
}

body[data-layout-mode=dark] .exec-kpi-card {
    background-color: #23272a;
    border-color: #343c46;
    box-shadow: 0 1px 4px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.2);
}

body[data-layout-mode=dark] .exec-kpi-label {
    color: #6e7681;
}

body[data-layout-mode=dark] .exec-kpi-value {
    color: #e6edf3;
}

body[data-layout-mode=dark] .exec-kpi-sub {
    color: #9aa4af;
}

body[data-layout-mode=dark] .exec-kpi-icon {
    background: rgba(255, 255, 255, .08);
}

body[data-layout-mode=dark] .exec-kpi-fact {
    background: #1e2225;
    border-color: #343c46;
    color: #9aa4af;
}

body[data-layout-mode=dark] .exec-kpi-fact strong {
    color: #e6edf3;
}

@media (max-width: 575.98px) {
    .db-chart-summary-3 {
        grid-template-columns: 1fr;
    }

    .exec-kpi-card {
        min-height: 168px;
        padding: .95rem .9rem .95rem;
    }

    .exec-kpi-value {
        font-size: 1.18rem;
    }
}

@media print {
    .exec-kpi-card {
        box-shadow: none !important;
        break-inside: avoid;
    }
}

/* Shared page utilities */
.erp-hidden {
    display: none !important;
}

.erp-page-subtitle {
    font-size: .82rem;
}

.erp-code-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    border-radius: 6px;
    background: var(--erp-surface-soft);
    color: var(--erp-ink);
    font-size: .8rem;
    font-weight: 600;
}

.erp-code-input {
    text-transform: lowercase;
    letter-spacing: .03em;
}

/* Access pages */
.access-stat-card {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: var(--erp-surface);
    border: 1px solid var(--erp-border);
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .03);
}

.access-stat-card-warning {
    border-color: #fde68a;
    background: linear-gradient(180deg, #fffbeb 0%, #ffffff 100%);
}

.access-stat-icon {
    font-size: 1.1rem;
}

.access-stat-icon-primary {
    color: var(--erp-brand);
}

.access-stat-icon-success {
    color: #15803d;
}

.access-stat-icon-info {
    color: #1d4ed8;
}

.access-stat-icon-muted {
    color: #475569;
}

.access-stat-icon-warning {
    color: #b45309;
}

.access-stat-num {
    color: var(--erp-ink);
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1;
}

.access-stat-num-warning {
    color: #b45309;
}

.access-stat-label {
    color: var(--erp-muted);
    font-size: .7rem;
}

.access-code-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    border-radius: 6px;
    background: var(--erp-surface-soft);
    color: var(--erp-ink);
    font-size: .8rem;
}

.access-name-cell {
    color: var(--erp-ink);
    font-size: .85rem;
    font-weight: 600;
}

.access-col-id {
    width: 50px;
}

.access-col-scope {
    width: 85px;
}

.access-col-code {
    width: 200px;
}

.access-col-permissions {
    width: 100px;
}

.access-col-status {
    width: 90px;
}

.access-col-joined {
    width: 100px;
}

.access-col-action-sm {
    width: 90px;
}

.access-col-action-lg {
    width: 170px;
}

.role-chip {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 99px;
    font-size: .68rem;
    font-weight: 600;
    white-space: nowrap;
}

.role-chip-global {
    background: #1e293b;
    color: #e2e8f0;
}

.role-chip-company {
    background: #dbeafe;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
}

.role-chip-system {
    background: #fef3c7;
    border: 1px solid #fde68a;
    color: #92400e;
}

.perm-count {
    display: inline-block;
    padding: 1px 8px;
    border: 1px solid var(--erp-border);
    border-radius: 99px;
    background: var(--erp-surface-soft);
    color: #475569;
    font-size: .7rem;
    font-weight: 600;
}

.usr-av {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .02em;
    vertical-align: middle;
}

.usr-av-0 { background: #3b82f6; }
.usr-av-1 { background: #8b5cf6; }
.usr-av-2 { background: #10b981; }
.usr-av-3 { background: #f59e0b; }
.usr-av-4 { background: #ef4444; }
.usr-av-5 { background: #0ea5e9; }
.usr-av-6 { background: #ec4899; }
.usr-av-7 { background: #14b8a6; }

.usr-chip {
    display: inline-block;
    padding: 1px 7px;
    border: 1px solid #c4b5fd;
    border-radius: 99px;
    background: #ede9fe;
    color: #5b21b6;
    font-size: .68rem;
    font-weight: 600;
    white-space: nowrap;
}

.usr-chip-super {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #991b1b;
}

.usr-no-role {
    color: var(--erp-muted-soft);
    font-size: .75rem;
    font-style: italic;
}

.usr-search-wrap {
    position: relative;
    flex: 1;
    min-width: 220px;
    max-width: 360px;
}

.usr-search-wrap .form-control {
    padding-left: 32px;
}

.usr-search-icon {
    position: absolute;
    top: 50%;
    left: 10px;
    transform: translateY(-50%);
    color: var(--erp-muted-soft);
    font-size: .9rem;
    pointer-events: none;
}

.usr-flt {
    padding: 4px 12px;
    border: 1.5px solid var(--erp-border);
    border-radius: 6px;
    background: #fff;
    color: var(--erp-muted);
    cursor: pointer;
    font-size: .75rem;
    font-weight: 600;
    transition: all .12s;
}

.usr-flt:hover {
    border-color: var(--erp-brand);
    color: var(--erp-brand);
}

.usr-flt.active {
    border-color: var(--erp-brand);
    background: #ede9fe;
    color: #4338ca;
}

.usr-toolbar-count {
    font-size: .75rem;
}

.usr-name {
    color: var(--erp-ink);
    font-size: .85rem;
    font-weight: 600;
    line-height: 1.2;
}

.usr-super-badge {
    font-size: .6rem;
}

.usr-email {
    color: var(--erp-muted);
    font-size: .82rem;
}

.usr-joined {
    color: var(--erp-muted-soft);
    font-size: .78rem;
}

.usr-empty-state {
    font-size: .85rem;
}

#usr-tbody tr.u-hidden {
    display: none;
}

/* Role form */
.rf-master-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    padding: 14px 20px;
    border-radius: 10px;
    background: var(--erp-ink);
    flex-wrap: wrap;
}

.rf-master-bar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rf-master-title {
    color: #fff;
    font-size: .82rem;
    font-weight: 700;
    letter-spacing: .03em;
}

.rf-master-count {
    color: rgba(255, 255, 255, .5);
    font-size: .75rem;
}

.rf-master-actions,
.rf-presets {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.rf-btn-all {
    padding: 5px 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: .75rem;
    font-weight: 600;
    transition: all .15s;
}

.rf-btn-all-check {
    background: #22c55e;
    color: #fff;
}

.rf-btn-all-check:hover {
    background: #16a34a;
}

.rf-btn-all-uncheck {
    background: rgba(255, 255, 255, .15);
    color: rgba(255, 255, 255, .85);
}

.rf-btn-all-uncheck:hover {
    background: rgba(255, 255, 255, .25);
    color: #fff;
}

.rf-presets {
    gap: 6px;
    margin-bottom: 20px;
}

.rf-preset-label {
    align-self: center;
    padding: 4px 4px;
    color: var(--erp-muted);
    font-size: .68rem;
    white-space: nowrap;
}

.rf-preset-chip {
    padding: 4px 12px;
    border: 1.5px solid var(--erp-border);
    border-radius: 99px;
    background: var(--erp-surface);
    color: var(--erp-muted);
    cursor: pointer;
    font-size: .72rem;
    font-weight: 600;
    transition: all .15s;
    white-space: nowrap;
}

.rf-preset-chip:hover {
    border-color: #2563eb;
    background: #eff6ff;
    color: #2563eb;
}

.rf-preset-chip.active {
    border-color: #2563eb;
    background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, .12);
    color: #1d4ed8;
}

.rf-preset-chip.active::after {
    content: "OK";
    margin-left: 6px;
    font-size: .66rem;
}

.rf-group {
    margin-bottom: 12px;
    border: 1.5px solid var(--erp-border);
    border-radius: 10px;
    overflow: hidden;
    transition: border-color .15s;
}

.rf-group:has(.perm-cb:checked) {
    border-color: var(--rf-group-accent, #2563eb);
}

.rf-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1.5px solid var(--erp-border);
    background: var(--erp-surface-soft);
    cursor: pointer;
    user-select: none;
    transition: background .12s;
}

.rf-group-header:hover {
    background: #f1f5f9;
}

.rf-group-icon {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    background: var(--rf-group-bg-light, #eff6ff);
    color: var(--rf-group-accent, #2563eb);
    flex-shrink: 0;
    font-size: .9rem;
}

.rf-group-name {
    flex: 1;
    color: var(--erp-ink);
    font-size: .82rem;
    font-weight: 700;
}

.rf-group-stats {
    margin-right: 8px;
    color: var(--erp-muted);
    font-size: .7rem;
    white-space: nowrap;
}

.rf-group-stats span {
    color: var(--erp-ink);
    font-weight: 700;
}

.rf-sect-toggle-btn {
    margin-right: 4px;
    padding: 4px 10px;
    border: 1.5px solid var(--erp-border);
    border-radius: 5px;
    background: var(--erp-surface);
    color: var(--erp-muted);
    cursor: pointer;
    font-size: .7rem;
    font-weight: 600;
    transition: all .12s;
    white-space: nowrap;
}

.rf-sect-toggle-btn:hover {
    border-color: var(--rf-group-accent, #2563eb);
    background: #f8faff;
    color: var(--rf-group-accent, #2563eb);
}

.rf-chevron {
    margin-left: 2px;
    color: var(--erp-muted);
    font-size: .65rem;
    transition: transform .2s ease;
    flex-shrink: 0;
}

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

.rf-group-body {
    display: none;
    padding: 14px 16px;
    background: var(--erp-surface);
}

.rf-group.open .rf-group-body {
    display: block;
}

.rf-perm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 6px;
}

.rf-perm-item {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 7px 10px;
    border: 1.5px solid transparent;
    border-radius: 7px;
    cursor: pointer;
    transition: all .12s;
}

.rf-perm-item:hover {
    border-color: var(--erp-border);
    background: var(--erp-surface-soft);
}

.rf-perm-item:has(.perm-cb:checked) {
    border-color: var(--rf-group-accent, #2563eb);
    background: var(--rf-perm-bg, #eff6ff);
}

.perm-cb {
    margin-top: 2px;
    flex-shrink: 0;
    accent-color: var(--rf-group-accent, #2563eb);
    cursor: pointer;
}

.rf-perm-text {
    min-width: 0;
}

.rf-perm-code {
    display: block;
    overflow: hidden;
    color: var(--erp-ink);
    font-family: var(--erp-font-mono);
    font-size: .72rem;
    font-weight: 600;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rf-perm-label {
    display: block;
    color: var(--erp-muted);
    font-size: .7rem;
    line-height: 1.3;
}

.rf-sticky-summary {
    position: sticky;
    top: 64px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding: 8px 0;
    border-bottom: 1px solid var(--erp-border);
    background: rgba(248, 250, 252, .95);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    flex-wrap: wrap;
}

.rf-selected-badge {
    padding: 3px 10px;
    border-radius: 99px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: .78rem;
    font-weight: 700;
}

.rf-selected-text {
    color: var(--erp-muted);
    font-size: .78rem;
}

.rf-has-checked .rf-group-header {
    background: var(--rf-group-bg-light, #f0f9ff);
}

.rf-edit-code {
    font-size: .78rem;
}

.rf-submit-summary {
    font-size: .85rem;
}

.rf-submit-note {
    font-size: .75rem;
}

/* Approval matrix */
.amx-step-row {
    display: grid;
    grid-template-columns: 36px minmax(154px, auto) minmax(0, 1fr) 32px;
    gap: 12px;
    align-items: center;
    margin-bottom: 8px;
    padding: 12px 16px;
    border: 1.5px solid var(--erp-border);
    border-radius: 8px;
    background: #fff;
    transition: border-color .15s;
}

.amx-step-row:hover {
    border-color: #c7d2fe;
}

.amx-step-num {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--erp-brand);
    color: #fff;
    flex-shrink: 0;
    font-size: .78rem;
    font-weight: 700;
}

.amx-step-approver {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.amx-type-toggle {
    display: flex;
    border: 1.5px solid var(--erp-border);
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    min-width: 154px;
}

.amx-type-btn {
    flex: 1 1 0;
    min-width: 0;
    height: 34px !important;
    min-height: 34px !important;
    padding: 0 12px !important;
    border: none;
    background: var(--erp-surface-soft);
    color: var(--erp-muted-soft);
    cursor: pointer;
    font-size: .73rem;
    font-weight: 600;
    line-height: 1.15 !important;
    transition: all .12s;
    white-space: nowrap;
}

.amx-type-btn.sel {
    background: var(--erp-brand);
    color: #fff;
}

.amx-type-btn:hover:not(.sel) {
    background: #ede9fe;
    color: var(--erp-brand);
}

.amx-remove-btn {
    width: 32px !important;
    min-width: 32px !important;
    height: 32px !important;
    min-height: 32px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid #fee2e2;
    border-radius: 6px;
    background: none;
    color: #fca5a5;
    cursor: pointer;
    font-size: .85rem;
    transition: all .12s;
    flex-shrink: 0;
}

.amx-remove-btn:hover {
    background: #fee2e2;
    color: #dc2626;
}

#amx-steps-list {
    min-height: 60px;
}

.amx-add-btn {
    width: 100%;
    margin-top: 4px;
    min-height: 38px !important;
    padding: 0 12px !important;
    border: 1.5px dashed #c7d2fe;
    border-radius: 8px;
    background: #f5f3ff;
    color: var(--erp-brand);
    cursor: pointer;
    font-size: .8rem;
    font-weight: 600;
    transition: all .15s;
}

.amx-add-btn:hover {
    border-color: var(--erp-brand);
    background: #ede9fe;
}

.amx-doc-type-wrap {
    min-width: 0;
    overflow: hidden;
}

.amx-select-ellipsis {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.amx-symbol {
    font-size: .8rem;
}

.amx-range-hint {
    background: #f5f3ff;
    color: #4338ca;
    font-size: .78rem;
}

.amx-guide-title {
    color: var(--erp-ink);
}

.amx-guide-list {
    line-height: 1.9;
}

.amx-guide-badge-role,
.amx-guide-badge-user {
    font-weight: 600;
}

.amx-guide-badge-role {
    background: #ede9fe;
    color: #5b21b6;
}

.amx-guide-badge-user {
    background: #dbeafe;
    color: #1d4ed8;
}

.amx-guide-example {
    padding: .5rem;
    border: 1px solid transparent;
    border-radius: .375rem;
    font-size: .75rem;
}

.amx-guide-example-success {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.amx-guide-example-info {
    background: #eff6ff;
    border-color: #bfdbfe;
}

.amx-guide-example-warning {
    background: #fef9c3;
    border-color: #fde68a;
}

@media (max-width: 767.98px) {
    .amx-step-row {
        grid-template-columns: 36px minmax(0, 1fr) 32px;
    }

    .amx-type-toggle,
    .amx-step-approver {
        grid-column: 2 / 3;
    }

    .amx-step-approver {
        min-width: 100%;
    }

    .amx-remove-btn {
        grid-column: 3 / 4;
        grid-row: 1 / 2;
    }
}

/* Finance GL */
.gl-filter-card {
    border: 1px solid var(--erp-border);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .03);
}

.gl-summary-card {
    padding: 14px 16px;
    border: 1px solid transparent;
    border-radius: 14px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45);
}

.gl-summary-label {
    color: #334155;
    font-size: .76rem;
    font-weight: 700;
    letter-spacing: .02em;
}

.gl-summary-value {
    color: #0f172a;
    font-size: 1rem;
    font-weight: 700;
}

.gl-summary-debit {
    background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
    border-color: rgba(37, 99, 235, .16);
}

.gl-summary-credit {
    background: linear-gradient(180deg, #fff1f2 0%, #ffe4e6 100%);
    border-color: rgba(225, 29, 72, .14);
}

.gl-summary-balance-ok {
    background: linear-gradient(180deg, #f0fdf4 0%, #dcfce7 100%);
    border-color: rgba(22, 101, 52, .14);
}

.gl-summary-balance-warn {
    background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%);
    border-color: rgba(146, 64, 14, .14);
}

.gl-summary-count {
    background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
    border-color: rgba(100, 116, 139, .14);
}

.gl-source-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border: 1px solid transparent;
    border-radius: 99px;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .02em;
    white-space: nowrap;
}

.gl-source-ar {
    background: #dbeafe;
    border-color: #bfdbfe;
    color: #1d4ed8;
}

.gl-source-arrec {
    background: #dcfce7;
    border-color: #bbf7d0;
    color: #15803d;
}

.gl-source-ap {
    background: #fee2e2;
    border-color: #fecaca;
    color: #b91c1c;
}

.gl-source-appay {
    background: #fef3c7;
    border-color: #fde68a;
    color: #92400e;
}

.gl-source-grn {
    background: #e0f2fe;
    border-color: #bae6fd;
    color: #0369a1;
}

.gl-source-do {
    background: #ede9fe;
    border-color: #ddd6fe;
    color: #6d28d9;
}

.gl-source-default {
    background: #e2e8f0;
    border-color: #cbd5e1;
    color: #475569;
}

.gl-empty-state {
    color: var(--erp-muted);
}

.gl-ledger-table thead th {
    background: var(--erp-surface-soft);
    color: var(--erp-text);
    font-size: .72rem;
    font-weight: 700;
    border-bottom: 1px solid var(--erp-border);
}

.gl-ledger-table tbody td {
    color: var(--erp-text);
}

.gl-row-start td {
    border-top: 1.5px solid var(--erp-border-strong);
}

.gl-ledger-memo {
    color: var(--erp-muted);
}

.gl-empty-money {
    color: var(--erp-muted-soft);
}

.gl-ledger-total {
    background: linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
}

.gl-col-date {
    width: 100px;
}

.gl-col-source {
    width: 110px;
}

.gl-col-doc {
    width: 150px;
}

.gl-col-account {
    width: 90px;
}

.gl-col-money {
    width: 130px;
}

body[data-layout-mode=dark] .gl-summary-card {
    box-shadow: none;
}

body[data-layout-mode=dark] .gl-summary-label {
    color: #dbe4f0;
}

body[data-layout-mode=dark] .gl-summary-value {
    color: #f8fafc;
}

body[data-layout-mode=dark] .gl-summary-debit {
    background: linear-gradient(180deg, rgba(37, 99, 235, .25) 0%, rgba(29, 78, 216, .16) 100%);
    border-color: rgba(96, 165, 250, .28);
}

body[data-layout-mode=dark] .gl-summary-credit {
    background: linear-gradient(180deg, rgba(225, 29, 72, .25) 0%, rgba(190, 24, 93, .16) 100%);
    border-color: rgba(251, 113, 133, .26);
}

body[data-layout-mode=dark] .gl-summary-balance-ok {
    background: linear-gradient(180deg, rgba(22, 163, 74, .24) 0%, rgba(21, 128, 61, .16) 100%);
    border-color: rgba(74, 222, 128, .24);
}

body[data-layout-mode=dark] .gl-summary-balance-warn {
    background: linear-gradient(180deg, rgba(217, 119, 6, .26) 0%, rgba(180, 83, 9, .16) 100%);
    border-color: rgba(251, 191, 36, .24);
}

body[data-layout-mode=dark] .gl-summary-count {
    background: linear-gradient(180deg, rgba(71, 85, 105, .28) 0%, rgba(51, 65, 85, .18) 100%);
    border-color: rgba(148, 163, 184, .22);
}

body[data-layout-mode=dark] .gl-source-default {
    background: rgba(148, 163, 184, .18);
    border-color: rgba(148, 163, 184, .22);
    color: #e2e8f0;
}

body[data-layout-mode=dark] .gl-ledger-table thead th {
    background: rgba(15, 23, 42, .45);
    color: #dbe4f0;
    border-bottom-color: rgba(148, 163, 184, .22);
}

body[data-layout-mode=dark] .gl-ledger-table tbody td {
    color: #e2e8f0;
}

body[data-layout-mode=dark] .gl-ledger-memo {
    color: #cbd5e1;
}

body[data-layout-mode=dark] .gl-empty-money {
    color: #94a3b8;
}

body[data-layout-mode=dark] .gl-ledger-total {
    background: linear-gradient(180deg, rgba(15, 23, 42, .58) 0%, rgba(49, 46, 129, .22) 100%);
}

/* Company profile */
/* Wrapper: holds the border and the gradient fade overlays */
.cp-tabs-outer {
    position: relative;
    border-bottom: 2px solid var(--erp-border);
}

/* Right-fade: shown when there are more tabs to the right */
.cp-tabs-outer::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 2px; /* sit above the border */
    width: 56px;
    background: linear-gradient(to right, rgba(255,255,255,0), #fff 80%);
    pointer-events: none;
    opacity: 0;
    transition: opacity .2s;
    z-index: 2;
}

/* Left-fade: shown when scrolled past the start */
.cp-tabs-outer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 2px;
    width: 56px;
    background: linear-gradient(to left, rgba(255,255,255,0), #fff 80%);
    pointer-events: none;
    opacity: 0;
    transition: opacity .2s;
    z-index: 2;
}

.cp-tabs-outer.cp-scroll-right::after  { opacity: 1; }
.cp-tabs-outer.cp-scroll-left::before  { opacity: 1; }

/* Dark mode */
body[data-layout-mode=dark] .cp-tabs-outer::after  {
    background: linear-gradient(to right, rgba(35,39,42,0), #23272a 80%);
}
body[data-layout-mode=dark] .cp-tabs-outer::before {
    background: linear-gradient(to left,  rgba(35,39,42,0), #23272a 80%);
}

.cp-tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 0;
    padding: 20px 24px 6px;  /* 6px bottom = breathing room for scrollbar */
    border-bottom: none;  /* border lives on .cp-tabs-outer */
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #eef2f7;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}

.cp-tabs::-webkit-scrollbar {
    height: 6px;
}

.cp-tabs::-webkit-scrollbar-track {
    background: #eef2f7;
    border-radius: 4px;
    margin-inline: .5rem;
}

.cp-tabs::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.cp-tabs::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.cp-tab {
    display: flex;
    align-items: center;
    gap: 7px;
    /* No margin-bottom trick — would be clipped by overflow-x:auto container */
    margin-bottom: 0;
    padding: 9px 16px 11px; /* 2px extra bottom padding replaces the old -margin overlap */
    border: none;
    outline: none;
    border-radius: 6px 6px 0 0;
    background: none;
    color: var(--erp-muted);
    cursor: pointer;
    font-size: .82rem;
    font-weight: 600;
    transition: color .15s, background .15s, box-shadow .15s;
    white-space: nowrap;
    box-shadow: inset 0 -2px 0 transparent;
}

.cp-tab i {
    font-size: .95rem;
}

.cp-tab:hover,
.cp-tab:focus,
.cp-tab:focus-visible {
    background: #eff6ff;
    color: #2563eb;
    outline: none;
    box-shadow: inset 0 -2px 0 transparent;
}

.cp-tab.active {
    background: #eff6ff;
    color: #2563eb;
    box-shadow: inset 0 -2px 0 #2563eb; /* blue underline drawn INSIDE, no clip issue */
}

.cp-panel {
    display: none;
    padding: 24px;
}

.cp-panel.active {
    display: block;
}

.sec-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1.5px solid var(--erp-border);
}

.sec-icon {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: #eff6ff;
    color: #2563eb;
    flex-shrink: 0;
    font-size: 1rem;
}

.sec-title {
    margin: 0;
    color: var(--erp-ink);
    font-size: .92rem;
    font-weight: 700;
}

.sec-sub {
    margin: 0;
    color: var(--erp-muted);
    font-size: .75rem;
}

.fl {
    display: block;
    margin-bottom: 5px;
    color: #374151;
    font-size: .79rem;
    font-weight: 600;
}

.fl .req {
    margin-left: 2px;
    color: #dc2626;
}

.fhint {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    color: var(--erp-muted);
    font-size: .72rem;
}

.curr-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 8px;
}

.curr-card {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 11px;
    border: 1.5px solid var(--erp-border);
    border-radius: 6px;
    cursor: pointer;
    transition: all .15s;
    user-select: none;
}

.curr-card:hover,
.curr-card.sel {
    border-color: #2563eb;
    background: #eff6ff;
}

.curr-card.sel {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.curr-card input {
    display: none;
}

.curr-flag {
    font-size: 1.25rem;
    line-height: 1;
}

.curr-code {
    color: var(--erp-ink);
    font-size: .8rem;
    font-weight: 700;
}

.curr-symbol {
    color: var(--erp-muted);
    font-weight: 400;
}

.curr-lbl {
    display: block;
    overflow: hidden;
    color: var(--erp-muted);
    font-size: .68rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fy-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.fy-btn {
    padding: 8px 4px;
    border: 1.5px solid var(--erp-border);
    border-radius: 6px;
    background: #fff;
    color: var(--erp-muted);
    cursor: pointer;
    font-size: .78rem;
    font-weight: 600;
    text-align: center;
    transition: all .15s;
    user-select: none;
}

.fy-btn:hover {
    border-color: #2563eb;
    background: #eff6ff;
    color: #2563eb;
}

.fy-btn.sel {
    border-color: #2563eb;
    background: #2563eb;
    color: #fff;
}

.nf-wrap {
    display: flex;
    width: fit-content;
    overflow: hidden;
    border: 1.5px solid var(--erp-border);
    border-radius: 6px;
}

.nf-opt {
    padding: 8px 18px;
    border: none;
    background: #fff;
    color: var(--erp-muted);
    cursor: pointer;
    font-size: .8rem;
    font-weight: 600;
    transition: all .15s;
    user-select: none;
    white-space: nowrap;
}

.nf-opt + .nf-opt {
    border-left: 1.5px solid var(--erp-border);
}

.nf-opt.sel {
    background: #2563eb;
    color: #fff;
}

.nf-opt:hover:not(.sel) {
    background: #eff6ff;
    color: #2563eb;
}

.cp-code-input {
    text-transform: uppercase;
    letter-spacing: .05em;
}

.cp-number-format-note,
.cp-updated-note {
    color: var(--erp-muted);
    font-size: .72rem;
}

.logo-zone {
    position: relative;
    padding: 24px 20px;
    border: 2px dashed var(--erp-border);
    border-radius: 10px;
    background: var(--erp-surface-soft);
    cursor: pointer;
    text-align: center;
    transition: all .2s;
}

.logo-zone:hover,
.logo-zone.drag {
    border-color: #2563eb;
    background: #eff6ff;
}

.logo-zone input[type=file] {
    position: absolute;
    inset: 0;
    width: 100%;
    opacity: 0;
    cursor: pointer;
}

.logo-current {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
    padding: 12px 14px;
    border: 1.5px solid var(--erp-border);
    border-radius: 10px;
    background: #fff;
}

.logo-current img {
    max-width: 150px;
    max-height: 52px;
    border-radius: 4px;
    object-fit: contain;
}

.cp-logo-current-label,
.cp-upload-title {
    color: #374151;
    font-size: .82rem;
    font-weight: 600;
}

.cp-logo-current-file,
.cp-upload-text {
    color: var(--erp-muted);
    font-size: .72rem;
}

.cp-logo-current-note,
.cp-upload-note {
    margin-top: 2px;
    color: var(--erp-muted-soft);
    font-size: .7rem;
}

.cp-upload-icon {
    display: block;
    margin-bottom: 6px;
    color: var(--erp-muted);
    font-size: 2.2rem;
}

.cp-dirty-badge {
    font-size: .72rem;
}

.kop-card {
    position: sticky;
    top: 80px;
}

.kop-paper {
    padding: 18px;
    background: #fff;
    color: #1a1a1a;
    font-family: var(--erp-font-ui);
    font-size: 10px;
    line-height: 1.5;
}

.kop-lh {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    min-height: 52px;
    margin-bottom: 12px;
    padding-bottom: 9px;
    border-bottom: 2px solid #1a1a1a;
}

.kop-logo-area {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    flex: 1;
}

.kop-logo-img {
    max-width: 100px;
    max-height: 42px;
    object-fit: contain;
}

.kop-logo-empty {
    width: 42px;
    height: 42px;
    border: 1px dashed #ccc;
    border-radius: 4px;
    background: #f0f0f0;
    flex-shrink: 0;
}

.kop-co-name {
    margin-bottom: 2px;
    font-size: 11.5px;
    font-weight: 700;
    line-height: 1.2;
}

.kop-co-detail {
    color: #555;
    font-size: 7.5px;
    line-height: 1.55;
}

.kop-doc-area,
.kop-right {
    text-align: right;
}

.kop-doc-area {
    margin-left: 12px;
    flex-shrink: 0;
}

.kop-doc-type {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .4px;
    text-transform: uppercase;
}

.kop-doc-no {
    color: #888;
    font-family: var(--erp-font-mono);
    font-size: 7px;
}

.kop-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 3px 10px;
    margin: 8px 0;
    padding-bottom: 7px;
    border-bottom: .5px solid #d0d0d0;
}

.kop-meta div {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    font-size: 6.7px;
}

.kop-meta span {
    color: #666;
}

.kop-meta b {
    font-weight: 700;
    text-align: right;
}

.kop-party {
    margin: 8px 0;
    padding: 7px 8px;
    border: .5px solid #d0d0d0;
    background: #fafafa;
}

.kop-party-label {
    color: #666;
    font-size: 6.5px;
    text-transform: uppercase;
}

.kop-party-name {
    margin-top: 1px;
    font-size: 8px;
    font-weight: 700;
}

.kop-party-detail {
    margin-top: 2px;
    color: #555;
    font-size: 6.5px;
    line-height: 1.4;
}

.kop-tbl {
    width: 100%;
    margin-top: 8px;
    border-collapse: collapse;
}

.kop-tbl th {
    padding: 2.5px 4px;
    background: #1a1a1a;
    color: #fff;
    font-size: 6.5px;
    text-align: left;
}

.kop-tbl td {
    padding: 2.5px 4px;
    border: .5px solid #d0d0d0;
    font-size: 6.5px;
}

.kop-total-summary {
    margin-top: 6px;
    font-size: 7px;
}

.kop-total-value {
    margin-top: 2px;
    padding-top: 2px;
    border-top: .5px solid #333;
    font-size: 8px;
    font-weight: 700;
}

.kop-sigs {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    padding-top: 7px;
    border-top: .5px solid #ccc;
}

.kop-sig-box {
    flex: 1;
    text-align: center;
}

.kop-sig-line {
    height: 24px;
    margin-bottom: 3px;
    border-bottom: .7px solid #333;
}

.kop-sig-lbl {
    color: #555;
    font-size: 6.5px;
}

.kop-panel-title {
    color: var(--erp-muted);
    font-size: .73rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.kop-live-badge {
    font-size: .65rem;
}

.cp-usage-title {
    margin-bottom: 10px;
    color: var(--erp-muted);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.cp-usage-icon {
    flex-shrink: 0;
    font-size: .88rem;
}

.cp-usage-text {
    color: #374151;
    font-size: .76rem;
}

@media (max-width: 991px) {
    .kop-card {
        display: none;
    }
}

/* ── Company Settings — Mobile responsive ──────────────────────────────── */

/* Tablet: slightly tighter tabs */
@media (max-width: 767px) {
    .cp-tabs {
        padding: 14px 14px 0;
        gap: 1px;
    }

    .cp-tab {
        flex-shrink: 0;
        padding: 8px 13px;
        font-size: .78rem;
    }

    .cp-panel {
        padding: 18px 16px;
    }
}

/* Phone: very compact */
@media (max-width: 575px) {
    .cp-tabs {
        padding: 10px 10px 0;
    }

    .cp-tab {
        padding: 7px 11px;
        font-size: .74rem;
        gap: 5px;
    }

    .cp-tab i {
        font-size: .85rem;
    }

    .cp-panel {
        padding: 14px 12px;
    }

    /* Fiscal-year grid: 4 columns still OK on 320 px but give a bit more room */
    .fy-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 5px;
    }
    .fy-btn {
        padding: 7px 2px;
        font-size: .73rem;
    }

    /* Currency cards: 2 per row on phones */
    .curr-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Number format + note wrap */
    .cp-panel .d-flex.align-items-center.gap-3.flex-wrap {
        flex-direction: column;
        align-items: flex-start !important;
    }

    /* Form footer: stack vertically */
    .form-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: .5rem;
    }

    /* Logo current: allow wrapping */
    .logo-current {
        flex-wrap: wrap;
    }

    /* Reduce logo-zone padding */
    .logo-zone {
        padding: 18px 14px;
    }
}

/* Error pages */
.erp-error-shell {
    max-width: 1080px;
    margin: 32px auto 8px;
    padding: 0 12px 12px;
}

.erp-error-card {
    border: 1px solid #e6eaf2;
    border-radius: 24px;
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, .08), transparent 38%),
        linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    box-shadow: 0 24px 60px rgba(15, 23, 42, .08);
    overflow: hidden;
}

.erp-error-card[data-tone="warning"] {
    background:
        radial-gradient(circle at top left, rgba(245, 158, 11, .10), transparent 38%),
        linear-gradient(180deg, #ffffff 0%, #fffaf1 100%);
}

.erp-error-card[data-tone="danger"] {
    background:
        radial-gradient(circle at top left, rgba(239, 68, 68, .10), transparent 38%),
        linear-gradient(180deg, #ffffff 0%, #fff8f8 100%);
}

.erp-error-card[data-tone="primary"] {
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, .10), transparent 38%),
        linear-gradient(180deg, #ffffff 0%, #f5f9ff 100%);
}

.erp-error-card[data-tone="secondary"] {
    background:
        radial-gradient(circle at top left, rgba(100, 116, 139, .10), transparent 38%),
        linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.erp-error-art-wrap {
    padding: 28px 24px 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.erp-error-art {
    width: min(100%, 380px);
    height: auto;
    display: block;
    filter: drop-shadow(0 18px 30px rgba(15, 23, 42, .10));
}

.erp-error-body {
    padding: 28px 28px 32px;
}

.erp-error-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(37, 99, 235, .09);
    color: #1d4ed8;
    font-size: .76rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.erp-error-card[data-tone="warning"] .erp-error-badge {
    background: rgba(245, 158, 11, .13);
    color: #b45309;
}

.erp-error-card[data-tone="danger"] .erp-error-badge {
    background: rgba(239, 68, 68, .12);
    color: #b91c1c;
}

.erp-error-card[data-tone="secondary"] .erp-error-badge {
    background: rgba(100, 116, 139, .12);
    color: #475569;
}

.erp-error-code {
    margin: 18px 0 6px;
    color: #0f172a;
    font-size: clamp(2.7rem, 6vw, 4.7rem);
    line-height: .95;
    font-weight: 800;
    letter-spacing: -.05em;
}

.erp-error-title {
    margin: 0;
    color: #0f172a;
    font-size: clamp(1.4rem, 2.6vw, 2rem);
    font-weight: 700;
    letter-spacing: -.02em;
}

.erp-error-copy {
    margin: 14px 0 0;
    color: #556275;
    font-size: 1rem;
    line-height: 1.72;
    max-width: 560px;
}

.erp-error-detail {
    margin-top: 16px;
    color: #475569;
    font-size: .9rem;
}

.erp-error-detail code {
    display: inline-block;
    max-width: 100%;
    padding: 6px 10px;
    border-radius: 10px;
    background: rgba(148, 163, 184, .14);
    color: #0f172a;
    white-space: normal;
    word-break: break-word;
}

.erp-error-note {
    margin-top: 14px;
    color: #64748b;
    font-size: .84rem;
}

.erp-error-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}

.erp-error-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 156px;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid transparent;
    font-size: .92rem;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, background-color .15s ease, color .15s ease;
}

.erp-error-actions .btn:hover {
    transform: translateY(-1px);
}

.erp-error-actions .btn-primary {
    background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
    border-color: #1d4ed8;
    color: #ffffff;
    box-shadow: 0 10px 20px rgba(37, 99, 235, .16);
}

.erp-error-actions .btn-outline-secondary {
    background: rgba(255, 255, 255, .78);
    border-color: #cbd5e1;
    color: #334155;
}

.erp-error-actions .btn-outline-secondary:hover {
    border-color: #94a3b8;
    color: #0f172a;
}

body.erp-error-standalone {
    margin: 0;
    min-height: 100vh;
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #edf4ff 0%, #f8fafc 100%);
    font-family: var(--erp-font-ui);
}

body.erp-error-standalone .erp-error-shell {
    width: 100%;
    max-width: 1080px;
    margin: 0;
    padding: 0;
}

body[data-layout-mode=dark] .erp-error-card {
    border-color: #334155;
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, .18), transparent 38%),
        linear-gradient(180deg, #151d27 0%, #111827 100%);
    box-shadow: 0 28px 60px rgba(2, 8, 23, .42);
}

body[data-layout-mode=dark] .erp-error-card[data-tone="warning"] {
    background:
        radial-gradient(circle at top left, rgba(245, 158, 11, .18), transparent 38%),
        linear-gradient(180deg, #1a2029 0%, #161b22 100%);
}

body[data-layout-mode=dark] .erp-error-card[data-tone="danger"] {
    background:
        radial-gradient(circle at top left, rgba(239, 68, 68, .18), transparent 38%),
        linear-gradient(180deg, #1c1a22 0%, #16161d 100%);
}

body[data-layout-mode=dark] .erp-error-card[data-tone="secondary"] {
    background:
        radial-gradient(circle at top left, rgba(100, 116, 139, .18), transparent 38%),
        linear-gradient(180deg, #171d26 0%, #121822 100%);
}

body[data-layout-mode=dark] .erp-error-code,
body[data-layout-mode=dark] .erp-error-title {
    color: #f8fafc;
}

body[data-layout-mode=dark] .erp-error-copy {
    color: #c9d4e3;
}

body[data-layout-mode=dark] .erp-error-detail,
body[data-layout-mode=dark] .erp-error-note {
    color: #94a3b8;
}

body[data-layout-mode=dark] .erp-error-detail code {
    background: rgba(148, 163, 184, .16);
    color: #f8fafc;
}

body[data-layout-mode=dark].erp-error-standalone {
    background: linear-gradient(180deg, #0f1724 0%, #111827 100%);
}

body[data-layout-mode=dark] .erp-error-actions .btn-outline-secondary {
    background: rgba(15, 23, 42, .24);
    border-color: #475569;
    color: #e2e8f0;
}

body[data-layout-mode=dark] .erp-error-actions .btn-outline-secondary:hover {
    border-color: #64748b;
    color: #f8fafc;
}

@media (max-width: 991.98px) {
    .erp-error-shell {
        margin-top: 12px;
    }

    .erp-error-art-wrap {
        padding-bottom: 0;
    }

    .erp-error-body {
        padding-top: 12px;
    }
}

@media (max-width: 575.98px) {
    body.erp-error-standalone {
        align-items: flex-start;
        padding: 16px;
    }

    .erp-error-actions .btn {
        width: 100%;
    }
}

/* Finance Trial Balance */
.report-shell-page .page-title-box .btn,
.tb-page .page-title-box .btn {
    white-space: nowrap;
}

.report-filter-card,
.report-table-card,
.report-mini-card {
    border: 1px solid var(--erp-border);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .03);
}

.finance-shell-page .page-title-box .btn {
    white-space: nowrap;
}

.finance-filter-card,
.finance-table-card,
.finance-detail-card,
.finance-note-card {
    border: 1px solid var(--erp-border);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .03);
}

.finance-filter-card .card-body,
.finance-table-card .card-body,
.finance-detail-card .card-body,
.finance-note-card .card-body {
    padding: 1rem;
}

.finance-table-card .table-responsive,
.finance-detail-card .table-responsive {
    border-radius: 12px;
}

.finance-table-card .table thead th,
.finance-detail-card .table thead th {
    background: var(--erp-surface-soft);
    border-top: 0;
    color: var(--erp-muted-soft);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.finance-detail-card .card-header,
.finance-table-card .card-header,
.finance-note-card .card-header {
    background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
    border-bottom: 1px solid var(--erp-border);
}

.finance-summary-alert {
    border: 1px solid rgba(37, 99, 235, .12);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(239, 246, 255, .96) 0%, rgba(219, 234, 254, .96) 100%);
    color: #1d4ed8;
}

.finance-summary-alert strong {
    color: #1e3a8a;
}

.finance-action-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding-top: .9rem;
    margin-top: 1rem;
    border-top: 1px solid var(--erp-border);
}

.finance-action-note {
    color: var(--erp-muted);
    font-size: .79rem;
    margin: 0;
}

.report-kpi-card {
    border: none;
}

.report-kpi-card > .card-body {
    min-height: 108px;
    height: 100%;
}

.report-kpi-card .kpi-value {
    font-size: 1.08rem;
}

.report-kpi-card .kpi-sub {
    margin-top: .16rem;
}

.report-filter-card .card-body,
.report-table-card .card-body,
.report-mini-card .card-body {
    padding: 1rem;
}

.report-table-card .table-responsive {
    border-radius: 12px;
}

.report-table-card .table thead th {
    background: var(--erp-surface-soft);
    border-top: 0;
    color: var(--erp-muted-soft);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.report-mini-card .report-mini-label {
    color: var(--erp-muted-soft);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.report-mini-card .report-mini-value {
    color: var(--erp-ink);
    font-size: 1.42rem;
    font-weight: 700;
    line-height: 1.15;
}

.report-mini-card .report-mini-sub {
    color: var(--erp-muted);
    font-size: .72rem;
    line-height: 1.35;
}

.tb-filter-card,
.tb-type-card,
.tb-grand-card {
    border: 1px solid var(--erp-border);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .03);
}

.tb-empty-state {
    color: var(--erp-muted);
}

.tb-status-alert {
    border: 1px solid transparent;
    border-radius: 14px;
}

.tb-status-alert-ok {
    background: linear-gradient(180deg, #f0fdf4 0%, #dcfce7 100%);
    border-color: rgba(22, 101, 52, .16);
    color: #166534;
}

.tb-status-alert-warn {
    background: linear-gradient(180deg, #fff7ed 0%, #ffedd5 100%);
    border-color: rgba(194, 65, 12, .18);
    color: #9a3412;
}

.tb-type-header {
    background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
    border-bottom: 1px solid var(--erp-border);
}

.tb-type-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.tb-type-asset {
    background: #dbeafe;
    border-color: #bfdbfe;
    color: #1d4ed8;
}

.tb-type-liability {
    background: #fee2e2;
    border-color: #fecaca;
    color: #b91c1c;
}

.tb-type-equity {
    background: #dcfce7;
    border-color: #bbf7d0;
    color: #15803d;
}

.tb-type-revenue {
    background: #fef3c7;
    border-color: #fde68a;
    color: #92400e;
}

.tb-type-expense {
    background: #e2e8f0;
    border-color: #cbd5e1;
    color: #475569;
}

.tb-table thead th {
    background: var(--erp-surface-soft);
    color: var(--erp-text);
    font-size: .72rem;
    font-weight: 700;
    border-bottom: 1px solid var(--erp-border);
}

.tb-col-code {
    width: 110px;
}

.tb-col-money {
    width: 140px;
}

.tb-balance-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    margin-left: 6px;
    padding: 2px 7px;
    border-radius: 999px;
    background: #fee2e2;
    color: #b91c1c;
    font-size: .64rem;
    font-weight: 700;
}

.tb-subtotal {
    background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
}

.tb-grand-total {
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    color: #fff;
}

.tb-grand-total .text-success {
    color: #86efac !important;
}

.tb-grand-total .text-warning {
    color: #fcd34d !important;
}

.ar-invoice-select-page .select-source-card {
    border: 1px solid var(--erp-border);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .03);
}

.ar-invoice-select-page .select-source-card .card-body {
    padding: 1rem;
}

.ar-invoice-select-page .select-source-card .table-responsive {
    border-radius: 12px;
}

.ar-invoice-select-page .source-meta-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    justify-content: flex-end;
}

.ar-invoice-select-page .selected-source-row > * {
    background: rgba(99, 102, 241, .08) !important;
}

.ar-invoice-select-page .select-source-card .table thead th {
    background: var(--erp-surface-soft);
    border-top: 0;
    color: var(--erp-muted-soft);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.ar-invoice-select-page .select-source-card .form-footer {
    border-top-color: var(--erp-border);
}

body[data-layout-mode=dark] .ar-invoice-select-page .selected-source-row > * {
    background: rgba(129, 140, 248, .16) !important;
}

@media print {
    .tb-page .page-title-box .d-flex,
    .tb-page .tb-filter-card form {
        display: none !important;
    }

    .tb-page .tb-status-alert {
        border: 1px solid currentColor !important;
    }

    .tb-page .tb-type-card,
    .tb-page .tb-filter-card,
    .tb-page .tb-grand-card {
        box-shadow: none !important;
        border: 1px solid #dee2e6 !important;
    }
}

/* Chat */
.chat-index-toolbar {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

.chat-dm-dialog {
    max-width: 380px;
}

.chat-dm-item {
    color: var(--erp-text);
    transition: background .1s ease;
}

.chat-dm-item:hover {
    background: #f1f5f9 !important;
}

.chat-dm-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--chat-avatar-bg, #5156be);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: .82rem;
    font-weight: 700;
    color: #fff;
}

.chat-dm-meta {
    min-width: 0;
}

.chat-dm-name {
    font-size: .88rem;
    line-height: 1.2;
}

.chat-dm-email {
    font-size: .74rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-room-card {
    border-radius: 14px;
    overflow: hidden;
}

.rooms-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.room-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 18px;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid #f1f5f9;
    transition: background .12s ease;
}

.room-item:last-child {
    border-bottom: none;
}

.room-item:hover {
    background: #f8fafc;
}

.room-av {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--chat-avatar-bg, #5156be);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .88rem;
    color: #fff;
}

.room-av.group {
    border-radius: 12px;
}

.room-av-icon {
    font-size: 1.2rem;
}

.room-info {
    flex: 1;
    min-width: 0;
}

.room-name {
    font-weight: 600;
    font-size: .9rem;
    color: #1e293b;
}

.room-last {
    font-size: .78rem;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.room-meta {
    text-align: right;
    flex-shrink: 0;
}

.room-time {
    font-size: .72rem;
    color: #cbd5e1;
}

.chat-doc-type-badge {
    font-size: .65rem;
}

.chat-page {
    display: flex;
    flex-direction: column;
    height: calc(100dvh - 160px);
    min-height: 560px;
}

.chat-room-shell {
    border-radius: 14px;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    border-radius: 14px 14px 0 0;
    flex-shrink: 0;
}

.chat-avatar-lg {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--chat-avatar-bg, #5156be);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: .85rem;
    font-weight: 700;
    color: #fff;
}

.chat-room-title {
    font-size: .95rem;
}

.chat-room-meta {
    font-size: .75rem;
}

.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-day-divider {
    position: relative;
    margin: 10px 0;
    color: #94a3b8;
    font-size: .72rem;
    text-align: center;
}

.chat-day-divider::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e2e8f0;
}

.chat-day-divider span {
    position: relative;
    padding: 0 10px;
    background: #f8fafc;
}

.msg-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-bottom: 2px;
}

.msg-row.me {
    flex-direction: row-reverse;
}

.msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--chat-avatar-bg, #5156be);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: .65rem;
    font-weight: 700;
    color: #fff;
}

.msg-avatar.ghost {
    background: transparent;
}

.msg-bubble-wrap {
    display: flex;
    flex-direction: column;
    max-width: 68%;
}

.me .msg-bubble-wrap {
    align-items: flex-end;
}

.msg-sender {
    margin-bottom: 2px;
    padding-left: 4px;
    color: #94a3b8;
    font-size: .7rem;
}

.msg-bubble {
    padding: 9px 13px;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
    font-size: .875rem;
    line-height: 1.5;
    word-break: break-word;
}

.msg-bubble.them {
    background: #fff;
    color: #1e293b;
    border-bottom-left-radius: 4px;
}

.msg-bubble.me {
    background: #5156be;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.msg-bubble.deleted {
    background: #f1f5f9;
    color: #94a3b8;
    font-style: italic;
    font-size: .8rem;
}

.msg-time {
    margin-top: 3px;
    padding: 0 4px;
    font-size: .67rem;
}

.msg-time.them {
    color: #94a3b8;
    text-align: left;
}

.msg-time.me {
    color: rgba(81, 86, 190, .65);
    text-align: right;
}

.msg-bubble.me + .msg-time,
.msg-bubble.me .msg-time {
    color: rgba(255, 255, 255, .7);
}

.chat-footer {
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    border-radius: 0 0 14px 14px;
    flex-shrink: 0;
}

.chat-input-wrap {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 8px 8px 8px 16px;
    border-radius: 24px;
    background: #f1f5f9;
}

#chat-input {
    flex: 1;
    max-height: 120px;
    padding: 2px 0;
    border: none;
    background: transparent;
    outline: none;
    resize: none;
    font-size: .875rem;
    line-height: 1.5;
}

#chat-send-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: #5156be;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    transition: background .15s ease;
}

#chat-send-btn:hover {
    background: #4349a5;
}

#chat-send-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
}

.chat-input-hint {
    padding-left: 4px;
    font-size: .7rem;
}

.chat-title-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.chat-realtime-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 10px;
    white-space: nowrap;
}

.chat-realtime-label {
    color: #64748b;
    font-weight: 600;
}

.chat-realtime-status-title {
    margin-left: 0;
}

.chat-ws-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: .7rem;
}

.chat-ws-badge::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    opacity: .9;
}

.chat-ws-badge.online {
    background: #dcfce7;
    color: #16a34a;
}

.chat-ws-badge.offline {
    background: #fee2e2;
    color: #dc2626;
}

.chat-ws-badge.connecting {
    background: #fef9c3;
    color: #ca8a04;
}

.chat-ws-badge.polling {
    background: #e0f2fe;
    color: #0369a1;
}

.load-older-btn {
    align-self: center;
    padding: 4px 14px;
    border: none;
    border-radius: 999px;
    background: #e2e8f0;
    color: #64748b;
    cursor: pointer;
    font-size: .75rem;
    transition: background .15s ease;
}

.load-older-btn:hover {
    background: #cbd5e1;
}

@media (max-width: 767.98px) {
    .tb-page .page-title-box .d-flex {
        width: 100%;
        flex-wrap: wrap;
    }

    .tb-page .page-title-box .btn {
        flex: 1 1 auto;
    }

    .chat-index-toolbar {
        width: 100%;
    }

    .chat-index-toolbar .btn {
        flex: 1 1 auto;
    }

    .room-item {
        padding: 12px 14px;
    }

    .chat-page {
        height: calc(100dvh - 118px);
        min-height: 0;
    }

    .chat-header {
        padding: 14px 16px;
    }

    .chat-body {
        padding: 16px 12px;
    }

    .chat-footer {
        padding: 12px;
    }

    .msg-bubble-wrap {
        max-width: 84%;
    }
}

/* Chat v2 */
.chat-app-shell {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    height: calc(100dvh - 190px);
    min-height: 520px;
    background: #fff;
    border: 1px solid var(--erp-border);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .06);
}

.chat-sidebar {
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #fff;
    border-right: 1px solid var(--erp-border);
}

.chat-sidebar-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 18px;
    border-bottom: 1px solid var(--erp-border);
}

.chat-sidebar-heading {
    min-width: 0;
}

.chat-sidebar-title {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
}

.chat-sidebar-subtitle {
    margin-top: 4px;
    font-size: .76rem;
    color: #64748b;
}

.chat-sidebar-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.chat-room-search-wrap {
    position: relative;
    padding: 14px 18px;
    border-bottom: 1px solid var(--erp-border);
    background: #fff;
}

.chat-room-search-wrap > i {
    position: absolute;
    left: 30px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 1rem;
}

.chat-room-search-input {
    width: 100%;
    height: 42px;
    padding: 0 14px 0 40px;
    border: 1px solid #dbe4f0;
    border-radius: 12px;
    background: #f8fafc;
    color: #0f172a;
    font-size: .85rem;
    outline: none;
}

.chat-room-search-input:focus {
    background: #fff;
    border-color: #a5b4fc;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .12);
}

.chat-room-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    background: #fbfcfe;
}

.chat-room-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-bottom: 4px;
    border: 1px solid transparent;
    border-radius: 16px;
    color: inherit;
    text-decoration: none;
    transition: background .14s ease, border-color .14s ease, box-shadow .14s ease;
}

.chat-room-row:hover {
    background: #fff;
    border-color: #e2e8f0;
    box-shadow: 0 4px 14px rgba(15, 23, 42, .05);
}

.chat-room-row.is-active {
    background: linear-gradient(180deg, #eef2ff 0%, #e0e7ff 100%);
    border-color: rgba(81, 86, 190, .18);
}

.chat-room-avatar {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: var(--chat-avatar-bg, #5156be);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: .95rem;
    font-weight: 700;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25);
}

.chat-room-avatar.is-direct {
    border-radius: 50%;
}

.chat-room-avatar.is-doc {
    background: linear-gradient(180deg, #0ea5e9 0%, #2563eb 100%);
}

.chat-room-avatar.is-group {
    background: linear-gradient(180deg, #6366f1 0%, #8b5cf6 100%);
}

.chat-room-main {
    min-width: 0;
    flex: 1;
}

.chat-room-top {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.chat-room-name {
    flex: 1;
    min-width: 0;
    font-size: .92rem;
    font-weight: 700;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-room-time {
    flex-shrink: 0;
    font-size: .72rem;
    color: #94a3b8;
}

.chat-room-bottom {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    margin-top: 4px;
}

.chat-room-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: .64rem;
    font-weight: 700;
    letter-spacing: .02em;
    white-space: nowrap;
}

.chat-room-chip.is-direct {
    background: #dbeafe;
    color: #1d4ed8;
}

.chat-room-chip.is-group {
    background: #ede9fe;
    color: #6d28d9;
}

.chat-room-chip.is-doc {
    background: #e0f2fe;
    color: #0369a1;
}

.chat-room-preview {
    min-width: 0;
    flex: 1;
    font-size: .78rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-room-empty-list {
    padding: 28px 20px;
    text-align: center;
    color: #94a3b8;
    font-size: .85rem;
}

.chat-room-empty-list.is-hidden {
    display: none;
}

.chat-index-main,
.chat-conversation {
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

.chat-index-empty {
    margin: auto;
    max-width: 380px;
    padding: 24px;
    text-align: center;
    color: #475569;
}

.chat-index-empty-icon {
    width: 76px;
    height: 76px;
    margin: 0 auto 18px;
    border-radius: 24px;
    background: linear-gradient(180deg, #eef2ff 0%, #e0e7ff 100%);
    color: #5156be;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.chat-index-empty-title {
    margin-bottom: 8px;
    color: #0f172a;
    font-weight: 700;
}

.chat-index-empty-text {
    margin-bottom: 0;
    font-size: .9rem;
}

.chat-header {
    padding: 18px 20px;
    background: #fff;
    border-bottom: 1px solid var(--erp-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-radius: 0;
}

.chat-header-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.chat-header-copy {
    min-width: 0;
}

.chat-avatar-lg {
    width: 44px;
    height: 44px;
    border-radius: 18px;
    background: var(--chat-avatar-bg, #5156be);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .95rem;
    font-weight: 700;
}

.chat-avatar-lg.is-direct {
    border-radius: 50%;
}

.chat-avatar-lg.is-doc {
    background: linear-gradient(180deg, #0ea5e9 0%, #2563eb 100%);
}

.chat-avatar-lg.is-group {
    background: linear-gradient(180deg, #6366f1 0%, #8b5cf6 100%);
}

.chat-room-title {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
}

.chat-room-sub {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
    color: #64748b;
    font-size: .76rem;
}

.chat-mobile-back {
    flex-shrink: 0;
}

#chat-scroll {
    height: auto !important;
    max-height: none !important;
    min-height: 0;
}

.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

#chat-messages {
    display: flex;
    flex-direction: column;
}

.chat-thread-empty {
    margin: auto;
    padding: 32px 20px;
    text-align: center;
    color: #94a3b8;
}

.chat-day-divider {
    margin: 16px auto 10px;
    text-align: center;
}

.chat-day-divider::before {
    display: none;
}

.chat-day-divider span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 12px;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #e2e8f0;
    color: #475569;
    font-size: .7rem;
    font-weight: 700;
}

.msg-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    margin-bottom: 10px;
}

.msg-row.me {
    flex-direction: row-reverse;
}

.msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--chat-avatar-bg, #5156be);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: .68rem;
    font-weight: 700;
}

.msg-avatar.ghost {
    background: transparent;
}

.msg-bubble-wrap {
    display: flex;
    flex-direction: column;
    max-width: min(74%, 720px);
}

.msg-row.me .msg-bubble-wrap {
    align-items: flex-end;
}

.msg-sender {
    margin-bottom: 3px;
    padding: 0 4px;
    color: #64748b;
    font-size: .7rem;
    font-weight: 700;
}

.msg-bubble {
    padding: 10px 14px;
    border: 1px solid transparent;
    border-radius: 18px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .04);
    font-size: .875rem;
    line-height: 1.5;
    word-break: break-word;
}

.msg-bubble.them {
    background: #fff;
    border-color: #e2e8f0;
    color: #0f172a;
    border-bottom-left-radius: 6px;
}

.msg-bubble.me {
    background: #5156be;
    border-color: #5156be;
    color: #fff;
    border-bottom-right-radius: 6px;
}

.msg-bubble.pending {
    opacity: .84;
}

.msg-bubble.deleted {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #94a3b8;
    border-style: dashed;
    font-style: italic;
}

.msg-time {
    margin-top: 4px;
    padding: 0 4px;
    font-size: .67rem;
}

.msg-time.them {
    color: #94a3b8;
}

.msg-time.me {
    color: rgba(81, 86, 190, .78);
}

.msg-time.pending {
    color: rgba(81, 86, 190, .6);
}

.load-older-btn {
    align-self: center;
    padding: 6px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #fff;
    color: #475569;
    cursor: pointer;
    font-size: .74rem;
    font-weight: 600;
}

.load-older-btn:hover {
    background: #f8fafc;
}

.chat-footer {
    padding: 14px 18px;
    background: #fff;
    border-top: 1px solid var(--erp-border);
    border-radius: 0;
    flex-shrink: 0;
}

.chat-input-wrap {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid #dbe4f0;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

#chat-input {
    flex: 1;
    min-height: 24px;
    max-height: 140px;
    padding: 0;
    border: none;
    background: transparent;
    outline: none;
    resize: none;
    color: #0f172a;
    font-size: .9rem;
    line-height: 1.5;
}

#chat-send-btn {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 14px;
    background: #5156be;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    transition: transform .12s ease, background .12s ease;
}

#chat-send-btn:hover {
    background: #4349a5;
    transform: translateY(-1px);
}

#chat-send-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    transform: none;
}

.chat-input-hint {
    padding-left: 4px;
    font-size: .72rem;
    color: #94a3b8;
}

body[data-layout-mode=dark] .chat-app-shell,
body[data-layout-mode=dark] .chat-sidebar,
body[data-layout-mode=dark] .chat-header,
body[data-layout-mode=dark] .chat-footer {
    background: #111827;
    border-color: rgba(148, 163, 184, .16);
}

body[data-layout-mode=dark] .chat-room-list,
body[data-layout-mode=dark] .chat-index-main,
body[data-layout-mode=dark] .chat-conversation,
body[data-layout-mode=dark] .chat-body {
    background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
}

body[data-layout-mode=dark] .chat-sidebar-title,
body[data-layout-mode=dark] .chat-room-name,
body[data-layout-mode=dark] .chat-room-title,
body[data-layout-mode=dark] #chat-input {
    color: #f8fafc;
}

body[data-layout-mode=dark] .chat-sidebar-subtitle,
body[data-layout-mode=dark] .chat-room-preview,
body[data-layout-mode=dark] .chat-room-time,
body[data-layout-mode=dark] .chat-room-sub,
body[data-layout-mode=dark] .chat-index-empty,
body[data-layout-mode=dark] .chat-input-hint,
body[data-layout-mode=dark] .msg-sender,
body[data-layout-mode=dark] .msg-time.them,
body[data-layout-mode=dark] .msg-time.me,
body[data-layout-mode=dark] .chat-thread-empty {
    color: #94a3b8;
}

body[data-layout-mode=dark] .chat-room-search-input,
body[data-layout-mode=dark] .chat-input-wrap {
    background: rgba(15, 23, 42, .72);
    border-color: rgba(148, 163, 184, .18);
}

body[data-layout-mode=dark] .chat-room-row:hover {
    background: rgba(15, 23, 42, .7);
    border-color: rgba(148, 163, 184, .18);
}

body[data-layout-mode=dark] .chat-room-row.is-active {
    background: rgba(81, 86, 190, .2);
    border-color: rgba(165, 180, 252, .24);
}

body[data-layout-mode=dark] .chat-index-empty-icon {
    background: rgba(81, 86, 190, .18);
    color: #a5b4fc;
}

body[data-layout-mode=dark] .chat-day-divider span {
    background: rgba(51, 65, 85, .82);
    border-color: rgba(148, 163, 184, .18);
    color: #cbd5e1;
}

body[data-layout-mode=dark] .msg-bubble.them {
    background: #1f2937;
    border-color: rgba(148, 163, 184, .14);
    color: #f8fafc;
}

body[data-layout-mode=dark] .msg-bubble.deleted {
    background: #111827;
    border-color: rgba(148, 163, 184, .18);
    color: #94a3b8;
}

body[data-layout-mode=dark] .load-older-btn {
    background: #1f2937;
    border-color: rgba(148, 163, 184, .18);
    color: #cbd5e1;
}

.chat-members-dialog {
    max-width: 460px;
}

#chatMembersModal {
    z-index: 1060;
}

.chat-members-list,
.chat-add-members-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat-members-list {
    max-height: 260px;
    overflow-y: auto;
}

.chat-member-row,
.chat-add-member-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
}

.chat-member-row {
    justify-content: space-between;
}

.chat-member-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--chat-avatar-bg, #5156be);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: .72rem;
    font-weight: 700;
}

.chat-member-main,
.chat-add-member-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.chat-member-name,
.chat-add-member-name {
    color: #0f172a;
    font-size: .86rem;
    font-weight: 700;
}

.chat-member-email,
.chat-add-member-email {
    color: #64748b;
    font-size: .75rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-add-members-list {
    max-height: 220px;
    overflow-y: auto;
}

.chat-add-member-option {
    width: 100%;
    border: 1px solid #e2e8f0;
    text-align: left;
    cursor: pointer;
}

.chat-add-member-option:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.chat-add-member-option[hidden],
.chat-add-members-list[hidden],
.chat-selected-members[hidden] {
    display: none !important;
}

.chat-selected-members {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}

.chat-selected-member {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    background: #eff6ff;
}

.chat-selected-member-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.chat-selected-member-name {
    color: #1e3a8a;
    font-size: .84rem;
    font-weight: 700;
}

.chat-selected-member-email {
    color: #64748b;
    font-size: .73rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-selected-member-remove {
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 8px;
    background: rgba(37, 99, 235, .1);
    color: #1d4ed8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-selected-member-remove:hover {
    background: rgba(37, 99, 235, .18);
}

.chat-member-kick {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    background: rgba(239, 68, 68, .1);
    color: #dc2626;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-member-kick:hover {
    background: rgba(239, 68, 68, .18);
}

body[data-layout-mode=dark] .chat-member-row,
body[data-layout-mode=dark] .chat-add-member-option,
body[data-layout-mode=dark] .chat-selected-member {
    background: #111827;
    border-color: rgba(148, 163, 184, .18);
}

body[data-layout-mode=dark] .chat-member-name,
body[data-layout-mode=dark] .chat-add-member-name,
body[data-layout-mode=dark] .chat-selected-member-name {
    color: #f8fafc;
}

body[data-layout-mode=dark] .chat-member-email,
body[data-layout-mode=dark] .chat-add-member-email,
body[data-layout-mode=dark] .chat-selected-member-email {
    color: #94a3b8;
}

body[data-layout-mode=dark] .chat-member-kick {
    background: rgba(239, 68, 68, .16);
    color: #fca5a5;
}

@media (max-width: 991.98px) {
    .chat-app-shell {
        grid-template-columns: 1fr;
        height: calc(100dvh - 160px);
        min-height: 520px;
    }

    .chat-app-shell-room .chat-sidebar {
        display: none;
    }

    .chat-app-shell-index .chat-index-main {
        display: none;
    }
}

@media (max-width: 767.98px) {
    .chat-app-shell {
        height: calc(100dvh - 132px);
        min-height: 480px;
        border-radius: 16px;
    }

    .chat-sidebar-top,
    .chat-header,
    .chat-footer {
        padding: 14px;
    }

    .chat-room-search-wrap {
        padding: 12px 14px;
    }

    .chat-room-search-wrap > i {
        left: 26px;
    }

    .chat-body {
        padding: 16px 12px;
    }

    .msg-bubble-wrap {
        max-width: 86%;
    }

    .chat-sidebar-actions {
        width: 100%;
        justify-content: stretch;
    }

    .chat-sidebar-actions .btn {
        flex: 1 1 auto;
    }

    .chat-header {
        align-items: flex-start;
    }

    .chat-header-actions {
        flex-wrap: wrap;
        justify-content: flex-end;
    }
}

/* Finance Aging */
.aging-top-name {
    width: 160px;
}

.aging-summary-card {
    border: none;
    overflow: hidden;
}

.aging-summary-card .card-body {
    min-height: 112px;
}

.aging-summary-card .kpi-icon {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .32);
}

.aging-summary-card .kpi-label {
    font-size: .66rem;
}

.aging-summary-card .kpi-value {
    font-size: 1.02rem;
}

.aging-summary-card .kpi-sub {
    margin-top: .18rem;
    font-size: .7rem;
}

.aging-filter-card .card-body,
.aging-top-list-card .card-body,
.aging-detail-card .card-body {
    padding: 1rem;
}

.aging-detail-card .table-responsive {
    border-radius: 10px;
}

.aging-detail-card .table thead th {
    background: var(--erp-surface-soft);
    border-top: 0;
    color: var(--erp-muted-soft);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.aging-top-bar {
    height: 10px;
}

.aging-top-amount {
    width: 120px;
}

.aging-col-date {
    width: 100px;
}

.aging-col-money {
    width: 130px;
}

.aging-col-days {
    width: 60px;
}

.aging-col-bucket {
    width: 110px;
}

@media print {
    .aging-page .page-title-box .d-flex,
    .aging-page form {
        display: none !important;
    }

    .aging-page .card {
        box-shadow: none !important;
        border: 1px solid #dee2e6 !important;
    }
}

@media (max-width: 767.98px) {
    .aging-summary-card .card-body {
        min-height: 96px;
    }
}

/* Layout Minia */
.header-icon-btn {
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #64748b;
    line-height: 1;
    padding: 6px 9px;
    transition: background .15s ease, color .15s ease;
}

.header-icon-btn:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.weather-topbar-btn {
    min-height: 34px;
    gap: 6px;
    max-width: 210px;
    line-height: 1.25;
}

.weather-topbar-icon {
    color: #0ea5e9;
}

.weather-topbar-temp {
    color: #334155;
    font-size: .86rem;
    font-weight: 700;
    line-height: 1.25;
    white-space: nowrap;
}

.weather-topbar-temp sup,
.weather-dropdown-temp sup {
    top: -.45em;
    font-size: .58em;
    font-weight: 700;
}

.weather-topbar-location {
    max-width: 130px;
    color: #64748b;
    font-size: .8rem;
    line-height: 1.35;
    padding-bottom: 1px;
}

.weather-dropdown {
    width: 300px;
    max-width: calc(100vw - 24px);
}

.weather-dropdown-icon {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: #e0f2fe;
    color: #0284c7;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.45rem;
    flex-shrink: 0;
}

.weather-dropdown-temp {
    color: #0f172a;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.1;
}

.weather-detail-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 7px 0;
    border-top: 1px solid #eef2f7;
    color: #64748b;
    font-size: .82rem;
}

.weather-detail-row strong {
    color: #334155;
    font-weight: 700;
    white-space: nowrap;
}

.weather-location-results {
    position: absolute;
    left: 0;
    right: 0;
    z-index: 20;
    margin-top: 4px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 12px 28px rgba(15, 23, 42, .12);
    overflow: hidden;
}

.weather-location-option {
    width: 100%;
    border: 0;
    background: #fff;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 12px;
    text-align: left;
    font-size: .86rem;
}

.weather-location-option:hover {
    background: #f8fafc;
    color: #2563eb;
}

.weather-location-empty {
    color: #64748b;
    padding: 10px 12px;
    font-size: .84rem;
}

.weather-location-selected {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    max-width: 100%;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    background: #eff6ff;
    color: #1d4ed8;
    padding: 8px 10px;
    font-size: .84rem;
    font-weight: 600;
}

body[data-layout-mode=dark] .weather-topbar-temp {
    color: #e2e8f0;
}

body[data-layout-mode=dark] .weather-topbar-location {
    color: #94a3b8;
}

body[data-layout-mode=dark] .weather-dropdown,
body[data-layout-mode=dark] .weather-dropdown .bg-white,
body[data-layout-mode=dark] .weather-dropdown .bg-light {
    background-color: #313533 !important;
    color: #ced4da;
}

body[data-layout-mode=dark] .weather-dropdown {
    border: 1px solid #3b403d !important;
}

body[data-layout-mode=dark] .weather-dropdown-temp,
body[data-layout-mode=dark] .weather-detail-row strong {
    color: #f8fafc;
}

body[data-layout-mode=dark] .weather-detail-row {
    border-color: #3b403d;
    color: #94a3b8;
}

body[data-layout-mode=dark] .weather-location-results {
    background: #313533;
    border-color: #3b403d;
}

body[data-layout-mode=dark] .weather-location-option {
    background: #313533;
    color: #ced4da;
}

body[data-layout-mode=dark] .weather-location-option:hover {
    background: #3b403d;
    color: #93c5fd;
}

.avatar-circle {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: .78rem;
    font-weight: 700;
}

.notif-item {
    color: #334155;
    border-bottom: none;
    transition: background .12s ease;
}

.notif-item:hover {
    background: #f8fafc !important;
}

.notif-icon-wrap {
    position: relative;
    margin-top: 2px;
}

.notif-badge {
    position: absolute;
    top: -5px;
    right: -7px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border: 1.5px solid #fff;
    border-radius: 9px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    pointer-events: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    -webkit-font-smoothing: antialiased;
    font-smoothing: antialiased;
}

#sidebar-menu ul li {
    position: relative;
}

#sidebar-menu ul li > a {
    border-radius: 6px !important;
    margin: 1px 8px !important;
    padding: .6rem 1rem !important;
    transition: background .15s ease, color .15s ease, transform .15s ease, box-shadow .15s ease !important;
    will-change: transform;
}

/* Expanded sidebar: badge aligned with the <a> row.
   top = a's margin-top (1px) + a's padding-top (.6rem) so the badge sits
   at the content-line of the link regardless of how tall li grows when
   a sub-menu is open. */
#sidebar-menu ul li > .menu-badge {
    position: absolute;
    top: calc(1px + .6rem);
    right: 1.5rem;
    transform: translateY(-50%);
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 99px;
    background: #ef4444 !important;
    color: #fff !important;
    font-size: .65rem;
    font-weight: 700;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    -webkit-font-smoothing: antialiased;
    font-smoothing: antialiased;
    pointer-events: none;
    z-index: 1;
}

#sidebar-menu ul li > a:hover {
    background-color: rgba(81, 86, 190, .11) !important;
    color: #5156be !important;
    transform: translateX(4px) !important;
    box-shadow: inset 3px 0 0 #5156be !important;
    font-weight: 600 !important;
}

#sidebar-menu ul li > a:hover i {
    color: #5156be !important;
}

#sidebar-menu ul li ul.sub-menu li a {
    position: relative;
    border-radius: 5px !important;
    margin: 1px 8px !important;
    padding: .38rem 1rem .38rem 2.8rem !important;
    transition: background .15s ease, color .15s ease, transform .15s ease !important;
    will-change: transform;
}

#sidebar-menu ul li ul.sub-menu li a::before {
    content: "";
    position: absolute;
    left: 1.15rem;
    top: 50%;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #cbd5e1;
    transform: translateY(-50%);
    transition: background .15s ease, transform .15s ease;
}

#sidebar-menu ul li ul.sub-menu li a:hover::before {
    background: #5156be;
    transform: translateY(-50%) scale(1.3);
}

#sidebar-menu ul li ul.sub-menu li a.active::before {
    background: #5156be;
    transform: translateY(-50%) scale(1.2);
}

#sidebar-menu ul li ul.sub-menu li a:hover {
    background-color: rgba(81, 86, 190, .09) !important;
    color: #5156be !important;
    transform: translateX(3px) !important;
    font-weight: 600 !important;
}

#sidebar-menu ul li ul.sub-menu li a.active {
    background-color: rgba(81, 86, 190, .13) !important;
    color: #5156be !important;
    font-weight: 600 !important;
    border-left: 2px solid #5156be !important;
    border-radius: 0 5px 5px 0 !important;
    margin-left: 14px !important;
    padding-left: calc(2.8rem - 6px) !important;
}

#sidebar-menu ul li ul.sub-menu li a .sub-badge {
    margin-left: auto;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 99px;
    background: #ef4444;
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    -webkit-font-smoothing: antialiased;
    font-smoothing: antialiased;
}

body[data-sidebar=dark] #sidebar-menu ul li > a:hover {
    background-color: rgba(255, 255, 255, .09) !important;
    color: #fff !important;
    box-shadow: inset 3px 0 0 rgba(255, 255, 255, .55) !important;
}

body[data-sidebar=dark] #sidebar-menu ul li > a:hover i {
    color: #fff !important;
}

body[data-sidebar=dark] #sidebar-menu ul li ul.sub-menu li a::before {
    background: rgba(255, 255, 255, .25);
}

body[data-sidebar=dark] #sidebar-menu ul li ul.sub-menu li a:hover::before,
body[data-sidebar=dark] #sidebar-menu ul li ul.sub-menu li a.active::before {
    background: #fff;
}

body[data-sidebar=dark] #sidebar-menu ul li ul.sub-menu li a:hover {
    background-color: rgba(255, 255, 255, .07) !important;
    color: #fff !important;
}

body[data-sidebar=dark] #sidebar-menu ul li ul.sub-menu li a.active {
    background-color: rgba(255, 255, 255, .1) !important;
    color: #fff !important;
    border-left-color: rgba(255, 255, 255, .7) !important;
}

/* Floating Chat Widget */
#fchat-btn {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1050;
    width: 52px;
    height: 52px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #fff;
    box-shadow: 0 4px 20px rgba(59, 130, 246, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.4rem;
    transition: transform .18s ease, box-shadow .18s ease;
}

#fchat-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(59, 130, 246, .55);
}

#fchat-unread {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    padding: 0 3px;
    border: 2px solid #fff;
    border-radius: 99px;
    background: #ef4444;
    color: #fff;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: .62rem;
    font-weight: 700;
}

#fchat-panel {
    position: fixed;
    right: 24px;
    bottom: 86px;
    z-index: 1049;
    width: 380px;
    height: min(72vh, 600px);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 8px 40px rgba(0, 0, 0, .15), 0 2px 8px rgba(0, 0, 0, .08);
    display: none;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    animation: fchat-in .18s ease;
}

#fchat-panel.is-open {
    display: flex;
}

@keyframes fchat-in {
    from {
        opacity: 0;
        transform: scale(.92) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.fchat-head {
    padding: 14px 16px 12px;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
}

.fchat-head-main {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.fchat-head-copy {
    min-width: 0;
}

.fchat-head .title {
    font-size: .92rem;
    font-weight: 700;
}

.fchat-head .sub {
    font-size: .73rem;
    opacity: .75;
}

.fchat-head-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fchat-back,
.fchat-notify,
.fchat-openpage,
.fchat-close {
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 6px;
    background: rgba(255, 255, 255, .2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: .9rem;
    transition: background .12s ease;
    text-decoration: none;
}

.fchat-back[hidden] {
    display: none !important;
}

.fchat-openpage {
    width: 30px;
    height: 30px;
}

.fchat-notify.is-enabled {
    background: rgba(34, 197, 94, .28);
    color: #fff;
}

.fchat-notify.is-blocked {
    background: rgba(239, 68, 68, .28);
}

.fchat-close:hover {
    background: rgba(255, 255, 255, .35);
}

.fchat-openpage:hover,
.fchat-notify:hover,
.fchat-back:hover {
    background: rgba(255, 255, 255, .35);
    color: #fff;
}

.chat-presence-badge {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .12rem .45rem;
    border-radius: 999px;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .02em;
    background: rgba(148, 163, 184, .16);
    color: #64748b;
}

.chat-presence-badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.chat-presence-badge.online {
    background: rgba(34, 197, 94, .14);
    color: #16a34a;
}

.chat-presence-badge.offline {
    background: rgba(100, 116, 139, .12);
    color: #64748b;
}

.chat-presence-badge.unknown {
    background: rgba(245, 158, 11, .14);
    color: #b45309;
}

#fchat-panel .fchat-body {
    flex: 1;
    min-height: 0;
    display: flex;
    background: #f8fafc;
}

.fchat-list-view,
.fchat-room-view {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.fchat-room-view {
    background:
        radial-gradient(circle at top left, rgba(99, 102, 241, .08), transparent 35%),
        linear-gradient(180deg, #f8fbff 0%, #eef4fb 100%);
}

#fchat-panel .fchat-search-wrap {
    position: relative;
    padding: 12px 14px;
    border-bottom: 1px solid #e2e8f0;
    background: #fff;
}

#fchat-panel .fchat-search-wrap > i {
    position: absolute;
    left: 28px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: .95rem;
}

.fchat-search-input {
    width: 100%;
    height: 40px;
    padding: 0 14px 0 38px;
    border: 1px solid #dbe4f0;
    border-radius: 12px;
    background: #f8fafc;
    color: #0f172a;
    font-size: .84rem;
    outline: none;
}

.fchat-search-input:focus {
    background: #fff;
    border-color: #a5b4fc;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .12);
}

#fchat-rooms {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    background: #fbfcfe;
}

.fchat-room {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    border: 0;
    color: inherit;
    text-decoration: none;
    text-align: left;
    background: transparent;
    cursor: pointer;
    transition: background .12s ease;
    border-radius: 14px;
    border-bottom: none;
}

.fchat-room:hover {
    background: #f8fafc;
}

.fchat-room.is-active {
    background: rgba(81, 86, 190, .08);
}

.fchat-room:last-child {
    border-bottom: none;
}

.fchat-av {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--fchat-avatar-bg, #5156be);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: .78rem;
    font-weight: 700;
}

.fchat-room-icon {
    font-size: 1.1rem;
}

.fchat-room-main {
    flex: 1;
    min-width: 0;
}

.fchat-rname {
    color: #1e293b;
    font-size: .83rem;
    font-weight: 600;
}

.fchat-rsub {
    max-width: 200px;
    color: #94a3b8;
    font-size: .73rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fchat-rtime {
    color: #cbd5e1;
    flex-shrink: 0;
    font-size: .68rem;
    display: inline-flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.fchat-runread {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .62rem;
    font-weight: 700;
    line-height: 1;
}

#fchat-thread {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fchat-thread-empty {
    margin: auto;
    max-width: 220px;
    text-align: center;
    color: #94a3b8;
    font-size: .82rem;
    line-height: 1.6;
}

.fchat-day-divider {
    align-self: center;
}

.fchat-day-divider span {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(148, 163, 184, .18);
    color: #64748b;
    font-size: .68rem;
    font-weight: 600;
}

.fchat-room-view .msg-bubble-wrap {
    max-width: 82%;
}

.fchat-room-view .msg-sender {
    font-size: .68rem;
}

.fchat-room-view .msg-bubble {
    font-size: .82rem;
}

.fchat-room-view .msg-time {
    font-size: .64rem;
}

.fchat-composer {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 12px 14px;
    border-top: 1px solid #e2e8f0;
    background: #fff;
    flex-shrink: 0;
}

.fchat-composer[hidden] {
    display: none !important;
}

#fchat-input {
    flex: 1;
    min-height: 40px;
    max-height: 110px;
    padding: 10px 14px;
    border: 1px solid #dbe4f0;
    border-radius: 18px;
    background: #f8fafc;
    color: #0f172a;
    resize: none;
    outline: none;
    font-size: .84rem;
    line-height: 1.45;
}

#fchat-input:focus {
    background: #fff;
    border-color: #a5b4fc;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .12);
}

#fchat-send {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: #5156be;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    transition: background .15s ease;
}

#fchat-send:hover {
    background: #4349a5;
}

#fchat-send:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
}

.fchat-foot {
    padding: 10px 14px;
    border-top: 1px solid #f1f5f9;
    background: #f8fafc;
    flex-shrink: 0;
}

.fchat-foot a {
    color: #3b82f6;
    font-size: .78rem;
    text-decoration: none;
}

.fchat-foot a:hover {
    text-decoration: underline;
}

#fchat-loading,
#fchat-empty {
    text-align: center;
    padding: 32px;
    color: #94a3b8;
    font-size: .82rem;
}

.fchat-empty-icon {
    display: block;
    margin-bottom: 6px;
    font-size: 2rem;
    opacity: .25;
}

@media (max-width: 767.98px) {
    #fchat-btn {
        right: 16px;
        bottom: 16px;
    }

    #fchat-panel {
        right: 12px;
        bottom: 78px;
        left: 12px;
        width: auto;
        height: min(76vh, 640px);
    }

    .fchat-room-view .msg-bubble-wrap {
        max-width: 88%;
    }
}

.erp-module-tabs {
    display: flex;
    gap: .35rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    margin-top: .7rem;
    margin-bottom: 0 !important;
    padding: 0 .25rem .45rem;
    border-bottom: 2px solid var(--erp-border-strong);
    scrollbar-color: #cbd5e1 #eef2f7;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scroll-padding-inline: .25rem;
    overscroll-behavior-x: contain;
}

.erp-module-tabs-row {
    margin-bottom: .4rem;
}

.erp-module-tabs-row + .card,
.erp-module-tabs-row + .card.mt-3,
.erp-module-tabs-row + .alert + .card,
.erp-module-tabs-row + .alert + .card.mt-3 {
    margin-top: .35rem !important;
}

.erp-module-tabs .nav-item {
    flex: 0 0 auto;
    margin-bottom: -2px;
    scroll-snap-align: start;
}

.erp-module-tabs .nav-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    white-space: nowrap;
    padding: .72rem 1rem;
    border: 1.5px solid var(--erp-border-strong) !important;
    border-bottom-width: 2px !important;
    border-radius: 12px 12px 0 0;
    background: linear-gradient(180deg, #ffffff 0%, var(--erp-surface-soft) 100%);
    color: var(--erp-text) !important;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 1px 0 rgba(15, 23, 42, .02);
}

.erp-module-tabs .nav-link::after {
    display: none !important;
}

.erp-module-tabs .nav-link:hover {
    background: #ffffff !important;
    border-color: #94a3b8 !important;
    color: var(--erp-brand-strong) !important;
}

.erp-module-tabs .nav-link.active {
    background: var(--erp-surface) !important;
    color: var(--erp-brand-strong) !important;
    border-color: var(--erp-brand) var(--erp-brand) var(--erp-surface) !important;
    box-shadow: inset 0 3px 0 0 var(--erp-brand);
}

.erp-module-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #ef4444;
    color: #fff;
    border-radius: 99px;
    font-size: .65rem;
    font-weight: 700;
    line-height: 1;
    -webkit-font-smoothing: antialiased;
    pointer-events: none;
    vertical-align: middle;
    margin-left: 5px;
}

.erp-module-tabs::-webkit-scrollbar {
    height: 6px;
}

.erp-module-tabs::-webkit-scrollbar-track {
    background: #eef2f7;
    border-radius: 4px;
    margin-inline: .35rem;
}

.erp-module-tabs::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.erp-module-tabs::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.erp-scroll-tabs {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: .45rem;
    scrollbar-color: #cbd5e1 #eef2f7;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    overscroll-behavior-x: contain;
}

.erp-scroll-tabs .nav-item {
    flex: 0 0 auto;
    scroll-snap-align: start;
}

.erp-scroll-tabs::-webkit-scrollbar {
    height: 6px;
}

.erp-scroll-tabs::-webkit-scrollbar-track {
    background: #eef2f7;
    border-radius: 4px;
    margin-inline: .35rem;
}

.erp-scroll-tabs::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.erp-scroll-tabs::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

body[data-layout-mode=dark] .cp-tabs {
    scrollbar-color: #30363d #1a1d1f;
}
body[data-layout-mode=dark] .cp-tabs::-webkit-scrollbar-track {
    background: #1a1d1f;
}
body[data-layout-mode=dark] .cp-tabs::-webkit-scrollbar-thumb {
    background: #30363d;
}
body[data-layout-mode=dark] .cp-tabs::-webkit-scrollbar-thumb:hover {
    background: #484f58;
}

body[data-layout-mode=dark] .erp-module-tabs {
    border-bottom-color: #414854;
    scrollbar-color: #30363d #1a1d1f;
}

body[data-layout-mode=dark] .erp-module-tabs::-webkit-scrollbar-track {
    background: #1a1d1f;
}

body[data-layout-mode=dark] .erp-module-tabs::-webkit-scrollbar-thumb {
    background: #30363d;
    border-radius: 4px;
}

body[data-layout-mode=dark] .erp-module-tabs::-webkit-scrollbar-thumb:hover {
    background: #484f58;
}

body[data-layout-mode=dark] .erp-scroll-tabs {
    scrollbar-color: #30363d #1a1d1f;
}

body[data-layout-mode=dark] .erp-scroll-tabs::-webkit-scrollbar-track {
    background: #1a1d1f;
}

body[data-layout-mode=dark] .erp-scroll-tabs::-webkit-scrollbar-thumb {
    background: #30363d;
    border-radius: 4px;
}

body[data-layout-mode=dark] .erp-scroll-tabs::-webkit-scrollbar-thumb:hover {
    background: #484f58;
}

body[data-layout-mode=dark] .erp-module-tabs .nav-link {
    background: linear-gradient(180deg, #2b3138 0%, #242a31 100%) !important;
    border-color: #4b5563 !important;
    color: #cbd5e1 !important;
    box-shadow: none;
}

body[data-layout-mode=dark] .erp-module-tabs .nav-link:hover {
    background: #2b3138 !important;
    border-color: #818cf8 !important;
    color: #c7d2fe !important;
}

body[data-layout-mode=dark] .erp-module-tabs .nav-link.active {
    background: #1f242a !important;
    color: #c7d2fe !important;
    border-color: #818cf8 #818cf8 #1f242a !important;
    box-shadow: inset 0 3px 0 0 #818cf8;
}

.erp-table-empty-row > td,
.erp-table-empty-row > th,
td.dataTables_empty {
    padding-top: 2rem !important;
    padding-bottom: 2rem !important;
    background: linear-gradient(180deg, rgba(122, 127, 220, .04), rgba(122, 127, 220, .01));
}

.erp-table-empty-cell {
    vertical-align: middle;
}

.erp-table-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .65rem;
    min-height: 180px;
    padding: .5rem 1rem;
    text-align: center;
    color: #64748b;
}

.erp-table-empty-icon {
    width: 56px;
    height: 56px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(122, 127, 220, .1);
    color: #5b61c9;
    flex: 0 0 auto;
}

.erp-table-empty-icon i {
    font-size: 1.85rem;
    line-height: 1;
    opacity: 1 !important;
    margin: 0 !important;
}

.erp-table-empty-copy {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    max-width: 560px;
}

.erp-table-empty-title {
    font-size: .96rem;
    font-weight: 600;
    color: #334155;
}

.erp-table-empty-copy,
.erp-table-empty-copy .text-muted,
.erp-table-empty-copy .small {
    color: #64748b !important;
}

.erp-table-empty-copy a:not(.btn) {
    font-weight: 500;
}

.erp-table-empty-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .5rem;
    margin-top: .1rem;
}

.erp-table-empty-state-search .erp-table-empty-icon,
.erp-table-empty-state-filter .erp-table-empty-icon {
    background: rgba(75, 166, 239, .12);
    color: #2b7fd2;
}

body[data-layout-mode=dark] .erp-table-empty-row > td,
body[data-layout-mode=dark] .erp-table-empty-row > th,
body[data-layout-mode=dark] td.dataTables_empty {
    background: linear-gradient(180deg, rgba(122, 127, 220, .08), rgba(49, 53, 51, .35));
}

body[data-layout-mode=dark] .erp-table-empty-icon {
    background: rgba(122, 127, 220, .18);
    color: #c7cbff;
}

body[data-layout-mode=dark] .erp-table-empty-state-search .erp-table-empty-icon,
body[data-layout-mode=dark] .erp-table-empty-state-filter .erp-table-empty-icon {
    background: rgba(75, 166, 239, .18);
    color: #8ed0ff;
}

body[data-layout-mode=dark] .erp-table-empty-title {
    color: #e2e8f0;
}

body[data-layout-mode=dark] .erp-table-empty-copy,
body[data-layout-mode=dark] .erp-table-empty-copy .text-muted,
body[data-layout-mode=dark] .erp-table-empty-copy .small {
    color: #94a3b8 !important;
}

.erp-action-panel {
    padding: 1rem 1.05rem;
    border: 1.5px solid var(--erp-border);
    border-radius: 16px;
    background: linear-gradient(180deg, #ffffff 0%, var(--erp-surface-soft) 100%);
    box-shadow: 0 4px 14px rgba(15, 23, 42, .04);
}

.erp-report-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: .9rem 1rem;
    border: 1px solid var(--erp-border);
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, var(--erp-surface-soft) 100%);
}

.erp-report-toolbar-title {
    color: var(--erp-text);
    font-size: .84rem;
    font-weight: 700;
    margin-bottom: .15rem;
}

.erp-report-toolbar-meta {
    color: var(--erp-muted);
    font-size: .8rem;
    line-height: 1.45;
}

.erp-report-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    justify-content: flex-end;
}

.erp-report-table thead th {
    background: var(--erp-surface-soft);
    color: var(--erp-text);
    font-size: .72rem;
    font-weight: 700;
    border-bottom: 1px solid var(--erp-border);
}

.erp-report-code {
    font-size: .78rem;
}

.erp-report-cell-stack {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    min-width: 0;
}

.erp-report-truncate {
    display: block;
    max-width: 360px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body[data-layout-mode=dark] .erp-action-panel,
body[data-layout-mode=dark] .erp-report-toolbar {
    background: linear-gradient(180deg, #30353a 0%, #2a2f35 100%);
    border-color: #414854;
    box-shadow: none;
}

body[data-layout-mode=dark] .erp-report-toolbar-title {
    color: #e2e8f0;
}

body[data-layout-mode=dark] .erp-report-toolbar-meta {
    color: #94a3b8;
}

body[data-layout-mode=dark] .erp-report-table thead th {
    background: #2f353c;
    color: #e2e8f0;
    border-bottom-color: #414854;
}

@media (max-width: 767.98px) {
    .erp-report-toolbar {
        flex-direction: column;
    }

    .erp-report-toolbar-actions {
        justify-content: flex-start;
    }

    .erp-report-truncate {
        max-width: 240px;
    }
}

/* ============================================================
   48. DARK MODE COMFORT REFINEMENT
   Improves readability and reduces harsh contrast without
   affecting light mode.
   ============================================================ */

body[data-layout-mode=dark] {
    --erp-page: #141a21;
    --erp-surface: #1c242d;
    --erp-surface-soft: #232d38;
    --erp-border: #34414f;
    --erp-border-strong: #46586c;
    --erp-ink: #ecf3fb;
    --erp-text: #d7e1ec;
    --erp-muted: #a6b4c6;
    --erp-muted-soft: #8898ab;
    --erp-brand-soft: rgba(99, 102, 241, .16);
    --erp-success-soft: rgba(16, 185, 129, .16);
    --erp-warning-soft: rgba(245, 158, 11, .16);
    --erp-danger-soft: rgba(239, 68, 68, .16);
    --erp-shadow: 0 20px 44px rgba(4, 10, 18, .30);
    --erp-shadow-soft: 0 12px 28px rgba(4, 10, 18, .22);
    background: linear-gradient(180deg, #131920 0%, #151c24 100%) !important;
    color: var(--erp-text) !important;
}

body[data-layout-mode=dark] .main-content,
body[data-layout-mode=dark] .page-content {
    background: transparent !important;
}

body[data-layout-mode=dark] .card,
body[data-layout-mode=dark] .sec-card,
body[data-layout-mode=dark] .kpi-card,
body[data-layout-mode=dark] .exec-kpi-card,
body[data-layout-mode=dark] .erp-action-panel,
body[data-layout-mode=dark] .erp-report-toolbar {
    background: linear-gradient(180deg, #1b232c 0%, #1f2832 100%) !important;
    border-color: var(--erp-border) !important;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .18) !important;
}

body[data-layout-mode=dark] .card-header,
body[data-layout-mode=dark] .card-footer,
body[data-layout-mode=dark] .sec-card .card-header,
body[data-layout-mode=dark] .exec-dashboard .card-header {
    background: linear-gradient(180deg, #202933 0%, #1c252e 100%) !important;
    border-color: var(--erp-border) !important;
    color: var(--erp-ink) !important;
}

body[data-layout-mode=dark] .card-body,
body[data-layout-mode=dark] .card-footer,
body[data-layout-mode=dark] .erp-report-table,
body[data-layout-mode=dark] .erp-action-panel {
    color: var(--erp-text) !important;
}

body[data-layout-mode=dark] .erp-report-toolbar-title,
body[data-layout-mode=dark] .page-title-box h4,
body[data-layout-mode=dark] h1,
body[data-layout-mode=dark] h2,
body[data-layout-mode=dark] h3,
body[data-layout-mode=dark] h4,
body[data-layout-mode=dark] h5,
body[data-layout-mode=dark] h6 {
    color: var(--erp-ink) !important;
}

body[data-layout-mode=dark] .text-muted,
body[data-layout-mode=dark] .page-title-box .text-muted.small,
body[data-layout-mode=dark] .page-title-sub,
body[data-layout-mode=dark] .kpi-label,
body[data-layout-mode=dark] .kpi-sub,
body[data-layout-mode=dark] .company-code,
body[data-layout-mode=dark] .company-id,
body[data-layout-mode=dark] .erp-report-toolbar-meta,
body[data-layout-mode=dark] .erp-page-subtitle {
    color: var(--erp-muted) !important;
}

body[data-layout-mode=dark] .table {
    color: var(--erp-text) !important;
    border-color: rgba(255, 255, 255, .08) !important;
}

body[data-layout-mode=dark] .table thead th,
body[data-layout-mode=dark] .erp-report-table thead th,
body[data-layout-mode=dark] .gl-ledger-table thead th {
    background: #202833 !important;
    color: #cdd8e7 !important;
    border-color: var(--erp-border) !important;
}

body[data-layout-mode=dark] .table td,
body[data-layout-mode=dark] .table th,
body[data-layout-mode=dark] .erp-report-table tbody td,
body[data-layout-mode=dark] .gl-ledger-table tbody td {
    border-color: rgba(255, 255, 255, .08) !important;
}

body[data-layout-mode=dark] .finance-summary-alert {
    background: linear-gradient(180deg, rgba(30, 41, 59, .96) 0%, rgba(15, 23, 42, .98) 100%) !important;
    border-color: rgba(148, 163, 184, .18) !important;
    color: #c7d2fe !important;
}

body[data-layout-mode=dark] .finance-summary-alert strong {
    color: #e0e7ff !important;
}

body[data-layout-mode=dark] .table-striped > tbody > tr:nth-of-type(odd) > *,
body[data-layout-mode=dark] .table-hover > tbody > tr:hover > * {
    color: var(--erp-text) !important;
}

body[data-layout-mode=dark] .table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: rgba(255, 255, 255, .03) !important;
}

body[data-layout-mode=dark] .table tbody tr:hover > td,
body[data-layout-mode=dark] .table-hover > tbody > tr:hover > * {
    background-color: rgba(148, 163, 184, .10) !important;
    color: var(--erp-ink) !important;
}

body[data-layout-mode=dark] .form-control,
body[data-layout-mode=dark] .form-select,
body[data-layout-mode=dark] .input-group-text {
    background-color: #151d25 !important;
    border-color: #3a4858 !important;
    color: var(--erp-text) !important;
}

body[data-layout-mode=dark] .form-control::placeholder,
body[data-layout-mode=dark] .form-select::placeholder {
    color: #8b98aa !important;
}

body[data-layout-mode=dark] .form-control:focus,
body[data-layout-mode=dark] .form-select:focus {
    background-color: #18212a !important;
    border-color: #8ea3ff !important;
    box-shadow: 0 0 0 .22rem rgba(99, 102, 241, .18) !important;
    color: var(--erp-ink) !important;
}

body[data-layout-mode=dark] #page-topbar,
body[data-layout-mode=dark] .navbar-brand-box {
    background: linear-gradient(180deg, #182029 0%, #141b22 100%) !important;
    border-color: #26313d !important;
}

body[data-layout-mode=dark] .vertical-menu {
    background: linear-gradient(180deg, #161d25 0%, #121920 100%) !important;
    border-right-color: #26313d !important;
}

body[data-layout-mode=dark] .header-icon-btn {
    color: #b7c4d4 !important;
}

body[data-layout-mode=dark] .header-icon-btn:hover,
body[data-layout-mode=dark] .header-icon-btn:focus {
    background: rgba(148, 163, 184, .12) !important;
    color: var(--erp-ink) !important;
}

body[data-layout-mode=dark] #sidebar-menu ul li > a {
    color: #b6c2d2 !important;
}

body[data-layout-mode=dark] #sidebar-menu ul li > a i,
body[data-layout-mode=dark] #sidebar-menu ul li ul.sub-menu li a {
    color: #93a3b7 !important;
}

body[data-layout-mode=dark]:not([data-sidebar-size=sm]) #sidebar-menu ul li > a:hover,
body[data-layout-mode=dark] #sidebar-menu ul li ul.sub-menu li a:hover,
body[data-layout-mode=dark] #sidebar-menu ul li ul.sub-menu li a.active,
body[data-layout-mode=dark] .mm-active > a {
    background-color: rgba(99, 102, 241, .14) !important;
    color: #cbd6ff !important;
    box-shadow: inset 3px 0 0 #93a4ff !important;
}

body[data-layout-mode=dark]:not([data-sidebar-size=sm]) #sidebar-menu ul li > a:hover i,
body[data-layout-mode=dark] .mm-active > a i {
    color: #cbd6ff !important;
}

body[data-layout-mode=dark] .dropdown-menu {
    background-color: #182029 !important;
    border-color: var(--erp-border) !important;
    box-shadow: 0 18px 34px rgba(0, 0, 0, .34) !important;
}

body[data-layout-mode=dark] .dropdown-item {
    color: var(--erp-text) !important;
}

body[data-layout-mode=dark] .dropdown-item:hover,
body[data-layout-mode=dark] .dropdown-item:focus {
    background-color: rgba(99, 102, 241, .16) !important;
    color: var(--erp-ink) !important;
}

body[data-layout-mode=dark] .nav-tabs,
body[data-layout-mode=dark] .erp-module-tabs {
    border-bottom-color: var(--erp-border) !important;
}

body[data-layout-mode=dark] .nav-tabs .nav-link {
    color: #b7c3d4 !important;
    border-color: transparent !important;
}

body[data-layout-mode=dark] .nav-tabs .nav-link.active {
    background-color: #1c242d !important;
    border-color: var(--erp-border) var(--erp-border) #1c242d !important;
    color: var(--erp-ink) !important;
}

body[data-layout-mode=dark] .nav-tabs .nav-link:not(.active):hover {
    background-color: rgba(99, 102, 241, .10) !important;
    border-bottom-color: #93a4ff !important;
    color: #d5defb !important;
}

body[data-layout-mode=dark] .erp-module-tabs .nav-link {
    background: linear-gradient(180deg, #27303a 0%, #222a33 100%) !important;
    border-color: var(--erp-border) !important;
    color: #cdd8e7 !important;
}

body[data-layout-mode=dark] .erp-module-tabs .nav-link:hover {
    background: #2a3340 !important;
    border-color: #93a4ff !important;
    color: #dde5ff !important;
}

body[data-layout-mode=dark] .erp-module-tabs .nav-link.active {
    background: #1b232c !important;
    color: var(--erp-ink) !important;
    border-color: #93a4ff #93a4ff #1b232c !important;
    box-shadow: inset 0 3px 0 0 #93a4ff;
}

body[data-layout-mode=dark] .alert-success,
body[data-layout-mode=dark] .alert-warning,
body[data-layout-mode=dark] .alert-danger,
body[data-layout-mode=dark] .alert-info {
    filter: saturate(.92) brightness(1.04);
}

body[data-layout-mode=dark] .btn-outline-secondary {
    color: #c1ccda !important;
    border-color: #445466 !important;
}

body[data-layout-mode=dark] .btn-outline-secondary:hover,
body[data-layout-mode=dark] .btn-outline-secondary:focus {
    background-color: rgba(148, 163, 184, .14) !important;
    border-color: #5e7288 !important;
    color: var(--erp-ink) !important;
}

body[data-layout-mode=dark] code {
    background-color: #29323d !important;
    color: #ffb4ab !important;
}

body[data-layout-mode=dark] .maintenance-page .maintenance-page-sub,
body[data-layout-mode=dark] .maintenance-page .maintenance-list-header .text-muted.small,
body[data-layout-mode=dark] .maintenance-page .maintenance-equipment-issue,
body[data-layout-mode=dark] .maintenance-page .maintenance-empty-state,
body[data-layout-mode=dark] .maintenance-page .maintenance-empty-state .text-muted,
body[data-layout-mode=dark] .maintenance-page .maintenance-filter-bar .form-label {
    color: #afbed0 !important;
}

body[data-layout-mode=dark] .maintenance-page .maintenance-list-header {
    background: linear-gradient(180deg, #25303b 0%, #1d2731 100%) !important;
}

body[data-layout-mode=dark] .maintenance-page .maintenance-meta-pills .erp-code-pill {
    background: linear-gradient(180deg, #283341 0%, #222c37 100%) !important;
    border: 1px solid #415164;
    color: #e4edf8 !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .03);
}

body[data-layout-mode=dark] .maintenance-page .maintenance-filter-bar {
    padding: 1rem;
    margin-left: 0;
    margin-right: 0;
    border: 1px solid rgba(99, 115, 129, .34);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(34, 44, 55, .92) 0%, rgba(27, 35, 43, .92) 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .02);
}

body[data-layout-mode=dark] .maintenance-page .maintenance-filter-bar .form-control,
body[data-layout-mode=dark] .maintenance-page .maintenance-filter-bar .form-select {
    background-color: #18212a !important;
    border-color: #46596d !important;
    color: #e4edf8 !important;
}

body[data-layout-mode=dark] .maintenance-page .maintenance-filter-bar .form-control:focus,
body[data-layout-mode=dark] .maintenance-page .maintenance-filter-bar .form-select:focus {
    background-color: #1b2530 !important;
    border-color: #98acff !important;
    box-shadow: 0 0 0 .22rem rgba(129, 140, 248, .18) !important;
}

body[data-layout-mode=dark] .maintenance-page .maintenance-filter-bar .btn-outline-primary {
    color: #dce6ff !important;
    border-color: #6e82ff !important;
    background: rgba(79, 70, 229, .14) !important;
}

body[data-layout-mode=dark] .maintenance-page .maintenance-filter-bar .btn-outline-primary:hover,
body[data-layout-mode=dark] .maintenance-page .maintenance-filter-bar .btn-outline-primary:focus {
    background: rgba(99, 102, 241, .24) !important;
    border-color: #93a4ff !important;
    color: #f2f6ff !important;
}

body[data-layout-mode=dark] .maintenance-page .table-responsive {
    border: 1px solid rgba(99, 115, 129, .28);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(25, 33, 41, .94) 0%, rgba(23, 30, 37, .94) 100%) !important;
}

body[data-layout-mode=dark] .maintenance-page .maintenance-table thead th {
    background: #26313d !important;
    color: #e7eef8 !important;
    border-bottom-color: #415164 !important;
}

body[data-layout-mode=dark] .maintenance-page .maintenance-table tbody td {
    color: #d9e3ef !important;
    border-color: rgba(117, 134, 150, .18) !important;
}

body[data-layout-mode=dark] .maintenance-page .maintenance-table.table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: rgba(255, 255, 255, .035) !important;
}

body[data-layout-mode=dark] .maintenance-page .maintenance-table tbody tr:hover > * {
    background-color: rgba(99, 102, 241, .10) !important;
}

body[data-layout-mode=dark] .maintenance-page .maintenance-equipment-name {
    color: #eff5fc !important;
}

body[data-layout-mode=dark] .maintenance-page .maintenance-wo-code {
    display: inline-flex;
    align-items: center;
    padding: .18rem .45rem;
    border-radius: 8px;
    border: 1px solid #415164;
    background: linear-gradient(180deg, #2a3440 0%, #24303b 100%) !important;
    color: #dfe9f7 !important;
    box-shadow: none;
}

body[data-layout-mode=dark] .maintenance-page .maintenance-empty-state i {
    color: #95a8bd !important;
    opacity: .82 !important;
}

/* ============================================================
   Lines table flush helper — removes card-body side padding
   so the line-items table extends edge-to-edge inside the card.
   Use on the table-responsive (or direct table wrapper) inside
   a card-body that contains both header fields and a lines table.
   ============================================================ */
/* Current standard: line tables stay inset from the card edge. */
.card-body .tbl-lines-flush {
    margin: 1rem 1rem 0;
    overflow-x: auto;
    overflow-y: visible;
}

/* ============================================================
   Lines table inset helper - keeps line item tables off the
   card edge while preserving responsive horizontal scroll.
   ============================================================ */
.erp-lines-table-shell {
    padding: 1rem 1rem 0;
    overflow: visible;
}

.card-body.p-0 > .table-responsive,
.card-body.p-0 > form > .table-responsive,
.card-body.p-0 > .dataTables_wrapper > .table-responsive,
.card > .table-responsive {
    padding: 1rem;
    overflow-x: auto;
    overflow-y: visible;
}

.card-body.p-0 > .table {
    margin: 1rem;
    width: calc(100% - 2rem);
}

.erp-lines-table-shell > .table-responsive {
    overflow-x: auto;
    overflow-y: visible;
}

.dashboard-settings-page .dashboard-settings-card {
    overflow: visible;
}

.dashboard-settings-page .dashboard-settings-card:hover {
    transform: none !important;
}

.dashboard-settings-page .dashboard-settings-card .card-body {
    padding-bottom: 1.25rem;
    overflow: visible;
}

.dashboard-settings-page .dashboard-settings-table-wrap {
    padding-bottom: .5rem;
}

.dashboard-settings-page .dataTables_wrapper {
    padding-bottom: .25rem;
}

.dashboard-settings-page .erp-dt-bottom,
.dashboard-settings-page .dataTables_info {
    display: none !important;
}

.dashboard-settings-page #dashboardSettingsTable {
    margin-bottom: .5rem !important;
}

@media (max-width: 991.98px) {
    body[data-sidebar-size=sm] .vertical-menu {
        width: 250px !important;
        height: calc(100vh - 70px) !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        z-index: 1005 !important;
    }

    body[data-sidebar-size=sm] .vertical-menu #sidebar-menu > ul > li {
        position: static !important;
        white-space: normal !important;
    }

    body[data-sidebar-size=sm] .vertical-menu #sidebar-menu > ul > li > a {
        display: block !important;
        width: 100% !important;
        min-height: 0 !important;
        padding: .62rem 1.5rem !important;
        border-radius: 0 !important;
    }

    body[data-sidebar-size=sm] .vertical-menu #sidebar-menu > ul > li > a span {
        display: inline !important;
        padding-left: 0 !important;
    }

    /* Mobile: sidebar expands full-width, badge uses absolute position same as expanded */
    body[data-sidebar-size=sm] .vertical-menu #sidebar-menu > ul > li > .menu-badge {
        display: inline-flex !important;
        position: absolute !important;
        top: 50% !important;
        right: 1.5rem !important;
        transform: translateY(-50%) !important;
        min-width: 18px;
        height: 18px;
        padding: 0 5px;
        border: 0;
        font-size: .65rem;
        line-height: 1;
        -webkit-font-smoothing: antialiased;
    }

    body[data-sidebar-size=sm] .vertical-menu #sidebar-menu > ul > li > a.has-arrow::after {
        display: block !important;
    }

    body[data-sidebar-size=sm] .vertical-menu #sidebar-menu > ul > li > a[data-erp-label]::after,
    body[data-sidebar-size=sm] .vertical-menu #sidebar-menu > ul > li:hover > a[data-erp-label]::after,
    .erp-sidebar-flyout-panel {
        display: none !important;
    }

    body[data-sidebar-size=sm] .main-content,
    body[data-sidebar-size=sm] .footer {
        margin-left: 0 !important;
        left: 0 !important;
    }
}

@media (max-width: 576px) {
    .card-body.p-0 > .table-responsive,
    .card-body.p-0 > form > .table-responsive,
    .card-body.p-0 > .dataTables_wrapper > .table-responsive,
    .card > .table-responsive {
        padding: .875rem;
    }

    .card-body .tbl-lines-flush {
        margin: .875rem .875rem 0;
    }

    .card-body.p-0 > .table {
        margin: .875rem;
        width: calc(100% - 1.75rem);
    }

    .erp-lines-table-shell {
        padding: .875rem .875rem 0;
    }
}

/* Password peek controls */
.password-peek-group .password-peek-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
}

.password-peek-group .password-peek-toggle i {
    font-size: 1.05rem;
    line-height: 1;
}

/* Standard back button */
.erp-back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 82px;
    min-height: 34px;
    height: auto;
    padding: .4375rem .875rem;
    margin: 0;
    border-radius: var(--erp-radius-md, .8125rem);
    border-color: #cbd5e1 !important;
    background: #fff !important;
    color: #334155 !important;
    font-weight: 500;
    font-size: .8125rem;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    box-shadow: none;
    transition: border-color .18s ease, background-color .18s ease, color .18s ease, box-shadow .18s ease;
}

.erp-back-btn:hover,
.erp-back-btn:focus {
    border-color: #94a3b8 !important;
    background: #f8fafc !important;
    color: #0f172a !important;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .06);
}

body[data-layout-mode=dark] .erp-back-btn {
    border-color: #475569 !important;
    background: #1e293b !important;
    color: #e2e8f0 !important;
}

body[data-layout-mode=dark] .erp-back-btn:hover,
body[data-layout-mode=dark] .erp-back-btn:focus {
    border-color: #64748b !important;
    background: #273449 !important;
    color: #f8fafc !important;
    box-shadow: 0 10px 24px rgba(2, 6, 23, .22);
}

.page-title-box .erp-back-btn,
.chat-header-actions .erp-back-btn {
    align-self: center;
}

.erp-back-btn.btn-sm {
    min-height: 34px;
    padding: .4375rem .875rem;
}

/* Standard create button */
.erp-create-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 88px;
    min-height: 34px;
    height: auto;
    padding: .4375rem .875rem;
    margin: 0;
    border-radius: var(--erp-radius-md, .8125rem);
    font-size: .8125rem;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    gap: .375rem;
}

.erp-create-btn.btn-sm {
    min-height: 34px;
    padding: .4375rem .875rem;
}

.erp-create-btn i {
    font-size: .95rem;
    line-height: 1;
}

/* Standard save button */
.erp-save-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 88px;
    min-height: 34px;
    height: auto;
    padding: .4375rem .875rem;
    margin: 0;
    border-radius: var(--erp-radius-md, .8125rem);
    font-size: .8125rem;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    gap: .375rem;
}

.erp-save-btn.btn-sm {
    min-height: 34px;
    padding: .4375rem .875rem;
}

.erp-save-btn i {
    font-size: .95rem;
    line-height: 1;
}

/* Standard cancel/reset buttons */
.erp-cancel-btn,
.erp-reset-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 88px;
    min-height: 34px;
    height: auto;
    padding: .4375rem .875rem;
    margin: 0;
    border-radius: var(--erp-radius-md, .8125rem);
    border-color: #cbd5e1 !important;
    background: #f8fafc !important;
    color: #475569 !important;
    font-size: .8125rem;
    font-weight: 500;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    gap: .375rem;
}

.erp-cancel-btn.btn-sm,
.erp-reset-btn.btn-sm {
    min-height: 34px;
    padding: .4375rem .875rem;
}

.erp-cancel-btn i,
.erp-reset-btn i {
    font-size: .95rem;
    line-height: 1;
}

.erp-cancel-btn:hover,
.erp-cancel-btn:focus,
.erp-reset-btn:hover,
.erp-reset-btn:focus {
    border-color: #94a3b8 !important;
    background: #f1f5f9 !important;
    color: #334155 !important;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .06);
}

body[data-layout-mode=dark] .erp-cancel-btn,
body[data-layout-mode=dark] .erp-reset-btn {
    border-color: #475569 !important;
    background: #1e293b !important;
    color: #cbd5e1 !important;
}

body[data-layout-mode=dark] .erp-cancel-btn:hover,
body[data-layout-mode=dark] .erp-cancel-btn:focus,
body[data-layout-mode=dark] .erp-reset-btn:hover,
body[data-layout-mode=dark] .erp-reset-btn:focus {
    border-color: #64748b !important;
    background: #273449 !important;
    color: #f8fafc !important;
    box-shadow: 0 10px 24px rgba(2, 6, 23, .22);
}

/* Standard edit/filter/post buttons */
.erp-edit-btn,
.erp-filter-btn,
.erp-post-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 88px;
    min-height: 34px;
    height: auto;
    padding: .4375rem .875rem;
    margin: 0;
    border-radius: var(--erp-radius-md, .8125rem);
    font-size: .8125rem;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    gap: .375rem;
}

.erp-edit-btn.btn-sm,
.erp-filter-btn.btn-sm,
.erp-post-btn.btn-sm {
    min-height: 34px;
    padding: .4375rem .875rem;
}

.erp-edit-btn i,
.erp-filter-btn i,
.erp-post-btn i {
    font-size: .95rem;
    line-height: 1;
}

.erp-edit-btn {
    border-color: #bfdbfe !important;
    background: #eff6ff !important;
    color: #1d4ed8 !important;
}

.erp-edit-btn:hover,
.erp-edit-btn:focus {
    border-color: #93c5fd !important;
    background: #dbeafe !important;
    color: #1e40af !important;
    box-shadow: 0 8px 20px rgba(29, 78, 216, .08);
}

.erp-filter-btn {
    border-color: #cbd5e1 !important;
    background: #fff !important;
    color: #334155 !important;
}

.erp-filter-btn:hover,
.erp-filter-btn:focus {
    border-color: #94a3b8 !important;
    background: #f8fafc !important;
    color: #0f172a !important;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .06);
}

.erp-post-btn {
    border-color: #16a34a !important;
    background: #16a34a !important;
    color: #fff !important;
}

.erp-post-btn:hover,
.erp-post-btn:focus {
    border-color: #15803d !important;
    background: #15803d !important;
    color: #fff !important;
    box-shadow: 0 10px 24px rgba(22, 163, 74, .18);
}

body[data-layout-mode=dark] .erp-edit-btn {
    border-color: rgba(96, 165, 250, .35) !important;
    background: rgba(59, 130, 246, .18) !important;
    color: #bfdbfe !important;
}

body[data-layout-mode=dark] .erp-edit-btn:hover,
body[data-layout-mode=dark] .erp-edit-btn:focus {
    border-color: rgba(96, 165, 250, .48) !important;
    background: rgba(59, 130, 246, .28) !important;
    color: #dbeafe !important;
}

body[data-layout-mode=dark] .erp-filter-btn {
    border-color: #475569 !important;
    background: #1e293b !important;
    color: #cbd5e1 !important;
}

body[data-layout-mode=dark] .erp-filter-btn:hover,
body[data-layout-mode=dark] .erp-filter-btn:focus {
    border-color: #64748b !important;
    background: #273449 !important;
    color: #f8fafc !important;
}

body[data-layout-mode=dark] .erp-post-btn {
    border-color: #16a34a !important;
    background: #16a34a !important;
    color: #fff !important;
}

/* Standard view/print/load/open buttons */
.erp-view-btn,
.erp-print-btn,
.erp-load-btn,
.erp-open-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 88px;
    min-height: 34px;
    height: auto;
    padding: .4375rem .875rem;
    margin: 0;
    border-radius: var(--erp-radius-md, .8125rem);
    font-size: .8125rem;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    gap: .375rem;
}

.erp-view-btn.btn-sm,
.erp-print-btn.btn-sm,
.erp-load-btn.btn-sm,
.erp-open-btn.btn-sm {
    min-height: 34px;
    padding: .4375rem .875rem;
}

.erp-view-btn i,
.erp-print-btn i,
.erp-load-btn i,
.erp-open-btn i {
    font-size: .95rem;
    line-height: 1;
}

.erp-view-btn {
    border-color: #cbd5e1 !important;
    background: #fff !important;
    color: #334155 !important;
}

.erp-view-btn:hover,
.erp-view-btn:focus {
    border-color: #94a3b8 !important;
    background: #f8fafc !important;
    color: #0f172a !important;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .06);
}

.erp-print-btn {
    border-color: #cbd5e1 !important;
    background: #fff !important;
    color: #334155 !important;
}

.erp-print-btn:hover,
.erp-print-btn:focus {
    border-color: #94a3b8 !important;
    background: #f8fafc !important;
    color: #0f172a !important;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .06);
}

.erp-load-btn {
    border-color: #38bdf8 !important;
    background: #e0f2fe !important;
    color: #0369a1 !important;
}

.erp-load-btn:hover,
.erp-load-btn:focus {
    border-color: #0ea5e9 !important;
    background: #bae6fd !important;
    color: #075985 !important;
    box-shadow: 0 8px 20px rgba(14, 165, 233, .10);
}

.erp-open-btn {
    border-color: #a78bfa !important;
    background: #f5f3ff !important;
    color: #6d28d9 !important;
}

.erp-open-btn:hover,
.erp-open-btn:focus {
    border-color: #8b5cf6 !important;
    background: #ede9fe !important;
    color: #5b21b6 !important;
    box-shadow: 0 8px 20px rgba(139, 92, 246, .10);
}

body[data-layout-mode=dark] .erp-view-btn,
body[data-layout-mode=dark] .erp-print-btn {
    border-color: #475569 !important;
    background: #1e293b !important;
    color: #cbd5e1 !important;
}

body[data-layout-mode=dark] .erp-view-btn:hover,
body[data-layout-mode=dark] .erp-view-btn:focus,
body[data-layout-mode=dark] .erp-print-btn:hover,
body[data-layout-mode=dark] .erp-print-btn:focus {
    border-color: #64748b !important;
    background: #273449 !important;
    color: #f8fafc !important;
}

body[data-layout-mode=dark] .erp-load-btn {
    border-color: rgba(56, 189, 248, .35) !important;
    background: rgba(14, 165, 233, .18) !important;
    color: #bae6fd !important;
}

body[data-layout-mode=dark] .erp-open-btn {
    border-color: rgba(167, 139, 250, .35) !important;
    background: rgba(139, 92, 246, .18) !important;
    color: #ddd6fe !important;
}

/* Standard destructive / workflow buttons */
.erp-delete-btn,
.erp-void-btn,
.erp-submit-btn,
.erp-approve-btn,
.erp-reject-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 88px;
    min-height: 34px;
    height: auto;
    padding: .4375rem .875rem;
    margin: 0;
    border-radius: var(--erp-radius-md, .8125rem);
    font-size: .8125rem;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    gap: .375rem;
}

.erp-delete-btn.btn-sm,
.erp-void-btn.btn-sm,
.erp-submit-btn.btn-sm,
.erp-approve-btn.btn-sm,
.erp-reject-btn.btn-sm {
    min-height: 34px;
    padding: .4375rem .875rem;
}

.erp-delete-btn i,
.erp-void-btn i,
.erp-submit-btn i,
.erp-approve-btn i,
.erp-reject-btn i {
    font-size: .95rem;
    line-height: 1;
}

.erp-delete-btn,
.erp-void-btn,
.erp-reject-btn {
    border-color: #dc2626 !important;
    background: #fff !important;
    color: #dc2626 !important;
}

.erp-delete-btn:hover,
.erp-delete-btn:focus,
.erp-void-btn:hover,
.erp-void-btn:focus,
.erp-reject-btn:hover,
.erp-reject-btn:focus {
    border-color: #b91c1c !important;
    background: #fef2f2 !important;
    color: #b91c1c !important;
    box-shadow: 0 10px 24px rgba(220, 38, 38, .12);
}

.erp-submit-btn {
    border-color: #2563eb !important;
    background: #2563eb !important;
    color: #fff !important;
}

.erp-submit-btn:hover,
.erp-submit-btn:focus {
    border-color: #1d4ed8 !important;
    background: #1d4ed8 !important;
    color: #fff !important;
    box-shadow: 0 10px 24px rgba(37, 99, 235, .18);
}

.erp-approve-btn {
    border-color: #16a34a !important;
    background: #16a34a !important;
    color: #fff !important;
}

.erp-approve-btn:hover,
.erp-approve-btn:focus {
    border-color: #15803d !important;
    background: #15803d !important;
    color: #fff !important;
    box-shadow: 0 10px 24px rgba(22, 163, 74, .18);
}

body[data-layout-mode=dark] .erp-delete-btn,
body[data-layout-mode=dark] .erp-void-btn,
body[data-layout-mode=dark] .erp-reject-btn {
    border-color: rgba(248, 113, 113, .42) !important;
    background: rgba(220, 38, 38, .16) !important;
    color: #fecaca !important;
}

body[data-layout-mode=dark] .erp-submit-btn {
    border-color: #2563eb !important;
    background: #2563eb !important;
    color: #fff !important;
}

body[data-layout-mode=dark] .erp-approve-btn {
    border-color: #16a34a !important;
    background: #16a34a !important;
    color: #fff !important;
}

/* Standard utility action buttons */
.erp-download-btn,
.erp-export-btn,
.erp-search-btn,
.erp-show-btn,
.erp-run-btn,
.erp-sync-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 88px;
    min-height: 34px;
    height: auto;
    padding: .4375rem .875rem;
    margin: 0;
    border-radius: var(--erp-radius-md, .8125rem);
    font-size: .8125rem;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    gap: .375rem;
}

.erp-download-btn.btn-sm,
.erp-export-btn.btn-sm,
.erp-search-btn.btn-sm,
.erp-show-btn.btn-sm,
.erp-run-btn.btn-sm,
.erp-sync-btn.btn-sm {
    min-height: 34px;
    padding: .4375rem .875rem;
}

.erp-download-btn i,
.erp-export-btn i,
.erp-search-btn i,
.erp-show-btn i,
.erp-run-btn i,
.erp-sync-btn i {
    font-size: .95rem;
    line-height: 1;
}

.erp-download-btn,
.erp-export-btn {
    border-color: #a78bfa !important;
    background: #f5f3ff !important;
    color: #6d28d9 !important;
}

.erp-download-btn:hover,
.erp-download-btn:focus,
.erp-export-btn:hover,
.erp-export-btn:focus {
    border-color: #8b5cf6 !important;
    background: #ede9fe !important;
    color: #5b21b6 !important;
    box-shadow: 0 8px 20px rgba(139, 92, 246, .10);
}

.erp-search-btn,
.erp-show-btn {
    border-color: #cbd5e1 !important;
    background: #fff !important;
    color: #334155 !important;
}

.erp-search-btn:hover,
.erp-search-btn:focus,
.erp-show-btn:hover,
.erp-show-btn:focus {
    border-color: #94a3b8 !important;
    background: #f8fafc !important;
    color: #0f172a !important;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .06);
}

.erp-run-btn,
.erp-sync-btn {
    border-color: #f97316 !important;
    background: #f97316 !important;
    color: #fff !important;
}

.erp-run-btn:hover,
.erp-run-btn:focus,
.erp-sync-btn:hover,
.erp-sync-btn:focus {
    border-color: #ea580c !important;
    background: #ea580c !important;
    color: #fff !important;
    box-shadow: 0 10px 24px rgba(249, 115, 22, .16);
}

body[data-layout-mode=dark] .erp-download-btn,
body[data-layout-mode=dark] .erp-export-btn {
    border-color: rgba(167, 139, 250, .35) !important;
    background: rgba(139, 92, 246, .18) !important;
    color: #ddd6fe !important;
}

body[data-layout-mode=dark] .erp-search-btn,
body[data-layout-mode=dark] .erp-show-btn {
    border-color: #475569 !important;
    background: #1e293b !important;
    color: #cbd5e1 !important;
}

body[data-layout-mode=dark] .erp-run-btn,
body[data-layout-mode=dark] .erp-sync-btn {
    border-color: #f97316 !important;
    background: #f97316 !important;
    color: #fff !important;
}

/* Standard process / state buttons */
.erp-confirm-btn,
.erp-close-btn,
.erp-send-btn,
.erp-refresh-btn,
.erp-generate-btn,
.erp-upload-post-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 88px;
    min-height: 34px;
    height: auto;
    padding: .4375rem .875rem;
    margin: 0;
    border-radius: var(--erp-radius-md, .8125rem);
    font-size: .8125rem;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    gap: .375rem;
}

.erp-confirm-btn.btn-sm,
.erp-close-btn.btn-sm,
.erp-send-btn.btn-sm,
.erp-refresh-btn.btn-sm,
.erp-generate-btn.btn-sm,
.erp-upload-post-btn.btn-sm {
    min-height: 34px;
    padding: .4375rem .875rem;
}

.erp-confirm-btn i,
.erp-close-btn i,
.erp-send-btn i,
.erp-refresh-btn i,
.erp-generate-btn i,
.erp-upload-post-btn i {
    font-size: .95rem;
    line-height: 1;
}

.erp-confirm-btn,
.erp-send-btn {
    border-color: #2563eb !important;
    background: #2563eb !important;
    color: #fff !important;
}

.erp-confirm-btn:hover,
.erp-confirm-btn:focus,
.erp-send-btn:hover,
.erp-send-btn:focus {
    border-color: #1d4ed8 !important;
    background: #1d4ed8 !important;
    color: #fff !important;
    box-shadow: 0 10px 24px rgba(37, 99, 235, .18);
}

.erp-close-btn,
.erp-upload-post-btn {
    border-color: #ea580c !important;
    background: #ea580c !important;
    color: #fff !important;
}

.erp-close-btn:hover,
.erp-close-btn:focus,
.erp-upload-post-btn:hover,
.erp-upload-post-btn:focus {
    border-color: #c2410c !important;
    background: #c2410c !important;
    color: #fff !important;
    box-shadow: 0 10px 24px rgba(234, 88, 12, .16);
}

.erp-refresh-btn {
    border-color: #cbd5e1 !important;
    background: #fff !important;
    color: #334155 !important;
}

.erp-refresh-btn:hover,
.erp-refresh-btn:focus {
    border-color: #94a3b8 !important;
    background: #f8fafc !important;
    color: #0f172a !important;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .06);
}

.erp-generate-btn {
    border-color: #0ea5e9 !important;
    background: #e0f2fe !important;
    color: #075985 !important;
}

.erp-generate-btn:hover,
.erp-generate-btn:focus {
    border-color: #0284c7 !important;
    background: #bae6fd !important;
    color: #0c4a6e !important;
    box-shadow: 0 8px 20px rgba(14, 165, 233, .12);
}

body[data-layout-mode=dark] .erp-confirm-btn,
body[data-layout-mode=dark] .erp-send-btn {
    border-color: #2563eb !important;
    background: #2563eb !important;
    color: #fff !important;
}

body[data-layout-mode=dark] .erp-close-btn,
body[data-layout-mode=dark] .erp-upload-post-btn {
    border-color: #ea580c !important;
    background: #ea580c !important;
    color: #fff !important;
}

body[data-layout-mode=dark] .erp-refresh-btn {
    border-color: #475569 !important;
    background: #1e293b !important;
    color: #cbd5e1 !important;
}

body[data-layout-mode=dark] .erp-generate-btn {
    border-color: rgba(14, 165, 233, .35) !important;
    background: rgba(14, 165, 233, .18) !important;
    color: #bae6fd !important;
}

/* Separate required-field notes from action buttons */
.card-body form .col-12.d-flex.justify-content-end.gap-2,
.card form .col-12.d-flex.justify-content-end.gap-2 {
    flex-wrap: wrap;
}

.card-body form .col-12.d-flex.justify-content-end.gap-2 > p.text-muted.small.mb-2,
.card form .col-12.d-flex.justify-content-end.gap-2 > p.text-muted.small.mb-2,
.card-body form .col-12.d-flex.justify-content-end.gap-2 > .finance-action-note,
.card form .col-12.d-flex.justify-content-end.gap-2 > .finance-action-note {
    flex: 0 0 100%;
    width: 100%;
    margin: 0 0 .375rem;
    text-align: right;
}

/* Standard archive buttons */
.erp-archive-btn,
.erp-archive-exit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 118px;
    min-height: 34px;
    height: auto;
    padding: .4375rem .875rem;
    margin: 0;
    border-radius: var(--erp-radius-md, .8125rem);
    font-size: .8125rem;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    gap: .375rem;
}

.erp-archive-btn.btn-sm,
.erp-archive-exit-btn.btn-sm {
    min-height: 34px;
    padding: .4375rem .875rem;
}

.erp-archive-btn i,
.erp-archive-exit-btn i {
    font-size: .95rem;
    line-height: 1;
}

.erp-archive-btn {
    border-color: #fbbf24 !important;
    background: #fff7db !important;
    color: #92400e !important;
}

.erp-archive-btn:hover,
.erp-archive-btn:focus {
    border-color: #f59e0b !important;
    background: #ffefb3 !important;
    color: #78350f !important;
    box-shadow: 0 8px 20px rgba(146, 64, 14, .08);
}

.erp-archive-exit-btn {
    border-color: #f59e0b !important;
    background: #f59e0b !important;
    color: #1f2937 !important;
}

.erp-archive-exit-btn:hover,
.erp-archive-exit-btn:focus {
    border-color: #d97706 !important;
    background: #d97706 !important;
    color: #111827 !important;
    box-shadow: 0 10px 24px rgba(146, 64, 14, .16);
}

body[data-layout-mode=dark] .erp-archive-btn {
    border-color: #d97706 !important;
    background: rgba(245, 158, 11, .16) !important;
    color: #fcd34d !important;
}

body[data-layout-mode=dark] .erp-archive-btn:hover,
body[data-layout-mode=dark] .erp-archive-btn:focus {
    border-color: #f59e0b !important;
    background: rgba(245, 158, 11, .24) !important;
    color: #fde68a !important;
    box-shadow: 0 10px 24px rgba(146, 64, 14, .18);
}

body[data-layout-mode=dark] .erp-archive-exit-btn {
    border-color: #f59e0b !important;
    background: #f59e0b !important;
    color: #111827 !important;
}

/* Standard document link buttons */
.erp-doclink-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 112px;
    min-height: 34px;
    height: auto;
    padding: .4375rem .875rem;
    margin: 0;
    border-radius: var(--erp-radius-md, .8125rem);
    border-color: #c7d2fe !important;
    background: #eef2ff !important;
    color: #3730a3 !important;
    font-size: .8125rem;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    gap: .375rem;
}

.erp-doclink-btn.btn-sm {
    min-height: 34px;
    padding: .4375rem .875rem;
}

.erp-doclink-btn i {
    font-size: .95rem;
    line-height: 1;
}

.erp-doclink-btn:hover,
.erp-doclink-btn:focus {
    border-color: #a5b4fc !important;
    background: #e0e7ff !important;
    color: #312e81 !important;
    box-shadow: 0 8px 20px rgba(67, 56, 202, .10);
}

body[data-layout-mode=dark] .erp-doclink-btn {
    border-color: rgba(129, 140, 248, .38) !important;
    background: rgba(79, 70, 229, .18) !important;
    color: #c7d2fe !important;
}

body[data-layout-mode=dark] .erp-doclink-btn:hover,
body[data-layout-mode=dark] .erp-doclink-btn:focus {
    border-color: rgba(129, 140, 248, .52) !important;
    background: rgba(79, 70, 229, .28) !important;
    color: #e0e7ff !important;
    box-shadow: 0 10px 24px rgba(30, 27, 75, .22);
}

/* Chat room bottom alignment fix */
.chat-app-shell.chat-app-shell-room {
    height: calc(100dvh - 160px);
    max-height: calc(100dvh - 160px);
    min-height: 620px;
}

.chat-app-shell-room .chat-sidebar,
.chat-app-shell-room .chat-conversation {
    min-height: 0;
    height: 100%;
}

.chat-app-shell-room .chat-body,
.chat-app-shell-room #chat-scroll {
    flex: 1 1 auto;
    min-height: 0;
    height: auto !important;
    max-height: none !important;
}

.chat-app-shell-room .chat-footer {
    margin-top: auto;
}

.chat-app-shell-room #chat-input {
    min-height: 42px;
    padding: 10px 0 8px;
    line-height: 22px;
}

@media (max-width: 991.98px) {
    .chat-app-shell.chat-app-shell-room {
        height: calc(100dvh - 130px);
        max-height: calc(100dvh - 130px);
        min-height: 560px;
    }
}

@media (max-width: 767.98px) {
    .chat-app-shell.chat-app-shell-room {
        height: calc(100dvh - 108px);
        max-height: calc(100dvh - 108px);
        min-height: 0;
    }
}

/* Golden ratio UI scale */
:root {
    --erp-phi: 1.618;
    --erp-space-xs: .5rem;
    --erp-space-sm: .8125rem;
    --erp-space-md: 1.3125rem;
    --erp-space-lg: 2.125rem;
    --erp-radius-sm: .5rem;
    --erp-radius-md: .8125rem;
    --erp-radius-lg: 1.3125rem;
}

.page-title-box {
    padding-bottom: var(--erp-space-md);
}

.page-title-box h4,
.page-title-box h5 {
    font-weight: 600;
    letter-spacing: 0;
}

.page-title-box .btn {
    min-height: 40px;
}

.erp-form-shell {
    max-width: 980px;
}

.erp-form-shell-narrow {
    max-width: 860px;
}

.erp-form-card {
    border-radius: var(--erp-radius-lg);
    overflow: hidden;
    box-shadow: 0 10px 28px rgba(15, 23, 42, .06);
}

.erp-form-card .card-header {
    padding: var(--erp-space-sm) var(--erp-space-md);
}

.erp-form-card-body {
    padding: var(--erp-space-md);
}

.erp-form-intro {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--erp-space-md);
    margin-bottom: var(--erp-space-md);
}

.erp-form-title {
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
}

.erp-form-note {
    max-width: 34rem;
    color: #64748b;
    font-size: .875rem;
    line-height: 1.62;
}

.erp-form-meta {
    min-width: 92px;
    padding: .6875rem .875rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--erp-radius-md);
    background: #f8fafc;
    color: #0f172a;
    text-align: right;
    line-height: 1.2;
}

.erp-form-meta-label {
    display: block;
    margin-bottom: .28rem;
    color: #64748b;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.erp-form-actions {
    display: flex;
    align-items: center;
    gap: var(--erp-space-sm);
    padding-top: .25rem;
}

.erp-form-search {
    position: relative;
}

.erp-form-search i {
    position: absolute;
    top: 50%;
    left: .95rem;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 1rem;
    pointer-events: none;
}

.erp-form-search .form-control {
    padding-left: 2.55rem;
    min-height: 44px;
    border-radius: var(--erp-radius-md);
}

.password-peek-group .form-control,
.password-peek-group .password-peek-toggle {
    min-height: 44px;
}

.password-peek-group .password-peek-toggle {
    padding-inline: .875rem;
}

.chat-members-dialog {
    max-width: 520px;
}

#chatMembersModal .modal-content {
    border: 0;
    border-radius: var(--erp-radius-lg);
    box-shadow: 0 18px 48px rgba(15, 23, 42, .18);
}

#chatMembersModal .modal-header,
#chatMembersModal .modal-body {
    padding-inline: var(--erp-space-md);
}

#chatMembersModal .modal-body {
    padding-bottom: var(--erp-space-md);
}

.chat-members-list,
.chat-add-members-list,
.chat-selected-members,
.chat-create-members {
    display: flex;
    flex-direction: column;
    gap: var(--erp-space-sm);
}

.chat-members-list,
.chat-create-members {
    max-height: 24rem;
    overflow-y: auto;
}

.chat-member-row,
.chat-add-member-option,
.chat-create-member-option {
    display: flex;
    align-items: center;
    gap: var(--erp-space-sm);
    padding: .875rem .95rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--erp-radius-md);
    background: #fff;
    transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}

.chat-member-row {
    justify-content: space-between;
}

.chat-add-member-option:hover,
.chat-create-member-option:hover {
    border-color: #cbd5e1;
    box-shadow: 0 8px 22px rgba(15, 23, 42, .06);
}

.chat-create-member-option {
    cursor: pointer;
}

.chat-create-member-option .form-check-input {
    margin-top: 0;
    flex-shrink: 0;
}

.chat-create-member-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: .22rem;
}

.chat-create-member-name {
    color: #0f172a;
    font-size: .94rem;
    font-weight: 600;
    line-height: 1.35;
}

.chat-create-member-email {
    color: #64748b;
    font-size: .8125rem;
    line-height: 1.5;
}

.chat-create-member-option.is-selected {
    border-color: rgba(81, 86, 190, .28);
    background: rgba(81, 86, 190, .05);
    box-shadow: 0 10px 24px rgba(81, 86, 190, .08);
}

body[data-layout-mode=dark] .erp-form-card {
    box-shadow: 0 12px 34px rgba(2, 6, 23, .28);
}

body[data-layout-mode=dark] .erp-form-title {
    color: #e2e8f0;
}

body[data-layout-mode=dark] .erp-form-note,
body[data-layout-mode=dark] .erp-form-meta-label,
body[data-layout-mode=dark] .chat-create-member-email {
    color: #94a3b8;
}

body[data-layout-mode=dark] .erp-form-meta,
body[data-layout-mode=dark] .chat-member-row,
body[data-layout-mode=dark] .chat-add-member-option,
body[data-layout-mode=dark] .chat-create-member-option,
body[data-layout-mode=dark] #chatMembersModal .modal-content {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

body[data-layout-mode=dark] .chat-add-member-option:hover,
body[data-layout-mode=dark] .chat-create-member-option:hover {
    border-color: #475569;
    box-shadow: 0 10px 24px rgba(2, 6, 23, .24);
}

body[data-layout-mode=dark] .chat-create-member-name {
    color: #e2e8f0;
}

body[data-layout-mode=dark] .chat-create-member-option.is-selected {
    background: rgba(81, 86, 190, .16);
    border-color: rgba(129, 140, 248, .42);
}

@media (max-width: 767.98px) {
    .erp-form-card-body,
    #chatMembersModal .modal-header,
    #chatMembersModal .modal-body {
        padding-inline: var(--erp-space-sm);
    }

    .erp-form-card-body {
        padding-block: var(--erp-space-md);
    }

    .erp-form-intro {
        flex-direction: column;
        align-items: stretch;
        gap: var(--erp-space-sm);
    }

    .erp-form-meta {
        text-align: left;
    }

    .erp-form-actions {
        flex-wrap: wrap;
    }
}

/* Master import */
.master-import-grid {
    --bs-gutter-y: var(--erp-space-md);
}

.master-import-card {
    border-radius: var(--erp-radius-lg);
    box-shadow: 0 10px 28px rgba(15, 23, 42, .06);
    overflow: hidden;
}

.master-import-card-body {
    display: flex;
    flex-direction: column;
    gap: var(--erp-space-sm);
    height: 100%;
    padding: var(--erp-space-md);
}

.master-import-card .card-title {
    margin-bottom: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
}

.master-import-card .text-muted {
    margin-bottom: 0 !important;
    line-height: 1.62;
}

.master-import-card .d-flex.gap-2 {
    margin-top: auto;
    padding-top: .25rem;
}

.master-import-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: auto;
    padding-top: .25rem;
}

.master-import-action-pair {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
}

.master-import-action-pair .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2rem;
    margin: 0;
    white-space: nowrap;
}

.master-import-opening-shell {
    margin-top: .125rem;
}

.master-import-opening-card .form-control,
.master-import-opening-card .form-select {
    min-height: 44px;
    border-radius: var(--erp-radius-md);
}

.master-import-alert {
    margin-bottom: var(--erp-space-md);
    border-radius: var(--erp-radius-md);
    padding: .95rem 1rem;
}

.master-import-alert .fw-semibold {
    margin-bottom: .35rem;
}

.master-import-alert code {
    word-break: break-word;
}

body[data-layout-mode=dark] .master-import-card {
    box-shadow: 0 12px 34px rgba(2, 6, 23, .28);
}

body[data-layout-mode=dark] .master-import-card .card-title {
    color: #e2e8f0;
}

/* ================================================================
   DARK MODE — Global UI completions
   (buttons, modals, borders, hr, list-groups, tooltips, misc)
   ================================================================ */

/* ── Outline buttons ────────────────────────────────────────── */
body[data-layout-mode=dark] .btn-outline-primary {
    color: #a5b4fc !important;
    border-color: #4f46e5 !important;
}
body[data-layout-mode=dark] .btn-outline-primary:hover,
body[data-layout-mode=dark] .btn-outline-primary:focus {
    background-color: rgba(99,102,241,.18) !important;
    border-color: #818cf8 !important;
    color: #dde5ff !important;
}

body[data-layout-mode=dark] .btn-outline-success {
    color: #4ade80 !important;
    border-color: #166534 !important;
}
body[data-layout-mode=dark] .btn-outline-success:hover,
body[data-layout-mode=dark] .btn-outline-success:focus {
    background-color: rgba(22,163,74,.18) !important;
    border-color: #4ade80 !important;
    color: #86efac !important;
}

body[data-layout-mode=dark] .btn-outline-warning {
    color: #fbbf24 !important;
    border-color: #92400e !important;
}
body[data-layout-mode=dark] .btn-outline-warning:hover,
body[data-layout-mode=dark] .btn-outline-warning:focus {
    background-color: rgba(245,158,11,.18) !important;
    border-color: #fbbf24 !important;
    color: #fde68a !important;
}

body[data-layout-mode=dark] .btn-outline-danger {
    color: #f87171 !important;
    border-color: #7f1d1d !important;
}
body[data-layout-mode=dark] .btn-outline-danger:hover,
body[data-layout-mode=dark] .btn-outline-danger:focus {
    background-color: rgba(239,68,68,.18) !important;
    border-color: #f87171 !important;
    color: #fca5a5 !important;
}

body[data-layout-mode=dark] .btn-outline-info {
    color: #38bdf8 !important;
    border-color: #0c4a6e !important;
}
body[data-layout-mode=dark] .btn-outline-info:hover,
body[data-layout-mode=dark] .btn-outline-info:focus {
    background-color: rgba(14,165,233,.18) !important;
    border-color: #38bdf8 !important;
    color: #7dd3fc !important;
}

body[data-layout-mode=dark] .btn-light,
body[data-layout-mode=dark] .btn-outline-light {
    background-color: #1c252e !important;
    border-color: #34414f !important;
    color: #d7e1ec !important;
}
body[data-layout-mode=dark] .btn-light:hover,
body[data-layout-mode=dark] .btn-light:focus,
body[data-layout-mode=dark] .btn-outline-light:hover,
body[data-layout-mode=dark] .btn-outline-light:focus {
    background-color: #232e3a !important;
    border-color: #46586c !important;
    color: #ecf3fb !important;
}

/* ── Modal dialogs ──────────────────────────────────────────── */
body[data-layout-mode=dark] .modal-content {
    background-color: #1b232c !important;
    border-color: #34414f !important;
    box-shadow: 0 20px 44px rgba(0,0,0,.5) !important;
}
body[data-layout-mode=dark] .modal-header {
    background-color: #202933 !important;
    border-bottom-color: #34414f !important;
}
body[data-layout-mode=dark] .modal-title {
    color: #ecf3fb !important;
}
body[data-layout-mode=dark] .modal-body {
    color: #d7e1ec !important;
}
body[data-layout-mode=dark] .modal-footer {
    background-color: #1b232c !important;
    border-top-color: #34414f !important;
}
body[data-layout-mode=dark] .btn-close {
    filter: invert(1) grayscale(1) brightness(1.5) !important;
}

/* ── HR separator ───────────────────────────────────────────── */
body[data-layout-mode=dark] hr {
    border-color: #34414f !important;
    opacity: 1 !important;
}

/* ── Bootstrap border utilities ─────────────────────────────── */
body[data-layout-mode=dark] .border       { border-color: #34414f !important; }
body[data-layout-mode=dark] .border-top   { border-top-color: #34414f !important; }
body[data-layout-mode=dark] .border-bottom{ border-bottom-color: #34414f !important; }
body[data-layout-mode=dark] .border-start { border-left-color: #34414f !important; }
body[data-layout-mode=dark] .border-end   { border-right-color: #34414f !important; }

/* ── List groups ────────────────────────────────────────────── */
body[data-layout-mode=dark] .list-group-item {
    background-color: #1b232c !important;
    border-color: #34414f !important;
    color: #d7e1ec !important;
}
body[data-layout-mode=dark] .list-group-item:hover {
    background-color: #232e3a !important;
    color: #ecf3fb !important;
}
body[data-layout-mode=dark] .list-group-item.active {
    background-color: #4f46e5 !important;
    border-color: #4f46e5 !important;
    color: #fff !important;
}

/* ── Setup Checklist widget ─────────────────────────────────── */
.sc-group-card {
    background: #f8f9fa;
}
body[data-layout-mode=dark] .sc-group-card {
    background: #1e2428 !important;
    border-color: #34414f !important;
}
body[data-layout-mode=dark] #setup-checklist-widget .card-header {
    background: linear-gradient(135deg, #4b6ef5 0%, #38b2ac 100%) !important;
    color: #fff !important;
}

/* ── Auth pages (login, forgot password, change password) ───── */
body[data-layout-mode=dark].auth-fullpage {
    background-color: #111318 !important;
}

/* Right panel / form card */
body[data-layout-mode=dark] .lp-right,
body[data-layout-mode=dark] .fp-wrap,
body[data-layout-mode=dark] .cp-card {
    background: #1e2228 !important;
    color-scheme: dark;
}

/* Heading & subtitle */
body[data-layout-mode=dark] .lp-head h1,
body[data-layout-mode=dark] .fp-head h1 {
    color: #e6edf3;
}
body[data-layout-mode=dark] .lp-head p,
body[data-layout-mode=dark] .fp-head p {
    color: #8b949e;
}
body[data-layout-mode=dark] .lp-head .eyebrow,
body[data-layout-mode=dark] .fp-eyebrow {
    color: #818cf8;
}

/* Form labels */
body[data-layout-mode=dark] .lp-label,
body[data-layout-mode=dark] .fp-label,
body[data-layout-mode=dark] .cp-card .form-label {
    color: #adb5bd;
}

/* Input fields */
body[data-layout-mode=dark] .lp-field input,
body[data-layout-mode=dark] .fp-input,
body[data-layout-mode=dark] .cp-card .form-control {
    background: #161b22 !important;
    border-color: #30363d !important;
    color: #e6edf3 !important;
}
body[data-layout-mode=dark] .lp-field input::placeholder,
body[data-layout-mode=dark] .fp-input::placeholder {
    color: #484f58 !important;
}
body[data-layout-mode=dark] .lp-field input:focus,
body[data-layout-mode=dark] .fp-input:focus,
body[data-layout-mode=dark] .cp-card .form-control:focus {
    background: #1c2333 !important;
    border-color: #818cf8 !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .2) !important;
}
body[data-layout-mode=dark] .lp-field .fi,
body[data-layout-mode=dark] .lp-eye {
    color: #6e7681;
}
body[data-layout-mode=dark] .cp-card .input-group-text {
    background: #1e2430;
    border-color: #30363d;
    color: #6e7681;
}

/* Flash messages */
body[data-layout-mode=dark] .lp-flash-ok,
body[data-layout-mode=dark] .fp-flash-ok,
body[data-layout-mode=dark] .flash-ok {
    background: #1a3626;
    border-color: #2d5a3d;
    color: #3fb950;
}
body[data-layout-mode=dark] .lp-flash-err,
body[data-layout-mode=dark] .fp-flash-err,
body[data-layout-mode=dark] .flash-err {
    background: #3d1a1a;
    border-color: #5a2525;
    color: #f85149;
}

/* First-login hint box */
body[data-layout-mode=dark] .lp-hint-box {
    background: #2d2208;
    border-color: #5a4010;
    color: #d29922;
}
body[data-layout-mode=dark] .lp-cred-lbl {
    color: #b07d2a;
}
body[data-layout-mode=dark] .lp-cred-val {
    background: rgba(255, 255, 255, .06);
    color: #e6d5a8;
}
body[data-layout-mode=dark] .lp-hint-btn {
    border-color: #a16207;
    color: #d29922;
}
body[data-layout-mode=dark] .lp-hint-btn:hover {
    background: rgba(210, 153, 34, .15);
}
body[data-layout-mode=dark] .lp-hint-note {
    color: #9a7a2a;
}

/* Forgot password info box */
body[data-layout-mode=dark] .fp-info {
    background: #1a2d3d;
    border-color: #1e3a55;
    color: #58a6ff;
}

/* Change password notice */
body[data-layout-mode=dark] .cp-notice {
    background: #2d2208;
    border-color: #5a4010;
    color: #d29922;
}

/* Forgot / footer links */
body[data-layout-mode=dark] .lp-forgot a {
    color: #6e7681;
}
body[data-layout-mode=dark] .lp-forgot a:hover {
    color: #adb5bd;
}
body[data-layout-mode=dark] .lp-footer {
    color: #484f58;
}

/* ── Tooltips ───────────────────────────────────────────────── */
body[data-layout-mode=dark] .tooltip .tooltip-inner {
    background-color: #232e3a;
    color: #d7e1ec;
}
body[data-layout-mode=dark] .bs-tooltip-auto[data-popper-placement^=top] .tooltip-arrow::before,
body[data-layout-mode=dark] .bs-tooltip-top .tooltip-arrow::before {
    border-top-color: #232e3a;
}
body[data-layout-mode=dark] .bs-tooltip-auto[data-popper-placement^=bottom] .tooltip-arrow::before,
body[data-layout-mode=dark] .bs-tooltip-bottom .tooltip-arrow::before {
    border-bottom-color: #232e3a;
}
body[data-layout-mode=dark] .bs-tooltip-auto[data-popper-placement^=left] .tooltip-arrow::before,
body[data-layout-mode=dark] .bs-tooltip-start .tooltip-arrow::before {
    border-left-color: #232e3a;
}
body[data-layout-mode=dark] .bs-tooltip-auto[data-popper-placement^=right] .tooltip-arrow::before,
body[data-layout-mode=dark] .bs-tooltip-end .tooltip-arrow::before {
    border-right-color: #232e3a;
}

/* ── Popovers ───────────────────────────────────────────────── */
body[data-layout-mode=dark] .popover {
    background-color: #1b232c !important;
    border-color: #34414f !important;
}
body[data-layout-mode=dark] .popover-header {
    background-color: #202933 !important;
    border-bottom-color: #34414f !important;
    color: #ecf3fb !important;
}
body[data-layout-mode=dark] .popover-body {
    color: #d7e1ec !important;
}

/* ── Table sub-text & fw-semibold inside dark tables ────────── */
body[data-layout-mode=dark] .table td .text-muted,
body[data-layout-mode=dark] .table td .small {
    color: #8898ab !important;
}
body[data-layout-mode=dark] .table td .fw-semibold,
body[data-layout-mode=dark] .table td strong {
    color: #ecf3fb !important;
}

/* ── Inline forms inside cards (filter bars) ────────────────── */
body[data-layout-mode=dark] .card-body .form-control,
body[data-layout-mode=dark] .card-body .form-select {
    background-color: #151d25 !important;
    border-color: #3a4858 !important;
    color: #d7e1ec !important;
}
body[data-layout-mode=dark] .card-body .form-control:focus,
body[data-layout-mode=dark] .card-body .form-select:focus {
    background-color: #18212a !important;
    border-color: #8ea3ff !important;
    box-shadow: 0 0 0 .22rem rgba(99,102,241,.18) !important;
    color: #ecf3fb !important;
}

/* ── Pagination (Bootstrap .pagination) ─────────────────────── */
body[data-layout-mode=dark] .pagination .page-link {
    background-color: #1c252e !important;
    border-color: #34414f !important;
    color: #d7e1ec !important;
}
body[data-layout-mode=dark] .pagination .page-link:hover {
    background-color: rgba(99,102,241,.18) !important;
    border-color: #818cf8 !important;
    color: #dce6ff !important;
}
body[data-layout-mode=dark] .pagination .page-item.active .page-link {
    background-color: #4f46e5 !important;
    border-color: #6366f1 !important;
    color: #fff !important;
}
body[data-layout-mode=dark] .pagination .page-item.disabled .page-link {
    background-color: #181f28 !important;
    border-color: #2a3644 !important;
    color: #56667a !important;
}

/* ── Misc utility ───────────────────────────────────────────── */
body[data-layout-mode=dark] .text-dark {
    color: #d7e1ec !important;
}
body[data-layout-mode=dark] .bg-light {
    background-color: #1c252e !important;
}
body[data-layout-mode=dark] .bg-white {
    background-color: #1b232c !important;
}
body[data-layout-mode=dark] pre {
    background-color: #151d25 !important;
    border-color: #34414f !important;
    color: #d7e1ec !important;
}
body[data-layout-mode=dark] .table-responsive {
    border-color: #34414f !important;
}

/* Global button standard */
:root {
    --erp-btn-height: 2rem;
    --erp-btn-pad-x: .75rem;
    --erp-btn-pad-x-sm: .625rem;
}

.btn,
a.btn,
button.btn,
input.btn,
input[type="button"].btn,
input[type="submit"].btn,
input[type="reset"].btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: var(--erp-btn-height) !important;
    min-height: var(--erp-btn-height) !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    padding-left: var(--erp-btn-pad-x) !important;
    padding-right: var(--erp-btn-pad-x) !important;
    line-height: 1 !important;
    text-align: center !important;
    vertical-align: middle !important;
    white-space: nowrap;
}

.lp-btn,
.fp-btn,
.btn-submit,
.lp-hint-btn,
.load-older-btn,
.btn-a,
.btn-b,
.btn-lm,
.btn-lm-ghost,
.fp-copy,
.fc,
.lp-eye,
.usr-flt,
.rf-btn-all,
.rf-preset-chip,
.rf-sect-toggle-btn,
.amx-type-btn,
.amx-remove-btn,
.amx-add-btn,
.cp-tab,
.wz-btn,
.fchat-back,
.fchat-notify,
.fchat-openpage,
.fchat-close,
#fchat-send,
.chat-member-kick,
.chat-add-member-option {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: var(--erp-btn-height) !important;
    min-height: var(--erp-btn-height) !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    line-height: 1 !important;
    text-align: center !important;
    vertical-align: middle !important;
    white-space: nowrap;
}

.lp-btn,
.fp-btn,
.btn-submit,
.load-older-btn,
.btn-a,
.btn-b,
.btn-lm,
.btn-lm-ghost,
.usr-flt,
.rf-btn-all,
.rf-preset-chip,
.rf-sect-toggle-btn,
.amx-type-btn,
.amx-add-btn,
.cp-tab,
.wz-btn,
.chat-add-member-option {
    padding-left: var(--erp-btn-pad-x) !important;
    padding-right: var(--erp-btn-pad-x) !important;
}

.lp-hint-btn,
.fp-copy,
.fc,
.lp-eye,
.amx-remove-btn,
.fchat-back,
.fchat-notify,
.fchat-openpage,
.fchat-close,
#fchat-send,
.chat-member-kick {
    padding-left: var(--erp-btn-pad-x-sm) !important;
    padding-right: var(--erp-btn-pad-x-sm) !important;
}

.btn-close {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: var(--erp-btn-height) !important;
    height: var(--erp-btn-height) !important;
    min-width: var(--erp-btn-height) !important;
    min-height: var(--erp-btn-height) !important;
    padding: 0 !important;
    line-height: 1 !important;
    text-align: center !important;
}

.btn-sm,
.table .btn-sm,
.page-title-box .btn-sm {
    height: var(--erp-btn-height) !important;
    min-height: var(--erp-btn-height) !important;
    padding-left: var(--erp-btn-pad-x-sm) !important;
    padding-right: var(--erp-btn-pad-x-sm) !important;
}

.btn-lg,
.page-title-box .btn,
.master-import-action-pair .btn,
.table .erp-table-action-btn {
    height: var(--erp-btn-height) !important;
    min-height: var(--erp-btn-height) !important;
}

.btn i,
.btn .bx,
.btn [class^="bx-"],
.btn [class*=" bx-"],
.btn .mdi,
.btn [class^="mdi-"],
.btn [class*=" mdi-"],
.lp-btn i,
.fp-btn i,
.btn-submit i,
.lp-hint-btn i,
.load-older-btn i,
.btn-a i,
.btn-b i,
.btn-lm i,
.btn-lm-ghost i,
.fp-copy i,
.fc i,
.lp-eye i,
.usr-flt i,
.rf-btn-all i,
.rf-preset-chip i,
.rf-sect-toggle-btn i,
.amx-type-btn i,
.amx-remove-btn i,
.amx-add-btn i,
.cp-tab i,
.wz-btn i,
.fchat-back i,
.fchat-notify i,
.fchat-openpage i,
.fchat-close i,
#fchat-send i,
.chat-member-kick i,
.chat-add-member-option i {
    line-height: 1 !important;
}

.btn.w-100,
.d-grid > .btn {
    display: flex !important;
}

.btn-group > .btn,
.input-group .btn {
    align-items: center !important;
    justify-content: center !important;
}

.erp-page-actions,
.page-title-box .d-flex,
.erp-form-actions,
.erp-table-action-stack,
.master-import-actions,
.master-import-action-pair,
.dataTables_wrapper .dt-buttons,
.erp-dt-toolbar-right {
    align-items: center !important;
}

form.d-inline .btn,
form.d-inline-block .btn,
.erp-table-action-stack .btn,
.master-import-action-pair .btn,
.lp-btn,
.fp-btn,
.btn-submit,
.lp-hint-btn,
.load-older-btn,
.btn-a,
.btn-b,
.btn-lm,
.btn-lm-ghost,
.fp-copy,
.fc,
.lp-eye,
.usr-flt,
.rf-btn-all,
.rf-preset-chip,
.rf-sect-toggle-btn,
.amx-type-btn,
.amx-remove-btn,
.amx-add-btn,
.cp-tab,
.wz-btn,
.fchat-back,
.fchat-notify,
.fchat-openpage,
.fchat-close,
#fchat-send,
.chat-member-kick,
.chat-add-member-option {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}
.select2-container {
    max-width: 100%;
}

.select2-container .select2-selection--single {
    min-height: 38px;
    border: 1px solid var(--bs-border-color, #ced4da);
    border-radius: .25rem;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--bs-body-color, #495057);
    line-height: 36px;
    padding-left: .75rem;
    padding-right: 2rem;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 36px;
    right: .35rem;
}

.select2-container--default .select2-selection--single .select2-selection__clear {
    height: 36px;
    margin-right: 1.25rem;
}

.form-select-sm + .select2-container .select2-selection--single,
.select2-container .select2-selection--single[aria-labelledby] {
    min-height: 31px;
}

.form-select-sm + .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 29px;
    padding-left: .5rem;
    font-size: .8125rem;
}

.form-select-sm + .select2-container--default .select2-selection--single .select2-selection__arrow,
.form-select-sm + .select2-container--default .select2-selection--single .select2-selection__clear {
    height: 29px;
}

.select2-dropdown {
    z-index: 9999;
    border-color: var(--bs-border-color, #ced4da);
}

.select2-search--dropdown .select2-search__field {
    min-height: 31px;
    border: 1px solid var(--bs-border-color, #ced4da);
    border-radius: .25rem;
    outline: none;
}

.erp-select2-code {
    float: right;
    margin-left: .75rem;
    color: #74788d;
    font-size: .75rem;
}

body[data-layout-mode=dark] .select2-container--default .select2-selection--single,
html[data-bs-theme=dark] .select2-container--default .select2-selection--single {
    background-color: #1f242d;
    border-color: #34414f;
}

body[data-layout-mode=dark] .select2-container--default .select2-selection--single .select2-selection__rendered,
html[data-bs-theme=dark] .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #d7dee8;
}

body[data-layout-mode=dark] .select2-container--default .select2-selection--single .select2-selection__placeholder,
html[data-bs-theme=dark] .select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #8b96a7;
}

body[data-layout-mode=dark] .select2-container--default .select2-selection--single .select2-selection__arrow b,
html[data-bs-theme=dark] .select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: #9aa7b8 transparent transparent transparent;
}

body[data-layout-mode=dark] .select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b,
html[data-bs-theme=dark] .select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
    border-color: transparent transparent #9aa7b8 transparent;
}

body[data-layout-mode=dark] .select2-container--default .select2-selection--single .select2-selection__clear,
html[data-bs-theme=dark] .select2-container--default .select2-selection--single .select2-selection__clear {
    color: #c7d0dd;
}

body[data-layout-mode=dark] .select2-dropdown,
html[data-bs-theme=dark] .select2-dropdown {
    background-color: #1f242d;
    border-color: #34414f;
    color: #d7dee8;
}

body[data-layout-mode=dark] .select2-search--dropdown .select2-search__field,
html[data-bs-theme=dark] .select2-search--dropdown .select2-search__field {
    background-color: #171b22;
    border-color: #34414f;
    color: #e6edf3;
}

body[data-layout-mode=dark] .select2-container--default .select2-results__option,
html[data-bs-theme=dark] .select2-container--default .select2-results__option {
    color: #d7dee8;
}

body[data-layout-mode=dark] .select2-container--default .select2-results__option--selected,
html[data-bs-theme=dark] .select2-container--default .select2-results__option--selected {
    background-color: #2d3745;
    color: #f4f7fb;
}

body[data-layout-mode=dark] .select2-container--default .select2-results__option--highlighted.select2-results__option--selectable,
html[data-bs-theme=dark] .select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
    background-color: #3b82f6;
    color: #ffffff;
}

body[data-layout-mode=dark] .select2-results__option .erp-select2-code,
html[data-bs-theme=dark] .select2-results__option .erp-select2-code {
    color: #9aa7b8;
}

body[data-layout-mode=dark] .select2-results__option--highlighted .erp-select2-code,
html[data-bs-theme=dark] .select2-results__option--highlighted .erp-select2-code {
    color: #eaf2ff;
}

/* ── Compact view-page detail tables ─────────────────────────────────────────
 * Applied to tables inside card-body within document view pages.
 * Reduces cell padding and font size so wide tables fit without excessive
 * horizontal scrolling. The table-responsive wrapper handles overflow.
 * ──────────────────────────────────────────────────────────────────────────── */
.card-body .table.table-sm td,
.card-body .table.table-sm th {
    font-size: .825rem;
}

.card-body .table.table-sm thead th {
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: var(--erp-muted-soft, #6c757d);
    white-space: nowrap;
}

/* Tighter row padding for detail tables */
.card-body .table.table-sm > tbody > tr > td,
.card-body .table.table-sm > tfoot > tr > td,
.card-body .table.table-sm > tfoot > tr > th {
    padding-top: .3rem;
    padding-bottom: .3rem;
}
