/* =====================================================================
   Novara ERP - Modern UI theme
   Built on Bootstrap 5. Includes compatibility shims so existing
   Bootstrap 4 / AdminLTE markup (badge-*, btn-xs, text-right, mr-*,
   form-inline, btn-block, form-group) keeps rendering correctly.
   ===================================================================== */

:root {
    --erp-bg:            #f4f6fb;
    --erp-surface:       #ffffff;
    --erp-sidebar:       #0f172a;   /* slate-900 */
    --erp-sidebar-2:     #1e293b;   /* slate-800 */
    --erp-sidebar-text:  #cbd5e1;   /* slate-300 */
    --erp-sidebar-muted: #64748b;   /* slate-500 */
    --erp-primary:       #4f46e5;   /* indigo-600 */
    --erp-primary-700:   #4338ca;
    --erp-primary-soft:  #eef2ff;   /* indigo-50  */
    --erp-text:          #1e293b;
    --erp-muted:         #64748b;
    --erp-border:        #e6e9f2;
    --erp-shadow:        0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
    --erp-shadow-sm:     0 1px 2px rgba(16, 24, 40, .06);
    --erp-shadow-lg:     0 12px 30px rgba(16, 24, 40, .12);
    --erp-radius:        14px;
    --erp-radius-sm:     9px;
    --sidebar-w:         260px;
    --topbar-h:          64px;
}

* { scrollbar-width: thin; }

body {
    background: var(--erp-bg);
    color: var(--erp-text);
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: .925rem;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; }
.small, small { font-size: .8rem; }

/* ---------------------- App shell ---------------------- */

.erp-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: var(--erp-sidebar);
    color: var(--erp-sidebar-text);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    overflow-y: auto;
    box-shadow: 2px 0 12px rgba(15, 23, 42, .06);
}

