:root {
    --ui-primary: #2563eb;
    --ui-primary-hover: #1d4ed8;
    --ui-ink: #172033;
    --ui-muted: #64748b;
    --ui-border: #e2e8f0;
    --ui-surface: #ffffff;
    --ui-canvas: #f5f7fb;
    --ui-radius: 12px;
    --ui-shadow: 0 8px 24px rgba(15, 23, 42, .06);
    --ui-success: #169b68;
    --ui-warning: #f59e0b;
    --ui-danger: #dc3545;
    --ui-info: #168fc4;
}

.ui-erp,
.ui-store,
.ui-mobile,
.ui-auth,
.ui-app {
    color: var(--ui-ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.5;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

.ui-auth-shell {
    background:
        radial-gradient(circle at 15% 10%, rgba(59,130,246,.13), transparent 34%),
        radial-gradient(circle at 90% 90%, rgba(15,118,110,.11), transparent 32%),
        #f5f7fb !important;
    padding: 1.25rem;
}
.ui-auth-card {
    border: 1px solid var(--ui-border);
    border-radius: 16px !important;
    box-shadow: 0 18px 55px rgba(15,23,42,.1) !important;
    padding: 1.5rem !important;
}
.ui-auth-card input { min-height: 42px; border-radius: 9px; }
.ui-auth-card button { min-height: 40px; border-radius: 9px; font-weight: 700; }
.ui-app { background: var(--ui-canvas); }

.ui-erp .btn,
.ui-store .btn,
.ui-mobile .btn {
    min-height: 38px;
    border-radius: 9px !important;
    font-weight: 650;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
}

.ui-erp .btn-sm,
.ui-store .btn-sm,
.ui-mobile .btn-sm { min-height: 34px; }

.ui-erp .form-control,
.ui-erp .form-select,
.ui-store .form-control,
.ui-store .form-select,
.ui-mobile .form-control,
.ui-mobile .form-select {
    min-height: 40px;
    border-color: #cbd5e1;
    border-radius: 9px !important;
    box-shadow: none;
}

.ui-erp .form-control:focus,
.ui-erp .form-select:focus,
.ui-store .form-control:focus,
.ui-store .form-select:focus,
.ui-mobile .form-control:focus,
.ui-mobile .form-select:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

/* ERP: compact, predictable workspace for 1280x720 laptops. */
.ui-erp { background: var(--ui-canvas) !important; }
.ui-erp { max-width: 100%; overflow-x: hidden !important; }
.ui-erp .erp-app-shell { width: 100%; max-width: 100vw; overflow-x: clip; }
.ui-erp .erp-main { min-width: 0 !important; max-width: 100%; overflow-x: clip; }
.ui-erp .erp-main > section { width: 100%; max-width: 100%; min-width: 0; }
.ui-erp { font-size: clamp(14px, calc(12px + .12vw), 16px); }
.ui-erp .erp-main table.table { font-size: clamp(.8rem, calc(.7rem + .12vw), .9rem) !important; }
.ui-erp .erp-main table.table thead th { font-size: clamp(.72rem, calc(.65rem + .1vw), .82rem) !important; }
.ui-erp .erp-main table.table tbody td { line-height: 1.35; }
.ui-erp .erp-main .form-label { font-size: clamp(.78rem, calc(.72rem + .08vw), .86rem); }
.ui-erp .erp-main .btn { font-size: clamp(.8rem, calc(.74rem + .08vw), .9rem); }
.ui-erp .erp-main .form-control,
.ui-erp .erp-main .form-select,
.ui-erp .erp-main textarea { font-size: clamp(.82rem, calc(.76rem + .08vw), .92rem); }
.ui-erp .erp-main { background: #f4f6f9 !important; min-width: 0; }
.ui-erp .erp-main .form-label { font-weight: 700; color: #334155; }
.ui-erp .erp-main .form-control,
.ui-erp .erp-main .form-select,
.ui-erp .erp-main textarea {
    min-height: 40px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #fff;
    color: #172033;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, .03);
}
.ui-erp .erp-main .form-control:focus,
.ui-erp .erp-main .form-select:focus,
.ui-erp .erp-main textarea:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.ui-erp .erp-main .btn {
    border-radius: 10px;
    min-height: 38px;
    padding: .6rem .9rem;
}
.ui-erp .erp-main .btn-sm {
    min-height: 34px;
    padding: .4rem .7rem;
}
.ui-erp .erp-main .erp-ui-search {
    position: relative;
    width: 100%;
    max-width: 420px;
}
.ui-erp .erp-main .erp-ui-search input {
    width: 100%;
    padding: .62rem 2.45rem .62rem 2.45rem;
    border: 1px solid #d2dce8;
    border-radius: 999px;
    background: #fff;
    color: #172033;
}
.ui-erp .erp-main .erp-ui-search > i {
    position: absolute;
    left: .95rem;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    pointer-events: none;
}
.ui-erp .erp-main .erp-ui-search .erp-ui-search-clear {
    position: absolute;
    right: .45rem;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: #64748b;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: none;
}
.ui-erp .erp-main .erp-ui-search .erp-ui-search-clear.show {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.ui-erp .erp-main .erp-ui-search .erp-ui-search-clear:hover {
    background: #f1f5f9;
    color: #0f172a;
}
.ui-erp .erp-main .erp-ui-card {
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .05);
    overflow: hidden;
}
.ui-erp .erp-main .erp-ui-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
    padding: .95rem 1rem;
    border-bottom: 1px solid #e8edf3;
    background: linear-gradient(180deg, #fbfdff, #f7faff);
}
.ui-erp .erp-main .erp-ui-card-title {
    font-size: .95rem;
    font-weight: 800;
    color: #253b53;
}
.ui-erp .erp-main .erp-ui-card-subtitle {
    font-size: .78rem;
    color: #64748b;
}
.ui-erp .erp-main .erp-ui-card-body {
    padding: 1rem;
}
.ui-erp .erp-main .erp-ui-badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .3rem .6rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
    line-height: 1;
}
.ui-erp .erp-main .erp-ui-badge-neutral { background: #f1f5f9; color: #475569; }
.ui-erp .erp-main .erp-ui-badge-success { background: #ecfdf5; color: #169b68; }
.ui-erp .erp-main .erp-ui-badge-warning { background: #fffbeb; color: #b45309; }
.ui-erp .erp-main .erp-ui-badge-danger { background: #fef2f2; color: #dc3545; }
.ui-erp .erp-main .erp-ui-badge-info { background: #eff6ff; color: #168fc4; }
.ui-erp .erp-main .erp-ui-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .55rem;
    min-height: 220px;
    padding: 2rem 1.2rem;
    border: 1px dashed #d8e4f0;
    border-radius: 14px;
    background: linear-gradient(180deg, #fcfdff, #f7faff);
    color: #475569;
    text-align: center;
}
.ui-erp .erp-main .erp-ui-empty-state-icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 999px;
    background: #eff6ff;
    color: #2563eb;
    font-size: 1.2rem;
}
.ui-erp .erp-main .erp-ui-empty-state h5 { margin: 0; color: #253b53; }
.ui-erp .erp-main .erp-ui-empty-state p { margin: 0; max-width: 460px; color: #64748b; }
.ui-erp .erp-main .erp-ui-empty-state-actions { margin-top: .25rem; }
.ui-erp .erp-main .table,
.ui-erp .erp-main .erp-datatable {
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 12px;
    overflow: hidden;
}
.ui-erp .erp-main .table thead th,
.ui-erp .erp-main .erp-datatable thead th {
    background: #f8fafc;
    color: #475569;
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.ui-erp .erp-main .pagination { gap: .35rem; margin-top: .85rem; }
.ui-erp .erp-main .page-link {
    min-width: 36px;
    border-radius: 9px;
    border-color: #dbe4ef;
    color: #334155;
}
.ui-erp .erp-main .page-item.active .page-link {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}
.ui-erp .erp-main .erp-table-tools,
.ui-erp .erp-main .erp-ui-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .7rem;
    margin-bottom: .85rem;
    padding: .75rem .85rem;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 4px 14px rgba(15, 23, 42, .035);
}
.ui-erp .erp-main .erp-ui-filter-bar .erp-ui-filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
    align-items: center;
}
.ui-erp .erp-main .erp-ui-filter-bar .erp-ui-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem .7rem;
    border: 1px solid #dbe4ef;
    border-radius: 999px;
    background: #f8fbff;
    color: #334155;
    font-size: .8rem;
}
.ui-erp input[type="search"]::-webkit-search-cancel-button,
.ui-erp input[type="search"]::-webkit-search-decoration {
    -webkit-appearance: none;
    appearance: none;
    display: none;
}
.ui-erp input[type="search"]::-ms-clear,
.ui-erp input[type="search"]::-ms-reveal {
    appearance: none;
    display: none;
}
.ui-erp .search-dropdown:empty,
.ui-erp [id$="Dropdown"].list-group:empty,
.ui-erp [id$="Results"]:empty {
    display: none !important;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
}
.ui-erp .erp-main .card:has(.search-dropdown:not(:empty)),
.ui-erp .erp-main .card:has([id$="Dropdown"].list-group:not(:empty)) {
    position: relative !important;
    z-index: 9000 !important;
    overflow: visible !important;
}
.ui-erp .erp-main .card:has(.search-dropdown:not(:empty)) .card-body,
.ui-erp .erp-main .card:has([id$="Dropdown"].list-group:not(:empty)) .card-body,
.ui-erp .erp-main .position-relative:has(> .search-dropdown:not(:empty)),
.ui-erp .erp-main .position-relative:has(> [id$="Dropdown"].list-group:not(:empty)) {
    position: relative !important;
    z-index: 9100 !important;
    overflow: visible !important;
}
.ui-erp .erp-main .search-dropdown:not(:empty):not(.erp-search-floating-panel),
.ui-erp .erp-main [id$="Dropdown"].list-group:not(:empty):not(.erp-search-floating-panel) {
    position: absolute !important;
    top: calc(100% + 4px) !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 10000 !important;
    max-height: min(340px, 56vh) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    background: #fff !important;
}
.ui-erp .erp-header {
    min-height: 60px !important;
    padding: .65rem 1.15rem !important;
    background: rgba(255,255,255,.96) !important;
    border-bottom: 1px solid var(--ui-border) !important;
    box-shadow: 0 2px 8px rgba(15,23,42,.035) !important;
}
.ui-erp .erp-header h5 { font-size: 1.05rem !important; font-weight: 750 !important; }
.ui-erp .erp-app-header { position: sticky; top: 0; z-index: 1060; display: flex; min-height: 50px; align-items: stretch; justify-content: space-between; background: #087f3f; color: #fff; box-shadow: 0 1px 0 rgba(0,0,0,.08); }
.ui-erp .erp-app-header-brand { display: flex; min-width: 0; align-items: center; gap: .65rem; padding: 0 1rem; }
.ui-erp .erp-app-header-brand img { width: 30px; height: 30px; object-fit: contain; border-radius: 50%; background: #fff; }
.ui-erp .erp-app-header-brand > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; font-weight: 750; letter-spacing: .015em; }
.ui-erp .erp-app-header-menu { display: inline-flex; width: 38px; height: 38px; align-items: center; justify-content: center; border: 0; border-radius: 6px; background: transparent; color: #fff; font-size: 1.5rem; }
.ui-erp .erp-app-header-menu:hover { background: rgba(255,255,255,.12); }
.ui-erp .erp-app-header-actions { display: flex; align-items: stretch; margin-left: auto; }
.ui-erp .erp-app-warehouse { display: flex; align-items: center; gap: .7rem; padding: 0 .95rem; border-left: 1px solid rgba(255,255,255,.22); }
.ui-erp .erp-app-warehouse > span { font-size: .74rem; font-weight: 750; }
.ui-erp .erp-app-warehouse > strong { min-width: 190px; padding: .45rem .7rem; border-radius: 4px; background: #fff; color: #64748b; font-size: .76rem; font-weight: 600; }
.ui-erp .erp-app-user-menu { display: flex; border-left: 1px solid rgba(255,255,255,.28); }
.ui-erp .erp-app-user-menu > .btn { border: 0; border-radius: 0; padding: 0 1rem; color: #fff; font-size: .76rem; }
.ui-erp .erp-app-user-menu > .btn:hover,
.ui-erp .erp-app-user-menu > .btn.show { background: rgba(0,0,0,.1); color: #fff; }
.ui-erp .erp-app-user-menu > .btn i { margin-right: .4rem; font-size: 1rem; }
.ui-erp .erp-app-user-menu .dropdown-item { display: flex; align-items: center; gap: .55rem; font-size: .84rem; }
.ui-erp .erp-app-shell { min-height: calc(100vh - 50px); }
.ui-erp .erp-page-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; padding: .65rem .75rem; border: 1px solid #dce5ef; border-radius: 10px; background: #fff; }
.ui-erp .erp-page-heading h5 { margin: 0; color: #253b53; font-size: 1rem; font-weight: 800; }
.ui-erp #erpSidebar { background: #f2f2f2 !important; border-right-color: #cfd3d7 !important; }
.ui-erp .erp-sidebar-mobile-head { min-height: 48px; padding: .5rem .75rem; border-bottom: 1px solid #d2d5d8; background: #f7f7f7; color: #333; }
.ui-erp .erp-sidebar-mobile-head strong { font-size: .84rem; text-transform: uppercase; }
.ui-erp .erp-sidebar-mobile-head .btn { width: 34px; min-height: 34px; padding: 0; border: 1px solid #cfd3d7; background: #fff; color: #444; }
.ui-erp .erp-sidebar-main-link { background: #f7f7f7 !important; border-bottom-color: #d7d7d7 !important; color: #333 !important; }
.ui-erp .erp-sidebar-main-link i { color: #3f4b56 !important; }
.ui-erp .erp-sidebar-main-link:hover { background: #fff !important; color: #087f3f !important; }
.ui-erp .erp-sidebar-main-link.active:not(.is-pos) { background: #fff !important; color: #176ca8 !important; border-left-color: #2684c7 !important; }
.ui-erp .erp-sidebar-main-link.is-pos { background: #dc2132 !important; border-bottom-color: #bd1727 !important; color: #fff !important; }
.ui-erp .erp-sidebar-main-link.is-pos i { color: #fff !important; }
.ui-erp .erp-sidebar-main-link.is-pos:hover,
.ui-erp .erp-sidebar-main-link.is-pos.active { background: #c7192a !important; color: #fff !important; }
.ui-erp .erp-top-menu { top: 60px !important; border-color: var(--ui-border) !important; box-shadow: none !important; }
.ui-erp .erp-top-menu-inner { min-height: 52px !important; padding: .5rem 1rem !important; gap: .4rem !important; flex-wrap: nowrap !important; overflow-x: auto !important; }
.ui-erp .erp-top-link,
.ui-erp .erp-top-group > .btn { min-height: 36px !important; padding: .42rem .72rem !important; border-radius: 9px !important; font-size: .86rem !important; box-shadow: none !important; }
.ui-erp .erp-main > section { padding: 1rem 1.15rem 1.5rem !important; max-width: 1920px; width: 100%; margin: 0 auto; }
.ui-erp .card,
.ui-erp .erp-card {
    border: 1px solid #e3e8ef !important;
    border-radius: 10px !important;
    box-shadow: 0 3px 12px rgba(15,23,42,.035) !important;
}
.ui-erp .card-header { padding: .8rem 1rem !important; background: #fff !important; border-color: var(--ui-border) !important; }
.ui-erp .card-body { padding: .85rem !important; }
.ui-erp .table-responsive { border-radius: 0 !important; }
.ui-erp .table { margin-bottom: 0; font-size: .88rem; }
.ui-erp .table > :not(caption) > * > * { padding: .64rem .72rem; }
.ui-erp .table thead th { height: 42px; background: #f8fafc !important; color: #475569 !important; font-size: .73rem !important; font-weight: 750; letter-spacing: .035em; }
.ui-erp .table tbody tr:hover > * { background: #f8fbff !important; }
.ui-erp .erp-table-tools { position: static !important; padding: .5rem !important; margin-bottom: .55rem !important; border: 1px solid #e3e8ef !important; border-radius: 9px !important; background: #fff !important; box-shadow: none !important; }

/* Shared server-aware DataTable presentation. */
.ui-erp .erp-datatable-wrap {
    border: 1px solid #dce4ee !important;
    border-radius: 10px !important;
    background: #fff;
    box-shadow: 0 2px 8px rgba(15,23,42,.035);
}
.ui-erp .erp-datatable { --bs-table-striped-bg: #f8fbff; }
.ui-erp .erp-datatable thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: linear-gradient(180deg,#f7faff 0%,#edf4fb 100%) !important;
    border-bottom: 1px solid #c9d8e8 !important;
    color: #294761 !important;
}
.ui-erp .erp-datatable tbody tr:nth-child(even) > * { background-color: #fbfdff; }
.ui-erp .erp-datatable tbody tr:hover > * { background-color: #eef6ff !important; }
.ui-erp .erp-datatable tbody tr { transition: background-color .12s ease; }
.ui-erp .erp-datatable td:first-child,
.ui-erp .erp-datatable th:first-child { border-left: 3px solid transparent; }
.ui-erp .erp-datatable tbody tr:hover td:first-child { border-left-color: #3b82f6; }
.ui-erp .erp-datatable-tools {
    background: linear-gradient(135deg,#f8fbff,#f3f8fd) !important;
    border-color: #d8e4f0 !important;
}
.ui-erp .erp-datatable-tools .erp-search-field-wrap { position: relative; }
.ui-erp .erp-datatable-tools .erp-table-status { color: #54708b !important; font-weight: 550; }
.ui-erp .erp-datatable-tools .erp-table-status:not(.is-loading) { display: none !important; }
.ui-erp .erp-datatable-tools .erp-table-per-page { background-color: #fff; border-color: #cbd8e6; }
.ui-erp .erp-sortable { cursor: pointer; user-select: none; }
.ui-erp .erp-sortable:hover { color: #1d4ed8 !important; background: #e5effa !important; }
.ui-erp .erp-sortable.sort-asc,
.ui-erp .erp-sortable.sort-desc { color: #1d4ed8 !important; box-shadow: inset 0 -2px #3b82f6; }

/* Restrained functional colour: primary actions, exports and destructive actions. */
.ui-erp .btn-primary { background: #2563eb !important; border-color: #2563eb !important; }
.ui-erp .btn-primary:hover { background: #1d4ed8 !important; border-color: #1d4ed8 !important; }
.ui-erp .btn-success { background: #16865b !important; border-color: #16865b !important; }
.ui-erp .btn-warning { background: #f5a70a !important; border-color: #f5a70a !important; color: #332400 !important; }
.ui-erp .btn-danger { background: #dc3545 !important; border-color: #dc3545 !important; }
.ui-erp .badge.bg-success { background-color: #169b68 !important; }
.ui-erp .badge.bg-info { background-color: #168fc4 !important; color: #fff !important; }
.ui-erp .badge.bg-warning { background-color: #f6b51b !important; color: #3d2b00 !important; }
.ui-erp .badge.bg-danger { background-color: #dc3545 !important; }
/* Sales form: compact payment inputs with a readable financial summary. */
.ui-erp .erp-sale-customer-card,
.ui-erp .erp-sale-items-card,
.ui-erp .erp-purchase-top-card,
.ui-erp .erp-purchase-items-card { width: 100%; border: 1px solid #c9d8e8 !important; border-radius: 10px !important; box-shadow: 0 8px 24px rgba(15,23,42,.07) !important; }
.ui-erp .erp-document-form-heading { display: flex; align-items: center; gap: .7rem; width: 100%; min-height: 60px; padding: .72rem 1rem; border-bottom: 1px solid #c7d9ee; background: #eaf3ff !important; }
.ui-erp .erp-purchase-items-card > .card-header { min-height: 60px; padding: .72rem 1rem !important; border-bottom: 1px solid #c7d9ee !important; background: #eaf3ff !important; }
.ui-erp .erp-document-form-heading .erp-document-form-icon { display: grid; place-items: center; flex: 0 0 36px; width: 36px; height: 36px; border: 1px solid #b9d2f2; border-radius: 9px; background: #fff; color: #1d4ed8; font-size: 1rem; box-shadow: 0 2px 6px rgba(37,99,235,.08); }
.ui-erp .erp-document-form-heading h5 { color: #172033; font-size: .94rem; font-weight: 800; }
.ui-erp .erp-document-form-heading small { display: block; margin-top: .12rem; color: #64748b; font-size: .72rem; line-height: 1.3; }
.ui-erp .erp-sale-customer-card > .card-body,
.ui-erp .erp-purchase-top-card > .card-body { background: #fff; }
.ui-erp .erp-sale-customer-card > .card-body.row,
.ui-erp .erp-purchase-top-card > .card-body.row { width: 100%; margin: 0; }
.ui-erp .erp-sale-items-card > .card-body,
.ui-erp .erp-purchase-items-card > .card-body { background: linear-gradient(180deg,#fff 0%,#fbfdff 100%); }
.ui-erp .erp-sale-items-card .table-responsive,
.ui-erp .erp-purchase-items-card .table-responsive { border-color: #d7e2ee; box-shadow: 0 2px 8px rgba(15,23,42,.035); }
.ui-erp .erp-sale-payment-panel {
    display: grid;
    grid-template-columns: minmax(0,1.65fr) minmax(300px,.75fr);
    gap: 1rem;
    align-items: stretch;
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid #b9decf;
    border-radius: 10px;
    background: #f0faf6;
}
.ui-erp .erp-sale-payment-fields { min-width: 0; }
.ui-erp .erp-sale-payment-title { display: flex; align-items: center; gap: .6rem; margin-bottom: .75rem; color: #253b53; }
.ui-erp .erp-sale-payment-title > i { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid #a7d8c4; border-radius: 9px; background: #fff; color: #07834f; font-size: 1rem; }
.ui-erp .erp-sale-payment-title > div { display: flex; flex-direction: column; line-height: 1.25; }
.ui-erp .erp-sale-payment-title small { margin-top: .15rem; color: #64748b; font-size: .74rem; }
.ui-erp .erp-sale-payment-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .75rem; }
.ui-erp .erp-sale-payment-grid .form-label { font-size: .76rem; font-weight: 700; color: #475569; }
.ui-erp .erp-sale-payment-grid .input-group-text { min-width: 38px; justify-content: center; color: #64748b; }
.ui-erp .erp-purchase-payment-panel .erp-sale-payment-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
.ui-erp .erp-purchase-payment-panel .erp-purchase-note-field { grid-column: 1 / -1; }
.ui-erp .erp-purchase-payment-panel .erp-purchase-note-field textarea { min-height: 70px; resize: vertical; }
.ui-erp .erp-quotation-section-label { display: flex; align-items: center; gap: .45rem; margin-bottom: .65rem; padding-bottom: .45rem; border-bottom: 1px solid #e8edf3; color: #334155; font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .025em; }
.ui-erp .erp-quotation-section-label i { color: #2563eb; font-size: .9rem; }
.ui-erp .erp-quotation-summary-panel .erp-sale-payment-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
.ui-erp .erp-quotation-summary-panel .erp-sale-totals { min-height: 100%; }
.ui-erp .erp-sale-totals { display: flex; flex-direction: column; justify-content: center; overflow: hidden; border: 1px solid #d5e1ed; border-radius: 10px; background: #fff; }
.ui-erp .erp-sale-totals > div { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 40px; padding: .5rem .8rem; border-bottom: 1px solid #e8edf3; }
.ui-erp .erp-sale-totals > div:last-child { border-bottom: 0; }
.ui-erp .erp-sale-totals span { color: #64748b; font-size: .8rem; }
.ui-erp .erp-sale-totals strong { color: #1e293b; font-size: .96rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ui-erp .erp-sale-totals strong::after { content: ' đ'; font-size: .72em; font-weight: 600; }
.ui-erp .erp-sale-totals .erp-sale-grand-total { background: #eff6ff; }
.ui-erp .erp-sale-totals .erp-sale-grand-total span,
.ui-erp .erp-sale-totals .erp-sale-grand-total strong { color: #1d4ed8; font-weight: 800; }
.ui-erp .erp-sale-totals .erp-sale-grand-total strong { font-size: 1.15rem; }
.ui-erp .erp-sale-totals .erp-sale-debt-total { background: #fff7ed; }
.ui-erp .erp-sale-totals .erp-sale-debt-total span,
.ui-erp .erp-sale-totals .erp-sale-debt-total strong { color: #c2410c; font-weight: 800; }
.ui-erp .erp-notify-options { width: 100%; padding: 1rem; border: 1px solid #d8dce8; border-radius: 10px; background: #f8f7fc; }
.ui-erp .erp-notify-options-title { display: flex; align-items: center; gap: .65rem; margin-bottom: .75rem; color: #334155; }
.ui-erp .erp-notify-options-title > i { display: grid; place-items: center; flex: 0 0 34px; width: 34px; height: 34px; border: 1px solid #d7d2ea; border-radius: 9px; background: #fff; color: #6d4bb5; }
.ui-erp .erp-notify-options-title > div { display: flex; flex-direction: column; }
.ui-erp .erp-notify-options-title small { margin-top: .1rem; color: #64748b; font-size: .72rem; }

@media (max-width: 991.98px) {
    .ui-erp .erp-sale-payment-panel { grid-template-columns: 1fr; }
    .ui-erp .erp-main .erp-ui-filter-bar { flex-direction: column; align-items: stretch; }
    .ui-erp .erp-main .erp-ui-filter-bar .erp-ui-filter-group { width: 100%; }
    .ui-erp .erp-main .erp-ui-filter-bar .btn,
    .ui-erp .erp-main .erp-ui-filter-bar .form-control,
    .ui-erp .erp-main .erp-ui-filter-bar .form-select { width: 100%; }
    .ui-erp .erp-main .erp-ui-search { max-width: 100%; }
}
@media (max-width: 767.98px) {
    .ui-erp .erp-sale-payment-grid { grid-template-columns: 1fr; }
    .ui-erp .erp-purchase-payment-panel .erp-sale-payment-grid { grid-template-columns: 1fr; }
    .ui-erp .erp-purchase-payment-panel .erp-purchase-note-field { grid-column: auto; }
    .ui-erp .erp-sale-payment-panel { padding: .75rem; }
}
.ui-erp .erp-pos-customer-type { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem; }
.ui-erp .erp-pos-customer-type label { display: flex; align-items: center; gap: .45rem; min-height: 38px; padding: .5rem .6rem; border: 1px solid #d9e3ee; border-radius: 9px; background: #f8fafc; color: #334155; font-size: .8rem; font-weight: 650; cursor: pointer; }
.ui-erp .erp-pos-customer-type label:has(input:checked) { border-color: #93bdf2; background: #eff6ff; color: #1d4ed8; }
.ui-erp .erp-pos-customer-box { padding: .75rem; border: 1px solid #dce5ef; border-radius: 10px; background: #f8fafc; }
.ui-erp .erp-pos-customer-box .form-label { margin-bottom: .25rem; font-size: .75rem; }
.ui-erp .erp-pos-payment-summary { display: grid; gap: .85rem; padding: 1rem; border: 1px solid #dbe5f0; border-radius: 12px; background: linear-gradient(180deg,#f8fbff 0%,#fff 100%); }
.ui-erp .erp-pos-payment-summary > input:not(#paidAmount) { display: none !important; }
.ui-erp .erp-pos-grand-total { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; padding-bottom: .8rem; border-bottom: 1px solid #dbe5f0; }
.ui-erp .erp-pos-grand-total>span { color: #475569; font-size: .82rem; font-weight: 750; text-transform: uppercase; letter-spacing: .035em; }
.ui-erp .erp-pos-grand-total strong { color: #0f172a; font-size: 1.75rem; line-height: 1; font-variant-numeric: tabular-nums; }
.ui-erp .erp-pos-grand-total small { color: #64748b; font-size: .85rem; }
.ui-erp .erp-pos-paid-field .input-group-text { min-width: 46px; justify-content: center; font-weight: 750; }
.ui-erp .erp-pos-paid-field .money-input { color: #0f172a; font-size: 1.1rem; font-weight: 800; }
.ui-erp .erp-pos-balance { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 42px; padding: .65rem .75rem; border: 1px solid #dbe5f0; border-radius: 9px; background: #f8fafc; color: #475569; }
.ui-erp .erp-pos-balance strong { color: #334155; font-size: 1rem; font-variant-numeric: tabular-nums; }
.ui-erp .erp-pos-balance.has-debt { border-color: #fed7aa; background: #fff7ed; color: #9a3412; }
.ui-erp .erp-pos-balance.has-debt strong { color: #c2410c; }
.ui-erp .erp-pos-balance.is-change { border-color: #bbf7d0; background: #f0fdf4; color: #166534; }
.ui-erp .erp-pos-balance.is-change strong { color: #15803d; }
.ui-erp .erp-pos-note { padding-top: .1rem; }
.ui-erp .erp-pos-note textarea { min-height: 78px; resize: vertical; }
.ui-erp .erp-period-actions { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .75rem; }
.ui-erp .erp-period-action { display: grid; grid-template-columns: 38px minmax(0,1fr) auto; align-items: center; gap: .7rem; padding: .8rem; border: 1px solid #dce5ef; border-radius: 10px; background: #fff; }
.ui-erp .erp-period-action-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 9px; background: #eff6ff; color: #2563eb; font-size: 1.05rem; }
.ui-erp .erp-period-action>div:nth-child(2) { display: flex; min-width: 0; flex-direction: column; }
.ui-erp .erp-period-action strong { color: #243b53; font-size: .86rem; }
.ui-erp .erp-period-action span { color: #64748b; font-size: .72rem; line-height: 1.35; }
.ui-erp .erp-floating-action-menu {
    position: fixed !important;
    inset: auto !important;
    transform: none !important;
    z-index: 1095 !important;
    max-height: min(430px,calc(100vh - 24px));
    overflow-y: auto;
}
.ui-erp .erp-period-action.is-close { border-color: #bfdbfe; background: #f8fbff; }
.ui-erp .erp-period-action.is-lookup .erp-period-action-icon { background: #ecfdf5; color: #16865b; }
@media(max-width:1199.98px){.ui-erp .erp-period-actions{grid-template-columns:1fr}.ui-erp .erp-period-action{grid-template-columns:38px minmax(0,1fr) auto}}
@media(max-width:575.98px){.ui-erp .erp-period-action{grid-template-columns:38px minmax(0,1fr)}.ui-erp .erp-period-action .btn{grid-column:1/-1;width:100%}}
.ui-erp .alert { border-radius: 10px !important; box-shadow: none !important; padding: .75rem 1rem; }
.ui-erp .dropdown-menu,
.ui-erp .dropdown-menu.show,
.ui-erp .erp-top-group .dropdown-menu,
.ui-erp .erp-app-user-menu .dropdown-menu,
.ui-erp .erp-row-action .dropdown-menu {
    position: fixed !important;
    z-index: 2147483650 !important;
    border: 1px solid var(--ui-border) !important;
    border-radius: 12px !important;
    box-shadow: 0 20px 46px rgba(15,23,42,.18) !important;
    overflow: visible !important;
    isolation: isolate;
}
.ui-erp .modal-content { border: 0; border-radius: 14px; box-shadow: 0 24px 70px rgba(15,23,42,.2); }
.ui-erp .modal-backdrop { z-index: 1070 !important; }
.ui-erp .modal { z-index: 1080 !important; }
.ui-erp .table-responsive,
.ui-erp .card,
.ui-erp .erp-card,
.ui-erp .erp-main > section,
.ui-erp .erp-header {
    overflow: visible !important;
}
.ui-erp .table-responsive:has(.erp-smart-select.open),
.ui-erp .card:has(.erp-smart-select.open),
.ui-erp .card-body:has(.erp-smart-select.open) {
    overflow: visible !important;
    z-index: 120;
}
.ui-erp .dropdown-menu .dropdown-item,
.ui-erp .dropdown-menu .dropdown-divider { position: relative; z-index: 1; }
.ui-erp .pagination { margin-bottom: 0; }
.ui-erp .erp-global-search { position: relative; width: min(440px, 36vw); margin-inline: auto; }
.ui-erp .erp-global-search > i { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: #64748b; pointer-events: none; }
.ui-erp .erp-global-search input { width: 100%; height: 40px; padding: 0 2.7rem 0 2.35rem; border: 1px solid #d6e0eb; border-radius: 10px; background: #f8fafc; color: #172033; outline: 0; transition: .16s ease; }
.ui-erp .erp-global-search input:focus { background: #fff; border-color: #60a5fa; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.ui-erp .erp-global-search kbd { position: absolute; right: .65rem; top: 50%; transform: translateY(-50%); min-width: 24px; padding: .1rem .35rem; border: 1px solid #d7e0ea; border-bottom-width: 2px; border-radius: 6px; background: #fff; color: #64748b; text-align: center; font: 600 .72rem/1.3 inherit; }
.ui-erp .erp-filter-panel { padding: 0; border: 1px solid #dce5ef; border-radius: 10px; background: #f8fafc; overflow: hidden; }
.ui-erp .erp-filter-summary { min-height: 44px; padding: .55rem .75rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; cursor: pointer; list-style: none; user-select: none; }
.ui-erp .erp-filter-summary::-webkit-details-marker { display: none; }
.ui-erp .erp-filter-summary > span:first-child { display: flex; align-items: center; gap: .45rem; color: #334155; }
.ui-erp .erp-filter-summary > span:first-child > i { color: #2563eb; }
.ui-erp .erp-filter-summary small { color: #64748b; font-size: .78rem; font-weight: 500; }
.ui-erp .erp-filter-summary-meta { display: inline-flex; align-items: center; gap: .55rem; color: #64748b; }
.ui-erp .erp-filter-summary-meta b { padding: .15rem .5rem; border-radius: 999px; background: #dbeafe; color: #1d4ed8; font-size: .72rem; }
.ui-erp .erp-filter-summary-meta i { transition: transform .16s ease; }
.ui-erp .erp-filter-panel[open] .erp-filter-summary-meta i { transform: rotate(180deg); }
.ui-erp .erp-filter-content { padding: .75rem; border-top: 1px solid #e2e8f0; background: #fff; }
.ui-erp .erp-filter-actions { display: flex; justify-content: flex-end; gap: .5rem; padding-top: .7rem; }
.ui-erp .erp-filter-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.ui-erp .erp-filter-heading > div:first-child { display: flex; align-items: center; gap: .45rem; }
.ui-erp .erp-filter-heading > div:first-child i { color: #2563eb; }
.ui-erp .erp-filter-heading > div:first-child span { color: #64748b; font-size: .8rem; margin-left: .2rem; }
.ui-erp .erp-filter-grid { display: grid; grid-template-columns: repeat(5,minmax(140px,1fr)); gap: .65rem; }
.ui-erp .erp-filter-grid .form-label { margin-bottom: .25rem; font-size: .75rem; font-weight: 700; color: #475569; }
.ui-erp .erp-filter-grid .form-control,
.ui-erp .erp-filter-grid .form-select { min-height: 38px; font-size: .84rem; }

/* Desktop ERP follows the familiar fixed-sidebar pattern used by business systems. */
@media (min-width: 1200px) {
    .ui-erp #erpSidebar {
        display: flex !important;
        flex-direction: column;
        position: sticky !important;
        inset: 0 auto auto 0 !important;
        width: 204px !important;
        min-width: 204px !important;
        height: calc(100vh - 50px) !important;
        max-height: calc(100vh - 50px) !important;
        overflow: hidden !important;
        background: #f2f2f2 !important;
        border-right: 1px solid #cfd3d7 !important;
        box-shadow: none !important;
    }
    .ui-erp .erp-nav { padding: 0 !important; }
    .ui-erp .erp-nav { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; }
    .ui-erp .erp-nav::before { content: none !important; display: none !important; }
    .ui-erp .erp-sidebar-legacy-note { padding: 0 1rem .55rem !important; margin: 0 !important; color: #64748b !important; font-size: .72rem !important; font-weight: 800 !important; letter-spacing: .055em !important; text-transform: uppercase; }
    .ui-erp .erp-nav a,
    .ui-erp .erp-nav .erp-menu-toggle {
        min-height: 42px !important;
        margin: 0 !important;
        padding: .58rem .72rem !important;
        border: 0 !important;
        border-bottom: 1px solid #d7d7d7 !important;
        border-radius: 0 !important;
        background: #f7f7f7 !important;
        color: #333 !important;
        box-shadow: none !important;
        transform: none !important;
        font-size: .87rem !important;
        font-weight: 650 !important;
        text-transform: none !important;
        letter-spacing: 0 !important;
    }
    .ui-erp .erp-nav a:hover,
    .ui-erp .erp-nav .erp-menu-toggle:hover { background: #fff !important; color: #087f3f !important; }
    .ui-erp .erp-nav a.active,
    .ui-erp .erp-nav .active { background: #fff !important; color: #176ca8 !important; box-shadow: inset 3px 0 0 #2684c7 !important; }
    .ui-erp .erp-nav a[href$="/pos"],
    .ui-erp .erp-nav a[href*="/pos?"] { margin: 0 !important; background: #dc2132 !important; color: #fff !important; border: 0 !important; }
    .ui-erp .erp-nav a[href$="/pos"] i,
    .ui-erp .erp-nav a[href*="/pos?"] i { color: #fff !important; }
    .ui-erp .erp-nav .erp-menu-body { margin: 0 !important; padding: 0 0 0 .65rem !important; border: 0 !important; background: #f2f6fa !important; }
    .ui-erp .erp-top-menu { display: none !important; }
    .ui-erp .erp-content-switcher {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        gap: .75rem;
        min-height: 40px;
        margin: 0 0 .55rem !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        flex-wrap: wrap;
    }
    .ui-erp .erp-content-switcher-label {
        display: inline-flex !important;
        align-items: center;
        gap: .5rem;
        color: #334155 !important;
        font-size: .82rem !important;
        font-weight: 750 !important;
        text-transform: uppercase;
        letter-spacing: .025em;
    }
    .ui-erp .erp-content-switcher-label i { color: #2563eb !important; }
    .ui-erp .erp-related-links { min-width: 0; flex: 1 1 1; display: flex; align-items: center; gap: .35rem; overflow-x: auto; padding: .1rem .05rem .25rem; scrollbar-width: thin; }
    .ui-erp .erp-related-link { min-height: 34px; flex: 0 0 auto; display: inline-flex; align-items: center; gap: .35rem; padding: .36rem .58rem; border: 1px solid #e0e6ed; border-radius: 8px; background: #fff; color: #526173; text-decoration: none; font-size: .78rem; font-weight: 650; white-space: nowrap; }
    .ui-erp .erp-related-link:hover { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
    .ui-erp .erp-related-link.active { background: #2563eb; border-color: #2563eb; color: #fff; }
    .ui-erp .erp-content-actions { flex: 0 0 auto; display: flex; align-items: center; gap: .45rem; margin-left: auto; min-width: 0; justify-content: flex-end; }
    .ui-erp .erp-content-actions > * { min-width: 0; }
    .ui-erp .erp-content-actions .btn { min-height: 34px; padding: .36rem .65rem; font-size: .78rem; white-space: nowrap; }
    .ui-erp .erp-content-menu-select {
        display: none !important;
        width: 100% !important;
        min-height: 38px !important;
        border-radius: 8px !important;
        font-size: .86rem !important;
    }
    .ui-erp .erp-main { width: calc(100% - 240px) !important; }
    .ui-erp .erp-header { display: none !important; }
    .ui-erp .erp-main > section { padding: .65rem .8rem 1.25rem !important; }
}

@media (min-width: 992px) {
    .ui-erp #erpSidebar { top: 50px !important; height: calc(100vh - 50px) !important; max-height: calc(100vh - 50px) !important; }
    .ui-erp.erp-sidebar-collapsed #erpSidebar { display: none !important; }
    .ui-erp.erp-sidebar-collapsed .erp-main { width: 100% !important; }
}

/* Storefront: calmer navigation and consistent product density. */
.ui-store { background: #f8fafc !important; }
.ui-store .topbar { padding: .35rem 0 !important; font-size: .8rem !important; }
.ui-store .navbar-store { min-height: 68px !important; box-shadow: 0 1px 0 var(--ui-border) !important; }
.ui-store .navbar-store .store-wide-container { min-height: 68px !important; }
.ui-store .navbar-store .navbar-brand { min-width: 260px !important; font-size: 1.05rem; }
.ui-store .navbar-store .brand-logo { width: 44px !important; height: 44px !important; }
.ui-store .store-nav-link,
.ui-store .navbar-store .nav-link { padding: .5rem .68rem !important; font-size: .88rem !important; }
.ui-store .hero { min-height: min(570px, calc(100vh - 104px)); display: flex; align-items: center; }
.ui-store .hero h1 { font-size: clamp(2.2rem, 4vw, 3.6rem); line-height: 1.05; }
.ui-store .product-card,
.ui-store .news-card { border: 1px solid var(--ui-border) !important; border-radius: 12px !important; box-shadow: 0 4px 14px rgba(15,23,42,.05) !important; }
.ui-store .product-card .product-img { width: 100% !important; height: auto !important; aspect-ratio: 1 / 1; object-fit: cover; }
.ui-store .product-card .card-body { min-height: 136px !important; padding: .85rem !important; }
.ui-store .product-card:hover,
.ui-store .news-card:hover { transform: translateY(-3px) !important; box-shadow: 0 12px 28px rgba(15,23,42,.1) !important; }
.ui-store .footer { margin-top: 3rem !important; }

/* Mobile ERP: thumb-friendly without oversized cards. */
.ui-mobile { background: var(--ui-canvas) !important; padding-bottom: calc(72px + env(safe-area-inset-bottom)) !important; }
.ui-mobile .m-top { background: #fff !important; color: var(--ui-ink) !important; border-bottom: 1px solid var(--ui-border); box-shadow: none !important; }
.ui-mobile .m-top a { color: var(--ui-primary) !important; }
.ui-mobile main.container { padding: .85rem .75rem !important; }
.ui-mobile .m-card { border: 1px solid var(--ui-border) !important; border-radius: 12px !important; box-shadow: 0 5px 16px rgba(15,23,42,.055) !important; }
.ui-mobile .m-row-card { border-radius: 12px !important; }
.ui-mobile .m-nav { box-shadow: 0 -6px 20px rgba(15,23,42,.06); }
.ui-mobile .m-nav a { min-height: 54px; display: flex; flex-direction: column; justify-content: center; line-height: 1.25; }

@media (max-width: 1279.98px) and (min-width: 992px) {
    .ui-erp .erp-main > section { padding: .85rem 1rem 1.25rem !important; }
    .ui-erp .erp-top-menu-inner { padding-inline: .75rem !important; }
    .ui-store .navbar-store .navbar-brand { min-width: 230px !important; }
}

@media (max-width: 1399.98px) {
    .ui-erp .erp-filter-grid { grid-template-columns: repeat(3,minmax(170px,1fr)); }
}

@media (max-width: 991.98px) {
    .ui-erp .erp-app-header { min-height: 50px; }
    .ui-erp .erp-app-header-brand { padding: 0 .55rem; }
    .ui-erp .erp-app-header-brand img { display: none; }
    .ui-erp .erp-app-header-brand > span { max-width: 45vw; font-size: .7rem; }
    .ui-erp .erp-app-warehouse { display: none; }
    .ui-erp .erp-app-user-menu > .btn { width: 46px; padding: 0; font-size: 0; }
    .ui-erp .erp-app-user-menu > .btn i { margin: 0; font-size: 1.2rem; }
    .ui-erp .erp-page-heading { align-items: flex-start; flex-direction: column; }
    .ui-erp .erp-header { min-height: 56px !important; padding: .55rem .75rem !important; }
    .ui-erp .erp-main > section { padding: .75rem !important; }
    .ui-erp .erp-header > div:last-child span { display: none; }
    .ui-erp .erp-global-search { order: 4; width: 100%; margin: .25rem 0 0; }
    .ui-erp .erp-content-switcher { display: block !important; }
    .ui-erp .erp-content-switcher-label { margin-bottom: .45rem; }
    .ui-erp .erp-related-links { display: none !important; }
    .ui-erp .erp-content-menu-select { display: block !important; }
    .ui-erp .erp-content-actions { margin: .6rem 0 0; flex-wrap: wrap; }
    .ui-erp .erp-main table.table { font-size: .84rem !important; }
    .ui-erp .erp-main table.table thead th { font-size: .75rem !important; }
    .ui-erp .erp-main .form-control,
    .ui-erp .erp-main .form-select { font-size: 16px !important; }
    .ui-erp .erp-filter-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .ui-erp .card-body { padding: .8rem !important; }
    .ui-erp .erp-toolbar-actions,
    .ui-erp .erp-form-actions { width: 100%; }
    .ui-erp .erp-toolbar-actions .btn,
    .ui-erp .erp-form-actions .btn { flex: 1 1 auto; }
    .ui-store .topbar { display: none; }
    .ui-store .navbar-store { min-height: 60px !important; }
    .ui-store .navbar-store .store-wide-container { min-height: 60px !important; }
    .ui-store .navbar-store .navbar-brand { min-width: 0 !important; max-width: calc(100% - 54px); }
    .ui-store .navbar-store .navbar-brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .ui-store .hero { min-height: auto; }
}

@media (min-width: 1600px) {
    .ui-erp .erp-main table.table { font-size: .88rem !important; }
    .ui-erp .erp-main table.table thead th { font-size: .8rem !important; }
    .ui-erp .erp-main table.table tbody td { padding-top: .58rem; padding-bottom: .58rem; }
    .ui-erp .erp-sidebar-main-link { font-size: .94rem !important; }
}

@media (max-width: 575.98px) {
    .ui-erp,
    .ui-store,
    .ui-mobile { font-size: 14px; }
    .ui-erp .table > :not(caption) > * > * { padding: .55rem .6rem; }
    .ui-erp .erp-filter-heading { align-items: flex-start; flex-direction: column; }
    .ui-erp .erp-filter-heading > div:first-child span { display: none; }
    .ui-erp .erp-filter-grid { grid-template-columns: 1fr; }
    .ui-store .navbar-store .navbar-brand { min-width: 0 !important; max-width: calc(100% - 54px) !important; overflow: hidden; }
    .ui-store .navbar-store .navbar-brand span { min-width: 0; max-width: 240px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .ui-store .hero { padding-block: 1.75rem !important; overflow: hidden; }
    .ui-store .hero .store-wide-container { padding-block: 0 !important; }
    .ui-store .hero .row { --bs-gutter-x: 1.25rem; --bs-gutter-y: 1.5rem; }
    .ui-store .hero h1,
    .ui-store .hero .hero-title { max-width: 100% !important; font-size: 2rem !important; line-height: 1.08 !important; letter-spacing: -.035em !important; overflow-wrap: anywhere; }
    .ui-store .hero .lead { max-width: 100% !important; font-size: 1rem !important; line-height: 1.6 !important; }
    .ui-store .hero form { width: 100%; padding: .5rem !important; border-radius: 12px !important; }
    .ui-store .hero form .form-control { min-height: 46px !important; padding: .65rem .75rem !important; }
    .ui-store .hero form .btn { width: 100%; margin: 0 !important; }
    .ui-store .hero-visual { display: none; }
    .ui-store .hero-badge-line { display: none; }
    .ui-store .product-card .card-body { min-height: 126px !important; }
    .ui-store .footer { margin-top: 2rem !important; padding-top: 2rem !important; }
}

@media (prefers-reduced-motion: reduce) {
    .ui-erp *, .ui-store *, .ui-mobile * { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

.erp-column-hidden { display: none !important; }
.ui-erp .erp-column-settings { display: grid; grid-template-columns: minmax(0,1fr); gap: 1rem; }
.ui-erp .erp-column-setting-card { min-width: 0; padding: .9rem; border: 1px solid #dce5ef; border-radius: 12px; background: #fbfdff; }
.ui-erp .erp-column-setting-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; margin-bottom: .75rem; }
.ui-erp .erp-column-setting-head b { display: block; color: #1e3a56; }
.ui-erp .erp-column-module { display: inline-flex; margin-bottom: .3rem; padding: .16rem .45rem; border-radius: 999px; background: #eaf2ff; color: #1d4ed8; font-size: .68rem; font-weight: 800; }
.ui-erp .erp-column-setting-head small { display: block; margin-top: .12rem; color: #64748b; }
.ui-erp .erp-column-check-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .5rem; }
.ui-erp .erp-column-check { display: flex; align-items: center; gap: .5rem; min-width: 0; padding: .5rem .6rem; border: 1px solid #e2e8f0; border-radius: 9px; background: #fff; cursor: pointer; }
.ui-erp .erp-column-check:hover { border-color: #93c5fd; background: #f8fbff; }
.ui-erp .erp-column-check input { flex: 0 0 auto; }
.ui-erp .erp-column-check span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-erp .erp-column-check span b,.ui-erp .erp-column-check span small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-erp .erp-column-check span small { margin-top: .1rem; color: #64748b; font-size: .68rem; font-family: ui-monospace,SFMono-Regular,Menlo,monospace; }
.ui-erp .erp-column-check.is-locked { background: #f1f5f9; cursor: not-allowed; }
.ui-erp .erp-column-empty { display: flex; align-items: center; justify-content: center; gap: .8rem; min-height: 150px; padding: 1.2rem; border: 1px dashed #b9c8d8; border-radius: 12px; color: #64748b; text-align: left; }
.ui-erp .erp-column-empty > i { font-size: 1.5rem; color: #2563eb; }
.ui-erp .erp-column-empty p { margin: .2rem 0 0; }
.ui-erp .erp-table-schema-tools { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.ui-erp .erp-table-schema-tools .form-control { max-width: 520px; }
@media (max-width: 991.98px) { .ui-erp .erp-column-check-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 479.98px) { .ui-erp .erp-column-check-grid { grid-template-columns: 1fr; } }

/* Quick-create dialogs are moved under body; keep the same order globally. */
.modal-backdrop { z-index: 1070 !important; }
.modal { z-index: 1080 !important; }

/* Product columns keep readable widths; the container scrolls instead of crushing labels. */
.ui-erp .erp-product-table-responsive {
    width: 100%;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scrollbar-gutter: stable;
}
.ui-erp .erp-product-simple-table { min-width: 1180px; }
.ui-erp .erp-product-simple-table thead th { white-space: nowrap; }
.ui-erp .erp-product-simple-table .erp-money-cell { min-width: 82px; white-space: nowrap; }

/* Website customers: keep row actions on one line and let the table scroll if needed. */
.ui-erp .erp-main table[data-column-key="website-customers.index"] { min-width: 1240px; }
.ui-erp .erp-main table[data-column-key="website-customers.index"] .website-customer-actions-col {
    width: 380px;
    min-width: 380px;
    white-space: nowrap;
}
.ui-erp .erp-main table[data-column-key="website-customers.index"] .website-customer-actions > form,
.ui-erp .erp-main table[data-column-key="website-customers.index"] .website-customer-actions > .btn {
    flex: 0 0 auto;
}
.ui-erp .erp-main table[data-column-key="website-customers.index"] .website-customer-actions > form { margin: 0; }

/* Document tables: compact master rows with professional expandable details. */
.ui-erp .erp-document-table { width: 100%; table-layout: auto; }
.ui-erp .erp-document-table > thead > tr > th { background: #f1f5f9 !important; color: #334155; vertical-align: middle; }
.ui-erp .erp-document-table > tbody > tr.erp-document-row > td { padding-top: .62rem; padding-bottom: .62rem; }
.ui-erp .erp-document-index { width: 46px; color: #64748b; text-align: center; font-variant-numeric: tabular-nums; }
.ui-erp .erp-document-toggle { width: 30px; height: 30px; padding: 0 !important; display: inline-flex; align-items: center; justify-content: center; border-radius: 50% !important; color: #2563eb; font-weight: 800; }
.ui-erp .erp-document-detail-row > td { padding: 0 !important; border: 0 !important; background: #fff9e8 !important; }
.ui-erp .erp-document-detail { margin: 0; padding: .75rem; border: 1px solid #f2dfa1; border-top: 0; background: #fffbee; }
.ui-erp .erp-document-detail-title { display: inline-flex; align-items: center; gap: .45rem; margin-bottom: .65rem; padding: .42rem .7rem; border-left: 3px solid #2563eb; border-radius: 0 .45rem .45rem 0; background: #fff; color: #9a3412; font-weight: 800; }
.ui-erp .erp-document-summary { display: flex; align-items: center; flex-wrap: wrap; gap: .55rem 1rem; margin-bottom: .75rem; padding: .68rem .8rem; border: 1px solid #bfe3bd; border-radius: .55rem; background: #e7f6e4; color: #276b2e; }
.ui-erp .erp-document-summary span { display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; }
.ui-erp .erp-document-summary strong { color: #14532d; font-variant-numeric: tabular-nums; }
.ui-erp .erp-document-detail-table { border: 1px solid #d9dee5; background: #fff; }
.ui-erp .erp-document-detail-table thead th { background: #f4f4f4 !important; color: #a3312b !important; }
.ui-erp .erp-document-detail-table tfoot td { border-top: 2px solid #cbd5e1; background: #f8fafc !important; font-weight: 800; }
.ui-erp .erp-document-page-total td { font-weight: 800; }
@media (max-width: 767.98px) {
    .ui-erp .erp-document-summary { align-items: flex-start; flex-direction: column; gap: .35rem; }
    .ui-erp .erp-document-detail { padding: .55rem; }
}

/* Sales list: stronger hierarchy without increasing the table width. */
.ui-erp .erp-sales-list-card { overflow: hidden; }
.ui-erp .erp-sales-list-card > .card-header { min-height: 64px; padding-inline: 1rem; }
.ui-erp .erp-sales-list-card > .card-body { padding: .9rem; }
.ui-erp .erp-sales-document-table { margin-bottom: .75rem; }
.ui-erp .erp-sales-filter-grid { display: grid; grid-template-columns: 140px 140px minmax(150px,1fr) minmax(130px,.85fr) minmax(220px,1.65fr) 92px; gap: .55rem; align-items: end; }
.ui-erp .erp-sales-filter-grid > * { min-width: 0; }
.ui-erp .erp-sales-filter-search { min-width: 0; }
.ui-erp .erp-sales-filter-reset { min-width: 0; }
.ui-erp .erp-sales-filter-reset .btn { width: 100%; white-space: nowrap; }
.ui-erp .erp-sales-filter-card.is-loading { opacity: .72; pointer-events: none; }
.ui-erp .erp-document-table-wrap { overflow-x: auto !important; overflow-y: hidden !important; scrollbar-gutter: stable; }
:is(.ui-erp, .ui-store, .ui-mobile, .ui-app) .erp-resizable-table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto !important;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
}
.ui-erp .erp-sales-document-table { min-width: 1320px; table-layout: fixed; }
.ui-erp .erp-document-table.erp-columns-customized,
.ui-erp .erp-product-simple-table.erp-columns-customized,
.ui-erp .erp-partners-table.erp-columns-customized { width: 100% !important; min-width: 100% !important; table-layout: auto !important; }
.ui-erp table.erp-columns-customized > thead > tr > th,
.ui-erp table.erp-columns-customized > tbody > tr > td { width: auto !important; max-width: none; }
.ui-erp .erp-sales-document-table .col-index { width: 48px; }
.ui-erp .erp-sales-document-table .col-toggle { width: 48px; }
.ui-erp .erp-sales-document-table .col-code { width: 100px; }
.ui-erp .erp-sales-document-table .col-date { width: 90px; }
.ui-erp .erp-sales-document-table .col-user { width: 112px; }
.ui-erp .erp-sales-document-table .col-warehouse { width: 120px; }
.ui-erp .erp-sales-document-table .col-partner { width: 145px; }
.ui-erp .erp-sales-document-table .col-customer-type { width: 100px; }
.ui-erp .erp-sales-document-table .col-source { width: 92px; }
.ui-erp .erp-sales-document-table .col-money { width: 105px; }
.ui-erp .erp-sales-document-table .col-document { width: 105px; }
.ui-erp .erp-document-items-detail .col-index { width: 48px; }
.ui-erp .erp-document-items-detail .col-thumb { width: 56px; }
.ui-erp .erp-document-items-detail .col-product-name { width: 420px; }
.ui-erp .erp-document-items-detail .col-unit { width: 80px; }
.ui-erp .erp-document-items-detail .col-qty { width: 80px; }
.ui-erp .erp-document-items-detail .col-price { width: 110px; }
.ui-erp .erp-document-items-detail .col-total { width: 120px; }
.ui-erp .erp-document-items-detail { table-layout: fixed !important; width: auto !important; }
.ui-erp .erp-document-items-detail-wrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ui-erp .erp-document-item-th-resizable { position: relative; }
.ui-erp .erp-document-item-col-resizer { position: absolute; top: 0; right: -4px; z-index: 5; display: block; width: 8px; height: 100%; cursor: col-resize; touch-action: none; }
.ui-erp .erp-document-item-col-resizer::after { content: ''; position: absolute; top: 15%; bottom: 15%; left: 3px; width: 2px; border-radius: 999px; background: transparent; transition: background-color .15s ease; }
.ui-erp .erp-document-item-th-resizable:hover .erp-document-item-col-resizer::after,
.ui-erp .erp-document-item-col-resizer:hover::after { background: #2563eb; }
body.erp-document-item-col-resizing { cursor: col-resize !important; user-select: none; }
.ui-erp .erp-sales-document-table .col-status { width: 105px; }
.ui-erp .erp-sales-document-table .col-actions { width: 72px; }
.ui-erp .erp-sales-document-table > thead > tr > th { border-bottom: 2px solid #cbd8e6 !important; white-space: nowrap; }
:is(.ui-erp .erp-main, .ui-store, .ui-mobile, .ui-app) table.erp-columns-resizable > thead > tr > th.erp-column-divider,
:is(.ui-erp .erp-main, .ui-store, .ui-mobile, .ui-app) table.erp-columns-resizable > tbody > tr > td:not(:last-child),
:is(.ui-erp .erp-main, .ui-store, .ui-mobile, .ui-app) table.erp-columns-resizable > tbody > tr > th:not(:last-child),
:is(.ui-erp .erp-main, .ui-store, .ui-mobile, .ui-app) table.erp-columns-resizable > tfoot > tr > th:not(:last-child),
:is(.ui-erp .erp-main, .ui-store, .ui-mobile, .ui-app) table.erp-columns-resizable > tfoot > tr > td:not(:last-child) {
    border-right: 1px solid #d4deea !important;
}
:is(.ui-erp .erp-main, .ui-store, .ui-mobile, .ui-app) table.erp-columns-resizable > thead > tr > th {
    position: relative !important;
}
:is(.ui-erp .erp-main, .ui-store, .ui-mobile, .ui-app) table.erp-columns-resizable.erp-column-widths-applied {
    width: var(--erp-user-table-width) !important;
    min-width: var(--erp-user-table-width) !important;
    max-width: none !important;
    table-layout: fixed !important;
}
:is(.ui-erp .erp-main, .ui-store, .ui-mobile, .ui-app) table.erp-columns-resizable.erp-column-widths-applied > thead > tr > th,
:is(.ui-erp .erp-main, .ui-store, .ui-mobile, .ui-app) table.erp-columns-resizable.erp-column-widths-applied > tbody > tr > td,
:is(.ui-erp .erp-main, .ui-store, .ui-mobile, .ui-app) table.erp-columns-resizable.erp-column-widths-applied > tbody > tr > th,
:is(.ui-erp .erp-main, .ui-store, .ui-mobile, .ui-app) table.erp-columns-resizable.erp-column-widths-applied > tfoot > tr > td,
:is(.ui-erp .erp-main, .ui-store, .ui-mobile, .ui-app) table.erp-columns-resizable.erp-column-widths-applied > tfoot > tr > th {
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
}
:is(.ui-erp .erp-main, .ui-store, .ui-mobile, .ui-app) table.erp-columns-resizable.erp-columns-customized {
    table-layout: fixed !important;
}
:is(.ui-erp, .ui-store, .ui-mobile, .ui-app) .erp-column-resizer {
    position: absolute;
    top: 0;
    right: -5px;
    z-index: 8;
    display: block;
    width: 10px;
    height: 100%;
    cursor: col-resize;
    touch-action: none;
    outline: 0;
}
:is(.ui-erp, .ui-store, .ui-mobile, .ui-app) .erp-column-resizer::after {
    content: '';
    position: absolute;
    top: 18%;
    bottom: 18%;
    left: 4px;
    width: 2px;
    border-radius: 999px;
    background: transparent;
    transition: background-color .15s ease;
}
:is(.ui-erp, .ui-store, .ui-mobile, .ui-app) .erp-columns-resizable > thead > tr > th:hover > .erp-column-resizer::after,
:is(.ui-erp, .ui-store, .ui-mobile, .ui-app) .erp-column-resizer:focus-visible::after,
:is(.ui-erp, .ui-store, .ui-mobile, .ui-app) .erp-column-resizer.is-active::after {
    background: #2563eb;
}
body.erp-column-resizing,
body.erp-column-resizing * {
    cursor: col-resize !important;
    user-select: none !important;
}
@media (max-width: 1199.98px) {
    .ui-erp .erp-main table.erp-product-simple-table.erp-column-widths-applied > thead > tr > th:not(.erp-column-hidden),
    .ui-erp .erp-main table.erp-product-simple-table.erp-column-widths-applied > tbody > tr > td:not(.erp-column-hidden),
    .ui-erp .erp-main table.erp-product-simple-table.erp-column-widths-applied > tfoot > tr > td:not(.erp-column-hidden) {
        display: table-cell !important;
    }
}
.ui-erp .erp-sales-document-table > tbody > tr.erp-document-row { border-left: 3px solid transparent; }
.ui-erp .erp-sales-document-table > tbody > tr.erp-document-row:hover { border-left-color: #93c5fd; background: #f8fbff; }
.ui-erp .erp-sales-document-table > tbody > tr.erp-document-row.is-expanded { border-left-color: #2563eb; background: #eff6ff !important; }
.ui-erp .erp-sales-document-table > tbody > tr.erp-document-row > td { border-bottom-color: #e5edf5; }
.ui-erp .erp-document-code { color: #0f3d75; font-weight: 800; letter-spacing: .01em; white-space: nowrap; }
.ui-erp .erp-money-cell { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ui-erp .erp-sales-document-table .erp-document-toggle[aria-expanded="true"] { border-color: #2563eb !important; background: #2563eb !important; color: #fff; }
.ui-erp .erp-sales-document-table .erp-document-detail-row > td { background: #f7faff !important; }
.ui-erp .erp-sales-document-table .erp-document-detail { padding: .9rem 1rem 1rem; border: 1px solid #cfe0f5; border-top: 0; background: linear-gradient(180deg, #f8fbff 0, #fff 100%); }
.ui-erp .erp-document-detail-heading { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .7rem; }
.ui-erp .erp-sales-document-table .erp-document-detail-title { margin: 0; border: 0; border-radius: .55rem; background: #eaf2ff; color: #334155; }
.ui-erp .erp-sales-document-table .erp-document-detail-title i { color: #2563eb; }
.ui-erp .erp-sales-document-table .erp-document-detail-title strong { color: #0f3d75; }
.ui-erp .erp-document-detail-count { padding: .25rem .6rem; border: 1px solid #d7e3f1; border-radius: 999px; background: #fff; color: #64748b; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.ui-erp .erp-sales-document-table .erp-document-summary { display: grid; grid-template-columns: repeat(5, minmax(120px, 1fr)); gap: .55rem; margin-bottom: .85rem; padding: 0; border: 0; background: transparent; }
.ui-erp .erp-document-stat { display: flex; align-items: center; gap: .6rem; min-width: 0; padding: .65rem .7rem; border: 1px solid #dde7f1; border-radius: .65rem; background: #fff; color: #64748b; }
.ui-erp .erp-document-stat > i { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 30px; width: 30px; height: 30px; border-radius: .55rem; background: #edf4ff; color: #2563eb; font-size: .9rem; }
.ui-erp .erp-document-stat > span { display: flex; min-width: 0; flex-direction: column; gap: .1rem; font-size: .7rem; line-height: 1.25; }
.ui-erp .erp-document-stat strong { overflow: hidden; color: #172033; font-size: .86rem; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.ui-erp .erp-document-stat.is-total { border-color: #b9d5ff; background: #f0f6ff; }
.ui-erp .erp-document-stat.is-total strong { color: #0b57d0; }
.ui-erp .erp-document-stat.is-debt { border-color: #fed7aa; background: #fff7ed; }
.ui-erp .erp-document-stat.is-debt > i { background: #ffedd5; color: #c2410c; }
.ui-erp .erp-document-stat.is-debt strong { color: #c2410c; }
.ui-erp .erp-sales-document-table .erp-document-detail-table { overflow: hidden; border-color: #d7e3f1; border-radius: .55rem; }
.ui-erp .erp-sales-document-table .erp-document-detail-table thead th { border-bottom: 1px solid #cbd8e6 !important; background: #eef3f8 !important; color: #334155 !important; }
.ui-erp .erp-sales-document-table .erp-document-detail-table tbody tr:nth-child(even) td { background: #f8fafc; }
.ui-erp .erp-document-product { display: flex; align-items: center; gap: .55rem; min-width: 0; }
.ui-erp .erp-document-product-code { flex: 0 0 auto; padding: .16rem .42rem; border: 1px solid #d7e3f1; border-radius: .35rem; background: #f8fafc; color: #475569; font-size: .7rem; font-weight: 700; }
.ui-erp .erp-document-product strong { min-width: 0; color: #172033; white-space: normal; overflow-wrap: break-word; }
.ui-erp .erp-document-product-thumb { display: block; width: 40px; height: 40px; border: 1px solid #d7e3f1; border-radius: .4rem; background: #f8fafc; object-fit: cover; }
.ui-erp .erp-document-product-thumb-empty { display: flex; align-items: center; justify-content: center; color: #94a3b8; font-size: 1rem; }
@media (hover: hover) and (pointer: fine) {
    .ui-erp img.erp-document-product-thumb { cursor: zoom-in; }
}
.erp-image-zoom-overlay {
    display: none;
    position: fixed;
    z-index: 4000;
    border: 1px solid #d7e3f1;
    border-radius: .6rem;
    background: #fff;
    object-fit: cover;
    box-shadow: 0 4px 10px rgba(15,23,42,.15);
    opacity: 0;
    pointer-events: none;
    transition: left .32s cubic-bezier(.22,.61,.36,1), top .32s cubic-bezier(.22,.61,.36,1), width .32s cubic-bezier(.22,.61,.36,1), height .32s cubic-bezier(.22,.61,.36,1), box-shadow .32s ease, opacity .32s ease;
}
.erp-image-zoom-overlay.is-visible { box-shadow: 0 24px 60px rgba(15,23,42,.45); border-color: #93c5fd; opacity: 1; }
.ui-erp .erp-pos-unit { display: inline-flex; align-items: center; justify-content: center; min-width: 52px; padding: .3rem .55rem; border: 1px solid #d7e3f1; border-radius: .55rem; background: #f8fafc; color: #334155; font-weight: 700; white-space: nowrap; }
.ui-erp .erp-pos-quantity { min-width: 96px; font-variant-numeric: tabular-nums; }

/* Purchase and sales documents share one clear detail and totals hierarchy. */
.ui-erp .erp-purchase-document-table { min-width: 1180px; }
.ui-erp .erp-document-table > tbody > tr.erp-document-row { border-left: 3px solid transparent; transition: background-color .15s ease, border-color .15s ease; }
.ui-erp .erp-document-table > tbody > tr.erp-document-row:hover { border-left-color: #93c5fd; background: #f8fbff; }
.ui-erp .erp-document-table > tbody > tr.erp-document-row.is-expanded { border-left-color: #2563eb; background: #eff6ff !important; }
.ui-erp .erp-document-table .erp-document-toggle[aria-expanded="true"] { border-color: #2563eb !important; background: #2563eb !important; color: #fff; }
.ui-erp .erp-purchase-document-table .erp-document-detail-row > td { background: #f7faff !important; }
.ui-erp .erp-purchase-document-table .erp-document-detail { padding: .9rem 1rem 1rem; border: 1px solid #cfe0f5; border-top: 0; background: linear-gradient(180deg, #f8fbff 0, #fff 100%); }
.ui-erp .erp-purchase-document-table .erp-document-detail-title { margin: 0; border: 0; border-radius: .55rem; background: #eaf2ff; color: #334155; }
.ui-erp .erp-purchase-document-table .erp-document-detail-title i { color: #2563eb; }
.ui-erp .erp-purchase-document-table .erp-document-detail-title strong { color: #0f3d75; }
.ui-erp .erp-purchase-document-table .erp-document-summary { display: grid; grid-template-columns: repeat(5, minmax(120px, 1fr)); gap: .55rem; margin-bottom: .85rem; padding: 0; border: 0; background: transparent; }
.ui-erp .erp-purchase-document-table .erp-document-detail-table { overflow: hidden; border-color: #d7e3f1; border-radius: .55rem; }
.ui-erp .erp-purchase-document-table .erp-document-detail-table thead th { border-bottom: 1px solid #cbd8e6 !important; background: #eef3f8 !important; color: #334155 !important; }
.ui-erp .erp-purchase-document-table .erp-document-detail-table tbody tr:nth-child(even) td { background: #f8fafc; }

.ui-erp .erp-document-detail-table .erp-document-detail-total > td { padding: .65rem .75rem !important; border-top: 2px solid #94a3b8 !important; background: #f8fafc !important; vertical-align: middle; }
.ui-erp .erp-document-detail-table .erp-document-detail-total .erp-total-title { display: inline-flex; align-items: center; gap: .45rem; color: #334155; font-size: .82rem; font-weight: 800; text-transform: uppercase; }
.ui-erp .erp-document-detail-table .erp-document-detail-total .erp-total-title i { color: #2563eb; }
.ui-erp .erp-document-detail-table .erp-document-detail-total small,
.ui-erp .erp-document-detail-table .erp-document-detail-total strong { display: block; }
.ui-erp .erp-document-detail-table .erp-document-detail-total small { margin-bottom: .12rem; color: #64748b; font-size: .65rem; font-weight: 700; text-transform: uppercase; }
.ui-erp .erp-document-detail-table .erp-document-detail-total strong { color: #0f172a; font-size: .9rem; font-variant-numeric: tabular-nums; }

.ui-erp .erp-document-table > tfoot > .erp-document-page-total > td { padding: .68rem .75rem !important; border-top: 3px solid #2563eb !important; border-bottom: 1px solid #bfdbfe !important; vertical-align: middle; }
.ui-erp .erp-document-page-total .erp-page-total-title { background: #f8fafc !important; }
.ui-erp .erp-page-total-title > span,
.ui-erp .erp-page-total-title > small { display: block; }
.ui-erp .erp-page-total-title > span { color: #0f172a; font-size: .88rem; font-weight: 800; }
.ui-erp .erp-page-total-title > span i { margin-right: .45rem; color: #2563eb; }
.ui-erp .erp-page-total-title > small { margin-top: .15rem; color: #64748b; font-size: .68rem; font-weight: 500; }
.ui-erp .erp-page-total-metric small,
.ui-erp .erp-page-total-metric strong { display: block; white-space: nowrap; }
.ui-erp .erp-page-total-metric small { margin-bottom: .14rem; color: #64748b; font-size: .64rem; font-weight: 800; text-transform: uppercase; }
.ui-erp .erp-page-total-metric strong { font-size: .92rem; font-variant-numeric: tabular-nums; }
.ui-erp .erp-page-total-metric.is-total { background: #eff6ff !important; }
.ui-erp .erp-page-total-metric.is-total strong { color: #1d4ed8; }
.ui-erp .erp-page-total-metric.is-paid { background: #ecfdf5 !important; }
.ui-erp .erp-page-total-metric.is-paid strong { color: #047857; }
.ui-erp .erp-page-total-metric.is-debt { background: #fff7ed !important; }
.ui-erp .erp-page-total-metric.is-debt strong { color: #c2410c; }
.ui-erp .erp-page-total-spacer { background: #f8fafc !important; }

.ui-erp .erp-document-show-card { overflow: hidden; border: 1px solid #d6e1ed !important; }
.ui-erp .erp-document-show-table-wrap { margin-top: 1rem; border: 1px solid #cddbea; border-radius: .55rem; overflow: auto; }
.ui-erp .erp-document-show-table { min-width: 760px; margin: 0; }
.ui-erp .erp-document-show-table > thead > tr > th { padding: .68rem .75rem; border-bottom: 2px solid #bfd0e1; background: #eef4fa !important; color: #334155; white-space: nowrap; }
.ui-erp .erp-document-show-table > tbody > tr > td { padding: .62rem .75rem; border-bottom-color: #e2e8f0; vertical-align: middle; }
.ui-erp .erp-document-show-table > tbody > tr:nth-child(even) > td { background: #f8fafc; }
.ui-erp .erp-document-show-table .erp-document-show-total > th { padding: .78rem .75rem !important; border-top: 3px solid #2563eb !important; background: #eff6ff !important; color: #0f172a; vertical-align: middle; }
.ui-erp .erp-document-show-table .erp-document-show-total > th:first-child { text-align: left; }
.ui-erp .erp-document-show-table .erp-document-show-total > th:not(:first-child) { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ui-erp .erp-document-show-total span { display: inline-flex; align-items: center; gap: .5rem; white-space: nowrap; font-size: .86rem; font-weight: 800; text-transform: uppercase; }
.ui-erp .erp-document-show-total span i { color: #2563eb; font-size: 1rem; }
.ui-erp .erp-document-financial-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .65rem; margin: .85rem 0 1rem auto; max-width: 760px; }
.ui-erp .erp-document-financial-summary > div { display: flex; min-height: 68px; flex-direction: column; justify-content: center; padding: .65rem .8rem; border: 1px solid #dbe4ee; border-radius: .55rem; background: #fff; }
.ui-erp .erp-document-financial-summary small { margin-bottom: .16rem; color: #64748b; font-size: .67rem; font-weight: 800; text-transform: uppercase; }
.ui-erp .erp-document-financial-summary strong { color: #0f172a; font-size: 1rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ui-erp .erp-document-financial-summary .is-total { border-color: #bfdbfe; background: #eff6ff; }
.ui-erp .erp-document-financial-summary .is-total strong { color: #1d4ed8; }
.ui-erp .erp-document-financial-summary .is-paid { border-color: #bbf7d0; background: #ecfdf5; }
.ui-erp .erp-document-financial-summary .is-paid strong { color: #047857; }
.ui-erp .erp-document-financial-summary .is-debt { border-color: #fed7aa; background: #fff7ed; }
.ui-erp .erp-document-financial-summary .is-debt strong { color: #c2410c; }
.ui-erp .erp-document-financial-summary .is-return { border-color: #fde68a; background: #fffbeb; }
.ui-erp .erp-document-financial-summary .is-return strong { color: #a16207; }

@media (max-width: 1199.98px) {
    .ui-erp .erp-purchase-document-table .erp-document-summary { grid-template-columns: repeat(3, minmax(120px, 1fr)); }
}
@media (max-width: 767.98px) {
    .ui-erp .erp-purchase-document-table .erp-document-summary { grid-template-columns: repeat(2, minmax(120px, 1fr)); width: 100%; }
}
@media (max-width: 1199.98px) {
    .ui-erp .erp-sales-filter-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
    .ui-erp .erp-sales-filter-search { grid-column: span 3; }
    .ui-erp .erp-sales-document-table .erp-document-summary { grid-template-columns: repeat(3, minmax(120px, 1fr)); }
}
@media (max-width: 767.98px) {
    .ui-erp .erp-sales-filter-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .ui-erp .erp-sales-filter-search { grid-column: 1 / -1; }
    .ui-erp .erp-sales-filter-reset { grid-column: 1 / -1; }
    .ui-erp .erp-sales-filter-reset .btn { width: 100%; }
    .ui-erp .erp-sales-list-card > .card-body { padding: .55rem; }
    .ui-erp .erp-document-detail-heading { align-items: flex-start; flex-direction: column; }
    .ui-erp .erp-sales-document-table .erp-document-summary { grid-template-columns: repeat(2, minmax(120px, 1fr)); width: 100%; }
    .ui-erp .erp-document-product { align-items: flex-start; flex-direction: column; gap: .25rem; }
}
@media (max-width: 479.98px) {
    .ui-erp .erp-sales-filter-grid { grid-template-columns: 1fr; }
    .ui-erp .erp-sales-filter-search { grid-column: auto; }
    .ui-erp .erp-sales-filter-reset { grid-column: auto; }
}

/* Shared product/customer picker: searchable, keyboard friendly, dynamic-row aware. */
.erp-smart-select { position: relative; width: 100%; min-width: 0; }
.erp-smart-select-control { position: relative; display: flex; align-items: center; }
.erp-smart-select-control > .bi-search { position: absolute; left: .78rem; z-index: 2; color: #64748b; pointer-events: none; }
.erp-smart-select-input { width: 100%; padding-left: 2.2rem !important; padding-right: 2.25rem !important; background-color: #fff !important; }
.erp-smart-select-input::-webkit-search-cancel-button { display: none; }
.erp-smart-select-clear { position: absolute; right: .45rem; z-index: 2; width: 30px; height: 30px; padding: 0; border: 0; border-radius: .45rem; background: transparent; color: #64748b; }
.erp-smart-select-clear:hover { background: #eef2f7; color: #dc2626; }
.erp-smart-select-native { position: absolute !important; width: 1px !important; height: 1px !important; margin: 0 !important; padding: 0 !important; opacity: 0 !important; pointer-events: none !important; overflow: hidden !important; }
.erp-smart-select-dropdown { display: none; position: absolute; left: 0; right: 0; top: calc(100% + 5px); z-index: 7500; max-height: min(360px, 52vh); overflow-y: auto; padding: .35rem; border: 1px solid #d7e0eb; border-radius: .75rem; background: #fff; box-shadow: 0 18px 38px rgba(15, 23, 42, .18); }
.erp-smart-select.open .erp-smart-select-dropdown { display: block; }
.erp-smart-select-option { display: block; width: 100%; padding: .65rem .75rem; border: 0; border-radius: .55rem; background: #fff; color: #172033; text-align: left; line-height: 1.35; white-space: normal; }
.erp-smart-select-option + .erp-smart-select-option { margin-top: .15rem; }
.erp-smart-select-option:hover,
.erp-smart-select-option.active { background: #eaf3ff; color: #0b57d0; }
.erp-smart-select-option[aria-selected="true"] { background: #ecfdf5; color: #047857; font-weight: 700; }
.erp-smart-select-option:disabled { color: #94a3b8; background: #f8fafc; cursor: not-allowed; }
.erp-smart-select-empty { padding: .9rem; color: #64748b; text-align: center; }
.table-responsive:has(.erp-smart-select.open),
.card:has(.erp-smart-select.open),
.card-body:has(.erp-smart-select.open) { overflow: visible !important; z-index: 120; }
@media (max-width: 575.98px) {
    .erp-smart-select-dropdown { position: fixed; left: .75rem; right: .75rem; top: 22vh; max-height: 56vh; border-radius: 1rem; }
    .erp-smart-select-option { min-height: 46px; padding: .75rem; }
}

/* Global table stability: avoid nested vertical scrolling and clipped first rows. */
.ui-erp .erp-main .erp-table-wrap,
.ui-erp .erp-main .erp-auto-table-responsive,
.ui-erp .erp-main .card-body > .table-responsive,
.ui-erp .erp-main .card > .table-responsive {
    width: 100%;
    max-height: none !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    scrollbar-gutter: auto !important;
}
.ui-erp .erp-main table.table thead th,
.ui-erp .erp-main .erp-datatable thead th {
    position: static !important;
    top: auto !important;
}
.ui-erp .erp-main table.table th:last-child,
.ui-erp .erp-main table.table td:last-child {
    position: static !important;
    right: auto !important;
    box-shadow: none !important;
}
.ui-erp .erp-main table.table tfoot th,
.ui-erp .erp-main table.table tfoot td {
    position: static !important;
    bottom: auto !important;
}

/* System-wide responsive calibration: ERP, storefront, auth and mobile. */
html { max-width: 100%; overflow-x: hidden; }
body { min-width: 0; max-width: 100%; overflow-x: clip; }
img, svg, video, canvas { max-width: 100%; }
.ui-erp *, .ui-store *, .ui-mobile *, .ui-auth * { min-width: 0; }
.ui-erp .container-fluid, .ui-store .container, .ui-store .container-fluid { max-width: 100%; }
.ui-auth .card[style*="width"] { width: min(100%, 460px) !important; max-width: calc(100vw - 2rem); }

/* Flexible controls and action groups. */
.ui-erp .erp-main .row > *, .ui-store .row > * { min-width: 0; }
.ui-erp .erp-main .input-group, .ui-store .input-group { flex-wrap: nowrap; }
.ui-erp .erp-main textarea, .ui-store textarea { max-width: 100%; resize: vertical; }
.ui-erp .erp-main .btn-group, .ui-store .btn-group { max-width: 100%; }
.ui-erp .erp-main .dropdown-menu, .ui-store .dropdown-menu { max-width: min(94vw, 420px); }
.ui-erp .erp-main .nav-tabs, .ui-erp .erp-main .nav-pills { flex-wrap: nowrap; max-width: 100%; overflow-x: auto; scrollbar-width: thin; }
.ui-erp .erp-main .nav-tabs .nav-link, .ui-erp .erp-main .nav-pills .nav-link { white-space: nowrap; }

/* Data-heavy screens retain meaning while allowing deliberate horizontal scroll. */
.ui-erp .erp-main .table-responsive,
.ui-erp .erp-main .erp-auto-table-responsive,
.ui-store .table-responsive { max-width: 100%; overscroll-behavior-inline: contain; scrollbar-width: thin; }
.ui-erp .erp-main .table-responsive::-webkit-scrollbar,
.ui-store .table-responsive::-webkit-scrollbar { height: 8px; }
.ui-erp .erp-main .table-responsive::-webkit-scrollbar-thumb,
.ui-store .table-responsive::-webkit-scrollbar-thumb { border-radius: 999px; background: #cbd5e1; }
.ui-erp .erp-main table { font-variant-numeric: tabular-nums; }
.ui-erp .erp-main table.table th,
.ui-erp .erp-main table.table td { word-break: normal; overflow-wrap: normal; }
.ui-erp .erp-main table.table td { white-space: normal; }
.ui-erp .erp-main table.table td.text-nowrap,
.ui-erp .erp-main table.table td.text-end,
.ui-erp .erp-main table.table td .badge { white-space: nowrap; }

/* Partner directory prioritizes names and addresses while keeping numeric columns compact. */
.ui-erp .erp-partners-table { min-width: 1420px !important; table-layout: fixed !important; }
.ui-erp .erp-partners-table .partner-col-stt { width: 48px !important; }
.ui-erp .erp-partners-table .partner-col-code { width: 105px; }
.ui-erp .erp-partners-table .partner-col-name { width: 190px; }
.ui-erp .erp-partners-table .partner-col-type { width: 155px; }
.ui-erp .erp-partners-table .partner-col-phone { width: 90px; }
.ui-erp .erp-partners-table .partner-col-address { width: 350px; }
.ui-erp .erp-partners-table .partner-col-email { width: 175px; }
.ui-erp .erp-partners-table .partner-col-price { width: 86px; }
.ui-erp .erp-partners-table .partner-col-balance { width: 108px; }
.ui-erp .erp-partners-table .partner-col-status { width: 92px; }
.ui-erp .erp-partners-table .partner-col-actions { width: 76px !important; }
.ui-erp .erp-partners-table > :is(thead, tbody) > tr > :is(th, td) { border-right: 1px solid #d6e0ea; }
.ui-erp .erp-partners-table > :is(thead, tbody) > tr > :is(th, td):last-child { border-right: 0; }
.ui-erp .erp-partners-table .partner-name-cell a { color: #123b64; font-weight: 750; text-decoration: none; }
.ui-erp .erp-partners-table .partner-name-cell a:hover { color: #0d6efd; text-decoration: underline; }
.ui-erp .erp-partners-table .partner-price-group-cell,
.ui-erp .erp-partners-table th:nth-child(5),
.ui-erp .erp-partners-table td:nth-child(5),
.ui-erp .erp-partners-table th:nth-child(9),
.ui-erp .erp-partners-table td:nth-child(9),
.ui-erp .erp-partners-table th:nth-child(10),
.ui-erp .erp-partners-table td:nth-child(10),
.ui-erp .erp-partners-table th:nth-child(11),
.ui-erp .erp-partners-table td:nth-child(11) { white-space: nowrap; }

/* Partner profile presents operational details as a compact, scannable record. */
.ui-erp .erp-partner-profile { overflow: hidden; }
.ui-erp .erp-partner-profile-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1.15rem 1.25rem; border-bottom: 1px solid #dbe5ef; background: #f8fbff; }
.ui-erp .erp-partner-profile-identity { display: flex; min-width: 0; align-items: center; gap: .9rem; }
.ui-erp .erp-partner-profile-icon { display: grid; width: 46px; height: 46px; flex: 0 0 46px; place-items: center; border: 1px solid #bfdbfe; border-radius: .5rem; background: #eff6ff; color: #2563eb; font-size: 1.25rem; }
.ui-erp .erp-partner-profile-code { margin-bottom: .1rem; color: #64748b; font-size: .72rem; font-weight: 800; text-transform: uppercase; }
.ui-erp .erp-partner-profile h1 { margin: 0; color: #0f172a; font-size: 1.25rem; font-weight: 800; letter-spacing: 0; overflow-wrap: anywhere; }
.ui-erp .erp-partner-profile-tags { display: flex; flex-wrap: wrap; gap: .4rem .85rem; margin-top: .4rem; color: #475569; font-size: .78rem; }
.ui-erp .erp-partner-profile-tags span { display: inline-flex; align-items: center; gap: .32rem; }
.ui-erp .erp-partner-profile-tags i { color: #2563eb; }
.ui-erp .erp-partner-status { display: inline-flex; flex: 0 0 auto; align-items: center; gap: .35rem; padding: .38rem .58rem; border-radius: .45rem; font-size: .75rem; font-weight: 750; white-space: nowrap; }
.ui-erp .erp-partner-status.is-active { border: 1px solid #a7f3d0; background: #ecfdf5; color: #047857; }
.ui-erp .erp-partner-status.is-locked { border: 1px solid #fecaca; background: #fef2f2; color: #b91c1c; }
.ui-erp .erp-partner-profile-body { padding: 0 1.25rem; }
.ui-erp .erp-partner-section { padding: 1.15rem 0; border-bottom: 1px solid #e2e8f0; }
.ui-erp .erp-partner-section-title { display: flex; align-items: flex-start; gap: .65rem; margin-bottom: .9rem; }
.ui-erp .erp-partner-section-title > i { margin-top: .05rem; color: #2563eb; font-size: 1rem; }
.ui-erp .erp-partner-section-title h2 { margin: 0; color: #1e293b; font-size: .92rem; font-weight: 800; letter-spacing: 0; }
.ui-erp .erp-partner-section-title p { margin: .12rem 0 0; color: #64748b; font-size: .72rem; }
.ui-erp .erp-partner-details { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; border: 1px solid #dbe5ef; border-radius: .45rem; overflow: hidden; }
.ui-erp .erp-partner-details > div { min-width: 0; padding: .75rem .85rem; border-right: 1px solid #dbe5ef; background: #fff; }
.ui-erp .erp-partner-details > div:nth-child(3) { border-right: 0; }
.ui-erp .erp-partner-details > .is-wide { grid-column: 1 / -1; border-top: 1px solid #dbe5ef; border-right: 0; background: #f8fafc; }
.ui-erp .erp-partner-details dt { display: flex; align-items: center; gap: .38rem; margin-bottom: .3rem; color: #64748b; font-size: .69rem; font-weight: 800; text-transform: uppercase; }
.ui-erp .erp-partner-details dt i { color: #2563eb; font-size: .82rem; }
.ui-erp .erp-partner-details dd { margin: 0; color: #172033; font-size: .86rem; font-weight: 650; overflow-wrap: anywhere; }
.ui-erp .erp-partner-details dd a { color: #0b63ce; text-decoration: none; }
.ui-erp .erp-partner-details dd a:hover { text-decoration: underline; }
.ui-erp .erp-partner-balance-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.ui-erp .erp-partner-balance-grid > div { display: grid; gap: .22rem; padding: .85rem 1rem; border: 1px solid; border-radius: .5rem; }
.ui-erp .erp-partner-balance-grid span { color: #475569; font-size: .72rem; font-weight: 800; text-transform: uppercase; }
.ui-erp .erp-partner-balance-grid strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ui-erp .erp-partner-balance-grid small { color: #64748b; font-size: .7rem; }
.ui-erp .erp-partner-balance-grid .is-receivable { border-color: #bbf7d0; background: #f0fdf4; }
.ui-erp .erp-partner-balance-grid .is-receivable strong { color: #047857; }
.ui-erp .erp-partner-balance-grid .is-payable { border-color: #fecaca; background: #fef2f2; }
.ui-erp .erp-partner-balance-grid .is-payable strong { color: #dc2626; }
.ui-erp .erp-partner-note > p { margin: 0; padding: .75rem .85rem; border-left: 3px solid #93c5fd; background: #f8fafc; color: #334155; white-space: pre-line; }
.ui-erp .erp-partner-profile-actions { display: flex; justify-content: flex-end; gap: .55rem; padding: 1rem 0 1.15rem; }
@media (max-width: 767.98px) {
    .ui-erp .erp-partner-profile-header { align-items: stretch; flex-direction: column; }
    .ui-erp .erp-partner-status { align-self: flex-start; }
    .ui-erp .erp-partner-details { grid-template-columns: 1fr; }
    .ui-erp .erp-partner-details > div { border-right: 0; border-bottom: 1px solid #dbe5ef; }
    .ui-erp .erp-partner-details > div:nth-child(3) { border-bottom: 0; }
    .ui-erp .erp-partner-details > .is-wide { grid-column: auto; border-top: 1px solid #dbe5ef; border-bottom: 0; }
    .ui-erp .erp-partner-balance-grid { grid-template-columns: 1fr; }
}

/* Cards, summaries and charts scale without fixed desktop assumptions. */
.ui-erp .erp-main .card, .ui-store .card { max-width: 100%; }
.ui-erp .erp-main canvas { width: 100% !important; max-height: min(420px, 55vh); }
.ui-erp .erp-main [class*="stats-grid"],
.ui-erp .erp-main [class*="kpi-grid"],
.ui-erp .erp-main [class*="summary-grid"] { grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }

/* Dialogs remain operable on short and narrow screens. */
.ui-erp .modal-dialog, .ui-store .modal-dialog { width: auto; max-width: min(var(--bs-modal-width, 720px), calc(100vw - 1.5rem)); margin-inline: auto; }
.ui-erp .modal-content, .ui-store .modal-content { max-height: calc(100dvh - 2rem); overflow: hidden; }
.ui-erp .modal-body, .ui-store .modal-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.ui-erp .modal-footer, .ui-store .modal-footer { flex-wrap: wrap; }

/* Storefront: modern fluid typography and non-clipping navigation/content. */
.ui-store .section-title { font-size: clamp(1.65rem, 1.25rem + 1.45vw, 2.65rem); line-height: 1.14; overflow-wrap: anywhere; }
.ui-store .hero-title { max-width: 100%; white-space: normal !important; text-wrap: balance; }
.ui-store .hero .lead { max-width: 100%; }
.ui-store .store-quote-cta { max-width: 100%; }
.ui-store .article-content { overflow-wrap: anywhere; }
.ui-store .article-content iframe { width: 100%; max-width: 100%; aspect-ratio: 16/9; height: auto; }
.ui-store .product-card, .ui-store .news-card { height: 100%; }
.ui-store .sticky-summary { top: clamp(72px, 10vh, 96px); }

@media (max-width: 1199.98px) {
    .ui-erp .erp-header { gap: .65rem; }
    .ui-erp .erp-header > div:first-child { flex: 1 1 280px; }
    .ui-erp .erp-header .erp-content-actions { flex: 1 1 100%; justify-content: flex-start; overflow-x: auto; padding-bottom: .15rem; }
    .ui-erp .erp-main [class*="content-grid"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ui-store .store-quote-cta { gap: 1rem; padding: 1.4rem; }
}

@media (max-width: 991.98px) {
    .ui-erp .erp-main { padding: .8rem !important; }
    .ui-erp .erp-page-heading, .ui-erp .erp-header { align-items: flex-start; flex-wrap: wrap; }
    .ui-erp .erp-header h5 { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
    .ui-erp .erp-header .small.text-muted { max-width: 100%; white-space: normal; }
    .ui-erp .erp-toolbar-actions, .ui-erp .erp-form-actions, .ui-erp .page-actions { width: 100%; flex-wrap: wrap; }
    .ui-erp .erp-toolbar-actions .btn, .ui-erp .erp-form-actions .btn, .ui-erp .page-actions .btn { flex: 1 1 150px; }
    .ui-erp .erp-table-tools { grid-template-columns: minmax(0, 1fr) !important; }
    .ui-erp .erp-table-tools > div:first-child { grid-template-columns: minmax(0, 1fr) !important; }
    .ui-erp .erp-table-tools .erp-search-field-wrap, .ui-erp .erp-table-tools .erp-table-search { max-width: none !important; }
    .ui-erp .erp-main .card-header { flex-wrap: wrap; gap: .55rem; }
    .ui-erp .erp-main .card-header > .d-flex { flex-wrap: wrap; }
    .ui-erp .erp-main .pagination { flex-wrap: wrap; }
    .ui-store .navbar-store .navbar-collapse { max-height: calc(100dvh - 90px); overflow-y: auto; overscroll-behavior: contain; }
    .ui-store .store-nav, .ui-store .navbar-nav { align-items: stretch !important; width: 100%; }
    .ui-store .store-nav-link, .ui-store .store-cart-link, .ui-store .store-user-link, .ui-store .store-erp-link { justify-content: flex-start; width: 100%; }
    .ui-store .sticky-summary { position: static; }
    .ui-store .store-quote-cta { align-items: flex-start; flex-direction: column; }
    .ui-store .store-quote-cta .btn { width: 100%; white-space: normal; }
}

@media (max-width: 767.98px) {
    :root { --responsive-page-gutter: .75rem; }
    .ui-erp .erp-main { padding: .65rem !important; }
    .ui-erp .erp-page-heading, .ui-erp .erp-header { padding: .65rem !important; border-radius: 10px; }
    .ui-erp .erp-main .card { border-radius: 12px !important; }
    .ui-erp .erp-main .card-body { padding: .75rem; }
    .ui-erp .erp-main .card-header { padding: .7rem .75rem; }
    .ui-erp .erp-main .form-control, .ui-erp .erp-main .form-select,
    .ui-store .form-control, .ui-store .form-select { min-height: 44px; font-size: 16px !important; }
    .ui-erp .erp-main .btn, .ui-store .btn { min-height: 42px; }
    .ui-erp .erp-toolbar-actions .btn, .ui-erp .erp-form-actions .btn, .ui-erp .page-actions .btn { flex-basis: calc(50% - .4rem); }
    .ui-erp .erp-main table.table { min-width: 680px; font-size: .82rem; }
    .ui-erp .erp-main table.table.table-sm { min-width: 620px; }
    .ui-erp .erp-main [class*="content-grid"],
    .ui-erp .erp-main [class*="stats-grid"],
    .ui-erp .erp-main [class*="kpi-grid"],
    .ui-erp .erp-main [class*="summary-grid"] { grid-template-columns: minmax(0, 1fr) !important; }
    .ui-erp .modal-dialog, .ui-store .modal-dialog { max-width: calc(100vw - 1rem); margin: .5rem; }
    .ui-erp .modal-content, .ui-store .modal-content { max-height: calc(100dvh - 1rem); border-radius: 14px; }
    .ui-erp .modal-footer .btn, .ui-store .modal-footer .btn { flex: 1 1 130px; }
    .ui-store .container, .ui-store .container-fluid { padding-inline: var(--responsive-page-gutter); }
    .ui-store .topbar { display: none; }
    .ui-store .navbar-store { min-height: 64px; }
    .ui-store .navbar-store .brand-logo { width: 42px; height: 42px; }
    .ui-store .navbar-store .navbar-brand { max-width: calc(100vw - 82px); font-size: .94rem; }
    .ui-store .navbar-store .navbar-brand span { max-width: calc(100vw - 145px); }
    .ui-store .hero { min-height: auto; }
    .ui-store .hero .container { padding-block: 2rem; }
    .ui-store .section-title { font-size: clamp(1.45rem, 7vw, 2rem); }
    .ui-store .footer { text-align: left; }
    .ui-store .footer .row { row-gap: 1.5rem; }
    .ui-store .product-card .card-body, .ui-store .news-card .card-body { padding: .8rem; }
    .ui-auth-shell { padding: .75rem !important; }
    .ui-auth-card { width: 100% !important; max-width: 100% !important; padding: 1.1rem !important; }
}

@media (max-width: 479.98px) {
    .ui-erp .erp-toolbar-actions .btn, .ui-erp .erp-form-actions .btn, .ui-erp .page-actions .btn { flex-basis: 100%; width: 100%; }
    .ui-erp .erp-main .input-group > .input-group-text { padding-inline: .55rem; }
    .ui-erp .erp-main table.table { min-width: 620px; }
    .ui-erp .erp-main .pagination .page-item:not(.active):not(:first-child):not(:last-child):not(:nth-child(2)):not(:nth-last-child(2)) { display: none; }
    .ui-store .store-brand-title, .ui-store .navbar-brand > span { font-size: .86rem; }
    .ui-store .btn { white-space: normal; }
}

@media (max-height: 520px) and (orientation: landscape) {
    .ui-erp .modal-content, .ui-store .modal-content { max-height: calc(100dvh - .5rem); }
    .ui-erp .modal-dialog, .ui-store .modal-dialog { margin-block: .25rem; }
    .ui-store .navbar-store .navbar-collapse { max-height: calc(100dvh - 64px); }
}

/* Storefront mobile header: keep long company names and the toggler on one line. */
@media (max-width: 991.98px) {
    .ui-store .navbar-store > .store-wide-container {
        align-items: center !important;
        column-gap: .5rem;
        flex-wrap: wrap;
    }

    .ui-store .navbar-store .navbar-brand {
        flex: 1 1 0;
        max-width: none !important;
        min-width: 0 !important;
        margin-right: 0;
        overflow: hidden;
    }

    .ui-store .navbar-store .navbar-brand > span {
        display: block;
        max-width: 100% !important;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .ui-store .navbar-store .navbar-toggler {
        flex: 0 0 auto;
        margin-left: auto;
    }

    .ui-store .navbar-store .navbar-collapse {
        flex-basis: 100%;
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ui-erp *, .ui-store *, .ui-mobile *, .ui-auth * { scroll-behavior: auto !important; }
}

/* Quotation detail: cleaner document-style item table. */
.ui-erp .quotation-items-card {
    border-color: #d8e2ee !important;
}
.ui-erp .quotation-items-card > .card-body {
    padding: .9rem !important;
}
.ui-erp .quotation-items-table-wrap {
    border: 1px solid #ccd8e6 !important;
    border-radius: 10px !important;
    background: #fff !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
}
.ui-erp .quotation-items-table {
    width: 100% !important;
    min-width: 760px !important;
    margin: 0 !important;
    table-layout: fixed !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
}
.ui-erp .quotation-items-table th,
.ui-erp .quotation-items-table td {
    border-color: #dbe5ef !important;
}
.ui-erp .quotation-items-table thead th {
    height: 44px !important;
    padding: .58rem .72rem !important;
    border-bottom: 2px solid #b9c8d9 !important;
    background: linear-gradient(180deg, #f8fbff 0%, #edf3f9 100%) !important;
    color: #16263a !important;
    font-size: .76rem !important;
    font-weight: 800 !important;
    letter-spacing: .02em !important;
    white-space: nowrap !important;
}
.ui-erp .quotation-items-table th:nth-child(1),
.ui-erp .quotation-items-table td:nth-child(1) {
    width: 56px !important;
}
.ui-erp .quotation-items-table th:nth-child(2),
.ui-erp .quotation-items-table td:nth-child(2) {
    width: auto !important;
}
.ui-erp .quotation-items-table th:nth-child(3),
.ui-erp .quotation-items-table td:nth-child(3) {
    width: 96px !important;
}
.ui-erp .quotation-items-table th:nth-child(4),
.ui-erp .quotation-items-table td:nth-child(4) {
    width: 92px !important;
}
.ui-erp .quotation-items-table th:nth-child(5),
.ui-erp .quotation-items-table td:nth-child(5),
.ui-erp .quotation-items-table th:nth-child(6),
.ui-erp .quotation-items-table td:nth-child(6) {
    width: 150px !important;
}
.ui-erp .quotation-items-table tbody td {
    padding: .62rem .72rem !important;
    color: #1f2d3d !important;
    line-height: 1.38 !important;
    vertical-align: middle !important;
}
.ui-erp .quotation-items-table tbody tr:nth-child(even) td {
    background: #fbfdff !important;
}
.ui-erp .quotation-items-table tbody tr:hover td {
    background: #f3f8ff !important;
}
.ui-erp .quotation-item-index {
    color: #40546b !important;
    font-weight: 700 !important;
}
.ui-erp .quotation-item-product {
    color: #102a43 !important;
    font-weight: 650 !important;
}
.ui-erp .quotation-item-total {
    color: #0f172a !important;
}
.ui-erp .quotation-items-table tfoot th {
    padding: .7rem .72rem !important;
    border-top: 1px solid #d6e1ec !important;
    background: #fff !important;
    color: #0f172a !important;
    font-weight: 800 !important;
}
.ui-erp .quotation-items-table tfoot tr:first-child th {
    border-top: 2px solid #c7d4e3 !important;
}
.ui-erp .quotation-items-table .quotation-grand-total th {
    background: #f8fafc !important;
}
.ui-erp .quotation-items-table .quotation-grand-total th:last-child {
    color: #000 !important;
    font-size: 1.05rem !important;
}
.ui-erp .quotation-note {
    margin: .85rem 0 0;
    color: #334155;
}

/* Optional warehouse location module and warehouse-transfer responsive calibration */
.ui-erp.location-management-disabled .sale-allocation-col,
.ui-erp.location-management-disabled .sale-allocation-head,
.ui-erp.location-management-disabled .pallet-allocation-cell,
.ui-erp.location-management-disabled [data-location-management-ui] {
    display: none !important;
}

.ui-erp .warehouse-transfer-form-card .search-dropdown {
    position: absolute;
    z-index: 1080;
    left: 0;
    right: 0;
    max-height: 320px;
    overflow-y: auto;
    display: none;
    box-shadow: 0 .75rem 1.5rem rgba(15, 23, 42, .15);
}
.ui-erp .warehouse-transfer-items-table th,
.ui-erp .warehouse-transfer-items-table td { vertical-align: middle; }
.ui-erp .warehouse-transfer-items-table .transfer-qty { min-width: 110px; }

@media (max-width: 767.98px) {
    .ui-erp .warehouse-transfer-table thead,
    .ui-erp .warehouse-transfer-items-table thead { display: none; }
    .ui-erp .warehouse-transfer-table,
    .ui-erp .warehouse-transfer-table tbody,
    .ui-erp .warehouse-transfer-table tr,
    .ui-erp .warehouse-transfer-table td,
    .ui-erp .warehouse-transfer-items-table,
    .ui-erp .warehouse-transfer-items-table tbody,
    .ui-erp .warehouse-transfer-items-table tr,
    .ui-erp .warehouse-transfer-items-table td { display: block; width: 100%; }
    .ui-erp .warehouse-transfer-table tr,
    .ui-erp .warehouse-transfer-items-table tr {
        margin: .75rem;
        width: calc(100% - 1.5rem);
        border: 1px solid #e2e8f0;
        border-radius: .75rem;
        padding: .5rem .75rem;
        background: #fff;
    }
    .ui-erp .warehouse-transfer-table td,
    .ui-erp .warehouse-transfer-items-table td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: .75rem;
        border: 0;
        padding: .45rem 0;
        text-align: right !important;
    }
    .ui-erp .warehouse-transfer-table td[data-label]::before,
    .ui-erp .warehouse-transfer-items-table td[data-label]::before {
        content: attr(data-label);
        color: #64748b;
        font-size: .75rem;
        font-weight: 700;
        text-align: left;
    }
    .ui-erp .warehouse-transfer-items-table td:first-child { display: none; }
    .ui-erp .warehouse-transfer-items-table .form-select,
    .ui-erp .warehouse-transfer-items-table .form-control { width: min(62vw, 230px); }
    .ui-erp .location-management-setting .form-check { align-self: flex-start; }
}

.ui-erp.location-management-disabled .erp-main .erp-stocks-table {
    min-width: 0 !important;
    max-width: 100% !important;
    table-layout: fixed !important;
}

@media (max-width: 767.98px) {
    .ui-erp .warehouse-transfer-table,
    .ui-erp .warehouse-transfer-items-table {
        min-width: 0 !important;
        max-width: 100% !important;
        table-layout: auto !important;
    }
}
