:root {
    --erp-sidebar-width: 280px;
    --erp-sidebar-collapsed: 72px;
    --erp-header-height: 62px;
    --erp-sidebar-bg: #0f172a;
    --erp-sidebar-bg-2: #111c34;
    --erp-sidebar-color: #cbd5e1;
    --erp-sidebar-active: #2563eb;
    --erp-accent: #2563eb;
    --erp-content-bg: #f1f5f9;
    --erp-dropdown-z: 1045;
    --erp-modal-z: 1060;
    --erp-toast-z: 1090;
    --erp-toast-min-width: 450px;
    --erp-toast-success: #16a34a;
    --erp-toast-success-bar: #15803d;
    --erp-toast-error: #dc2626;
    --erp-toast-error-bar: #b91c1c;
    --erp-toast-warning: #f59e0b;
    --erp-toast-warning-bar: #d97706;
    --erp-toast-info: #2563eb;
    --erp-toast-info-bar: #1d4ed8;
}

[x-cloak] { display: none !important; }

body { background: var(--erp-content-bg); }

/* Hide spinner arrows for all modern browsers */

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* ---------- Table / card overflow (action menus) ---------- */
.erp-card,
.erp-content .card {
    overflow: visible;
}

.erp-card > .table-responsive,
.erp-content .table-responsive,
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive > .table {
    margin-bottom: 0;
}

.mo-show-table > :not(caption) > * > * {
    padding-left: 1rem;
    padding-right: 1rem;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    vertical-align: middle;
}

.mo-show-table > thead > tr > th,
.mo-show-table > tbody > tr > td:not(.text-center) {
    white-space: nowrap;
}

.table td .dropdown,
.table th .dropdown,
.table-responsive .dropdown,
.erp-row-action-menu {
    position: relative;
}

.erp-row-action-menu .dropdown-menu,
.table .dropdown-menu,
.erp-card .dropdown-menu {
    z-index: var(--erp-dropdown-z);
}

.table thead th {
    position: relative;
    z-index: 2;
}

.modal {
    z-index: var(--erp-modal-z);
}

.modal-backdrop {
    z-index: calc(var(--erp-modal-z) - 5);
}
.btn-primary{ padding: 5px 10px !important; font-size: 12px; font-weight: 500; }
/* ---------- Layout shell ---------- */
.erp-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
    max-width: 100%;
}
tbody, td, tfoot, th, thead, tr, p { font-size: 14px; }
.h4, h4 { font-size: calc(0.775rem + .3vw); }
.erp-sidebar {
    width: var(--erp-sidebar-width);
    background: linear-gradient(180deg, var(--erp-sidebar-bg) 0%, var(--erp-sidebar-bg-2) 100%);
    color: var(--erp-sidebar-color);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: width .2s ease, transform .2s ease;
    overflow: hidden;
}

.erp-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    margin-left: var(--erp-sidebar-width);
    transition: margin-left .2s ease;
}

.sidebar-collapsed .erp-sidebar { width: var(--erp-sidebar-collapsed); }
.sidebar-collapsed .erp-main { margin-left: var(--erp-sidebar-collapsed); }
/* Hide labels in the icon rail only — not inside hover fly-out panels */
.sidebar-collapsed .erp-sidebar .erp-nav > ul > .erp-nav-item > .erp-nav-link .erp-menu-text,
.sidebar-collapsed .erp-sidebar .erp-nav > ul > .erp-nav-item > .erp-nav-link .erp-menu-arrow,
.sidebar-collapsed .erp-sidebar .erp-menu-header,
.sidebar-collapsed .erp-sidebar .erp-brand .erp-brand-text { display: none; }
.sidebar-collapsed .erp-sidebar .erp-submenu:not(.erp-submenu--flyout) { display: none !important; }

/* ---------- Sidebar brand ---------- */
.erp-brand {
    height: var(--erp-header-height);
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: 0 1rem;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.06);
    flex-shrink: 0;
}
.erp-brand i { font-size: 1.5rem; color: var(--erp-accent); }
.erp-brand-logo-img { max-height: 36px; max-width: 140px; object-fit: contain; }
.sidebar-collapsed .erp-sidebar .erp-brand-logo-img { max-width: 36px; }
.erp-brand-text { font-weight: 700; font-size: 1.05rem; white-space: nowrap; }

/* ---------- Sidebar nav ---------- */
.erp-nav {
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    padding: .5rem 0;
    scrollbar-gutter: stable;
}
.erp-nav::-webkit-scrollbar { width: 10px; }
.erp-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 3px; }

