/* =====================================================================
   WeighPro CRM – Design System
   ===================================================================== */

:root {
    --crm-primary: #2f5bea;
    --crm-primary-dark: #1f44c4;
    --crm-primary-soft: #eaf0ff;
    --crm-success: #12b76a;
    --crm-warning: #f79009;
    --crm-danger: #f04438;
    --crm-info: #0ba5ec;
    --crm-teal: #0e9384;
    --crm-purple: #7a5af8;
    --crm-indigo: #444ce7;
    --crm-orange: #ef6820;
    --crm-secondary: #667085;

    --crm-body-bg: #f4f6fb;
    --crm-card-bg: #ffffff;
    --crm-border: #e7eaf3;
    --crm-text: #1d2939;
    --crm-muted: #667085;
    --crm-heading: #101828;

    --crm-sidebar-width: 268px;
    --crm-sidebar-mini: 78px;
    --crm-header-height: 68px;
    --crm-radius: 14px;
    --crm-radius-sm: 10px;
    --crm-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .05);
    --crm-shadow-lg: 0 12px 32px rgba(16, 24, 40, .12);

    --bs-primary: var(--crm-primary);
    --bs-primary-rgb: 47, 91, 234;
    --bs-body-font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --bs-body-color: var(--crm-text);
    --bs-border-color: var(--crm-border);
}

body {
    background: var(--crm-body-bg);
    font-size: .9rem;
    color: var(--crm-text);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 { color: var(--crm-heading); font-weight: 600; }
a { color: var(--crm-primary); text-decoration: none; }
a:hover { color: var(--crm-primary-dark); }
.text-muted { color: var(--crm-muted) !important; }
.fw-semibold { font-weight: 600 !important; }
.min-w-0 { min-width: 0; }
.small-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--crm-muted); font-weight: 600; }