.erp-main {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.erp-content { padding: 1.5rem; flex: 1 1 auto; }

@media (max-width: 991.98px) {
    .erp-sidebar { transform: translateX(-100%); transition: transform .25s ease; }
    body.sidebar-open .erp-sidebar { transform: none; }
    .erp-main { margin-left: 0; }
    .erp-content { padding: 1rem; }
    .erp-backdrop {
        position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
        z-index: 1035; opacity: 0; visibility: hidden; transition: opacity .25s ease;
    }
    body.sidebar-open .erp-backdrop { opacity: 1; visibility: visible; }
    body.sidebar-open { overflow: hidden; }
}

/* ---------------------- Sidebar brand & nav ---------------------- */

.erp-brand {
    display: flex; align-items: center; gap: .65rem;
    height: var(--topbar-h);
    padding: 0 1.25rem;
    color: #fff; font-weight: 700; font-size: 1.05rem;
    letter-spacing: .2px;
    border-bottom: 1px solid rgba(255,255,255,.06);
    flex: 0 0 auto;
    position: sticky; top: 0; background: var(--erp-sidebar); z-index: 2;
}
.erp-brand .erp-brand-mark {
    width: 34px; height: 34px; border-radius: 10px;
    display: grid; place-items: center;
    background: rgba(255,255,255,.10);
    color: #fff; font-size: 1.05rem;
    overflow: hidden;
}
.erp-brand-icon-img {
    width: 30px;
    height: 30px;
    object-fit: contain;
    display: block;
}

.erp-nav { padding: .5rem .75rem 2rem; }
.erp-nav-section {
    text-transform: uppercase; font-size: .67rem; letter-spacing: .1em;
    color: var(--erp-sidebar-muted); font-weight: 700;
    padding: 1.15rem .85rem .4rem;
    margin-top: .25rem;
    border-top: 1px solid rgba(255,255,255,.05);
}
.erp-nav-section:first-of-type { border-top: none; }
.erp-nav .nav-link {
    display: flex; align-items: center; gap: .7rem;
    padding: .62rem .85rem; margin-bottom: .12rem;
    border-radius: 10px;
    color: var(--erp-sidebar-text); font-weight: 500; font-size: .9rem;
    position: relative;
    transition: background .15s ease, color .15s ease, padding-left .15s ease;
}
.erp-nav .nav-link i { width: 1.2rem; text-align: center; font-size: 1.05rem; opacity: .85; }
.erp-nav .nav-link:hover { background: rgba(255,255,255,.07); color: #fff; padding-left: 1rem; }
.erp-nav .nav-link.active {
    background: linear-gradient(135deg, var(--erp-primary), var(--erp-primary-700));
    color: #fff; box-shadow: 0 8px 18px rgba(79,70,229,.40);
}
.erp-nav .nav-link.active::before {
    content: ""; position: absolute; left: -.75rem; top: 50%; transform: translateY(-50%);
    width: 4px; height: 22px; border-radius: 0 4px 4px 0; background: #a5b4fc;
}
.erp-nav .nav-link.active i { opacity: 1; }
.erp-nav .erp-caret { margin-left: auto; transition: transform .2s ease; font-size: .75rem; opacity: .7; }
.erp-nav .nav-link[aria-expanded="true"] { color: #fff; background: rgba(255,255,255,.04); }
.erp-nav .nav-link[aria-expanded="true"] .erp-caret { transform: rotate(180deg); }
.erp-submenu { margin: .15rem 0 .35rem; position: relative; }
.erp-submenu::before {
    content: ""; position: absolute; left: 1.3rem; top: .2rem; bottom: .4rem;
    width: 2px; background: rgba(255,255,255,.08); border-radius: 2px;
}
.erp-submenu .nav-link { font-size: .855rem; padding-left: 2.6rem; }
.erp-submenu .nav-link:hover { padding-left: 2.75rem; }

/* ---------------------- Topbar ---------------------- */

.erp-topbar {
    position: sticky; top: 0; z-index: 1030;
    height: var(--topbar-h);
    display: flex; align-items: center; gap: 1rem;
    padding: 0 1.5rem;
    background: rgba(255,255,255,.85);
    backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid var(--erp-border);
}
.erp-topbar .erp-toggle {
    border: none; background: transparent; font-size: 1.35rem;
    color: var(--erp-muted); display: none; cursor: pointer; line-height: 1;
}
@media (max-width: 991.98px) { .erp-topbar .erp-toggle { display: inline-flex; } }
.erp-topbar-title { font-weight: 600; color: var(--erp-text); }
.erp-user-chip {
    display: flex; align-items: center; gap: .65rem;
    padding: .3rem .4rem; border-radius: 999px; border: 1px solid transparent;
    background: transparent; cursor: pointer;
}
.erp-user-chip:hover { background: var(--erp-bg); border-color: var(--erp-border); }
.erp-avatar {
    width: 38px; height: 38px; border-radius: 50%;
    display: grid; place-items: center; font-weight: 600; color: #fff;
    background: linear-gradient(135deg, var(--erp-primary), #7c3aed);
}
.erp-user-meta { line-height: 1.1; text-align: right; }
.erp-user-meta .erp-user-name { font-weight: 600; font-size: .85rem; color: var(--erp-text); }
.erp-user-meta .erp-user-role { font-size: .72rem; color: var(--erp-muted); }

/* ---------------------- Page header ---------------------- */

.page-header { margin-bottom: 1.25rem; }
.page-header h1 { font-size: 1.4rem; font-weight: 700; margin: 0; color: var(--erp-text); }
.page-header .btn { box-shadow: var(--erp-shadow-sm); }

/* ---------------------- Cards ---------------------- */

.card {
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius);
    background: var(--erp-surface);
    box-shadow: var(--erp-shadow);
    margin-bottom: 1.25rem;
}
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--erp-border);
    padding: 1rem 1.25rem;
    font-weight: 600;
}
.card-title { font-size: 1rem; font-weight: 600; margin: 0; }
.card-body { padding: 1.25rem; }
.card-footer { background: transparent; border-top: 1px solid var(--erp-border); padding: 1rem 1.25rem; }
.card.card-warning  { border-top: 3px solid #f59e0b; }
.card.card-danger   { border-top: 3px solid #ef4444; }
.card.card-success  { border-top: 3px solid #10b981; }

/* ---------------------- Metric / stat cards ---------------------- */

.metric-card-wrap {
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
    cursor: default;
}
.metric-card-wrap:hover {
    transform: translateY(-3px);
    box-shadow: var(--erp-shadow-lg);
    border-color: #d8ddee;
}
.metric-card {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 1rem; height: 100%;
}
.metric-card-body { min-width: 0; }
.metric-card .metric-label { color: var(--erp-muted); font-size: .8rem; font-weight: 500; margin: 0 0 .35rem; }
.metric-card .metric-value { font-size: 1.55rem; font-weight: 700; line-height: 1.1; margin: 0; color: var(--erp-text); word-break: break-word; }
.metric-link { font-size: .76rem; font-weight: 600; color: var(--erp-primary); display: inline-flex; align-items: center; gap: .25rem; margin-top: .5rem; }
.metric-link i { transition: transform .15s ease; }
.metric-card-wrap:hover .metric-link i { transform: translateX(3px); }
.metric-icon {
    width: 46px; height: 46px; border-radius: 12px; flex: 0 0 auto;
    display: grid; place-items: center; font-size: 1.15rem;
}
.metric-icon.tone-primary { background: #eef2ff; color: #4f46e5; }
.metric-icon.tone-success { background: #e7f7ef; color: #0f9d58; }
.metric-icon.tone-info    { background: #e6f4fb; color: #0ea5e9; }
.metric-icon.tone-warning { background: #fdf3e1; color: #d97706; }
.metric-icon.tone-danger  { background: #fdeaea; color: #ef4444; }
.metric-icon.tone-purple  { background: #f3e8ff; color: #9333ea; }

/* ---------------------- Charts ---------------------- */

.chart-card .card-body { padding: 1rem 1.25rem 1.25rem; }
.chart-canvas-wrap { position: relative; width: 100%; height: 260px; }
@media (max-width: 575.98px) { .chart-canvas-wrap { height: 240px; } }

/* ---------------------- Accounting reports ---------------------- */

.accounting-report {
    background: var(--erp-surface);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius);
    box-shadow: var(--erp-shadow);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}
.accounting-report-accent {
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--erp-primary), #7c3aed);
    margin-bottom: 1.2rem;
}
.accounting-report-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    border: 1px solid var(--erp-border);
    border-left: 5px solid var(--erp-primary);
    border-radius: var(--erp-radius-sm);
    background: #f8fafc;
    padding: 1.1rem 1.25rem;
    margin-bottom: 1rem;
}
.accounting-report-kicker {
    display: inline-block;
    margin-bottom: .35rem;
    color: var(--erp-primary);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.accounting-report-header h2 {
    margin: 0 0 .3rem;
    color: var(--erp-text);
    font-size: 1.45rem;
    font-weight: 800;
}
.accounting-report-header p {
    margin: 0;
    color: var(--erp-muted);
}
.accounting-report-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 4rem;
    padding: .45rem .75rem;
    border-radius: 999px;
    color: var(--erp-primary-700);
    background: var(--erp-primary-soft);
    font-weight: 800;
    font-size: .8rem;
}
.accounting-report-meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-sm);
    overflow: hidden;
    margin-bottom: 1rem;
}
.accounting-report-meta div {
    padding: .85rem 1rem;
    background: #fff;
    border-right: 1px solid var(--erp-border);
}
.accounting-report-meta div:last-child { border-right: 0; }
.accounting-report-meta span {
    display: block;
    color: #94a3b8;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .08em;
    margin-bottom: .25rem;
    text-transform: uppercase;
}
.accounting-report-meta strong {
    color: #0f172a;
    font-size: .92rem;
}
.accounting-report-table-card {
    box-shadow: none;
    margin-bottom: 0;
}
.accounting-report-table thead th {
    background: #0f172a;
    color: #fff;
    border-color: #0f172a;
}
.accounting-report-table th:first-child,
.accounting-report-table td:first-child { width: 50%; }
.accounting-report-table th:not(:first-child),
.accounting-report-table td:not(:first-child) { width: 16.666%; }
.accounting-report-table tbody tr:nth-child(even) td { background: #f8fafc; }
.accounting-report-table tbody tr:last-child td { border-bottom: 2px solid var(--erp-primary); }
.accounting-amount {
    color: #0f172a;
    font-weight: 800;
}
.accounting-report-table .accounting-row-section td {
    background: var(--erp-primary-soft) !important;
    color: var(--erp-primary-700);
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.accounting-report-table .accounting-row-section-muted td {
    background: #f1f5f9 !important;
    color: #475569;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.accounting-report-table .accounting-row-subtotal td {
    border-top: 2px solid #cbd5e1;
    font-weight: 800;
}
.accounting-report-table .accounting-row-total td {
    background: #0f172a !important;
    border-color: #0f172a;
    color: #fff;
    font-weight: 900;
}
.accounting-report-table .accounting-row-total .accounting-amount { color: #fff; }
.accounting-indent { padding-left: 2.25rem !important; }
@media (max-width: 767.98px) {
    .accounting-report { padding: 1rem; }
    .accounting-report-header { display: block; }
    .accounting-report-badge { margin-top: .85rem; }
    .accounting-report-meta { grid-template-columns: 1fr; }
    .accounting-report-meta div { border-right: 0; border-bottom: 1px solid var(--erp-border); }
    .accounting-report-meta div:last-child { border-bottom: 0; }
}

/* ---------------------- Tables ---------------------- */

.card-body.p-0 { overflow-x: auto; }            /* tables scroll on small screens */
.table-responsive { border-radius: var(--erp-radius); }
.table { margin: 0; color: var(--erp-text); }
.table thead th {
    text-transform: uppercase; font-size: .72rem; letter-spacing: .04em;
    color: var(--erp-muted); font-weight: 600;
    border-bottom: 1px solid var(--erp-border); background: #fafbfe;
    padding: .7rem 1rem; white-space: nowrap;
}
.table tbody td { padding: .8rem 1rem; vertical-align: middle; border-color: var(--erp-border); }
.table tbody tr:last-child td { border-bottom: 0; }
.table-hover tbody tr { transition: background .12s ease; }
.table-hover tbody tr:hover { background: var(--erp-primary-soft); }
.table code { color: var(--erp-primary-700); background: var(--erp-primary-soft); padding: .1rem .4rem; border-radius: 6px; font-size: .82rem; }

/* Clean row-action buttons */
.table .btn-xs { margin: 0 1px; }
.table-actions { display: inline-flex; align-items: center; gap: .25rem; justify-content: flex-end; }
.action-toggle { line-height: 1; color: var(--erp-muted); background: #fff; }
.action-toggle:hover, .action-toggle[aria-expanded="true"] { color: var(--erp-primary); background: var(--erp-primary-soft); border-color: #c7d2fe !important; }
.action-menu { border: 1px solid var(--erp-border); border-radius: 12px; padding: .35rem; min-width: 11rem; }
.action-menu .dropdown-item { border-radius: 8px; padding: .5rem .65rem; font-size: .875rem; display: flex; align-items: center; gap: .55rem; }
.action-menu .dropdown-item i { width: 1.05rem; text-align: center; opacity: .8; }
.action-menu .dropdown-item.text-danger:hover { background: #fdeaea; }
.action-menu form { margin: 0; }
.action-menu button.dropdown-item { width: 100%; background: none; border: 0; text-align: left; }

/* ---------------------- Badges ---------------------- */

.badge { font-weight: 600; font-size: .72rem; padding: .38em .65em; border-radius: 7px; letter-spacing: .01em; }
/* BS4 / AdminLTE soft badge shims */
.badge-success   { background: #e7f7ef; color: #0f9d58; }
.badge-secondary { background: #eef0f4; color: #64748b; }
.badge-info      { background: #e6f4fb; color: #0284c7; }
.badge-primary   { background: #eef2ff; color: #4f46e5; }
.badge-warning   { background: #fdf3e1; color: #b45309; }
.badge-danger    { background: #fdeaea; color: #dc2626; }
.badge-light     { background: #f1f5f9; color: #475569; }
.badge-dark      { background: #e2e8f0; color: #1e293b; }

/* Standardized status badges (status-badge component) */
.status-badge { display: inline-flex; align-items: center; gap: .35em; text-transform: capitalize; }
.status-badge::before { content: ""; width: .45em; height: .45em; border-radius: 50%; background: currentColor; opacity: .9; }
.status-open                  { background: #e6f0ff; color: #1d4ed8; }   /* blue   */
.status-active                { background: #e7f7ef; color: #0f9d58; }   /* green  */
.status-inactive              { background: #eef0f4; color: #64748b; }   /* gray   */
.status-pending               { background: #fdf3e1; color: #c2680c; }   /* orange */
.status-dispatched            { background: #eceaff; color: #5b4bd6; }   /* indigo */
.status-received              { background: #e7f7ef; color: #0f9d58; }   /* green  */
.status-cancelled,
.status-canceled              { background: #fdeaea; color: #dc2626; }   /* red    */
.status-closed                { background: #e2e8f0; color: #1e293b; }   /* dark   */
.status-reconciled            { background: #f3e8ff; color: #9333ea; }   /* purple */
.status-draft                 { background: #eef0f4; color: #64748b; }   /* gray   */
.status-verified              { background: #dcfce7; color: #166534; }   /* green  */
.status-partially_distributed { background: #fdf3e1; color: #c2680c; }   /* orange */
.status-fully_distributed     { background: #e7f7ef; color: #0f9d58; }   /* green  */
.status-over_sold             { background: #fdeaea; color: #dc2626; }   /* red    */
.status-default               { background: #eef0f4; color: #64748b; }

/* ---------------------- Buttons ---------------------- */

.btn { border-radius: var(--erp-radius-sm); font-weight: 500; }
.btn-primary { background: var(--erp-primary); border-color: var(--erp-primary); }
.btn-primary:hover { background: var(--erp-primary-700); border-color: var(--erp-primary-700); }
.btn-xs { padding: .2rem .5rem; font-size: .78rem; line-height: 1.35; border-radius: 8px; }
.btn-block { display: block; width: 100%; }
.btn-default { background: #fff; border: 1px solid var(--erp-border); color: var(--erp-text); }
.btn-default:hover { background: var(--erp-bg); }

/* ---------------------- Forms ---------------------- */

.form-group { margin-bottom: 1.1rem; }
label { font-weight: 500; margin-bottom: .4rem; color: #334155; }
.form-control, .form-select {
    border-radius: var(--erp-radius-sm); border-color: var(--erp-border);
    padding: .55rem .8rem; font-size: .9rem;
}
.form-control::placeholder { color: #aab2c5; }
.form-control:focus, .form-select:focus {
    border-color: #c7d2fe; box-shadow: 0 0 0 .2rem rgba(79,70,229,.15);
}
.form-control.is-invalid, .form-select.is-invalid { border-color: #ef4444; }
.form-control.is-invalid:focus { box-shadow: 0 0 0 .2rem rgba(239,68,68,.15); }
.invalid-feedback { font-size: .8rem; font-weight: 500; }
.form-text { font-size: .78rem; color: var(--erp-muted); margin-top: .3rem; }
.text-danger { color: #dc2626 !important; }
.form-inline { display: flex; flex-flow: row wrap; align-items: center; gap: .5rem; }

/* Select2 Bootstrap 5 integration */
.select2-container--bootstrap-5 .select2-selection {
    border-color: var(--erp-border);
    border-radius: var(--erp-radius-sm);
    min-height: 38px;
    box-shadow: none;
    font-size: .9rem;
}
.select2-container--bootstrap-5 .select2-selection--single {
    padding: .38rem 2.25rem .38rem .8rem;
}
.select2-container--bootstrap-5 .select2-selection--multiple {
    padding: .25rem .5rem;
}
.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
    border-color: #c7d2fe;
    box-shadow: 0 0 0 .2rem rgba(79,70,229,.15);
}
.select2-container--bootstrap-5 .select2-dropdown {
    border-color: var(--erp-border);
    border-radius: var(--erp-radius-sm);
    box-shadow: var(--erp-shadow-lg);
    overflow: hidden;
}
.select2-container--bootstrap-5 .select2-search--dropdown .select2-search__field {
    border-color: var(--erp-border);
    border-radius: 8px;
    font-size: .9rem;
    outline: none;
}
.select2-container--bootstrap-5 .select2-search--dropdown .select2-search__field:focus {
    border-color: #c7d2fe;
    box-shadow: 0 0 0 .15rem rgba(79,70,229,.12);
}
.select2-container--bootstrap-5 .select2-results__option--highlighted {
    background-color: var(--erp-primary);
}
.select2-container--bootstrap-5 .select2-results__option--selected {
    background-color: var(--erp-primary-soft);
    color: var(--erp-primary-700);
}
.is-invalid + .select2-container--bootstrap-5 .select2-selection,
.form-select.is-invalid + .select2-container--bootstrap-5 .select2-selection {
    border-color: #ef4444;
}
/* BS4 form-row shim (used by some filter bars / forms) */
.form-row { display: flex; flex-wrap: wrap; align-items: flex-end; margin: 0 -.4rem; }
.form-row > [class*="col-"] { padding: 0 .4rem; }
.form-row { display: flex; flex-wrap: wrap; margin-right: -.25rem; margin-left: -.25rem; }
.form-row > [class*="col-"] { padding-right: .25rem; padding-left: .25rem; }
.card-header .form-control, .card-header .form-select { min-height: 38px; }
@media (max-width: 767.98px) {
    .card-header .form-inline .form-control,
    .card-header .form-inline .form-select,
    .card-header .form-inline .btn { width: 100%; margin-right: 0 !important; }
}
dl.row dt { color: var(--erp-muted); font-weight: 600; }
dl.row dd { color: var(--erp-text); }
dl.row dt, dl.row dd { padding-top: .35rem; padding-bottom: .35rem; }

/* ---------------------- Pagination ---------------------- */

.pagination { margin: 0; }
.page-link { color: var(--erp-primary); border-color: var(--erp-border); border-radius: 8px; margin: 0 2px; }
.page-item.active .page-link { background: var(--erp-primary); border-color: var(--erp-primary); }

/* ---------------------- Alerts ---------------------- */

.alert { border: 1px solid transparent; border-radius: var(--erp-radius-sm); }
.alert-success { background: #e7f7ef; border-color: #b7ebd1; color: #0f7a48; }
.alert-danger  { background: #fdeaea; border-color: #f6c8c8; color: #b42318; }
.alert-info    { background: #e6f4fb; border-color: #c2e4f5; color: #0369a1; }
.alert-warning { background: #fdf3e1; border-color: #f6e0b5; color: #92600c; }

/* ---------------------- Empty states ---------------------- */

.empty-state { padding: 2.75rem 1rem; text-align: center; color: var(--erp-muted); }
.empty-state i { font-size: 2.1rem; opacity: .35; display: block; margin-bottom: .6rem; }
.empty-state-text { font-size: .9rem; }
.empty-state-sm { padding: 1.5rem 1rem; }
.empty-state-sm i { font-size: 1.6rem; margin-bottom: .4rem; }

/* ---------------------- WhatsApp import ---------------------- */

.whatsapp-raw-message {
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 420px;
    overflow-y: auto;
    background: var(--erp-body-bg, #f8f9fb);
    border: 1px solid var(--erp-border, #e3e6ef);
    border-radius: .375rem;
    padding: .75rem;
    font-size: .85rem;
}

/* ---------------------- Compatibility shims (BS4 -> BS5) ---------------------- */

.text-right { text-align: right !important; }
.text-left  { text-align: left  !important; }
.float-right { float: right !important; }
.float-left  { float: left  !important; }
.mr-1 { margin-right: .25rem !important; } .ml-1 { margin-left: .25rem !important; }
.mr-2 { margin-right: .5rem  !important; } .ml-2 { margin-left: .5rem  !important; }
.mr-3 { margin-right: 1rem   !important; } .ml-3 { margin-left: 1rem   !important; }
.mr-auto { margin-right: auto !important; } .ml-auto { margin-left: auto !important; }
.pl-0 { padding-left: 0 !important; } .pr-0 { padding-right: 0 !important; }

/* Utility */
.gap-2 { gap: .5rem !important; }
.text-muted-2 { color: var(--erp-muted); }

/* ---------------------- Auth pages (login / forgot / reset) ---------------------- */

.auth-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    background: var(--erp-bg);
}
@media (max-width: 991.98px) { .auth-page { grid-template-columns: 1fr; } }

/* Left brand panel */
.auth-brand {
    position: relative;
    padding: 3rem;
    color: #fff;
    background: radial-gradient(120% 120% at 0% 0%, #6366f1 0%, #4f46e5 42%, #3730a3 100%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
}
@media (max-width: 991.98px) { .auth-brand { display: none; } }
.auth-brand::after {
    content: ""; position: absolute; inset: 0;
    background:
        radial-gradient(40% 40% at 80% 20%, rgba(255,255,255,.16), transparent 60%),
        radial-gradient(50% 50% at 10% 90%, rgba(255,255,255,.10), transparent 60%);
    pointer-events: none;
}
.auth-brand-logo { display: flex; align-items: center; gap: .75rem; font-weight: 700; font-size: 1.25rem; position: relative; z-index: 1; }
.auth-brand-logo .auth-logo-mark {
    width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center;
    background: rgba(255,255,255,.16); backdrop-filter: blur(6px); font-size: 1.3rem;
}
.auth-brand-logo-img {
    width: min(420px, 78%);
    max-height: 118px;
    object-fit: contain;
    display: block;
    object-position: left center;
}
.auth-brand-hero { position: relative; z-index: 1; }
.auth-brand-hero h2 { font-size: 2rem; font-weight: 700; line-height: 1.2; margin: 0 0 1rem; }
.auth-brand-hero p { color: rgba(255,255,255,.82); font-size: 1rem; max-width: 30rem; margin: 0; }
.auth-feature-list { list-style: none; padding: 0; margin: 2rem 0 0; position: relative; z-index: 1; display: grid; gap: .85rem; }
.auth-feature-list li { display: flex; align-items: center; gap: .65rem; color: rgba(255,255,255,.92); font-size: .95rem; }
.auth-feature-list li i { width: 1.6rem; height: 1.6rem; display: grid; place-items: center; border-radius: 7px; background: rgba(255,255,255,.16); font-size: .85rem; }
.auth-brand-footer { position: relative; z-index: 1; color: rgba(255,255,255,.7); font-size: .82rem; }

/* Right form panel */
.auth-form-side { display: flex; align-items: center; justify-content: center; padding: 2.5rem 1.5rem; }
.auth-card {
    width: 100%; max-width: 420px;
    background: var(--erp-surface);
    border: 1px solid var(--erp-border);
    border-radius: 18px;
    box-shadow: var(--erp-shadow-lg);
    padding: 2.25rem;
}
.auth-card-mobile-logo { display: none; }
@media (max-width: 991.98px) {
    .auth-card-mobile-logo { display: flex; align-items: center; justify-content: center; gap: .6rem; font-weight: 700; font-size: 1.15rem; color: var(--erp-primary); margin-bottom: 1.5rem; }
    .auth-card-mobile-logo .auth-logo-mark { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--erp-primary-soft); }
    .auth-card-logo-img { width: 42px; height: 42px; object-fit: contain; display: block; }
}
.auth-card h1 { font-size: 1.5rem; font-weight: 700; margin: 0 0 .35rem; }
.auth-card .auth-sub { color: var(--erp-muted); font-size: .9rem; margin-bottom: 1.6rem; }
.auth-input-group { position: relative; }
.auth-input-group .auth-input-icon {
    position: absolute; left: .9rem; top: 50%; transform: translateY(-50%);
    color: #94a3b8; font-size: 1rem; pointer-events: none;
}
.auth-input-group .form-control { padding-left: 2.6rem; height: 48px; }
.auth-input-group .auth-toggle-pw {
    position: absolute; right: .6rem; top: 50%; transform: translateY(-50%);
    background: none; border: 0; color: #94a3b8; padding: .25rem .4rem; cursor: pointer;
}
.auth-input-group .auth-toggle-pw:hover { color: var(--erp-primary); }
.auth-btn { height: 48px; font-weight: 600; font-size: .95rem; }
.auth-meta-row { display: flex; align-items: center; justify-content: space-between; margin: .25rem 0 1.25rem; }
.auth-card .form-check-label { font-size: .85rem; color: #475569; }
.auth-divider { text-align: center; color: var(--erp-muted); font-size: .78rem; margin: 1.4rem 0 1rem; position: relative; }
.auth-divider::before, .auth-divider::after { content: ""; position: absolute; top: 50%; width: calc(50% - 2.5rem); height: 1px; background: var(--erp-border); }
.auth-divider::before { left: 0; } .auth-divider::after { right: 0; }
.auth-hint { text-align: center; font-size: .85rem; color: var(--erp-muted); margin: 0; }