.erp-menu-header {
    text-transform: uppercase;
    font-size: .68rem;
    letter-spacing: .08em;
    color: #64748b;
    padding: 1rem 1.25rem .35rem;
    font-weight: 600;
}

.erp-nav-item { list-style: none; }
.erp-nav-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .3rem 1rem;
    color: var(--erp-sidebar-color);
    text-decoration: none;
    border-left: 3px solid transparent;
    white-space: nowrap;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.erp-nav-link:hover { background: rgba(255,255,255,.05); color: #fff; }
.erp-nav-link i.erp-menu-icon { font-size: 14px; width: 1.25rem; text-align: center; }
.erp-nav-link.active {
    background: rgba(37,99,235,.15);
    color: #fff;
    border-left-color: var(--erp-sidebar-active);
}
.erp-menu-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 14px;
}
.erp-menu-arrow {
    flex-shrink: 0;
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    opacity: 1;
    visibility: visible;
    transition: transform .2s ease;
    font-size: .8rem;
}
.erp-nav-link.erp-nav-link--open .erp-menu-arrow,
.erp-nav-link[aria-expanded="true"] .erp-menu-arrow { transform: rotate(90deg); }

/* ---------- Submenus (multi-level) ---------- */
.erp-submenu { list-style: none; padding-left: 0; background: rgba(0,0,0,.18); }
.erp-submenu .erp-nav-link { padding-left: 2.0rem; font-size: .9rem; }
.erp-submenu .erp-submenu .erp-nav-link { padding-left: 3.9rem; }

/* ---------- Collapsed sidebar fly-out panels (desktop) ---------- */
.erp-sidebar-flyout {
    --erp-flyout-width: 250px;
    position: fixed;
    left: var(--erp-sidebar-collapsed);
    z-index: 1055;
    width: var(--erp-flyout-width);
    min-width: 240px;
    max-width: 260px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: .5rem;
    box-shadow:
        0 12px 28px rgba(2, 6, 23, .12),
        0 2px 6px rgba(2, 6, 23, .06);
    overflow-x: hidden;
    overflow-y: auto;
}

.erp-sidebar-flyout__header {
    padding: .65rem 1rem;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #64748b;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.erp-submenu--flyout {
    background: transparent;
    padding: .35rem 0;
}

.erp-submenu--flyout .erp-nav-item {
    position: relative;
}

.erp-submenu--flyout .erp-nav-link {
    color: #334155;
    border-left: 3px solid transparent;
    padding: .45rem 1rem;
    font-size: 14px;
}

.erp-submenu--flyout .erp-nav-link:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.erp-submenu--flyout .erp-nav-link.active {
    background: #eff6ff;
    color: #1d4ed8;
    border-left-color: var(--erp-sidebar-active);
}

.erp-submenu--flyout .erp-menu-arrow {
    color: #94a3b8;
    font-size: .75rem;
    display: inline-flex;
}

.sidebar-collapsed .erp-sidebar .erp-sidebar-flyout .erp-menu-text {
    display: inline;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-collapsed .erp-sidebar .erp-sidebar-flyout .erp-menu-icon {
    display: inline-block;
    width: 1.25rem;
    text-align: center;
}

.erp-sidebar-flyout--nested {
    position: absolute;
    left: calc(100% - 2px);
    top: 0;
    margin-left: 0;
}

.erp-nav-item--has-flyout > .erp-sidebar-flyout--nested {
    padding-top: .25rem;
    padding-bottom: .25rem;
}

@media (max-width: 991.98px) {
    .erp-sidebar-flyout {
        display: none !important;
    }
}

@media (min-width: 992px) {
    .sidebar-collapsed .erp-nav-item--has-flyout {
        position: static;
    }
}

/* ---------- Header ---------- */
.erp-header {
    height: var(--erp-header-height);
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1rem;
    position: sticky;
    top: 0;
    z-index: 1030;
}
.erp-header .erp-search { max-width: 420px; flex: 1; position: relative; }
.erp-header .erp-search-results {
    position: absolute; top: 110%; left: 0; right: 0;
    background: #fff; border: 1px solid #e2e8f0; border-radius: .5rem;
    box-shadow: 0 12px 28px rgba(2,6,23,.12); z-index: 1050; max-height: 420px; overflow-y: auto;
}

/* ---------- Unsaved changes guard modal ---------- */
#erpUnsavedModal.show {
    background: rgba(2, 6, 23, .55);
}
body.erp-guard-open {
    overflow: hidden;
}