/* ---------- Buttons ---------- */
.btn { font-size: .875rem; font-weight: 500; border-radius: 8px; padding: .4rem .9rem; }
.btn-sm { padding: .28rem .65rem; font-size: .8rem; border-radius: 7px; }
.btn-primary { background: var(--crm-primary); border-color: var(--crm-primary); }
.btn-primary:hover, .btn-primary:focus { background: var(--crm-primary-dark); border-color: var(--crm-primary-dark); }
.btn-outline-primary { color: var(--crm-primary); border-color: var(--crm-primary); }
.btn-outline-primary:hover { background: var(--crm-primary); border-color: var(--crm-primary); }
.btn-light { background: #fff; border-color: var(--crm-border); color: var(--crm-text); }
.btn-light:hover { background: #f8f9fc; border-color: #d0d5dd; }
.btn-soft-primary { background: var(--crm-primary-soft); color: var(--crm-primary); border: 0; }
.btn-soft-primary:hover { background: var(--crm-primary); color: #fff; }
.btn-soft-success { background: #e7f8ef; color: #039855; border: 0; }
.btn-soft-success:hover { background: var(--crm-success); color: #fff; }
.btn-soft-warning { background: #fff4e5; color: #b54708; border: 0; }
.btn-soft-warning:hover { background: var(--crm-warning); color: #fff; }
.btn-soft-danger { background: #fdecea; color: #d92d20; border: 0; }
.btn-soft-danger:hover { background: var(--crm-danger); color: #fff; }

.contact-line { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.4rem; font-size: .86rem; }
.contact-line > a, .contact-line > span { color: inherit; white-space: nowrap; }
.contact-line > a:hover { color: var(--crm-primary); }
.contact-line > a > i, .contact-line > span > i { color: #98a2b3; margin-right: .4rem; }
.contact-list { list-style: none; margin: 0; padding: 0; }
.contact-list li { display: flex; align-items: flex-start; gap: .6rem; padding: .4rem 0; border-bottom: 1px dashed var(--crm-border); font-size: .84rem; }
.contact-list li:last-child { border-bottom: 0; }
.contact-list li > i { width: 16px; text-align: center; color: var(--crm-muted, #98a2b3); margin-top: .2rem; flex-shrink: 0; }
.contact-list li a { color: inherit; }
.contact-list li a:hover { color: var(--crm-primary); }
.btn-icon { width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; }

/* ---------- Layout ---------- */
.crm-wrapper { min-height: 100vh; }

.crm-sidebar {
    position: fixed; inset: 0 auto 0 0;
    width: var(--crm-sidebar-width);
    background: #fff;
    border-right: 1px solid var(--crm-border);
    z-index: 1040;
    display: flex; flex-direction: column;
    transition: width .25s ease, transform .25s ease;
}

.crm-brand {
    height: var(--crm-header-height);
    display: flex; align-items: center; gap: .75rem;
    padding: 0 1.25rem;
    border-bottom: 1px solid var(--crm-border);
    flex-shrink: 0;
}
.crm-brand-logo {
    width: 40px; height: 40px; border-radius: 12px;
    background: linear-gradient(135deg, var(--crm-primary), #6a8bff);
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; flex-shrink: 0;
    box-shadow: 0 6px 16px rgba(47, 91, 234, .35);
}
.crm-brand-image { justify-content: center; padding: 0 1rem; }
.crm-brand-full { height: 54px; width: auto; max-width: 100%; object-fit: contain; }
.crm-brand-icon { display: none; width: 46px; height: 46px; object-fit: contain; }
body.sidebar-mini .crm-brand-full { display: none; }
body.sidebar-mini .crm-brand-icon { display: block; }
.crm-brand-name { font-weight: 700; font-size: 1.05rem; color: var(--crm-heading); line-height: 1.1; }
.crm-brand-sub { font-size: .7rem; color: var(--crm-muted); }

.crm-nav { flex: 1; overflow-y: auto; padding: .75rem .75rem 1.5rem; }
.crm-nav::-webkit-scrollbar { width: 5px; }
.crm-nav::-webkit-scrollbar-thumb { background: #d0d5dd; border-radius: 10px; }

.crm-nav-heading {
    font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
    color: #98a2b3; padding: 1.1rem .85rem .4rem; white-space: nowrap;
}
.crm-nav-link {
    display: flex; align-items: center; gap: .75rem;
    padding: .58rem .85rem; margin-bottom: 2px;
    border-radius: 10px; color: #475467; font-weight: 500;
    white-space: nowrap; transition: all .15s ease;
}
.crm-nav-link i { width: 20px; text-align: center; font-size: .95rem; color: #98a2b3; transition: color .15s; }
.crm-nav-link:hover { background: #f5f7ff; color: var(--crm-primary); }
.crm-nav-link:hover i { color: var(--crm-primary); }
.crm-nav-link.active { background: var(--crm-primary-soft); color: var(--crm-primary); font-weight: 600; }
.crm-nav-link.active i { color: var(--crm-primary); }
.crm-nav-link .badge { margin-left: auto; font-size: .68rem; }

.crm-sidebar-footer { padding: 1rem; border-top: 1px solid var(--crm-border); }
.crm-help-card { background: linear-gradient(135deg, #f0f4ff, #e9f7f5); border-radius: 12px; padding: .9rem; font-size: .78rem; }

.crm-main { margin-left: var(--crm-sidebar-width); min-height: 100vh; display: flex; flex-direction: column; transition: margin .25s ease; }

/* Header */
.crm-header {
    position: sticky; top: 0; z-index: 1030;
    height: var(--crm-header-height);
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--crm-border);
    display: flex; align-items: center; gap: 1rem;
    padding: 0 1.5rem;
}
.crm-search { position: relative; max-width: 380px; width: 100%; }
.crm-search i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #98a2b3; }
.crm-search input { padding-left: 2.4rem; background: #f4f6fb; border-color: transparent; border-radius: 10px; height: 40px; }
.crm-search input:focus { background: #fff; }
.crm-header-btn {
    width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--crm-border);
    background: #fff; color: #475467; display: inline-flex; align-items: center; justify-content: center; position: relative;
}
.crm-header-btn:hover { color: var(--crm-primary); border-color: #c7d3ff; }
.crm-header-btn .dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; background: var(--crm-danger); border-radius: 50%; border: 2px solid #fff; }
.crm-user-btn { display: flex; align-items: center; gap: .6rem; background: none; border: 0; padding: .25rem; border-radius: 10px; }
.crm-user-btn:hover { background: #f4f6fb; }

.crm-content { padding: 1.25rem; flex: 1; }
.crm-footer { padding: 1rem 1.5rem; color: var(--crm-muted); font-size: .78rem; border-top: 1px solid var(--crm-border); background: #fff; }

/* Collapsed sidebar (desktop) */
body.sidebar-mini .crm-sidebar { width: var(--crm-sidebar-mini); }
body.sidebar-mini .crm-main { margin-left: var(--crm-sidebar-mini); }
body.sidebar-mini .crm-brand-text,
body.sidebar-mini .crm-nav-link span,
body.sidebar-mini .crm-nav-link .badge,
body.sidebar-mini .crm-sidebar-footer { display: none; }
body.sidebar-mini .crm-nav-heading { font-size: 0; padding: .6rem 0; border-top: 1px solid var(--crm-border); margin: .4rem .5rem; }
body.sidebar-mini .crm-nav-link { justify-content: center; padding: .65rem; }
body.sidebar-mini .crm-brand { justify-content: center; padding: 0; }

.crm-backdrop { display: none; }

@media (max-width: 991.98px) {
    .crm-sidebar { transform: translateX(-100%); box-shadow: var(--crm-shadow-lg); }
    .crm-main, body.sidebar-mini .crm-main { margin-left: 0; }
    body.sidebar-open .crm-sidebar { transform: translateX(0); width: var(--crm-sidebar-width); }
    body.sidebar-open .crm-backdrop { display: block; position: fixed; inset: 0; background: rgba(16, 24, 40, .45); z-index: 1035; }
    .crm-header { padding: 0 1rem; }
    .crm-content { padding: 1rem; }
}

/* ---------- Page header ---------- */
.page-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1.1rem; }
.page-title { font-size: 1.35rem; margin: 0; font-weight: 700; }
.page-subtitle { color: var(--crm-muted); margin: .2rem 0 0; }
.breadcrumb { margin: 0 0 .35rem; font-size: .78rem; }
.breadcrumb-item + .breadcrumb-item::before { content: "\f105"; font-family: "Font Awesome 6 Free"; font-weight: 900; font-size: .65rem; color: #98a2b3; }
.breadcrumb-item a { color: var(--crm-muted); }
.breadcrumb-item.active { color: var(--crm-text); }

/* ---------- Cards ---------- */
.card { border: 1px solid var(--crm-border); border-radius: var(--crm-radius); box-shadow: var(--crm-shadow); background: var(--crm-card-bg); }
.card-header { background: transparent; border-bottom: 1px solid var(--crm-border); padding: .75rem 1.1rem; display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.card-header:first-child { border-radius: var(--crm-radius) var(--crm-radius) 0 0; }
.card-title { font-size: 1rem; margin: 0; font-weight: 600; display: flex; align-items: center; gap: .5rem; }
.card-title i { color: var(--crm-primary); }
.card-body { padding: 1rem 1.1rem; }
form .card.mb-3 { margin-bottom: .75rem !important; }
.card-footer { background: #fafbfd; border-top: 1px solid var(--crm-border); padding: .9rem 1.25rem; }

/* Stat cards */
.stat-card { position: relative; overflow: hidden; height: 100%; transition: transform .15s ease, box-shadow .15s ease; display: block; color: inherit; }
a.stat-card:hover { box-shadow: var(--crm-shadow-lg); color: inherit; }
.stat-card .card-body { display: flex; align-items: flex-start; gap: 1rem; }
.stat-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0; }
.stat-label { color: var(--crm-muted); font-size: .8rem; font-weight: 500; margin-bottom: .25rem; }
.stat-value { font-size: 1.3rem; font-weight: 700; color: var(--crm-heading); line-height: 1.2; }
.stat-trend { font-size: .74rem; color: var(--crm-muted); margin-top: .3rem; }
.stat-card::after { content: ""; position: absolute; right: -30px; bottom: -30px; width: 100px; height: 100px; border-radius: 50%; background: currentColor; opacity: .03; }

.flow-card { display: block; border: 1px solid var(--crm-border); transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.flow-card:hover { box-shadow: var(--crm-shadow-lg); border-color: var(--bs-primary); }
.flow-icon { width: 56px; height: 56px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; flex-shrink: 0; }

.mini-stat { border: 1px solid var(--crm-border); border-radius: 12px; padding: .7rem .9rem; background: #fff; height: 100%; }
.mini-stat .value { font-size: 1.15rem; font-weight: 700; color: var(--crm-heading); }
.mini-stat .label { font-size: .75rem; color: var(--crm-muted); }

/* ---------- Soft colour utilities ---------- */
.bg-soft-primary { background: #eaf0ff !important; color: var(--crm-primary) !important; }
.bg-soft-success { background: #e7f8ef !important; color: #039855 !important; }
.bg-soft-warning { background: #fff4e5 !important; color: #b54708 !important; }
.bg-soft-danger { background: #fdecea !important; color: #d92d20 !important; }
.bg-soft-info { background: #e6f6fe !important; color: #026aa2 !important; }
.bg-soft-teal { background: #e3f6f3 !important; color: #107569 !important; }
.bg-soft-purple { background: #f1edff !important; color: #6941c6 !important; }
.bg-soft-indigo { background: #eceefe !important; color: #3538cd !important; }
.bg-soft-orange { background: #fef0e7 !important; color: #c4320a !important; }
.bg-soft-secondary { background: #f2f4f7 !important; color: #475467 !important; }
.text-teal { color: var(--crm-teal) !important; }
.text-purple { color: var(--crm-purple) !important; }
.text-orange { color: var(--crm-orange) !important; }
.text-indigo { color: var(--crm-indigo) !important; }

/* ---------- Badges ---------- */
.badge { font-weight: 600; font-size: .72rem; padding: .38em .7em; border-radius: 6px; letter-spacing: .01em; }
.badge-status { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; }
.badge-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-source { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; }

/* ---------- Avatars ---------- */
.avatar { width: 38px; height: 38px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem; flex-shrink: 0; }
.avatar-sm { width: 32px; height: 32px; font-size: .72rem; border-radius: 8px; }
.avatar-lg { width: 72px; height: 72px; font-size: 1.4rem; border-radius: 18px; }

/* ---------- Tables ---------- */
.table { --bs-table-hover-bg: #f8faff; margin-bottom: 0; vertical-align: middle; }
.table > :not(caption) > * > * { padding: .45rem .6rem; border-bottom-color: var(--crm-border); }
.table td { font-size: .86rem; line-height: 1.4; }
.table td .badge { font-size: .72rem; padding: .28em .55em; }
.table td .avatar-sm { width: 28px; height: 28px; font-size: .68rem; border-radius: 7px; }
.table td .btn-sm { padding: .2rem .5rem; font-size: .78rem; }
.table thead th { background: #f8f9fc; color: #475467; font-weight: 600; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; border-bottom: 1px solid var(--crm-border); }
.table td { color: var(--crm-text); }
.table .cell-title { font-weight: 600; color: var(--crm-heading); }
.table .cell-sub { font-size: .76rem; color: var(--crm-muted); }
.table-actions { display: flex; gap: .25rem; justify-content: flex-end; flex-wrap: nowrap; min-width: 140px; }
.table-actions .btn { width: 28px; height: 28px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 7px; font-size: .82rem; }

/* DataTables */
div.dataTables_wrapper { padding: 0; }
.dt-toolbar { padding: 1rem 1.25rem; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; border-bottom: 1px solid var(--crm-border); }
.dt-footer { padding: .9rem 1.25rem; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; }
div.dataTables_wrapper div.dataTables_filter input { margin-left: .5rem; border-radius: 10px; min-width: 220px; }
div.dataTables_wrapper div.dataTables_length select { border-radius: 8px; margin: 0 .35rem; }
div.dataTables_wrapper div.dataTables_info { padding-top: 0; color: var(--crm-muted); font-size: .8rem; }
div.dataTables_wrapper div.dataTables_paginate ul.pagination { margin: 0; }
.page-link { border-radius: 8px !important; margin: 0 2px; border: 1px solid var(--crm-border); color: var(--crm-text); font-size: .8rem; }
.page-item.active .page-link { background: var(--crm-primary); border-color: var(--crm-primary); }
table.dataTable { margin-top: 0 !important; margin-bottom: 0 !important; }
table.dataTable th.col-fit, table.dataTable td.col-fit { width: 1%; white-space: nowrap; }
table.dataTable td.col-fit .cell-sub { white-space: normal; min-width: 110px; }
table.dataTable th.col-grow, table.dataTable td.col-grow { width: 99%; min-width: 180px; }
table.dataTable.table-nowrap td.col-fit .cell-sub { white-space: nowrap; min-width: 0; }
table.dataTable.table-nowrap td.col-grow { min-width: 0; }
table.dataTable th.col-fit + th.col-fit, table.dataTable td.col-fit + td.col-fit { padding-left: 1.1rem; }
table.dataTable thead > tr > th.sorting::before, table.dataTable thead > tr > th.sorting::after,
table.dataTable thead > tr > th.sorting_asc::before, table.dataTable thead > tr > th.sorting_asc::after,
table.dataTable thead > tr > th.sorting_desc::before, table.dataTable thead > tr > th.sorting_desc::after { font-size: .7em; }
.dataTables_empty { padding: 2.5rem !important; color: var(--crm-muted); }

/* Loading state for server-side tables */
.dt-table-wrap { position: relative; min-height: 120px; }
div.dataTables_wrapper .dt-table-wrap div.dataTables_processing {
    position: absolute; inset: 0; top: 0; left: 0; width: auto; margin: 0; padding: 0;
    display: flex; align-items: flex-start; justify-content: center; padding-top: 4.5rem;
    background: rgba(255, 255, 255, .6); backdrop-filter: blur(1px);
    border: 0; border-radius: 0; box-shadow: none; z-index: 5;
}
div.dataTables_wrapper .dt-table-wrap div.dataTables_processing > div:last-child { display: none; }
.dt-loading-box {
    display: inline-flex; align-items: center; gap: .6rem; padding: .6rem 1.1rem;
    background: #fff; border: 1px solid var(--crm-border); border-radius: 999px;
    box-shadow: 0 6px 20px rgba(16, 24, 40, .08); font-size: .85rem; font-weight: 500; color: var(--crm-text);
}
.dt-busy table.dataTable tbody { pointer-events: none; }
.skeleton-row td { padding-top: 1.05rem !important; padding-bottom: 1.05rem !important; }
.skeleton-bar {
    display: block; height: 12px; width: 75%; border-radius: 6px;
    background: linear-gradient(90deg, #eef1f6 25%, #e2e7ef 37%, #eef1f6 63%); background-size: 400% 100%;
    animation: skeleton-shimmer 1.3s ease infinite;
}
.skeleton-row td:nth-child(2n) .skeleton-bar { width: 55%; }
.skeleton-row td:last-child .skeleton-bar { width: 40%; margin-left: auto; }
@keyframes skeleton-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- Forms ---------- */
.form-label { font-weight: 500; color: #344054; margin-bottom: .28rem; font-size: .84rem; }
.form-label .req { color: var(--crm-danger); margin-left: 2px; }
.form-control, .form-select { border-radius: 8px; border-color: #d0d5dd; padding: .38rem .72rem; font-size: .9rem; line-height: 1.45; }
.form-select { padding-right: 2rem; background-position: right .6rem center; }
.form-control:focus, .form-select:focus { border-color: #9fb4ff; box-shadow: 0 0 0 3px rgba(47, 91, 234, .12); }
.form-control-sm, .form-select-sm { padding: .28rem .55rem; font-size: .84rem; border-radius: 7px; }
.input-group-text { background: #f8f9fc; border-color: #d0d5dd; color: var(--crm-muted); border-radius: 8px; padding: .38rem .68rem; font-size: .86rem; }
textarea.form-control { min-height: 0; resize: vertical; }
.form-text { font-size: .78rem; margin-top: .2rem; }
.invalid-feedback { font-size: .8rem; }
.form-check { font-size: .875rem; }
form .row.g-3 { --bs-gutter-x: .9rem; --bs-gutter-y: .7rem; }
.form-text { color: var(--crm-muted); font-size: .78rem; }
.disc-pair { display: flex; align-items: center; gap: .35rem; }
.disc-pair > .input-group { flex: 1 1 0; min-width: 0; flex-wrap: nowrap; }
.disc-pair .form-control { min-width: 0; padding-left: .6rem; padding-right: .6rem; }
.disc-pair .input-group-text { padding-left: .6rem; padding-right: .6rem; justify-content: center; min-width: 2.1rem; }
.disc-pair-sep { color: #98a2b3; font-size: .65rem; flex: none; }
.line-disc .input-group, .line-spec .input-group { flex-wrap: nowrap; }
.line-disc .input-group-text { min-width: 1.9rem; justify-content: center; padding-left: .4rem; padding-right: .4rem; }
.line-spec .input-group-text { min-width: 2.6rem; justify-content: center; padding-left: .4rem; padding-right: .4rem; font-size: .72rem; }
.line-disc .form-control, .line-spec .form-control { min-width: 0; }
.disc-pair input[type=number], .line-disc input[type=number] { -moz-appearance: textfield; appearance: textfield; }
.disc-pair input[type=number]::-webkit-inner-spin-button, .disc-pair input[type=number]::-webkit-outer-spin-button,
.line-disc input[type=number]::-webkit-inner-spin-button, .line-disc input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.form-section-title { font-size: .92rem; font-weight: 600; color: var(--crm-heading); display: flex; align-items: center; gap: .45rem; margin-bottom: .75rem; padding-bottom: .45rem; border-bottom: 1px dashed var(--crm-border); }
.form-section-title i { color: var(--crm-primary); }
.form-actions { display: flex; justify-content: flex-end; gap: .5rem; flex-wrap: wrap; }

/* Government fee multi-line picker */
.gov-fee-picker-head { justify-content: space-between; gap: .75rem; width: 100%; }
.gov-fee-picker-head > span { display: inline-flex; align-items: center; gap: .45rem; min-width: 0; }
.gov-fee-add { flex-shrink: 0; font-weight: 600; padding: .28rem .7rem; border-radius: 8px; line-height: 1.2; }
.gov-fee-rows { display: grid; gap: .85rem; }
.gov-fee-row {
    border: 1px solid var(--crm-border);
    border-radius: 12px;
    background: linear-gradient(180deg, #f8faff 0%, #fff 100%);
    padding: .85rem 1rem .9rem;
}
.gov-fee-row-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin-bottom: .55rem;
    min-height: 32px;
}
.gov-fee-row-label {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #667085;
}
.gov-fee-row .form-label { font-size: .78rem; margin-bottom: .28rem; color: #344054; }
.gov-fee-row .form-select { background-color: #fff; }
.gov-fee-row-meta {
    margin-top: .65rem;
    padding-top: .55rem;
    border-top: 1px dashed var(--crm-border);
    font-size: .8rem;
    color: #667085;
}
.gov-fee-row-meta strong { color: var(--crm-heading); font-weight: 600; }
.gov-fee-hint { margin-top: .65rem; margin-bottom: 0; }
.gov-fee-row .gov-fee-remove { width: 30px; height: 30px; border-radius: 8px; }

.source-option { cursor: pointer; border: 2px solid var(--crm-border); border-radius: 10px; padding: .55rem .8rem; display: flex; gap: .7rem; align-items: center; transition: all .15s; height: 100%; }
.source-option:hover { border-color: #c7d3ff; }
.btn-check:checked + .source-option { border-color: var(--crm-primary); background: var(--crm-primary-soft); }
.source-option .icon { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; }

.upload-zone { border: 2px dashed #c7d3ff; border-radius: 12px; padding: 1.5rem; text-align: center; background: #f8faff; cursor: pointer; transition: all .15s; }
.upload-zone:hover, .upload-zone.dragover { background: var(--crm-primary-soft); border-color: var(--crm-primary); }
.upload-zone i { font-size: 2rem; color: var(--crm-primary); }
.file-chip { display: flex; align-items: center; gap: .75rem; border: 1px solid var(--crm-border); border-radius: 10px; padding: .65rem .85rem; background: #fff; }
.identity-doc { border: 1px solid var(--crm-border); border-radius: 12px; background: #fff; overflow: hidden; height: 100%; display: flex; flex-direction: column; }
.identity-doc-label { font-size: .8rem; font-weight: 600; color: #344054; padding: .55rem .85rem; background: #f8fafc; border-bottom: 1px solid var(--crm-border); }
.identity-doc .file-chip { border: 0; border-radius: 0; flex: 1; }
.file-chip i { font-size: 1.5rem; }
.multi-upload-list { display: grid; gap: .5rem; }
.multi-upload-list:empty { display: none; }
.multi-upload-list .file-chip { padding: .5rem .75rem; }
.multi-upload-list .file-chip i { font-size: 1.25rem; }
.multi-upload-current.is-replaced .multi-upload-list { opacity: .45; }
.multi-upload-current.is-replaced .multi-upload-note { color: var(--crm-danger); font-weight: 500; }

/* Line items */
.line-items-table { min-width: 1100px; }
.line-items-table[data-mode="sales"] { min-width: 1240px; }
.line-items-table th, .line-items-table td { padding: .28rem .2rem !important; }
.line-items-table td { vertical-align: top; }
.line-items-table td.row-index { padding-top: .5rem !important; padding-left: .55rem !important; }
.line-items-table .form-control, .line-items-table .form-select { min-width: 0; }
.line-items-table .form-control-sm, .line-items-table .form-select-sm { padding: .22rem .4rem; font-size: .8125rem; }
.line-items-table .form-select-sm { padding-right: 1.15rem; background-position: right .3rem center; }
.line-items-table .line-spec,
.line-items-table .line-disc { display: flex; flex-direction: column; gap: 0; }
.line-items-table .line-spec .input-group + .input-group,
.line-items-table .line-disc .input-group + .input-group { margin-top: -1px; }
.line-items-table .line-spec .input-group:first-child .form-control,
.line-items-table .line-spec .input-group:first-child .input-group-text,
.line-items-table .line-disc .input-group:first-child .form-control,
.line-items-table .line-disc .input-group:first-child .input-group-text { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.line-items-table .line-spec .input-group:last-child .form-control,
.line-items-table .line-spec .input-group:last-child .input-group-text,
.line-items-table .line-disc .input-group:last-child .form-control,
.line-items-table .line-disc .input-group:last-child .input-group-text { border-top-left-radius: 0; border-top-right-radius: 0; }
.line-items-table .line-spec .input-group-text { min-width: 2.2rem; padding: .22rem .3rem; }
.line-items-table .line-disc .input-group-text { min-width: 1.6rem; padding: .22rem .3rem; }
.line-items-table [data-name="hsn"] { min-width: 4.6rem !important; width: 4.6rem; }
.line-items-table [data-name="qty"] { min-width: 3.4rem !important; width: 3.4rem; text-align: center; }
.line-items-table [data-name="rate"] { min-width: 5.4rem !important; width: 5.4rem; }
.line-items-table [data-name="gst"] { min-width: 4.15rem !important; width: 4.15rem; padding-left: .3rem; padding-right: 1.1rem; }
.line-items-table [data-name="qty"],
.line-items-table [data-name="rate"] { appearance: textfield; -moz-appearance: textfield; }
.line-items-table [data-name="qty"]::-webkit-outer-spin-button,
.line-items-table [data-name="qty"]::-webkit-inner-spin-button,
.line-items-table [data-name="rate"]::-webkit-outer-spin-button,
.line-items-table [data-name="rate"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.line-items-table .line-total { font-weight: 600; padding-top: .5rem !important; white-space: nowrap; }
.line-items-table .btn-icon { width: 28px; height: 28px; padding: 0; }
.totals-box { background: #f8faff; border: 1px solid var(--crm-border); border-radius: 10px; padding: .65rem .95rem; font-size: .875rem; }
.totals-box .row-line { display: flex; justify-content: space-between; padding: .14rem 0; }
.totals-box .grand { border-top: 1px dashed #c7d3ff; margin-top: .3rem; padding-top: .4rem; font-size: 1.05rem; font-weight: 700; color: var(--crm-primary); }

/* ---------- Tabs ---------- */
.nav-tabs-crm { border-bottom: 1px solid var(--crm-border); gap: .25rem; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; }
.nav-tabs-crm .nav-link { border: 0; border-bottom: 2px solid transparent; color: var(--crm-muted); font-weight: 500; padding: .8rem 1rem; white-space: nowrap; border-radius: 0; }
.nav-tabs-crm .nav-link:hover { color: var(--crm-primary); }
.nav-tabs-crm .nav-link.active { color: var(--crm-primary); border-bottom-color: var(--crm-primary); background: transparent; }
.nav-tabs-crm .nav-link .badge { margin-left: .35rem; }

.nav-pills-crm .nav-link { color: var(--crm-muted); font-weight: 500; border-radius: 10px; padding: .45rem .9rem; border: 1px solid var(--crm-border); background: #fff; margin: 0 .35rem .35rem 0; }
.nav-pills-crm .nav-link.active { background: var(--crm-primary); border-color: var(--crm-primary); color: #fff; }

/* ---------- Profile ---------- */
.profile-hero { background: linear-gradient(120deg, #2f5bea 0%, #5a7dff 60%, #7fa0ff 100%); border-radius: var(--crm-radius); color: #fff; padding: 1.5rem; position: relative; overflow: hidden; }
.profile-hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 240px; height: 240px; border-radius: 50%; background: rgba(255, 255, 255, .08); }
.profile-hero h3, .profile-hero h4 { color: #fff; }
.profile-hero .avatar { background: rgba(255, 255, 255, .2); color: #fff; }
.profile-hero .meta { opacity: .85; font-size: .82rem; }

/* Single-column pages: the side column drops below the main one at full width. */
.page-single > [class*="col-"] { flex: 0 0 auto; width: 100%; }
.page-single .position-sticky { position: static !important; }
.page-single .detail-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); column-gap: 2rem; }
.page-single .detail-list .item:last-child { border-bottom: 1px dashed var(--crm-border); }
.page-single .detail-list dt { width: 40%; }
.page-single .d-grid.gap-2, .page-single .card-body.d-grid { display: flex !important; flex-wrap: wrap; gap: .5rem; }
.page-single .d-grid.gap-2 > .btn, .page-single .card-body.d-grid > .btn { min-width: 170px; }
form .page-single .d-grid.gap-2, form .page-single .card-body.d-grid { flex-direction: row-reverse; justify-content: flex-start; }
form .page-single .card-body > .d-flex.justify-content-between,
form .page-single .card-body > .mb-3 > .d-flex.justify-content-between,
form .page-single .card-body > .mb-3.small,
.page-single .totals-box { max-width: 480px; margin-left: auto; }
.page-single .card-body > .btn.w-100 { width: auto !important; }

.you-saved { display: flex; align-items: center; gap: .45rem; margin-top: .6rem; padding: .45rem .75rem; border-radius: 8px; background: #ecfdf3; color: #067647; font-size: .85rem; font-weight: 600; border: 1px dashed #75e0a7; }
.you-saved i { font-size: .95rem; }
.summary-inline .you-saved { padding: .2rem .6rem; font-size: .8rem; }
.inv .you-saved { margin-top: 8px; font-size: 12px; padding: 6px 10px; }

.select2-sub { font-size: .76rem; color: var(--crm-muted); margin-top: .1rem; }
.select2-results__option .select2-sub { color: var(--crm-muted); }
.select2-results__option--highlighted .select2-sub { color: var(--crm-primary-dark); opacity: .75; }
.select2-results__option.select2-results__option--selected .select2-sub { color: #fff; opacity: .85; }
.machine-address { margin-top: .4rem; font-size: .8rem; color: var(--crm-heading); }
.machine-address i { color: var(--crm-primary); }
.machine-address.text-muted i { color: inherit; }

.machine-cert-head { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin-bottom: .9rem; padding-bottom: .75rem; border-bottom: 1px dashed var(--crm-border); }
.machine-cert-num { width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--crm-primary-soft); color: var(--crm-primary); font-weight: 700; }
.machine-cert-head .text-heading { color: var(--crm-heading); }
.machine-cert-no { width: 260px; max-width: 100%; }
@media (max-width: 575.98px) { .machine-cert-no { width: 100%; } }

#customerLoginCard .login-head { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; }
#customerLoginCard .login-icon { width: 42px; height: 42px; border-radius: 11px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--crm-primary-soft); color: var(--crm-primary); font-size: 1.05rem; }
#customerLoginCard .login-title { font-weight: 600; color: var(--crm-heading); font-size: .95rem; }
#customerLoginCard .login-text { font-size: .82rem; color: var(--crm-muted); margin-top: .1rem; }
#customerLoginCard .login-switch { display: inline-flex; align-items: center; gap: .55rem; margin: 0; padding: .45rem .85rem; border: 1px solid var(--crm-border); border-radius: 999px; cursor: pointer; white-space: nowrap; transition: all .15s; }
#customerLoginCard .login-switch:hover { border-color: #c7d3ff; }
#customerLoginCard .login-switch:has(input:checked) { border-color: var(--crm-primary); background: var(--crm-primary-soft); color: var(--crm-primary); }
#customerLoginCard .login-switch .form-check-input { margin: 0; cursor: pointer; }
#customerLoginCard .login-switch .form-switch { padding-left: 2.5em; min-height: 0; }
#customerLoginCard .login-switch .form-switch .form-check-input { margin-left: -2.5em; }
#customerLoginCard .login-badge { white-space: normal; padding: .45rem .7rem; }
#customerLoginCard .login-fields { margin-top: .5rem; padding-top: 1rem; border-top: 1px dashed var(--crm-border); }

/* Save / Cancel bar at the end of a form; stays in view while scrolling. */
.form-actions-bar {
    position: sticky; bottom: 0; z-index: 5;
    display: flex; flex-wrap: wrap; align-items: center; gap: .75rem;
    padding: .55rem 1rem; margin-top: .25rem;
    background: rgba(255, 255, 255, .96); backdrop-filter: blur(6px);
    border: 1px solid var(--crm-border); border-radius: .75rem;
    box-shadow: 0 -6px 18px rgba(15, 23, 42, .06);
}
.form-actions-bar .btn { min-width: 110px; }
.summary-inline { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem 1.2rem; font-size: .875rem; }
.summary-inline b { color: var(--crm-heading); font-weight: 600; }
.summary-inline .total b { color: var(--crm-primary); font-size: 1.05rem; font-weight: 700; }
@media (max-width: 575.98px) {
    .form-actions-bar > .d-flex { width: 100%; }
    .form-actions-bar .btn { flex: 1; min-width: 0; }
}

.detail-list { margin: 0; }
.detail-list .item { display: flex; padding: .6rem 0; border-bottom: 1px dashed var(--crm-border); gap: 1rem; }
.detail-list .item:last-child { border-bottom: 0; }
.detail-list dt { width: 42%; flex-shrink: 0; color: var(--crm-muted); font-weight: 500; }
.detail-list dd { margin: 0; color: var(--crm-heading); font-weight: 500; word-break: break-word; }

/* Timeline */
.timeline { position: relative; padding-left: 1.75rem; margin: 0; list-style: none; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 4px; bottom: 4px; width: 2px; background: var(--crm-border); }
.timeline li { position: relative; padding-bottom: 1.25rem; }
.timeline li:last-child { padding-bottom: 0; }
.timeline .tl-dot { position: absolute; left: -1.75rem; top: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 2px solid var(--crm-border); display: flex; align-items: center; justify-content: center; font-size: .55rem; }
.timeline li.done .tl-dot { background: var(--crm-success); border-color: var(--crm-success); color: #fff; }
.timeline li.current .tl-dot { background: var(--crm-primary); border-color: var(--crm-primary); color: #fff; box-shadow: 0 0 0 4px rgba(47, 91, 234, .18); }

/* Renewal stepper */
.stepper { display: flex; justify-content: space-between; position: relative; gap: .25rem; overflow-x: auto; padding-bottom: .25rem; }
.stepper .step { flex: 1; text-align: center; position: relative; min-width: 90px; }
.stepper .step::before { content: ""; position: absolute; top: 18px; left: -50%; width: 100%; height: 3px; background: var(--crm-border); z-index: 0; }
.stepper .step:first-child::before { display: none; }
.stepper .step .circle { width: 38px; height: 38px; border-radius: 50%; background: #fff; border: 3px solid var(--crm-border); display: inline-flex; align-items: center; justify-content: center; position: relative; z-index: 1; color: #98a2b3; font-size: .85rem; }
.stepper .step .label { font-size: .74rem; margin-top: .45rem; color: var(--crm-muted); font-weight: 500; line-height: 1.25; }
.stepper .step.done::before, .stepper .step.current::before { background: var(--crm-success); }
.stepper .step.done .circle { background: var(--crm-success); border-color: var(--crm-success); color: #fff; }
.stepper .step.current .circle { border-color: var(--crm-primary); background: var(--crm-primary); color: #fff; box-shadow: 0 0 0 5px rgba(47, 91, 234, .15); }
.stepper .step.done .label, .stepper .step.current .label { color: var(--crm-heading); font-weight: 600; }
.stepper.cancelled .step .circle { opacity: .5; }

.progress { background: #eef1f7; border-radius: 10px; }
.progress-thin { height: 6px; }

/* Reminder buckets */
.bucket-card { cursor: pointer; border: 2px solid transparent; transition: all .15s; }
.bucket-card:hover { box-shadow: var(--crm-shadow-lg); }
.bucket-card.active { border-color: var(--crm-primary); box-shadow: 0 0 0 4px rgba(47, 91, 234, .1); }

/* Report cards */
.report-tile { display: flex; gap: 1rem; align-items: flex-start; height: 100%; padding: 1.25rem; color: inherit; transition: all .15s; }
.report-tile:hover { box-shadow: var(--crm-shadow-lg); color: inherit; }

/* Empty state */
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--crm-muted); }
.empty-state i { font-size: 2.5rem; color: #d0d5dd; margin-bottom: .75rem; }

/* Dropdowns */
.dropdown-menu { border: 1px solid var(--crm-border); border-radius: 12px; box-shadow: var(--crm-shadow-lg); padding: .4rem; font-size: .85rem; }
.dropdown-item { border-radius: 8px; padding: .5rem .75rem; display: flex; align-items: center; gap: .6rem; }
.dropdown-item i { width: 16px; color: var(--crm-muted); }
.dropdown-item:active { background: var(--crm-primary); }
.dropdown-item:active i { color: #fff; }
.notif-menu { width: 340px; }
.notif-item { display: flex; gap: .75rem; padding: .65rem .75rem; border-radius: 10px; color: inherit; }
.notif-item:hover { background: #f5f7ff; color: inherit; }

/* Modals */
.modal-content { border: 0; border-radius: 16px; box-shadow: var(--crm-shadow-lg); }
.modal-header { border-bottom: 1px solid var(--crm-border); padding: .8rem 1.1rem; }
.modal-footer { border-top: 1px solid var(--crm-border); padding: .65rem 1.1rem; }
.modal-body { padding: 1rem 1.1rem; }
.modal-title { font-size: 1.05rem; font-weight: 600; }

/* SweetAlert */
.swal2-popup { border-radius: 16px !important; font-family: var(--bs-body-font-family); }
.swal2-styled.swal2-confirm { background: var(--crm-primary) !important; border-radius: 10px !important; }
.swal2-styled.swal2-cancel { border-radius: 10px !important; }

/* Charts */
.chart-box { position: relative; height: 290px; }
.chart-box-sm { position: relative; height: 240px; }

/* =====================================================================
   A4 documents (invoice, receipt, certificate)
   ===================================================================== */
.document-toolbar { position: sticky; top: calc(var(--crm-header-height) + .5rem); z-index: 5; }
.document-wrapper { background: #e9ecf3; border-radius: var(--crm-radius); padding: 2rem 1rem; overflow-x: auto; }
.a4-page { width: 210mm; min-height: 297mm; margin: 0 auto; background: #fff; box-shadow: 0 10px 40px rgba(16, 24, 40, .15); padding: 14mm 14mm 12mm; color: #1d2939; font-size: 12.5px; position: relative; }
.a4-page.receipt { min-height: auto; }
/* While saving as PDF: no shadow, and a hair under A4 so it never spills onto a blank second page. */
.a4-page.pdf-export { box-shadow: none; margin: 0; min-height: 296mm; }
.a4-page.receipt.pdf-export { min-height: auto; }
.doc-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding-bottom: 1rem; border-bottom: 3px solid var(--crm-primary); }
.doc-logo { width: 58px; height: 58px; border-radius: 14px; background: linear-gradient(135deg, var(--crm-primary), #6a8bff); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; }
.doc-logo:has(img) { background: none; border-radius: 0; }
.doc-logo img { border-radius: 0 !important; }
.doc-company { font-size: 1.25rem; font-weight: 800; color: var(--crm-heading); margin: 0; }
.doc-title { font-size: 1.6rem; font-weight: 800; color: var(--crm-primary); letter-spacing: .04em; text-transform: uppercase; margin: 0; text-align: right; }
.doc-meta td { padding: 2px 0 2px 12px; }
.doc-meta td:first-child { color: var(--crm-muted); }
.doc-box { border: 1px solid var(--crm-border); border-radius: 10px; padding: .8rem 1rem; height: 100%; }
.doc-box h6 { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--crm-muted); margin-bottom: .4rem; }
.doc-table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.doc-table th { background: var(--crm-primary); color: #fff; font-weight: 600; font-size: 11px; text-transform: uppercase; padding: 8px; text-align: left; }
.doc-table td { padding: 8px; border-bottom: 1px solid var(--crm-border); vertical-align: top; }
.doc-table .num { text-align: right; white-space: nowrap; }
.doc-totals { width: 100%; }
.doc-totals td { padding: 4px 0; }
.doc-totals td:last-child { text-align: right; font-weight: 600; }
.doc-totals .grand td { border-top: 2px solid var(--crm-primary); padding-top: 8px; font-size: 15px; font-weight: 800; color: var(--crm-primary); }
.doc-stamp { position: absolute; top: 46%; left: 50%; transform: translate(-50%, -50%) rotate(-18deg); font-size: 64px; font-weight: 900; letter-spacing: .1em; opacity: .07; pointer-events: none; }
.doc-signature { text-align: center; margin-top: 2.5rem; }
.doc-signature .line { border-top: 1px solid #98a2b3; width: 200px; margin: 0 auto .3rem; }
.doc-signature .sign { font-family: 'Brush Script MT', 'Segoe Script', cursive; font-size: 26px; color: var(--crm-primary-dark); height: 36px; }
.doc-footer { margin-top: 1.5rem; padding-top: .75rem; border-top: 1px solid var(--crm-border); text-align: center; font-size: 11px; color: var(--crm-muted); }

/* Tax invoice */
.inv { display: flex; flex-direction: column; font-size: 12.5px; line-height: 1.55; color: #344054; padding: 16mm 16mm 12mm; }
.inv b { color: #101828; font-weight: 600; }
.inv-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1.5rem; padding-bottom: 1.25rem; border-bottom: 1px solid #e4e7ec; }
.inv-brand { display: flex; gap: .9rem; color: #667085; }
.inv-brand .doc-logo { width: 52px; height: 52px; border-radius: 12px; font-size: 1.4rem; flex-shrink: 0; }
.inv-brand .doc-logo:has(img) { width: 60px; height: 60px; border-radius: 0; }
.doc-wordmark { display: block; height: 62px; width: auto; max-width: 260px; object-fit: contain; margin-bottom: 6px; }
.inv-company { font-size: 17px; font-weight: 700; color: #101828; margin-bottom: 2px; }
.inv-title { text-align: right; flex-shrink: 0; white-space: nowrap; }
.inv-label { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--crm-primary); }
.inv-no { font-size: 22px; font-weight: 700; color: #101828; line-height: 1.3; margin-bottom: 6px; }
.inv-status { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.inv-status-paid { background: #ecfdf3; color: #067647; }
.inv-status-partial { background: #fffaeb; color: #b54708; }
.inv-status-unpaid { background: #fef3f2; color: #b42318; }
.inv-caption { font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #98a2b3; margin-bottom: 4px; }
.inv-info { display: flex; justify-content: space-between; gap: 2rem; padding: 1.25rem 0; }
.inv-party { font-size: 14px; font-weight: 700; color: #101828; }
.inv-info-3 { display: grid; grid-template-columns: 1.15fr 1fr .95fr; gap: 1.5rem; }
.inv-info-3 .inv-col { min-width: 0; line-height: 1.6; }
.inv-info-3 .inv-party { font-size: 13px; margin-bottom: 2px; }
.inv-col-title { font-size: 13px; font-weight: 700; color: #101828; margin-bottom: 4px; }
.inv-col-right { text-align: right; }
.inv-dates { display: grid; grid-template-columns: auto auto; gap: 4px 1.5rem; margin: 0; align-content: start; white-space: nowrap; }
.inv-dates dt { font-weight: 400; color: #98a2b3; }
.inv-dates dd { margin: 0; text-align: right; font-weight: 600; color: #101828; }
.inv-table { width: 100%; border-collapse: collapse; }
.inv-table th { background: #f2f4f7; color: #475467; font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; padding: 9px 10px; text-align: left; }
.inv-table th:first-child { border-radius: 8px 0 0 8px; }
.inv-table th:last-child { border-radius: 0 8px 8px 0; }
.inv-table td { padding: 11px 10px; border-bottom: 1px solid #eaecf0; vertical-align: top; }
.inv-table .num { text-align: right; white-space: nowrap; }
.inv-table .inv-sr { width: 34px; color: #98a2b3; }
.inv-item { font-weight: 600; color: #101828; }
.inv-sub { font-size: 11px; color: #98a2b3; }
.inv-details { font-size: 11.5px; color: #475467; margin-top: 2px; line-height: 1.45; }
.inv-specs { margin-top: 4px; }
.inv-spec-row { display: flex; gap: 1.25rem; font-size: 11.5px; color: #475467; line-height: 1.5; }
.inv-spec-row span { flex: 1; min-width: 0; }
.inv-table .inv-hsn { white-space: nowrap; color: #344054; }
.inv-summary { display: flex; justify-content: space-between; gap: 2rem; margin-top: 1.25rem; }
.inv-notes { flex: 1; color: #667085; }
.inv-words { font-weight: 600; color: #101828; }
.inv-totals { width: 46%; border-collapse: collapse; align-self: flex-start; }
.inv-totals td { padding: 4px 0; color: #667085; }
.inv-totals td:last-child { text-align: right; font-weight: 600; color: #101828; white-space: nowrap; }
.inv-totals .inv-grand td { padding: 10px 12px; margin-top: 6px; background: var(--crm-primary); color: #fff; font-size: 15px; font-weight: 700; }
.inv-totals .inv-grand td:first-child { border-radius: 8px 0 0 8px; }
.inv-totals .inv-grand td:last-child { border-radius: 0 8px 8px 0; color: #fff; }
.inv-totals .inv-grand + tr td { padding-top: 10px; }
.inv-totals .inv-due td { font-weight: 700; color: #b42318 !important; }
.inv-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 2rem; margin-top: auto; padding-top: 2rem; }
.inv-terms { flex: 1; font-size: 11px; color: #667085; }
.inv-terms ol { padding-left: 1rem; margin: 0; }
.inv-sign { margin-top: 0; min-width: 200px; }
.inv-thanks { margin-top: 1.25rem; padding-top: .75rem; border-top: 1px solid #eaecf0; text-align: center; font-size: 11px; color: #98a2b3; }

/* Calibration certificate */
.cert-page { border: 10px double #2f5bea; padding: 12mm; min-height: 270mm; background: radial-gradient(circle at 50% 40%, #f5f8ff 0%, #ffffff 70%); }
.cert-title { font-family: Georgia, 'Times New Roman', serif; font-size: 30px; font-weight: 700; color: var(--crm-primary-dark); text-align: center; letter-spacing: .06em; margin: 0; }
.cert-seal { width: 110px; height: 110px; border-radius: 50%; border: 4px solid var(--crm-primary); display: flex; align-items: center; justify-content: center; flex-direction: column; color: var(--crm-primary); font-weight: 800; font-size: 11px; text-align: center; transform: rotate(-12deg); }
.cert-table { width: 100%; border-collapse: collapse; }
.cert-table td { border: 1px solid #c7d3ff; padding: 7px 10px; }
.cert-table td:nth-child(odd) { background: #f5f8ff; color: var(--crm-muted); font-weight: 600; width: 22%; }

.pdf-frame { width: 100%; height: 72vh; border: 0; border-radius: 10px; background: #525659; }

/* =====================================================================
   Print
   ===================================================================== */
@media print {
    @page { size: A4; margin: 0; }
    body { background: #fff !important; }
    .crm-sidebar, .crm-header, .crm-footer, .no-print, .page-header, .document-toolbar, .crm-backdrop { display: none !important; }
    .crm-main { margin: 0 !important; }
    .crm-content { padding: 0 !important; }
    .document-wrapper { background: none !important; padding: 0 !important; border-radius: 0; }
    .a4-page { box-shadow: none !important; margin: 0 !important; width: 100% !important; }
    .card { box-shadow: none !important; border: 0 !important; }
    .doc-table th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .print-area { display: block !important; }
    .dt-toolbar, .dt-footer, .dataTables_filter, .dataTables_length, .dataTables_paginate { display: none !important; }
    * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Step Wizard */
.step-indicator {
    display: flex;
    align-items: center;
    gap: .6rem;
    opacity: .45;
    transition: opacity .25s;
}
.step-indicator.active,
.step-indicator.done { opacity: 1; }
.step-num {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--crm-border);
    color: var(--crm-muted);
    font-weight: 700;
    font-size: .875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .25s, color .25s;
    flex-shrink: 0;
}
.step-indicator.active .step-num {
    background: var(--crm-primary);
    color: #fff;
    box-shadow: 0 0 0 4px var(--crm-primary-soft);
}
.step-indicator.done .step-num {
    background: var(--crm-success);
    color: #fff;
}
.step-indicator.done .step-num::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: .75rem;
}
.step-label {
    font-weight: 600;
    font-size: .875rem;
    color: var(--crm-text);
}
.step-connector {
    flex: 1;
    max-width: 80px;
    height: 2px;
    background: var(--crm-border);
    border-radius: 2px;
}

/* Login */
.auth-wrapper { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero { background: linear-gradient(140deg, #1f44c4 0%, #2f5bea 50%, #5a7dff 100%); color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-hero::before { content: ""; position: absolute; width: 420px; height: 420px; border-radius: 50%; background: rgba(255, 255, 255, .07); right: -120px; top: -120px; }
.auth-hero h1 { color: #fff; font-size: 2.2rem; font-weight: 800; }
.auth-feature { display: flex; gap: .85rem; align-items: center; margin-bottom: 1rem; }
.auth-feature i { width: 40px; height: 40px; border-radius: 12px; background: rgba(255, 255, 255, .15); display: flex; align-items: center; justify-content: center; }
.auth-logo { display: inline-flex; background: #fff; border-radius: 16px; padding: .6rem 1.1rem; box-shadow: 0 10px 30px rgba(16, 24, 40, .18); }
.auth-logo img { height: 64px; width: auto; display: block; }
.auth-form-logo { height: 58px; width: auto; display: block; margin: 0 auto 1.5rem; }
.crm-footer-logo { height: 26px; width: auto; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 2rem; background: #fff; }
@media (max-width: 991.98px) { .auth-wrapper { grid-template-columns: 1fr; } .auth-hero { display: none; } }

/* Searchable dropdowns (Select2, Bootstrap 5 theme) */
.select2-container--bootstrap-5 .select2-selection { min-height: calc(1.45em + .76rem + 2px); padding: .38rem 2rem .38rem .72rem; font-size: .9rem; border-radius: 8px; border-color: #d0d5dd; }
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered { line-height: 1.45; }
.select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option { padding: .38rem .72rem; font-size: .875rem; }
.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection { border-color: var(--crm-primary); box-shadow: 0 0 0 .2rem rgba(47, 91, 234, .15); }
.select2-container--bootstrap-5 .select2-dropdown { border-color: var(--crm-primary); box-shadow: 0 8px 24px rgba(16, 24, 40, .12); z-index: 1060; }
.select2-container--bootstrap-5 .select2-dropdown .select2-results__option--highlighted[aria-selected],
.select2-container--bootstrap-5 .select2-dropdown .select2-results__option--highlighted { background-color: var(--crm-primary-soft); color: var(--crm-primary-dark); }
.select2-container--bootstrap-5 .select2-dropdown .select2-results__option--selected { background-color: var(--crm-primary); color: #fff; }
.select2-container--bootstrap-5 .select2-dropdown .select2-search .select2-search__field:focus { border-color: var(--crm-primary); box-shadow: none; }
.select2-container--bootstrap-5.select2-container--disabled .select2-selection { background-color: var(--bs-secondary-bg, #e9ecef); }
.was-validated select:invalid + .select2-container .select2-selection,
select.is-invalid + .select2-container .select2-selection { border-color: var(--crm-danger) !important; }
.was-validated select:valid:required + .select2-container .select2-selection { border-color: var(--crm-success); }
.input-group > .select2-container--bootstrap-5 { flex: 1 1 auto; width: 1% !important; }
.input-group > .select2-container--bootstrap-5:not(:last-child) .select2-selection { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group > .select2-container--bootstrap-5:not(:first-child) .select2-selection { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.dt-toolbar .select2-container, .card-header .select2-container { min-width: 175px; }

/* Custom multi machine picker (matches form-select / Select2 single look) */
select.machine-multi-select {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    border: 0 !important;
}
.machine-picker {
    position: relative;
}
.machine-picker-toggle {
    display: flex;
    align-items: center;
    width: 100%;
    text-align: left;
    cursor: pointer;
}
.machine-picker-toggle .machine-picker-label {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #6c757d;
    font-weight: 400;
}
.machine-picker-toggle.is-filled .machine-picker-label {
    color: var(--crm-heading, #101828);
    font-weight: 600;
}
.machine-picker.is-open .machine-picker-toggle {
    border-color: var(--crm-primary);
    box-shadow: 0 0 0 .2rem rgba(47, 91, 234, .15);
}
select.machine-multi-select.is-invalid + .machine-picker .machine-picker-toggle,
.was-validated select.machine-multi-select:invalid + .machine-picker .machine-picker-toggle {
    border-color: var(--crm-danger) !important;
}
.machine-picker-menu {
    position: absolute;
    top: calc(100% + .35rem);
    left: 0;
    right: 0;
    z-index: 1060;
    display: none;
    max-height: 18rem;
    overflow: auto;
    padding: .4rem;
    background: #fff;
    border: 1px solid var(--crm-primary);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(16, 24, 40, .12);
}
.machine-picker.is-open .machine-picker-menu {
    display: block;
}
.machine-picker-search {
    margin-bottom: .35rem;
}
.machine-picker-option {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    margin: 0;
    padding: .55rem .65rem;
    border-radius: 8px;
    cursor: pointer;
}
.machine-picker-option:hover {
    background: var(--crm-primary-soft);
}
.machine-picker-option.is-checked {
    background: #eef3ff;
}
.machine-picker-option input {
    margin-top: .2rem;
    flex-shrink: 0;
}
.machine-picker-option-title {
    display: block;
    font-size: .875rem;
    font-weight: 600;
    color: var(--crm-heading, #101828);
    line-height: 1.25;
}
.machine-picker-option-meta {
    display: block;
    margin-top: .1rem;
    font-size: .75rem;
    color: var(--crm-muted, #667085);
    line-height: 1.3;
}
.machine-picker-empty {
    padding: .85rem .65rem;
    font-size: .85rem;
    color: var(--crm-muted, #667085);
}

.machine-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    margin-top: .55rem;
}
.machine-chip {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    max-width: 100%;
    padding: .35rem .45rem .35rem .65rem;
    border: 1px solid #dbe3f5;
    border-radius: 10px;
    background: #f5f8ff;
    color: var(--crm-heading, #101828);
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
.machine-chip-main {
    display: flex;
    flex-direction: column;
    gap: .05rem;
    min-width: 0;
}
.machine-chip-title {
    font-size: .82rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}
.machine-chip-meta {
    font-size: .72rem;
    color: var(--crm-muted, #667085);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 16rem;
}
.machine-chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.45rem;
    height: 1.45rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--crm-muted, #667085);
    line-height: 1;
    flex-shrink: 0;
}
.machine-chip-remove:hover {
    background: #fee4e2;
    color: var(--crm-danger, #d92d20);
}
.machine-chip-count {
    font-size: .75rem;
    font-weight: 600;
    color: var(--crm-primary);
    background: var(--crm-primary-soft);
    border-radius: 999px;
    padding: .2rem .55rem;
    align-self: center;
}
.dataTables_length select { min-width: 72px; padding-right: 2rem; }
.ledger-summary tbody tr[data-href] { cursor: pointer; }

/* Full-width sale summary */
.sale-summary .summary-tile { border: 1px solid var(--crm-border, #e4e7ec); border-radius: 12px; padding: .9rem 1rem; height: 100%; background: #fff; }
.sale-summary .summary-tile-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: #667085; font-weight: 600; }
.sale-summary .summary-tile-value { font-size: 1.35rem; font-weight: 700; color: #101828; margin-top: .25rem; }
.sale-summary .summary-tile-primary { background: var(--crm-primary-soft); border-color: transparent; }
.sale-summary .summary-tile-primary .summary-tile-value { color: var(--crm-primary); }