/* ---------- Breadcrumb ---------- */
.erp-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
    background: transparent;
}
.erp-breadcrumb .erp-breadcrumb-home {
    display: inline-flex;
    align-items: center;
    color: var(--erp-accent);
    text-decoration: none;
    font-size: 1.05rem;
    line-height: 1;
}
.erp-breadcrumb .erp-breadcrumb-home:hover { color: #1d4ed8; }
.erp-breadcrumb .breadcrumb-separator { color: #94a3b8; line-height: 1; }
.erp-breadcrumb .erp-breadcrumb-link,
.erp-breadcrumb .erp-breadcrumb-text {
    color: #64748b;
    font-size: .95rem;
}
.erp-breadcrumb .erp-breadcrumb-link {
    text-decoration: none;
}
.erp-breadcrumb .erp-breadcrumb-link:hover { color: var(--erp-accent); }
.erp-breadcrumb .page-title {
    font-weight: 600;
    color: #0f172a;
    font-size: 1rem;
}

/* ---------- Content ---------- */
.erp-content {
    flex: 1;
    min-width: 0;
    width: 100%;
    max-width: 100%;
}
.erp-card { background: #fff; border: 1px solid #e2e8f0; border-radius: .75rem; }

/* Assign Production modal — visual step grouping only */
.assign-production-modal .assign-step {
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 0.375rem;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.assign-production-modal .assign-step:last-child {
    margin-bottom: 0;
}

.assign-production-modal .assign-step-heading {
    width: 100%;
    margin: 0;
    padding: 0.7rem 1rem;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.4;
    color: #334155;
    background-color: #eef3f8;
    border-bottom: 1px solid #dbe4ee;
}

.assign-production-modal .assign-step-body {
    padding: 1rem;
}

.assign-production-overlay {
    z-index: 1055;
}

.assign-operator-overlay {
    z-index: 1090;
}

.assign-production-modal .field-with-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.assign-production-modal .field-with-actions .dropdown-wrapper {
    flex: 1 1 0%;
    min-width: 0;
}

.assign-production-modal .field-with-actions > button {
    flex: 0 0 auto;
}

.assign-production-modal .field-with-actions .form-select {
    width: 100%;
    min-width: 0;
}

.assign-production-modal .assign-selected-count {
    font-size: 0.875rem;
    font-weight: 600;
    color: #0f172a;
    background: #e8f1fb;
    border: 1px solid #c5d7ee;
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    white-space: nowrap;
}

.assign-production-modal .assign-mo-item-table {
    max-height: 280px;
    overflow: auto;
}

.assign-production-modal .assign-mo-item-table table {
    white-space: nowrap;
}

.assign-production-modal .assign-confirm-summary {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    padding: 0.75rem 1rem;
}

.machine-exec-assignments {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.machine-exec-assignment {
    min-height: 1.35rem;
    line-height: 1.35rem;
    white-space: nowrap;
}

@media (max-width: 576px) {
    .assign-production-modal .assign-step-heading {
        padding: 0.65rem 0.85rem;
        font-size: 0.875rem;
    }

    .assign-production-modal .assign-step-body {
        padding: 0.85rem;
    }
}

/* Production Receipt — Warehouse & Execution (prevent Select2/long labels widening page) */
.production-receipt-execution {
    overflow: visible;
}

.production-receipt-execution .card-body,
.production-receipt-execution .warehouse-execution-grid,
.production-receipt-execution .warehouse-execution-column,
.production-receipt-execution .field-with-actions {
    overflow: visible;
}

.production-receipt-execution .warehouse-execution-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    width: 100%;
    max-width: 100%;
}

.production-receipt-execution .warehouse-execution-column {
    min-width: 0;
    width: 100%;
    max-width: 100%;
}

.production-receipt-execution .warehouse-execution-remarks {
    grid-column: 1 / -1;
    min-width: 0;
    width: 100%;
    max-width: 100%;
}

.production-receipt-execution .field-with-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.production-receipt-execution .dropdown-wrapper {
    position: relative;
    min-width: 0;
    max-width: 100%;
}

.production-receipt-execution .field-with-actions .dropdown-wrapper {
    flex: 1 1 0%;
    min-width: 0;
}

.production-receipt-execution .warehouse-execution-column > .dropdown-wrapper {
    width: 100%;
}

.production-receipt-execution .field-with-actions > button,
.production-operator-field .field-with-actions > button {
    flex: 0 0 auto;
}

.production-operator-field {
    overflow: visible;
}

.production-operator-field .field-with-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: visible;
}

.production-operator-field .dropdown-wrapper {
    position: relative;
    flex: 1 1 0%;
    min-width: 0;
    max-width: 100%;
}

.production-operator-field .dropdown-wrapper .select2-container--bootstrap-5.select2,
.production-operator-field .dropdown-wrapper .form-select {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
}

.mrqn-inline-master .field-with-actions > button {
    width: 38px;
    min-width: 38px;
    height: 38px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.mrqn-item-block {
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 0.5rem;
    background: #fff;
    overflow: hidden;
}

.mrqn-item-block + .mrqn-item-block {
    margin-top: 0.75rem;
}

.mrqn-item-block__header {
    padding: 0.7rem 1.15rem;
    background: #e8eef5;
    border-bottom: 1px solid #d5dee8;
}

.mrqn-item-block__qty-summary {
    padding: 0.85rem 1.15rem;
    background: #f6f8fb;
    border-bottom: 1px solid #e6ebf1;
}

.mrqn-item-block__details {
    padding: 1rem 1.15rem 1.15rem;
    background: #fff;
}

.pr-bag-product-strip {
    padding: 0.65rem 1.25rem;
    background: #f6f8fb;
    border-bottom: 1px solid #e6ebf1;
    color: #334155;
    font-size: 0.925rem;
    font-weight: 600;
}

.production-receipt-execution .dropdown-wrapper .select2-container--bootstrap-5.select2,
.production-receipt-execution .dropdown-wrapper .form-select {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
}

@media (max-width: 1100px) {
    .production-receipt-execution .warehouse-execution-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .production-receipt-execution .warehouse-execution-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Compact address accordions (Company / Party forms) */
.erp-address-accordion .card-header {
    cursor: default;
}
.erp-address-accordion .card-header .btn-link {
    line-height: 1.35;
}
.erp-address-accordion .form-label {
    margin-bottom: .25rem;
}
.erp-address-accordion .form-control-sm,
.erp-address-accordion .form-select-sm {
    min-height: calc(1.5em + .5rem + 2px);
}

/* ---------- Badges ---------- */
.erp-badge i { font-size: .5rem; vertical-align: middle; margin-right: .15rem; }

/* Standard ERP status badge palette (see App\Support\ErpStatusBadge) */
.erp-status-active { background-color: #198754 !important; color: #fff !important; }
.erp-status-inactive { background-color: #6c757d !important; color: #fff !important; }
.erp-status-locked { background-color: #ffc107 !important; color: #000 !important; }
.erp-status-pending { background-color: #fd7e14 !important; color: #fff !important; }
.erp-status-draft { background-color: #0d6efd !important; color: #fff !important; }
.erp-status-cancelled { background-color: #dc3545 !important; color: #fff !important; }

/* ---------- Employee summary ---------- */
.erp-avatar-placeholder {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.9rem;
    font-weight: 700;
    letter-spacing: .04em;
}
.erp-info-list dt {
    font-weight: 500;
    color: #64748b;
    padding-bottom: .6rem;
    font-size: .9rem;
}
.erp-info-list dd {
    font-weight: 500;
    color: #0f172a;
    padding-bottom: .6rem;
    margin-bottom: 0;
}
.erp-info-list dt:last-of-type,
.erp-info-list dd:last-of-type { padding-bottom: 0; }

/* ---------- Notifications (solid colored toasts) ---------- */
.erp-toast-stack {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: var(--erp-toast-z);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.75rem;
    min-width: var(--erp-toast-min-width);
    max-width: min(var(--erp-toast-min-width), calc(100vw - 2rem));
    pointer-events: none;
}

.erp-toast {
    pointer-events: auto;
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    width: 100%;
    min-width: var(--erp-toast-min-width);
    max-width: min(var(--erp-toast-min-width), calc(100vw - 2rem));
    padding: 1.125rem 1.125rem 1.25rem;
    color: #fff;
    border: 0;
    border-radius: 0.75rem;
    box-shadow:
        0 12px 24px -6px rgba(15, 23, 42, 0.28),
        0 6px 10px -4px rgba(15, 23, 42, 0.18);
    overflow: hidden;
}

.erp-toast--success { background: var(--erp-toast-success); }
.erp-toast--error   { background: var(--erp-toast-error); }
.erp-toast--warning { background: var(--erp-toast-warning); }
.erp-toast--info    { background: var(--erp-toast-info); }

.erp-toast__icon {
    flex-shrink: 0;
    width: 1.75rem;
    height: 1.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    line-height: 1;
    margin-top: 0.05rem;
    color: #fff;
}

.erp-toast__content {
    flex: 1 1 auto;
    min-width: 0;
}

.erp-toast__title {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.35;
    color: #fff;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.erp-toast__body {
    margin-top: 0.35rem;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.5;
    color: #fff;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.erp-toast__close {
    flex-shrink: 0;
    border: 0;
    background: transparent;
    color: #fff;
    width: 1.75rem;
    height: 1.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    cursor: pointer;
    opacity: 0.9;
    transition: opacity .15s ease, background-color .15s ease;
}

.erp-toast__close:hover {
    opacity: 1;
    color: #fff;
    background: rgba(255, 255, 255, 0.18);
}

.erp-toast__progress {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 4px;
    width: 100%;
    transform-origin: left center;
    animation: erp-toast-progress linear forwards;
    animation-duration: var(--erp-toast-duration, 3000ms);
    background: rgba(0, 0, 0, 0.22);
}

.erp-toast--success .erp-toast__progress { background: var(--erp-toast-success-bar); }
.erp-toast--error   .erp-toast__progress { background: var(--erp-toast-error-bar); }
.erp-toast--warning .erp-toast__progress { background: var(--erp-toast-warning-bar); }
.erp-toast--info    .erp-toast__progress { background: var(--erp-toast-info-bar); }

@keyframes erp-toast-progress {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

/* Toast enter/leave transitions */
.erp-toast-enter { transition: all .2s ease-out; }
.erp-toast-enter-start { opacity: 0; transform: translateX(1rem); }
.erp-toast-enter-end { opacity: 1; transform: translateX(0); }
.erp-toast-leave { transition: all .15s ease-in; }
.erp-toast-leave-start { opacity: 1; transform: translateX(0); }
.erp-toast-leave-end { opacity: 0; transform: translateX(1rem); }

/* Inline session flash (deprecated stub styles; keep parity with toast colors) */
.erp-flash {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1.125rem;
    margin-bottom: 1rem;
    color: #fff;
    border: 0;
    border-radius: 0.75rem;
    box-shadow:
        0 12px 24px -6px rgba(15, 23, 42, 0.28),
        0 6px 10px -4px rgba(15, 23, 42, 0.18);
}

.erp-flash--success { background: var(--erp-toast-success); }
.erp-flash--error   { background: var(--erp-toast-error); }
.erp-flash--warning { background: var(--erp-toast-warning); }
.erp-flash--info    { background: var(--erp-toast-info); }

.erp-flash__icon {
    flex-shrink: 0;
    font-size: 1.25rem;
    line-height: 1.4;
    color: #fff;
}

.erp-flash__content {
    flex: 1 1 auto;
    min-width: 0;
}

.erp-flash__title {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
}

.erp-flash__body {
    margin-top: 0.35rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #fff;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.erp-flash__list {
    padding-left: 1.1rem;
}

.erp-flash__close {
    flex-shrink: 0;
    margin-top: 0.1rem;
    color: #fff;
}

@media (max-width: 575.98px) {
    .erp-toast-stack,
    .erp-toast {
        min-width: 0;
        width: calc(100vw - 2rem);
        max-width: calc(100vw - 2rem);
    }
}

/* ---------- Backdrop (mobile) ---------- */
.erp-backdrop { display: none; }

/* ---------- Auth pages ---------- */
.erp-auth-body {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
    padding: 1.5rem;
}
.erp-auth-wrapper { width: 100%; max-width: 420px; }
.erp-auth-card { background: #fff; border-radius: 1rem; padding: 2.25rem; }
.erp-auth-logo {
    width: 64px; height: 64px; border-radius: 1rem;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.8rem;
}

/* ---------- Searchable product select ---------- */
.erp-product-select-menu {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    z-index: 1050;
    max-height: 280px;
    overflow-y: auto;
}

.erp-product-select-menu--teleported {
    position: fixed;
    top: auto;
    left: auto;
    right: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.erp-product-select-option:hover,
.erp-product-select-option:focus {
    background: #eff6ff !important;
    outline: none;
}

.erp-product-select-option-row:hover,
.erp-product-select-option-row:focus-within {
    background: #eff6ff;
}

.erp-product-select-option-row .erp-select-edit-btn {
    opacity: 0;
    transition: opacity 0.15s ease;
}

.erp-product-select-option-row:hover .erp-select-edit-btn,
.erp-product-select-option-row:focus-within .erp-select-edit-btn {
    opacity: 1;
}

/* The caret must stay visible on an empty search box so a click reads as focus. */
.erp-product-select input.form-control {
    caret-color: currentColor;
}

/* ---------- Standard pagination footer ---------- */
.erp-pagination-footer {
    background: #fff;
    width: 100%;
}

.erp-pagination-footer.card-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.erp-pagination-nav .pagination {
    gap: 0.15rem;
}

.erp-pagination-nav .page-link {
    min-width: 2.25rem;
    text-align: center;
    border-radius: 0.375rem;
    color: #334155;
    border-color: #e2e8f0;
    padding: 0.35rem 0.65rem;
    line-height: 1.25;
}

.erp-pagination-nav .page-item.active .page-link {
    background-color: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.erp-pagination-nav .page-item.disabled .page-link {
    color: #94a3b8;
    background-color: #f8fafc;
}

.erp-pagination-nav .page-link:hover:not(.active) {
    background-color: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
}

.erp-card > .erp-pagination-footer,
.card > .erp-pagination-footer,
.table-responsive + .erp-pagination-footer {
    margin-top: 0;
}

@media (max-width: 767.98px) {
    .erp-pagination-footer {
        text-align: center;
    }

    .erp-pagination-summary {
        order: 2;
    }

    .erp-pagination-links {
        order: 1;
    }
}

@media (min-width: 768px) {
    .erp-pagination-footer {
        flex-direction: row !important;
    }
}

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
    .erp-sidebar { transform: translateX(-100%); }
    .erp-main { margin-left: 0; }
    .sidebar-mobile-open .erp-sidebar { transform: translateX(0); }
    .sidebar-mobile-open .erp-backdrop {
        display: block; position: fixed; inset: 0;
        background: rgba(2,6,23,.5); z-index: 1035;
    }
}

/* ---------- Branding asset upload (Company Settings) ---------- */
.erp-branding-box {
    position: relative;
    width: 100%;
    max-width: 200px;
    margin-left: auto;
    margin-right: auto;
    aspect-ratio: 1;
    border: 2px dashed #cbd5e1;
    border-radius: 0.75rem;
    background: #f8fafc;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.erp-branding-box:hover,
.erp-branding-box:focus-visible {
    border-color: #2563eb;
    background: #eff6ff;
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.15);
}

.erp-branding-box--dragging {
    border-color: #2563eb;
    background: #dbeafe;
    box-shadow: 0 0 0 0.25rem rgba(37, 99, 235, 0.2);
}

.erp-branding-box__placeholder {
    width: 100%;
}

.erp-branding-box__icon {
    font-size: 1.75rem;
    color: #64748b;
}

.erp-branding-box__image {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.erp-branding-box__img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 0.35rem;
}

.erp-branding-box__delete {
    position: absolute;
    top: 0.35rem;
    right: 0.35rem;
    z-index: 2;
    width: 1.65rem;
    height: 1.65rem;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #dc2626;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.erp-branding-box__delete:hover {
    background: #b91c1c;
}

.erp-branding-box__delete:focus-visible {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(220, 38, 38, 0.4);
}

/* ---------- Product image preview (create/edit) ---------- */
.erp-product-image-preview {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
}

.erp-product-image-preview__img {
    display: block;
    max-width: 100%;
    max-height: 180px;
    object-fit: contain;
    border-radius: 0.375rem;
}

.erp-product-image-preview__delete {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
    width: 30px;
    height: 30px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #dc2626;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    line-height: 1;
    cursor: pointer;
    opacity: 1;
    visibility: visible;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.erp-product-image-preview__delete:hover {
    background: #b91c1c;
}

.erp-product-image-preview__delete:focus-visible {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(220, 38, 38, 0.4);
}

.erp-branding-upload__status-text {
    color: #dc2626;
    font-weight: 600;
    animation: erp-branding-pulse 1.5s ease-in-out infinite;
}

.erp-branding-upload__status--active {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.erp-branding-upload__dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: #dc2626;
    flex-shrink: 0;
    animation: erp-branding-pulse 1.5s ease-in-out infinite;
}

@keyframes erp-branding-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

@media (max-width: 575.98px) {
    .erp-branding-box {
        max-width: 180px;
    }
}

.party-contacts-toolbar-search {
    max-width: 100%;
}

@media (min-width: 576px) {
    .party-contacts-toolbar-search {
        max-width: 260px;
    }
}

.nav-tabs .nav-link.party-tab-has-errors {
    color: #dc2626;
}

.nav-tabs .nav-link.party-tab-has-errors.active {
    color: #dc2626;
    border-bottom-color: #dc2626;
}

/* Party document preview modal */
.party-doc-preview-body {
    background: #f8f9fa;
    min-height: 420px;
}

.party-doc-preview-image-panel,
.party-doc-preview-pdf-panel {
    background: #f8f9fa;
}

.party-doc-preview-image-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 420px;
    max-height: 75vh;
    overflow: auto;
    padding: 1.5rem;
}

.party-doc-preview-image {
    display: block;
    max-width: 100%;
    max-height: 72vh;
    width: auto;
    height: auto;
    object-fit: contain;
    margin: 0 auto;
    background: #fff;
    border-radius: 0.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.party-doc-preview-pdf-frame {
    display: block;
    width: 100%;
    height: 75vh;
    border: 0;
    background: #fff;
}

.party-doc-preview-unavailable {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 320px;
    padding: 2.5rem 1.5rem;
    text-align: center;
    background: #f8f9fa;
}

/* ---------- Company brand header (documents / print / PDF) ---------- */
.erp-company-brand-header--screen {
    background: #ffffff;
    border-bottom: 2px solid var(--erp-accent, #2563eb);
    padding: 0.75rem 0 0.85rem;
    max-height: 110px;
    overflow: hidden;
}

.erp-company-brand-header__grid {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.85rem 1rem;
    align-items: center;
}

.erp-company-brand-header__logo {
    width: 90px;
    flex-shrink: 0;
}

.erp-company-brand-header__logo-img {
    display: block;
    width: 90px;
    max-width: 90px;
    max-height: 70px;
    height: auto;
    object-fit: contain;
    object-position: left center;
}

.erp-company-brand-header__company {
    min-width: 0;
}

.erp-company-brand-header__name {
    font-size: 1.25rem; /* ~20px */
    font-weight: 700;
    color: #0f172a;
    line-height: 1.25;
    margin-bottom: 0.2rem;
}

.erp-company-brand-header__address {
    font-size: 0.8125rem;
    color: #475569;
    line-height: 1.4;
    margin-bottom: 0.25rem;
}

.erp-company-brand-header__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.15rem 0.85rem;
    font-size: 0.75rem;
    color: #64748b;
    line-height: 1.35;
}

.erp-company-brand-header__meta-item {
    white-space: nowrap;
}

.erp-company-brand-header__meta-label {
    font-weight: 600;
    color: #334155;
    margin-right: 0.2rem;
}

.erp-company-brand-header__doc {
    text-align: right;
    min-width: 9rem;
    max-width: 16rem;
}

.erp-company-brand-header__doc-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e3a8a;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    line-height: 1.3;
}

.erp-company-brand-header__doc-no {
    margin-top: 0.2rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #334155;
    word-break: break-word;
}

@media (max-width: 991.98px) {
    .erp-company-brand-header--screen {
        max-height: none;
    }

    .erp-company-brand-header__grid {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .erp-company-brand-header__doc {
        grid-column: 1 / -1;
        text-align: left;
        max-width: none;
        padding-top: 0.15rem;
        border-top: 1px dashed #e2e8f0;
    }
}

@media (max-width: 575.98px) {
    .erp-company-brand-header__grid {
        grid-template-columns: 1fr;
        gap: 0.65rem;
    }

    .erp-company-brand-header__logo {
        width: auto;
    }

    .erp-company-brand-header__logo-img {
        margin: 0 auto 0 0;
    }

    .erp-company-brand-header__name {
        font-size: 1.125rem;
    }

    .erp-company-brand-header__meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.15rem;
    }

    .erp-company-brand-header__meta-item {
        white-space: normal;
    }
}

@media print {
    .erp-company-brand-header--screen {
        max-height: none;
        overflow: visible;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .erp-company-brand-header__grid {
        grid-template-columns: auto minmax(0, 1fr) auto;
    }

    .erp-company-brand-header__doc {
        grid-column: auto;
        text-align: right;
        border-top: 0;
        padding-top: 0;
    }
}

/* ---------- Document view header (Debit Note / ERP document screens) ---------- */
.erp-doc-view-header {
    border-radius: var(--bs-border-radius, 0.375rem);
    border-color: #e2e8f0;
}

.erp-doc-view-header__grid {
    display: grid;
    grid-template-columns: 90px minmax(0, 1fr) minmax(14rem, 18rem);
    gap: 0.85rem 1.15rem;
    align-items: start;
}

.erp-doc-view-header__logo {
    width: 90px;
    height: 90px;
    min-width: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 0.375rem;
    overflow: hidden;
}

.erp-doc-view-header__logo img {
    display: block;
    width: auto;
    height: auto;
    max-width: 90px;
    max-height: 90px;
    object-fit: contain;
}

.erp-doc-view-header__logo-placeholder {
    font-size: 0.7rem;
    line-height: 1.25;
    color: #94a3b8;
    text-align: center;
    padding: 0.35rem;
}

.erp-doc-view-header__company-name {
    margin: 0 0 0.2rem;
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.25;
    color: #0f172a;
}

.erp-doc-view-header__address,
.erp-doc-view-header__line {
    margin: 0 0 0.15rem;
    font-size: 0.8125rem;
    line-height: 1.35;
    color: #475569;
}

.erp-doc-view-header__label {
    font-weight: 600;
    color: #334155;
}

.erp-doc-view-header__doc {
    border-left: 2px solid var(--erp-accent, #2563eb);
    padding-left: 1rem;
}

.erp-doc-view-header__doc-title {
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #1e3a8a;
    line-height: 1.25;
}

.erp-doc-view-header__table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    font-size: 0.8125rem;
    line-height: 1.45;
}

.erp-doc-view-header__table th,
.erp-doc-view-header__table td {
    padding: 0.15rem 0;
    vertical-align: top;
    border: none;
}

.erp-doc-view-header__table th {
    width: 7.5rem;
    font-weight: 600;
    color: #64748b;
    text-align: left;
    white-space: nowrap;
    padding-right: 0.5rem;
}

.erp-doc-view-header__table td {
    color: #0f172a;
    font-weight: 600;
}

@media (max-width: 991.98px) {
    .erp-doc-view-header__grid {
        grid-template-columns: 90px minmax(0, 1fr);
    }

    .erp-doc-view-header__doc {
        grid-column: 1 / -1;
        border-left: none;
        border-top: 1px solid #e2e8f0;
        padding-left: 0;
        padding-top: 0.85rem;
    }
}

@media (max-width: 575.98px) {
    .erp-doc-view-header__grid {
        grid-template-columns: 1fr;
    }
}

/* Packing Slip Select Bags — explicit SVG checkmark (do not rely on Bootstrap background-image) */
.erp-bag-check {
    cursor: pointer;
    user-select: none;
}

.erp-bag-check__input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    opacity: 0;
}

.erp-bag-check__box {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    border: 2px solid #94a3b8;
    border-radius: 0.25rem;
    background-color: #fff;
    color: #fff;
    transition: background-color 0.12s ease, border-color 0.12s ease;
}

.erp-bag-check__tick {
    width: 0.85rem;
    height: 0.85rem;
    display: none;
}

.erp-bag-check__input:checked + .erp-bag-check__box,
.erp-bag-check__box.is-checked {
    background-color: #2563eb;
    border-color: #2563eb;
}

.erp-bag-check__input:checked + .erp-bag-check__box .erp-bag-check__tick,
.erp-bag-check__box.is-checked .erp-bag-check__tick {
    display: block;
}

.erp-bag-check__input:focus-visible + .erp-bag-check__box {
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.25);
    border-color: #2563eb;
}

/* Visible checkbox ✓ (Permissions matrix) */
.erp-perm-check.form-check-input {
    width: 1.15rem;
    height: 1.15rem;
    margin-top: 0;
    cursor: pointer;
    flex-shrink: 0;
    background-color: #fff;
    border: 1.5px solid #94a3b8;
}

.erp-perm-check.form-check-input:checked {
    background-color: #2563eb !important;
    border-color: #2563eb !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10l3 3 6-6'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: 100% 100% !important;
}

.erp-perm-check.form-check-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.25);
    border-color: #2563eb;
}

.erp-perm-check.form-check-input:focus:not(:checked) {
    background-color: #fff;
    background-image: none;
}

/* Manage Permissions — Production matrix scrolls inside its own container */
.erp-perm-matrix-scroll {
    max-height: min(60vh, 500px);
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
}

.erp-perm-matrix-scroll > .table {
    width: 100%;
    margin-bottom: 0;
}

.erp-perm-matrix-scroll thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background-color: #f8f9fa;
    box-shadow: inset 0 -1px 0 #dee2e6;
}

/* Manufacturing Cost Sheet — soft table grid (matches erp-card borders) */
.cost-sheet-table {
    --bs-table-border-color: #e2e8f0;
    border-color: #e2e8f0;
}

.cost-sheet-table > :not(caption) > * > *,
.cost-sheet-table .table > :not(caption) > * > * {
    border-color: #e2e8f0;
}

.cost-sheet-table .table {
    --bs-table-border-color: #e2e8f0;
    border-color: #e2e8f0;
}

/* Manufacturing Cost Sheet — highlight editable inputs only (not read-only/calculated cells) */
.cost-sheet-table .form-control:not([readonly]):not(:disabled):not(.is-invalid),
.cost-sheet-table .form-select:not(:disabled):not(.is-invalid) {
    border-color: #ff5722;
}

.cost-sheet-table .form-control:not([readonly]):not(:disabled):not(.is-invalid):focus,
.cost-sheet-table .form-select:not(:disabled):not(.is-invalid):focus {
    border-color: #ff5722;
    box-shadow: 0 0 0 0.2rem rgba(255, 87, 34, 0.2);
}


