:root{
  --erp-bg:#f5f7fb;
  --erp-surface:#fff;
  --erp-border:#e2e7ef;
  --erp-text:#1f2937;
  --erp-muted:#697386;
  --erp-primary:#3867f4;
  --erp-primary-soft:#eef3ff;
  --erp-success:#16a36a;
  --erp-warning:#e9a11b;
  --erp-danger:#dc4c64;
  --erp-purple:#7c5ce7;
  --erp-header-h:64px;
  --erp-sidebar-w:250px;
  --erp-radius:12px;
}

/* ---------- Base: intentionally lightweight ---------- */
body.erp-ui-v4{
  font-family:'Cairo',Arial,sans-serif!important;
  font-size:14.5px!important;
  line-height:1.55;
  color:var(--erp-text)!important;
  background:var(--erp-bg)!important;
}
body.erp-ui-v4 .wrapper{background:var(--erp-bg)!important;min-height:100vh;}
body.erp-ui-v4 a{color:#315fcf;}
body.erp-ui-v4 small,.erp-ui-v4 .small{font-size:12px;}
body.erp-ui-v4 .text-muted{color:var(--erp-muted)!important;}

/* ---------- Main header ---------- */
body.erp-ui-v4:not(.erp-pos-v4) .main-header.erp-header-v4{
  position:fixed!important;
  top:0;right:0;left:0;
  height:var(--erp-header-h)!important;
  padding:0 16px!important;
  display:flex!important;
  align-items:center!important;
  justify-content:space-between!important;
  gap:14px;
  background:#fff!important;
  border-bottom:1px solid var(--erp-border)!important;
  box-shadow:0 1px 3px rgba(15,23,42,.05)!important;
  z-index:1040!important;
}
.erp-header-brand-group,.erp-header-actions,.erp-header-user-nav{
  display:flex!important;align-items:center!important;gap:8px!important;
}
.erp-header-brand-group{min-width:230px;}
.erp-header-brand{display:flex!important;align-items:center!important;gap:9px;text-decoration:none!important;min-width:0;}
.erp-header-brand img{height:36px!important;max-width:120px;object-fit:contain;}
.erp-header-logo-fallback{width:36px;height:36px;display:inline-flex;align-items:center;justify-content:center;border-radius:10px;background:var(--erp-primary-soft);color:var(--erp-primary);font-size:17px;}
.erp-header-brand .company-name{font-size:14.5px!important;font-weight:700!important;color:var(--erp-text)!important;max-width:190px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.erp-header-icon-btn,.erp-header-action-btn{
  height:38px!important;min-height:38px!important;border:1px solid var(--erp-border)!important;border-radius:10px!important;background:#fff!important;color:#465266!important;box-shadow:none!important;font-size:13px!important;
}
.erp-header-icon-btn{width:38px!important;min-width:38px!important;padding:0!important;display:inline-flex!important;align-items:center;justify-content:center;}
.erp-header-action-btn{padding:0 11px!important;display:inline-flex!important;align-items:center;gap:7px;font-weight:700!important;}
.erp-header-action-btn:hover,.erp-header-icon-btn:hover{background:var(--erp-primary-soft)!important;color:var(--erp-primary)!important;border-color:#cfdcff!important;}
.erp-header-user-nav{margin:0!important;padding:0!important;list-style:none!important;float:none!important;}
.erp-header-user-nav>li{float:none!important;}
.erp-header-user-nav .notifications-menu>a{
  width:38px;height:38px;padding:0!important;display:flex!important;align-items:center;justify-content:center;border:1px solid var(--erp-border);border-radius:10px;color:#465266!important;background:#fff!important;
}
.erp-header-user-nav .notifications-menu .label{top:-3px!important;right:-4px!important;left:auto!important;border-radius:10px!important;font-size:10px!important;min-width:17px;padding:3px 5px!important;}
.erp-user-trigger{display:flex!important;align-items:center!important;gap:8px;padding:3px 8px!important;min-height:40px;border:1px solid var(--erp-border);border-radius:11px;background:#fff!important;color:var(--erp-text)!important;text-decoration:none!important;}
.erp-user-trigger img,.erp-user-initial{width:32px;height:32px;border-radius:9px;object-fit:cover;}
.erp-user-initial{display:inline-flex;align-items:center;justify-content:center;background:var(--erp-primary-soft);color:var(--erp-primary);font-weight:700;}
.erp-user-copy{display:flex;flex-direction:column;line-height:1.25;min-width:80px;}
.erp-user-copy strong{font-size:12.5px;color:var(--erp-text);font-weight:700;}
.erp-user-copy small{font-size:10px;color:var(--erp-muted);}
.erp-user-trigger>.fa-chevron-down{font-size:9px;color:#98a2b3;}
.erp-header-v4 .dropdown-menu{border:1px solid var(--erp-border)!important;border-radius:11px!important;box-shadow:0 6px 18px rgba(15,23,42,.09)!important;padding:6px!important;background:#fff!important;font-size:13px!important;}
.erp-header-v4 .dropdown-menu>li>a{padding:8px 10px!important;border-radius:7px!important;color:#445064!important;display:flex!important;align-items:center!important;gap:8px;}
.erp-header-v4 .dropdown-menu>li>a:hover{background:#f5f7fb!important;}
.erp-user-dropdown{min-width:220px!important;}
.erp-user-dropdown-head{padding:8px 10px;display:flex;flex-direction:column;}
.erp-user-dropdown-head strong{font-size:13px}.erp-user-dropdown-head small{font-size:11px;color:var(--erp-muted)}
.erp-header-v4 .notifications-menu>.dropdown-menu{min-width:330px!important;right:auto!important;left:0!important;}
[dir="ltr"] .erp-header-v4 .notifications-menu>.dropdown-menu{left:auto!important;right:0!important;}

/* ---------- Sidebar ---------- */
body.erp-ui-v4:not(.erp-pos-v4) .main-sidebar.erp-sidebar-v4{
  position:fixed!important;
  top:76px!important;right:12px!important;left:auto!important;bottom:12px!important;
  width:var(--erp-sidebar-w)!important;
  min-height:0!important;
  padding:0!important;
  background:#fff!important;
  border:1px solid var(--erp-border)!important;
  border-radius:14px!important;
  box-shadow:0 1px 3px rgba(15,23,42,.05)!important;
  overflow:hidden!important;
  z-index:1025!important;
}
[dir="ltr"] body.erp-ui-v4:not(.erp-pos-v4) .main-sidebar.erp-sidebar-v4{left:12px!important;right:auto!important;}
.erp-sidebar-v4 .sidebar{height:100%!important;overflow-y:auto!important;padding:10px!important;background:#fff!important;}
.erp-sidebar-title{display:flex;align-items:center;gap:9px;padding:10px;margin-bottom:6px;border-radius:10px;background:#f7f9fd;border:1px solid #edf0f5;}
.erp-sidebar-title-icon{width:34px;height:34px;display:inline-flex;align-items:center;justify-content:center;border-radius:9px;background:var(--erp-primary-soft);color:var(--erp-primary);}
.erp-sidebar-title strong{display:block;font-size:13px;font-weight:700;color:var(--erp-text);}.erp-sidebar-title small{display:block;font-size:10.5px;color:var(--erp-muted);max-width:150px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
body.erp-ui-v4 .sidebar-menu{padding:0!important;margin:0!important;background:transparent!important;}
body.erp-ui-v4 .sidebar-menu>li.header{padding:12px 10px 5px!important;background:transparent!important;color:#98a2b3!important;font-size:11.5px!important;font-weight:700!important;}
body.erp-ui-v4 .sidebar-menu>li>a,body.erp-ui-v4 .treeview-menu>li>a{
  min-height:39px!important;margin:2px 0!important;padding:9px 10px!important;border-radius:9px!important;background:transparent!important;color:#445064!important;font-size:13px!important;font-weight:600!important;display:flex!important;align-items:center!important;gap:8px;
}
body.erp-ui-v4 .sidebar-menu>li>a>i:first-child,body.erp-ui-v4 .treeview-menu>li>a>i:first-child{display:inline-block!important;width:18px;text-align:center;color:#7d899b;font-size:14px!important;}
body.erp-ui-v4 .sidebar-menu>li:hover>a,body.erp-ui-v4 .sidebar-menu>li.active>a,body.erp-ui-v4 .sidebar-menu>li.menu-open>a{background:var(--erp-primary-soft)!important;color:var(--erp-primary)!important;}
body.erp-ui-v4 .sidebar-menu>li.active>a>i:first-child,body.erp-ui-v4 .sidebar-menu>li:hover>a>i:first-child{color:var(--erp-primary)!important;}
body.erp-ui-v4 .treeview-menu{background:transparent!important;padding:3px 11px 3px 0!important;margin:0!important;}
[dir="ltr"] body.erp-ui-v4 .treeview-menu{padding:3px 0 3px 11px!important;}
body.erp-ui-v4 .treeview-menu>li>a{font-size:12.5px!important;min-height:35px!important;padding:7px 9px!important;}
body.erp-ui-v4 .treeview-menu a::before{display:none!important;content:none!important;}
body.erp-ui-v4 .sidebar-menu .pull-right-container{margin-inline-start:auto!important;position:static!important;}
body.erp-ui-v4 .sidebar-menu .pull-right-container .fa{font-size:10px!important;}

/* ---------- Main content ---------- */
body.erp-ui-v4:not(.erp-pos-v4) .content-wrapper{
  margin-top:76px!important;margin-right:274px!important;margin-left:12px!important;
  padding:0 0 18px!important;background:transparent!important;min-height:calc(100vh - 76px)!important;
}
[dir="ltr"] body.erp-ui-v4:not(.erp-pos-v4) .content-wrapper{margin-left:274px!important;margin-right:12px!important;}
body.erp-ui-v4:not(.erp-pos-v4) .main-footer{margin-right:274px!important;margin-left:12px!important;background:transparent!important;border:0!important;padding:12px!important;font-size:12px!important;}
[dir="ltr"] body.erp-ui-v4:not(.erp-pos-v4) .main-footer{margin-left:274px!important;margin-right:12px!important;}
body.erp-ui-v4:not(.erp-pos-v4).sidebar-collapse .main-sidebar.erp-sidebar-v4{transform:translateX(270px)!important;}
[dir="ltr"] body.erp-ui-v4:not(.erp-pos-v4).sidebar-collapse .main-sidebar.erp-sidebar-v4{transform:translateX(-270px)!important;}
body.erp-ui-v4:not(.erp-pos-v4).sidebar-collapse .content-wrapper,body.erp-ui-v4:not(.erp-pos-v4).sidebar-collapse .main-footer{margin-right:12px!important;margin-left:12px!important;}
body.erp-ui-v4 .content{padding:14px 10px 22px!important;background:transparent!important;}
body.erp-ui-v4 .content-header{padding:14px 10px 8px!important;}
body.erp-ui-v4 .content-header>h1{font-size:21px!important;line-height:1.4!important;font-weight:700!important;color:var(--erp-text)!important;margin:0!important;}
body.erp-ui-v4 .content-header>h1>small{font-size:12px!important;color:var(--erp-muted)!important;}
body.erp-ui-v4 .content-header>.breadcrumb{position:static!important;float:none!important;background:transparent!important;margin:3px 0 0!important;padding:0!important;font-size:12px!important;}

/* ---------- Common components on all internal pages ---------- */
body.erp-ui-v4 .box,body.erp-ui-v4 .panel,body.erp-ui-v4 .well{
  border:1px solid var(--erp-border)!important;border-radius:var(--erp-radius)!important;box-shadow:0 1px 3px rgba(15,23,42,.04)!important;background:#fff!important;margin-bottom:14px!important;overflow:visible;
}
body.erp-ui-v4 .box.box-primary,body.erp-ui-v4 .box.box-info,body.erp-ui-v4 .box.box-warning,body.erp-ui-v4 .box.box-danger,body.erp-ui-v4 .box.box-success{border-top-color:var(--erp-border)!important;}
body.erp-ui-v4 .box-header{padding:11px 14px!important;border-bottom:1px solid #edf0f5!important;background:#fff!important;border-radius:12px 12px 0 0;}
body.erp-ui-v4 .box-title{font-size:15.5px!important;line-height:1.4!important;font-weight:700!important;color:var(--erp-text)!important;}
body.erp-ui-v4 .box-body{padding:14px!important;background:#fff!important;}
body.erp-ui-v4 .box-footer{padding:10px 14px!important;background:#fafbfc!important;border-top:1px solid #edf0f5!important;}
body.erp-ui-v4 .panel-heading{padding:10px 13px!important;border-color:#edf0f5!important;background:#fafbfc!important;font-size:14px!important;font-weight:700!important;}
body.erp-ui-v4 .panel-body{padding:13px!important;}
body.erp-ui-v4 label{font-size:13px!important;line-height:1.4!important;font-weight:700!important;color:#4a5568!important;margin-bottom:5px!important;}
body.erp-ui-v4 .form-control{font-family:'Cairo',Arial,sans-serif!important;font-size:14px!important;min-height:38px;border:1px solid #d9e0ea!important;border-radius:9px!important;background:#fff!important;color:var(--erp-text)!important;box-shadow:none!important;padding:7px 10px!important;}
body.erp-ui-v4 textarea.form-control{min-height:84px;height:auto;}
body.erp-ui-v4 .form-control:focus{border-color:#9eb5f7!important;box-shadow:0 0 0 2px rgba(56,103,244,.08)!important;}
body.erp-ui-v4 .input-group-addon{border-color:#d9e0ea!important;background:#f7f9fc!important;color:#667085!important;}
body.erp-ui-v4 .select2-container .select2-selection--single{height:38px!important;min-height:38px!important;border:1px solid #d9e0ea!important;border-radius:9px!important;background:#fff!important;}
body.erp-ui-v4 .select2-container--default .select2-selection--single .select2-selection__rendered{line-height:36px!important;font-size:14px!important;color:var(--erp-text)!important;}
body.erp-ui-v4 .select2-container--default .select2-selection--single .select2-selection__arrow{height:36px!important;}
body.erp-ui-v4 .btn{font-family:'Cairo',Arial,sans-serif!important;font-size:13.5px!important;font-weight:600!important;border-radius:9px!important;box-shadow:none!important;}
body.erp-ui-v4 .btn:not(.btn-xs):not(.btn-sm):not(.btn-lg):not(.btn-box-tool):not(.btn-app){min-height:36px;padding:7px 11px;}
body.erp-ui-v4 .btn-sm{font-size:12.5px!important;border-radius:8px!important;}
body.erp-ui-v4 .btn-xs{font-size:11.5px!important;border-radius:7px!important;}
body.erp-ui-v4 .btn-default:not(.bg-yellow):not(.bg-red):not(.bg-purple):not(.bg-maroon):not(.bg-navy):not(.bg-info){background:#fff!important;border-color:#d9e0ea!important;color:#475467!important;}
body.erp-ui-v4 .btn-flat{border-radius:8px!important;}
body.erp-ui-v4 .table{font-size:13.5px!important;color:#344054!important;background:#fff!important;margin-bottom:0;}
body.erp-ui-v4 .table>thead>tr>th{padding:9px 8px!important;border-bottom:1px solid #dde3eb!important;background:#f8fafc!important;color:#5f6b7d!important;font-size:12.5px!important;font-weight:700!important;vertical-align:middle!important;}
body.erp-ui-v4 .table>tbody>tr>td,body.erp-ui-v4 .table>tfoot>tr>td{padding:8px!important;border-color:#edf0f4!important;vertical-align:middle!important;}
body.erp-ui-v4 .table-striped>tbody>tr:nth-of-type(odd){background:#fbfcfe!important;}
body.erp-ui-v4 .table-responsive{border:0!important;margin-bottom:0!important;}
body.erp-ui-v4 .dataTables_wrapper{font-size:13px!important;}
body.erp-ui-v4 .dataTables_filter input,body.erp-ui-v4 .dataTables_length select{height:34px!important;border:1px solid #d9e0ea!important;border-radius:8px!important;padding:5px 8px!important;background:#fff!important;}
body.erp-ui-v4 .pagination>li>a,body.erp-ui-v4 .pagination>li>span{padding:6px 10px!important;border-color:#dfe4ec!important;color:#4d5b70!important;font-size:12.5px!important;}
body.erp-ui-v4 .modal-content{border:0!important;border-radius:13px!important;box-shadow:0 10px 30px rgba(15,23,42,.14)!important;overflow:hidden;}
body.erp-ui-v4 .modal-header{padding:12px 15px!important;border-bottom:1px solid #edf0f5!important;}
body.erp-ui-v4 .modal-title{font-size:16px!important;font-weight:700!important;}
body.erp-ui-v4 .modal-body{padding:15px!important;}
body.erp-ui-v4 .modal-footer{padding:10px 15px!important;border-top:1px solid #edf0f5!important;}
body.erp-ui-v4 .nav-tabs>li>a{font-size:13px!important;padding:9px 12px!important;border-radius:8px 8px 0 0!important;}
body.erp-ui-v4 .small-box{border:1px solid var(--erp-border)!important;border-radius:12px!important;box-shadow:none!important;background:#fff!important;color:var(--erp-text)!important;overflow:hidden;}
body.erp-ui-v4 .small-box>.inner{padding:14px!important;}
body.erp-ui-v4 .small-box h3,body.erp-ui-v4 .small-box .info-box-number{font-size:21px!important;color:var(--erp-text)!important;}
body.erp-ui-v4 .small-box p{font-size:12.5px!important;color:var(--erp-muted)!important;}
body.erp-ui-v4 .small-box>.icon{font-size:38px!important;opacity:.12!important;}
body.erp-ui-v4 .small-box>.small-box-footer{padding:7px 10px!important;background:#fafbfc!important;color:var(--erp-primary)!important;font-size:12px!important;}

/* ---------- Dashboard V4 ---------- */
.erp-dashboard{display:flex;flex-direction:column;gap:12px;}
.erp-page-hero,.erp-panel,.erp-stat-card,.erp-mini-card{background:#fff;border:1px solid var(--erp-border);border-radius:12px;box-shadow:0 1px 3px rgba(15,23,42,.04);}
.erp-page-hero{padding:17px;}
.erp-hero-top{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;margin-bottom:12px;}
.erp-hero-title h1{margin:0;font-size:22px;font-weight:700;color:var(--erp-text);}.erp-hero-title p{margin:3px 0 0;color:var(--erp-muted);font-size:13px;}
.erp-date-badge{display:flex;align-items:center;gap:9px;padding:9px 11px;border:1px solid var(--erp-border);border-radius:10px;background:#fafbfc;}
.erp-date-badge i{width:34px;height:34px;display:flex;align-items:center;justify-content:center;border-radius:9px;background:var(--erp-primary-soft);color:var(--erp-primary);}.erp-date-badge strong{display:block;font-size:12.5px}.erp-date-badge span{display:block;font-size:11px;color:var(--erp-muted);}
.erp-hero-controls{display:grid;grid-template-columns:repeat(2,minmax(180px,1fr));gap:9px;margin-bottom:12px;}.erp-hero-controls .btn{width:100%;text-align:right;}
.erp-quick-actions{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:9px;}.erp-quick-action{min-height:82px;padding:10px 7px;border:1px solid var(--erp-border);border-radius:10px;background:#fbfcfe;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;color:var(--erp-text)!important;text-decoration:none!important;}.erp-quick-action .icon{width:36px;height:36px;display:flex;align-items:center;justify-content:center;border-radius:9px;background:var(--erp-primary-soft);color:var(--erp-primary);font-size:15px;}.erp-quick-action span{font-size:12.5px;font-weight:700;text-align:center;}
.erp-stats-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;}.erp-stat-card{padding:13px;}.erp-stat-card .stat-top{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:5px;}.erp-stat-card .stat-label{font-size:12px;color:var(--erp-muted);font-weight:700;}.erp-stat-card .stat-icon{width:36px;height:36px;display:flex;align-items:center;justify-content:center;border-radius:9px;background:var(--erp-primary-soft);color:var(--erp-primary);font-size:15px;}.erp-stat-card.success .stat-icon{background:#eaf8f1;color:var(--erp-success)}.erp-stat-card.warning .stat-icon{background:#fff6e5;color:var(--erp-warning)}.erp-stat-card.danger .stat-icon{background:#fff0f3;color:var(--erp-danger)}.erp-stat-card.purple .stat-icon{background:#f2efff;color:var(--erp-purple)}.erp-stat-card.aqua .stat-icon{background:#ecf8ff;color:#178bb8}.erp-stat-card.orange .stat-icon{background:#fff3e8;color:#dd7518}.erp-stat-card.olive .stat-icon{background:#f2f8e9;color:#70962e}.erp-stat-card .stat-value{font-size:21px;font-weight:700;color:var(--erp-text);min-height:32px;}.erp-stat-card .stat-link{margin-top:4px;font-size:11.5px;}
.erp-content-grid,.erp-additional-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;}.erp-panel{padding:13px;}.erp-panel-header{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:9px;}.erp-panel-title{margin:0;font-size:15px;font-weight:700;}.erp-panel-subtitle{margin:2px 0 0;font-size:11.5px;color:var(--erp-muted);}

/* ---------- POS V4: preserve original markup & functions ---------- */
body.erp-pos-v4{background:#f3f5f9!important;overflow-x:hidden;}
body.erp-pos-v4 .wrapper{background:#f3f5f9!important;}
.erp-pos-header-v4{
  position:sticky;top:0;z-index:1050;
  min-height:62px;padding:8px 12px;
  display:grid;grid-template-columns:minmax(190px,auto) minmax(220px,1fr) auto;align-items:center;gap:10px;
  background:#fff;border-bottom:1px solid var(--erp-border);box-shadow:0 1px 3px rgba(15,23,42,.05);
}
.erp-pos-brand-v4,.erp-pos-location-v4,.erp-pos-tools-v4{display:flex;align-items:center;gap:7px;min-width:0;}
.erp-pos-brand-icon-v4{width:36px;height:36px;display:flex;align-items:center;justify-content:center;border-radius:9px;background:var(--erp-primary-soft);color:var(--erp-primary);}
.erp-pos-brand-copy-v4{display:flex;flex-direction:column;line-height:1.25;min-width:0;}.erp-pos-brand-copy-v4 strong{font-size:13.5px;font-weight:700;color:var(--erp-text)}.erp-pos-brand-copy-v4 small{font-size:10.5px;color:var(--erp-muted);max-width:140px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.erp-pos-location-v4{justify-content:center;padding:5px 9px;border:1px solid #edf0f5;border-radius:10px;background:#fafbfc;}
.erp-pos-location-icon-v4{color:var(--erp-primary);}.erp-pos-location-content-v4{display:flex;align-items:center;gap:6px;min-width:0;}.erp-pos-location-content-v4 small{font-size:10.5px;color:var(--erp-muted)}.erp-pos-location-content-v4 strong{font-size:12.5px}.erp-pos-location-content-v4 .form-control{height:32px!important;min-height:32px!important;min-width:150px;font-size:12.5px!important;padding:4px 8px!important;}.erp-pos-time-v4{font-size:11px;color:var(--erp-muted);white-space:nowrap;}
.erp-pos-tools-v4{justify-content:flex-end;flex-wrap:nowrap;}
.erp-pos-tool-v4{width:36px;height:36px;min-width:36px;padding:0;border:1px solid var(--erp-border);border-radius:9px;background:#fff;color:#4c586a;display:inline-flex;align-items:center;justify-content:center;font-size:13px;cursor:pointer;text-decoration:none!important;box-shadow:none;}
.erp-pos-tool-v4:hover{background:var(--erp-primary-soft);color:var(--erp-primary);}.erp-pos-success-v4{color:var(--erp-success)}.erp-pos-warning-v4{color:var(--erp-warning)}.erp-pos-danger-v4{color:var(--erp-danger)}.erp-pos-purple-v4{color:var(--erp-purple)}
body.erp-pos-v4>.wrapper>.content,body.erp-pos-v4 .wrapper>.content{padding:10px 12px 92px!important;}
body.erp-pos-v4 .content>.row{margin-left:-5px!important;margin-right:-5px!important;}body.erp-pos-v4 .content>.row>[class*="col-"]{padding-left:5px!important;padding-right:5px!important;}
body.erp-pos-v4 .box{border-radius:11px!important;margin-bottom:10px!important;box-shadow:0 1px 3px rgba(15,23,42,.04)!important;}
body.erp-pos-v4 .box-body{padding:11px!important;}
body.erp-pos-v4 .form-group{margin-bottom:9px!important;}
body.erp-pos-v4 .form-control{font-size:13.5px!important;min-height:38px!important;height:38px!important;border-radius:8px!important;}
body.erp-pos-v4 .input-group-addon,body.erp-pos-v4 .input-group-btn>.btn{height:38px!important;min-height:38px!important;border-color:#d9e0ea!important;}
body.erp-pos-v4 .erp-pos-search-group{width:100%;}
body.erp-pos-v4 .erp-pos-search-group #search_product{height:44px!important;min-height:44px!important;font-size:15px!important;font-weight:600!important;border-top:2px solid #b8c8f8!important;border-bottom:2px solid #b8c8f8!important;background:#fff!important;}
body.erp-pos-v4 .erp-pos-search-group .input-group-btn>.btn{height:44px!important;min-height:44px!important;min-width:42px!important;border-color:#b8c8f8!important;background:#f7f9ff!important;color:var(--erp-primary)!important;font-size:14px!important;}
body.erp-pos-v4 .erp-pos-search-group .erp-barcode-focus{background:var(--erp-primary)!important;color:#fff!important;border-color:var(--erp-primary)!important;}
body.erp-pos-v4 #product_list_body{max-height:calc(100vh - 205px)!important;min-height:360px;overflow-y:auto!important;overflow-x:hidden!important;padding:2px 0 0;}
body.erp-pos-v4 .product_list{padding-left:5px!important;padding-right:5px!important;}
body.erp-pos-v4 .product_box{margin-bottom:8px!important;border:1px solid #e2e7ef!important;border-radius:10px!important;padding:4px!important;background:#fff!important;box-shadow:none!important;}
body.erp-pos-v4 .product_box:hover{border-color:#aebff5!important;background:#fafcff!important;}
body.erp-pos-v4 .product_box .image-container{height:70px!important;}
body.erp-pos-v4 .product_box .text_div{margin-top:4px!important;}.erp-pos-v4 .product_box .text{font-size:12px!important;line-height:17px!important;max-height:17px!important;font-weight:700!important;}.erp-pos-v4 .product_box .text-muted{font-size:10.5px!important;}
body.erp-pos-v4 .pos_product_div{min-height:46vh!important;max-height:55vh!important;margin-bottom:12px!important;}
body.erp-pos-v4 #pos_table{font-size:12.5px!important;}body.erp-pos-v4 #pos_table th{font-size:11.5px!important;padding:7px 5px!important;}body.erp-pos-v4 #pos_table td{padding:6px 5px!important;}
body.erp-pos-v4 .pos-form-actions{position:fixed!important;right:0;left:0;bottom:0;width:100%!important;height:auto!important;padding:7px 10px!important;background:#fff!important;border-top:1px solid var(--erp-border)!important;box-shadow:0 -2px 8px rgba(15,23,42,.05)!important;z-index:1045!important;}
body.erp-pos-v4 .pos-form-actions>.col-md-12{display:flex!important;align-items:center;gap:6px;flex-wrap:wrap;float:none!important;width:100%!important;}
body.erp-pos-v4 .pos-form-actions .btn{min-height:36px!important;padding:6px 9px!important;font-size:12.5px!important;margin:0!important;}
body.erp-pos-v4 .pos-form-actions .pos-total{padding:5px 9px!important;margin:0 4px!important;border-radius:8px!important;background:#26344d!important;display:inline-flex!important;align-items:center;gap:7px;}.erp-pos-v4 .pos-total span.text{width:auto!important;font-size:11px!important;}.erp-pos-v4 .pos-total span.number{font-size:20px!important;}
body.erp-pos-v4 .pos-form-actions #recent-transactions{margin-inline-start:auto!important;}
body.erp-pos-v4 .erp-pos-tools-v4>.btn,body.erp-pos-v4 .erp-pos-tools-v4>a.btn{width:36px!important;height:36px!important;min-width:36px!important;min-height:36px!important;padding:0!important;border-radius:9px!important;display:inline-flex!important;align-items:center!important;justify-content:center!important;font-size:0!important;}
body.erp-pos-v4 .erp-pos-tools-v4>.btn i,body.erp-pos-v4 .erp-pos-tools-v4>a.btn i{font-size:13px!important;}
body.erp-pos-v4 #pos-draft{background:#4299e1!important;border-color:#4299e1!important;color:#fff!important;}
body.erp-pos-v4 #pos-quotation{background:#f2b84b!important;border-color:#f2b84b!important;color:#fff!important;}
body.erp-pos-v4 .pos-express-finalize[data-pay_method="suspend"]{background:#e45a67!important;border-color:#e45a67!important;color:#fff!important;}
body.erp-pos-v4 .pos-express-finalize[data-pay_method="credit_sale"]{background:#7c5ce7!important;border-color:#7c5ce7!important;color:#fff!important;}
body.erp-pos-v4 .pos-express-finalize[data-pay_method="card"]{background:#344966!important;border-color:#344966!important;color:#fff!important;}
body.erp-pos-v4 #pos-finalize{background:#31557c!important;border-color:#31557c!important;color:#fff!important;}
body.erp-pos-v4 .pos-express-finalize[data-pay_method="cash"]{background:#18a66d!important;border-color:#18a66d!important;color:#fff!important;}
body.erp-pos-v4 #pos-cancel,body.erp-pos-v4 #pos-delete{background:#dc4c64!important;border-color:#dc4c64!important;color:#fff!important;}

body.erp-pos-v4 .select2-container--default .select2-selection--single{height:38px!important;min-height:38px!important;}.erp-pos-v4 .select2-container--default .select2-selection--single .select2-selection__rendered{line-height:36px!important;font-size:13px!important;}

/* ---------- Simple dark mode (no expensive visual effects) ---------- */
body.erp-ui-v4.dark-mode{--erp-bg:#151922;--erp-surface:#202632;--erp-border:#323a48;--erp-text:#edf1f7;--erp-muted:#a7b0c0;--erp-primary-soft:#263457;background:var(--erp-bg)!important;color:var(--erp-text)!important;}
body.erp-ui-v4.dark-mode .content-wrapper,body.erp-ui-v4.dark-mode .wrapper{background:var(--erp-bg)!important;}
body.erp-ui-v4.dark-mode .box,body.erp-ui-v4.dark-mode .box-header,body.erp-ui-v4.dark-mode .box-body,body.erp-ui-v4.dark-mode .box-footer,body.erp-ui-v4.dark-mode .panel,body.erp-ui-v4.dark-mode .modal-content,body.erp-ui-v4.dark-mode .main-header,body.erp-ui-v4.dark-mode .main-sidebar,body.erp-ui-v4.dark-mode .sidebar,body.erp-ui-v4.dark-mode .form-control,body.erp-ui-v4.dark-mode .table,body.erp-ui-v4.dark-mode .table td,body.erp-ui-v4.dark-mode .table th{background:var(--erp-surface)!important;color:var(--erp-text)!important;border-color:var(--erp-border)!important;}

/* ---------- Responsive ---------- */
@media(max-width:1199px){
  .erp-header-action-btn span{display:none}.erp-header-action-btn{width:38px!important;padding:0!important;justify-content:center}.erp-header-brand-group{min-width:180px}.erp-quick-actions{grid-template-columns:repeat(3,minmax(0,1fr))}.erp-stats-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.erp-pos-header-v4{grid-template-columns:auto 1fr auto}.erp-pos-time-v4{display:none}.erp-pos-tool-v4{width:34px;height:34px;min-width:34px}
}
@media(max-width:991px){
  body.erp-ui-v4:not(.erp-pos-v4) .main-sidebar.erp-sidebar-v4{top:var(--erp-header-h)!important;right:0!important;bottom:0!important;border-radius:0!important;transform:translateX(100%)!important;}
  [dir="ltr"] body.erp-ui-v4:not(.erp-pos-v4) .main-sidebar.erp-sidebar-v4{left:0!important;right:auto!important;transform:translateX(-100%)!important;}
  body.erp-ui-v4:not(.erp-pos-v4).sidebar-open .main-sidebar.erp-sidebar-v4{transform:translateX(0)!important;}
  body.erp-ui-v4:not(.erp-pos-v4) .content-wrapper,body.erp-ui-v4:not(.erp-pos-v4) .main-footer{margin-right:0!important;margin-left:0!important;}
  .erp-header-brand-group{min-width:0}.erp-header-brand .company-name,.erp-user-copy,.erp-user-trigger>.fa-chevron-down{display:none}.erp-user-trigger{padding:3px!important}.erp-content-grid,.erp-additional-grid{grid-template-columns:1fr}
  .erp-pos-header-v4{grid-template-columns:1fr auto;grid-template-areas:"brand tools" "location location";padding:7px 9px}.erp-pos-brand-v4{grid-area:brand}.erp-pos-location-v4{grid-area:location;justify-content:flex-start}.erp-pos-tools-v4{grid-area:tools;overflow-x:auto;max-width:55vw}.erp-pos-tools-v4::-webkit-scrollbar{display:none}body.erp-pos-v4 #product_list_body{max-height:460px!important;min-height:280px}.erp-pos-v4 .product_list{width:25%!important}
}
@media(max-width:767px){
  body.erp-ui-v4:not(.erp-pos-v4) .main-header.erp-header-v4{padding:0 8px!important;gap:6px}.erp-header-actions{gap:4px!important}.erp-header-action-btn,.erp-header-icon-btn,.erp-header-user-nav .notifications-menu>a{width:36px!important;height:36px!important;min-width:36px!important}.erp-header-brand img,.erp-header-logo-fallback{height:32px!important;width:32px!important}.erp-header-v4 .notifications-menu>.dropdown-menu{position:fixed!important;top:58px!important;left:8px!important;right:8px!important;min-width:0!important;width:auto!important}.erp-page-hero{padding:13px}.erp-hero-top{flex-direction:column}.erp-hero-controls,.erp-stats-grid,.erp-quick-actions{grid-template-columns:1fr}.erp-content-grid,.erp-additional-grid{grid-template-columns:1fr}.erp-quick-action{min-height:68px}.erp-pos-brand-copy-v4 small{display:none}.erp-pos-location-v4{flex-wrap:wrap}.erp-pos-location-content-v4{flex:1}.erp-pos-location-content-v4 .form-control{min-width:120px}.erp-pos-v4 .product_list{width:50%!important}.erp-pos-v4 .pos-form-actions{position:static!important;margin-top:8px!important}.erp-pos-v4 .pos-form-actions>.col-md-12{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important}.erp-pos-v4 .pos-form-actions .btn{width:100%!important}.erp-pos-v4 .pos-form-actions .pos-total{grid-column:1/-1!important}.erp-pos-v4 .pos-form-actions #recent-transactions{margin:0!important}.erp-pos-v4 .content{padding-bottom:12px!important}
}

@media print{body.erp-ui-v4 .main-header,body.erp-ui-v4 .main-sidebar,.erp-pos-header-v4,body.erp-pos-v4 .pos-form-actions{display:none!important}body.erp-ui-v4 .content-wrapper{margin:0!important;padding:0!important;background:#fff!important}body.erp-ui-v4 .box{box-shadow:none!important;border:0!important}}

/* ---------- Authentication ---------- */
body.erp-auth-v4{background:#f4f6fb!important;}
body.erp-auth-v4 .login-box,body.erp-auth-v4 .register-box{width:min(420px,92vw)!important;margin:7vh auto!important;}
body.erp-auth-v4 .login-box-body,body.erp-auth-v4 .register-box-body{background:#fff!important;border:1px solid var(--erp-border)!important;border-radius:14px!important;box-shadow:0 3px 12px rgba(15,23,42,.07)!important;padding:22px!important;color:var(--erp-text)!important;}
body.erp-auth-v4 .right-col{background:#f4f6fb!important;}
body.erp-auth-v4 .right-col>.row{background:#fff;border:1px solid var(--erp-border);border-radius:14px;margin:18px!important;padding:14px;}

/* ==========================================================
   V5 focused fixes: POS payment readability & speed-friendly UI
   ========================================================== */
body.erp-pos-v4 #modal_payment .modal-dialog{
  width:min(1080px,94vw)!important;
  margin:28px auto!important;
}
body.erp-pos-v4 #modal_payment .modal-content{
  background:#fff!important;
  color:#1f2937!important;
}
body.erp-pos-v4 #modal_payment .modal-header,
body.erp-pos-v4 #modal_payment .modal-body,
body.erp-pos-v4 #modal_payment .modal-footer{
  background:#fff!important;
  color:#1f2937!important;
}
body.erp-pos-v4 #modal_payment .modal-title,
body.erp-pos-v4 #modal_payment label,
body.erp-pos-v4 #modal_payment strong,
body.erp-pos-v4 #modal_payment .lead,
body.erp-pos-v4 #modal_payment .text-bold,
body.erp-pos-v4 #modal_payment .total_quantity,
body.erp-pos-v4 #modal_payment .total_payable_span,
body.erp-pos-v4 #modal_payment .total_paying,
body.erp-pos-v4 #modal_payment .change_return_span,
body.erp-pos-v4 #modal_payment .balance_due{
  color:#1f2937!important;
  opacity:1!important;
  text-shadow:none!important;
}
body.erp-pos-v4 #modal_payment label,
body.erp-pos-v4 #modal_payment strong{
  font-size:14px!important;
  font-weight:700!important;
}
body.erp-pos-v4 #modal_payment .lead{
  font-size:20px!important;
  line-height:1.45!important;
}
body.erp-pos-v4 #modal_payment .box.bg-orange{
  background:#f7f9fc!important;
  color:#1f2937!important;
  border:1px solid #dfe6ef!important;
  border-radius:12px!important;
}
body.erp-pos-v4 #modal_payment .box.bg-orange .box-body{
  background:#f7f9fc!important;
  color:#1f2937!important;
}
body.erp-pos-v4 #modal_payment .box.bg-orange hr{
  border-top:1px solid #dbe3ed!important;
  margin:13px 0!important;
}
body.erp-pos-v4 #modal_payment .payment_row.bg-lightgray,
body.erp-pos-v4 #modal_payment .box.payment_row{
  background:#fbfcfe!important;
  color:#1f2937!important;
  border:1px solid #e3e8ef!important;
}
body.erp-pos-v4 #modal_payment .form-control,
body.erp-pos-v4 #modal_payment .select2-selection--single{
  color:#1f2937!important;
  background:#fff!important;
  font-size:14px!important;
}
body.erp-pos-v4 #modal_payment textarea.form-control{
  min-height:72px!important;
}
body.erp-pos-v4 #modal_payment #add-payment-row{
  min-height:42px!important;
  font-size:14px!important;
  font-weight:700!important;
}
body.erp-pos-v4 #modal_payment .modal-footer .btn{
  min-height:40px!important;
  font-size:14px!important;
}

/* Avoid expensive smooth scroll/transition work inside the high-frequency POS area. */
body.erp-pos-v4 .pos_product_div,
body.erp-pos-v4 #pos_table tbody,
body.erp-pos-v4 #product_list_body{
  scroll-behavior:auto!important;
}
body.erp-pos-v4 #pos_table tbody tr{
  transition:none!important;
}

@media(max-width:767px){
  body.erp-pos-v4 #modal_payment .modal-dialog{width:auto!important;margin:10px!important;}
}

/* ==========================================================
   V6 polish: buttons, fixed program logo, responsive dashboard/POS
   ========================================================== */
:root{
  --erp-primary:#2563eb;
  --erp-primary-700:#1d4ed8;
  --erp-success:#16a34a;
  --erp-danger:#dc2626;
  --erp-warning:#d97706;
  --erp-info:#0891b2;
}

/* ---------- Consistent buttons ---------- */
body.erp-ui-v4 .btn-primary,
body.erp-ui-v4 .btn-primary:focus,
body.erp-ui-v4 .btn-primary:active{
  background:#2563eb!important;border-color:#2563eb!important;color:#fff!important;
}
body.erp-ui-v4 .btn-primary:hover{background:#1d4ed8!important;border-color:#1d4ed8!important;color:#fff!important;}
body.erp-ui-v4 .btn-success,
body.erp-ui-v4 .btn-success:focus,
body.erp-ui-v4 .btn-success:active{background:#16a34a!important;border-color:#16a34a!important;color:#fff!important;}
body.erp-ui-v4 .btn-success:hover{background:#15803d!important;border-color:#15803d!important;color:#fff!important;}
body.erp-ui-v4 .btn-danger,
body.erp-ui-v4 .btn-danger:focus,
body.erp-ui-v4 .btn-danger:active{background:#dc2626!important;border-color:#dc2626!important;color:#fff!important;}
body.erp-ui-v4 .btn-danger:hover{background:#b91c1c!important;border-color:#b91c1c!important;color:#fff!important;}
body.erp-ui-v4 .btn-info,
body.erp-ui-v4 .btn-info:focus,
body.erp-ui-v4 .btn-info:active{background:#0891b2!important;border-color:#0891b2!important;color:#fff!important;}
body.erp-ui-v4 .btn-warning,
body.erp-ui-v4 .btn-warning:focus,
body.erp-ui-v4 .btn-warning:active{background:#d97706!important;border-color:#d97706!important;color:#fff!important;}
body.erp-ui-v4 .btn-warning:hover{background:#b45309!important;border-color:#b45309!important;color:#fff!important;}
body.erp-ui-v4 .btn.bg-yellow,body.erp-ui-v4 .bg-yellow.btn{background:#f59e0b!important;border-color:#f59e0b!important;color:#fff!important;}
body.erp-ui-v4 .btn.bg-red,body.erp-ui-v4 .bg-red.btn{background:#dc2626!important;border-color:#dc2626!important;color:#fff!important;}
body.erp-ui-v4 .btn.bg-purple,body.erp-ui-v4 .bg-purple.btn{background:#7c3aed!important;border-color:#7c3aed!important;color:#fff!important;}
body.erp-ui-v4 .btn.bg-maroon,body.erp-ui-v4 .bg-maroon.btn{background:#9f1239!important;border-color:#9f1239!important;color:#fff!important;}
body.erp-ui-v4 .btn.bg-navy,body.erp-ui-v4 .bg-navy.btn{background:#1e3a5f!important;border-color:#1e3a5f!important;color:#fff!important;}
body.erp-ui-v4 .btn.bg-info,body.erp-ui-v4 .bg-info.btn{background:#0284c7!important;border-color:#0284c7!important;color:#fff!important;}
body.erp-ui-v4 .btn[class*="bg-"] i,body.erp-ui-v4 .btn-primary i,body.erp-ui-v4 .btn-success i,body.erp-ui-v4 .btn-danger i{color:inherit!important;}
body.erp-ui-v4 .pagination>.active>a,
body.erp-ui-v4 .pagination>.active>a:focus,
body.erp-ui-v4 .pagination>.active>a:hover,
body.erp-ui-v4 .pagination>.active>span{
  background:#2563eb!important;border-color:#2563eb!important;color:#fff!important;font-weight:700!important;
}
body.erp-ui-v4 .dataTables_wrapper .dt-buttons .btn{min-height:34px!important;padding:6px 10px!important;}

/* ---------- Fixed application logo ---------- */
.erp-header-brand .erp-program-logo{height:42px!important;width:auto!important;max-width:150px!important;object-fit:contain!important;display:block!important;}
.erp-pos-program-logo-v6{height:38px;width:auto;max-width:100px;object-fit:contain;display:block;}
.erp-header-brand-group{min-width:260px;}

/* ---------- Dashboard analytics ---------- */
.erp-analytics-grid-v6{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;}
.erp-chart-panel-v6{min-width:0;overflow:hidden;}
.erp-chart-wrap-v6{min-height:300px;overflow:hidden;}
.erp-chart-wrap-v6>div{max-width:100%!important;}
.erp-async-chart-v6{height:300px;min-height:300px;display:flex;align-items:center;justify-content:center;}
.erp-analytics-grid-compact-v6 .erp-async-chart-v6{height:280px;min-height:280px;}
.erp-chart-loading-v6,.erp-chart-error-v6{display:flex;align-items:center;gap:8px;color:#667085;font-size:13px;}
.erp-chart-error-v6{color:#b42318;}
.erp-chart-badge-v6{display:inline-flex;align-items:center;gap:6px;border:1px solid #dbe4f0;background:#f8fbff;color:#475467;padding:5px 9px;border-radius:999px;font-size:11.5px;font-weight:700;white-space:nowrap;}
.erp-quick-reports-panel-v6{padding-bottom:14px!important;}
.erp-quick-reports-grid-v6{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:9px;}
.erp-quick-report-card-v6{min-width:0;display:grid;grid-template-columns:38px 1fr auto;align-items:center;gap:9px;padding:10px;border:1px solid var(--erp-border);border-radius:10px;background:#fbfcff;color:var(--erp-text)!important;text-decoration:none!important;transition:border-color .15s ease,background .15s ease;}
.erp-quick-report-card-v6:hover{border-color:#bfd0ff;background:#f4f7ff;}
.erp-quick-report-icon-v6{width:38px;height:38px;border-radius:9px;background:var(--erp-primary-soft);color:var(--erp-primary);display:flex;align-items:center;justify-content:center;font-size:15px;}
.erp-quick-report-copy-v6{min-width:0;display:flex;flex-direction:column;line-height:1.4;}
.erp-quick-report-copy-v6 strong{font-size:12.5px;color:var(--erp-text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.erp-quick-report-copy-v6 small{font-size:10.5px;color:var(--erp-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.erp-quick-report-arrow-v6{font-size:9px;color:#98a2b3;}
.erp-customize-reports-btn-v6{display:inline-flex!important;align-items:center;gap:6px;white-space:nowrap;}
.erp-report-picker-v6{display:grid;grid-template-columns:1fr 1fr;gap:8px;}
.erp-report-picker-item-v6{position:relative!important;display:grid!important;grid-template-columns:auto 36px 1fr;align-items:center;gap:8px;margin:0!important;padding:10px!important;border:1px solid #e1e7ef;border-radius:10px;background:#fff;cursor:pointer;}
.erp-report-picker-item-v6>input{margin:0!important;}
.erp-report-picker-icon-v6{width:36px;height:36px;border-radius:9px;display:flex;align-items:center;justify-content:center;background:#eef3ff;color:#2563eb;}
.erp-report-picker-item-v6 strong,.erp-report-picker-item-v6 small{display:block;}
.erp-report-picker-item-v6 strong{font-size:12.5px;color:#344054;}.erp-report-picker-item-v6 small{font-size:10.5px;color:#667085;font-weight:400;}

/* ---------- POS: desktop refinements ---------- */
body.erp-pos-v4 .erp-pos-program-logo-v6{margin-inline:3px 1px;}
body.erp-pos-v4 .erp-pos-search-group{border-radius:10px;overflow:hidden;box-shadow:0 0 0 1px #dbe3ed;}
body.erp-pos-v4 .erp-pos-search-group .form-control{border-radius:0!important;border-top:0!important;border-bottom:0!important;min-height:44px!important;}
body.erp-pos-v4 .erp-pos-search-group .btn{min-height:44px!important;border-radius:0!important;border-top:0!important;border-bottom:0!important;}
body.erp-pos-v4 #pos_table{background:#fff!important;}
body.erp-pos-v4 #pos_table thead th{position:sticky;top:0;z-index:2;}
body.erp-pos-v4 .product_box{border:1px solid #e2e8f0!important;border-radius:12px!important;background:#fff!important;overflow:hidden!important;box-shadow:0 1px 2px rgba(15,23,42,.04)!important;}
body.erp-pos-v4 .product_box .image-container{background-color:#fafbfc!important;}
body.erp-pos-v4 .product_box .text_div{padding:7px 6px!important;line-height:1.35!important;}
body.erp-pos-v4 .product_box .text_div .text{font-size:12px!important;font-weight:700!important;color:#263244!important;}
body.erp-pos-v4 .product_box .text_div .text-muted{font-size:10.5px!important;}

/* ---------- Tablet ---------- */
@media(max-width:1199px){
  .erp-quick-reports-grid-v6{grid-template-columns:repeat(3,minmax(0,1fr));}
  .erp-header-brand-group{min-width:190px;}
}

/* ---------- Mobile: dashboard ---------- */
@media(max-width:767px){
  body.erp-ui-v4:not(.erp-pos-v4){font-size:14px!important;}
  body.erp-ui-v4:not(.erp-pos-v4) .content{padding:10px 8px 18px!important;}
  .erp-header-brand .erp-program-logo{height:34px!important;max-width:92px!important;}
  .erp-header-brand-group{min-width:0!important;}
  .erp-page-hero-v6{padding:12px!important;}
  .erp-hero-top{gap:9px!important;margin-bottom:10px!important;}
  .erp-hero-title h1{font-size:20px!important;}.erp-hero-title p{font-size:12.5px!important;line-height:1.6;}
  .erp-date-badge{width:100%;justify-content:flex-start;}
  .erp-hero-controls{grid-template-columns:1fr!important;gap:8px!important;}
  .erp-quick-actions{grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:7px!important;}
  .erp-quick-action{min-height:88px!important;padding:8px 4px!important;gap:5px!important;}
  .erp-quick-action .icon{width:34px!important;height:34px!important;font-size:14px!important;}
  .erp-quick-action span{font-size:11.5px!important;line-height:1.35!important;}
  .erp-stats-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:8px!important;}
  .erp-stat-card{padding:10px!important;}.erp-stat-card .stat-value{font-size:18px!important;}
  .erp-analytics-grid-v6{grid-template-columns:1fr!important;gap:9px!important;}
  .erp-chart-panel-v6{padding:11px!important;}
  .erp-chart-wrap-v6,.erp-async-chart-v6{height:260px!important;min-height:260px!important;}
  .erp-quick-reports-grid-v6{grid-template-columns:1fr 1fr!important;gap:7px!important;}
  .erp-quick-report-card-v6{grid-template-columns:32px 1fr;padding:8px;gap:7px;}
  .erp-quick-report-icon-v6{width:32px;height:32px;font-size:13px;}
  .erp-quick-report-copy-v6 strong{font-size:11.5px;}.erp-quick-report-copy-v6 small,.erp-quick-report-arrow-v6{display:none;}
  .erp-report-picker-v6{grid-template-columns:1fr!important;}
}

/* ---------- Mobile POS: operational layout ---------- */
@media(max-width:767px){
  body.erp-pos-v4{background:#f3f6fa!important;padding:0!important;overflow-x:hidden!important;}
  body.erp-pos-v4 .erp-pos-header-v4{position:sticky!important;top:0!important;z-index:1050!important;display:grid!important;grid-template-columns:1fr!important;grid-template-areas:"brand" "location" "tools"!important;gap:7px!important;padding:7px 8px!important;background:#fff!important;border-bottom:1px solid #dde5ef!important;box-shadow:0 2px 8px rgba(15,23,42,.05)!important;}
  body.erp-pos-v4 .erp-pos-brand-v4{grid-area:brand!important;display:flex!important;align-items:center!important;gap:7px!important;min-width:0!important;}
  body.erp-pos-v4 .erp-pos-program-logo-v6{height:31px!important;max-width:78px!important;}
  body.erp-pos-v4 .erp-pos-brand-copy-v4{display:flex!important;flex-direction:column!important;min-width:0!important;}
  body.erp-pos-v4 .erp-pos-brand-copy-v4 strong{font-size:13px!important;}.erp-pos-brand-copy-v4 small{font-size:10px!important;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
  body.erp-pos-v4 .erp-pos-back-v4{margin-inline-start:auto!important;order:5!important;}
  body.erp-pos-v4 .erp-pos-location-v4{grid-area:location!important;width:100%!important;display:flex!important;align-items:center!important;gap:7px!important;padding:6px 8px!important;border:1px solid #e1e8f0!important;border-radius:9px!important;background:#f8fafc!important;}
  body.erp-pos-v4 .erp-pos-location-content-v4{min-width:0!important;flex:1!important;}.erp-pos-location-content-v4 small{display:none!important;}.erp-pos-location-content-v4 strong{font-size:12px!important;}
  body.erp-pos-v4 .erp-pos-location-content-v4 .form-control{height:34px!important;min-height:34px!important;width:100%!important;}
  body.erp-pos-v4 .erp-pos-time-v4{display:block!important;font-size:10.5px!important;white-space:nowrap!important;}
  body.erp-pos-v4 .erp-pos-tools-v4{grid-area:tools!important;display:flex!important;gap:5px!important;max-width:none!important;width:100%!important;overflow-x:auto!important;padding-bottom:1px!important;-webkit-overflow-scrolling:touch;}
  body.erp-pos-v4 .erp-pos-tool-v4{width:36px!important;height:36px!important;min-width:36px!important;border-radius:9px!important;flex:0 0 36px!important;}

  body.erp-pos-v4 .content{padding:8px 6px 118px!important;margin:0!important;}
  body.erp-pos-v4 .content>.row,body.erp-pos-v4 #add_pos_sell_form>.row{margin-left:0!important;margin-right:0!important;}
  body.erp-pos-v4 #add_pos_sell_form .box{margin-bottom:8px!important;border-radius:11px!important;}
  body.erp-pos-v4 #add_pos_sell_form .box-body{padding:8px!important;}
  body.erp-pos-v4 #add_pos_sell_form .box-body>.row:first-child>.col-md-4,
  body.erp-pos-v4 #add_pos_sell_form .box-body>.row:first-child>.col-md-8{width:100%!important;float:none!important;padding-left:0!important;padding-right:0!important;}
  body.erp-pos-v4 #add_pos_sell_form .box-body>.row:first-child>.col-md-4{margin-bottom:7px!important;}
  body.erp-pos-v4 #customer_id+span.select2,body.erp-pos-v4 #customer_id{width:100%!important;}
  body.erp-pos-v4 .erp-pos-search-group{position:sticky!important;top:151px!important;z-index:20!important;background:#fff!important;box-shadow:0 2px 10px rgba(15,23,42,.08)!important;}
  body.erp-pos-v4 .erp-pos-search-group .form-control,body.erp-pos-v4 .erp-pos-search-group .btn{min-height:46px!important;height:46px!important;}
  body.erp-pos-v4 #search_product{font-size:15px!important;font-weight:600!important;}

  body.erp-pos-v4 .pos_product_div{width:100%!important;overflow-x:auto!important;-webkit-overflow-scrolling:touch!important;border:1px solid #e2e8f0!important;border-radius:10px!important;background:#fff!important;max-height:47vh!important;}
  body.erp-pos-v4 #pos_table{min-width:720px!important;margin:0!important;font-size:12px!important;}
  body.erp-pos-v4 #pos_table>thead>tr>th{font-size:11px!important;padding:7px 5px!important;white-space:nowrap!important;}
  body.erp-pos-v4 #pos_table>tbody>tr>td{padding:6px 5px!important;}
  body.erp-pos-v4 #pos_table input.form-control{min-height:34px!important;height:34px!important;font-size:12px!important;padding:4px 5px!important;}

  body.erp-pos-v4 .pos-form-actions{position:fixed!important;left:0!important;right:0!important;bottom:0!important;z-index:1045!important;background:#fff!important;border-top:1px solid #dbe3ed!important;box-shadow:0 -4px 14px rgba(15,23,42,.08)!important;padding:7px!important;margin:0!important;max-height:112px!important;overflow-y:auto!important;}
  body.erp-pos-v4 .pos-form-actions>.col-md-12{display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:5px!important;padding:0!important;}
  body.erp-pos-v4 .pos-form-actions>.col-md-12>.col-md-12.text-right{grid-column:1/-1!important;padding:0 3px!important;font-size:12px!important;text-align:center!important;}
  body.erp-pos-v4 .pos-form-actions .btn{width:100%!important;min-width:0!important;height:42px!important;min-height:42px!important;padding:5px 3px!important;font-size:10.5px!important;line-height:1.2!important;white-space:normal!important;border-radius:8px!important;margin:0!important;}
  body.erp-pos-v4 .pos-form-actions .btn i{display:block!important;margin:0 auto 2px!important;font-size:12px!important;}
  body.erp-pos-v4 .pos-form-actions #recent-transactions{float:none!important;margin:0!important;}

  body.erp-pos-v4 #mobile_product_suggestion_modal .modal-dialog{width:100%!important;height:100%!important;margin:0!important;}
  body.erp-pos-v4 #mobile_product_suggestion_modal .modal-content{min-height:100vh!important;border-radius:0!important;background:#f5f7fb!important;}
  body.erp-pos-v4 #mobile_product_suggestion_modal .modal-header{position:sticky!important;top:0!important;z-index:2!important;background:#fff!important;padding:9px!important;}
  body.erp-pos-v4 #mobile_product_suggestion_modal .modal-body{padding:8px!important;}
  body.erp-pos-v4 #mobile_product_suggestion_modal #product_category_div,
  body.erp-pos-v4 #mobile_product_suggestion_modal #product_brand_div,
  body.erp-pos-v4 #mobile_product_suggestion_modal #feature_product_div{width:50%!important;float:right!important;padding:0 4px!important;margin-bottom:7px!important;}
  body.erp-pos-v4 #mobile_product_suggestion_modal #product_list_body{display:flex!important;flex-wrap:wrap!important;margin:0 -4px!important;max-height:none!important;min-height:0!important;}
  body.erp-pos-v4 #mobile_product_suggestion_modal .product_list{width:50%!important;float:none!important;padding:4px!important;}
  body.erp-pos-v4 #mobile_product_suggestion_modal .product_box{height:150px!important;margin:0!important;}
  body.erp-pos-v4 #mobile_product_suggestion_modal .product_box .image-container{height:98px!important;}
  body.erp-pos-v4 #mobile_product_suggestion_modal .product_box .text_div{height:50px!important;overflow:hidden!important;}

  body.erp-pos-v4 #modal_payment .modal-dialog{width:100%!important;max-width:none!important;margin:0!important;height:100%!important;}
  body.erp-pos-v4 #modal_payment .modal-content{min-height:100vh!important;border-radius:0!important;}
  body.erp-pos-v4 #modal_payment .modal-body{padding:10px!important;max-height:calc(100vh - 120px)!important;overflow-y:auto!important;}
}

@media(max-width:380px){
  .erp-quick-action span{font-size:10.5px!important;}
  body.erp-pos-v4 .pos-form-actions>.col-md-12{grid-template-columns:repeat(3,minmax(0,1fr))!important;}
  body.erp-pos-v4 .content{padding-bottom:154px!important;}
  body.erp-pos-v4 .pos-form-actions{max-height:148px!important;}
}

@media(max-width:767px){
  body.erp-pos-v4 .pos-form-actions>.col-md-12{grid-template-columns:repeat(3,minmax(0,1fr))!important;}
  body.erp-pos-v4 .pos-form-actions{max-height:170px!important;}
  body.erp-pos-v4 .content{padding-bottom:176px!important;}
  .erp-chart-wrap-v6>div[id]{height:300px!important;min-height:300px!important;}
}
@media(max-width:380px){
  body.erp-pos-v4 .pos-form-actions>.col-md-12{grid-template-columns:repeat(3,minmax(0,1fr))!important;}
  body.erp-pos-v4 .pos-form-actions{max-height:176px!important;}
  body.erp-pos-v4 .content{padding-bottom:182px!important;}
}

/* ===== V6.3: self-contained mobile product row editor ===== */
@media(max-width:767px){
  body.erp-mobile-row-editor-lock{overflow:hidden!important;position:relative!important;}
  body.erp-pos-v4 .row_edit_product_price_model.erp-mobile-row-editor-active{
    position:fixed!important;
    inset:0!important;
    width:100%!important;
    height:100%!important;
    margin:0!important;
    padding:10px!important;
    display:flex!important;
    align-items:flex-start!important;
    justify-content:center!important;
    overflow-y:auto!important;
    -webkit-overflow-scrolling:touch!important;
    background:rgba(15,23,42,.60)!important;
    opacity:1!important;
    visibility:visible!important;
    pointer-events:auto!important;
    z-index:100000!important;
    transform:none!important;
    filter:none!important;
  }
  body.erp-pos-v4 .row_edit_product_price_model.erp-mobile-row-editor-active .modal-dialog{
    position:relative!important;
    width:100%!important;
    max-width:560px!important;
    margin:8px auto!important;
    padding:0!important;
    transform:none!important;
    opacity:1!important;
    z-index:100001!important;
    pointer-events:auto!important;
  }
  body.erp-pos-v4 .row_edit_product_price_model.erp-mobile-row-editor-active .modal-content{
    position:relative!important;
    width:100%!important;
    max-height:calc(100dvh - 36px)!important;
    display:flex!important;
    flex-direction:column!important;
    overflow:hidden!important;
    border:0!important;
    border-radius:14px!important;
    background:#fff!important;
    color:#1f2937!important;
    opacity:1!important;
    visibility:visible!important;
    filter:none!important;
    box-shadow:0 18px 50px rgba(0,0,0,.28)!important;
    pointer-events:auto!important;
  }
  body.erp-pos-v4 .row_edit_product_price_model.erp-mobile-row-editor-active .modal-header{
    flex:0 0 auto!important;
    padding:12px 14px!important;
    background:#fff!important;
    color:#1f2937!important;
    border-bottom:1px solid #e5e7eb!important;
  }
  body.erp-pos-v4 .row_edit_product_price_model.erp-mobile-row-editor-active .modal-title{
    color:#1f2937!important;
    font-size:16px!important;
    line-height:1.5!important;
  }
  body.erp-pos-v4 .row_edit_product_price_model.erp-mobile-row-editor-active .modal-body{
    flex:1 1 auto!important;
    min-height:0!important;
    overflow-y:auto!important;
    -webkit-overflow-scrolling:touch!important;
    padding:14px!important;
    background:#fff!important;
    color:#1f2937!important;
  }
  body.erp-pos-v4 .row_edit_product_price_model.erp-mobile-row-editor-active .modal-footer{
    flex:0 0 auto!important;
    padding:10px 14px!important;
    background:#fff!important;
    border-top:1px solid #e5e7eb!important;
  }
  body.erp-pos-v4 .row_edit_product_price_model.erp-mobile-row-editor-active .close{
    width:42px!important;
    height:42px!important;
    display:inline-flex!important;
    align-items:center!important;
    justify-content:center!important;
    padding:0!important;
    opacity:1!important;
    color:#344054!important;
    font-size:27px!important;
    line-height:1!important;
    pointer-events:auto!important;
    touch-action:manipulation!important;
  }
  body.erp-pos-v4 .row_edit_product_price_model.erp-mobile-row-editor-active label,
  body.erp-pos-v4 .row_edit_product_price_model.erp-mobile-row-editor-active strong,
  body.erp-pos-v4 .row_edit_product_price_model.erp-mobile-row-editor-active p{
    color:#344054!important;
    opacity:1!important;
  }
  body.erp-pos-v4 .row_edit_product_price_model.erp-mobile-row-editor-active .form-control{
    min-height:44px!important;
    height:44px!important;
    font-size:16px!important;
    background:#fff!important;
    color:#1f2937!important;
    opacity:1!important;
    border:1px solid #cfd8e6!important;
  }
  body.erp-pos-v4 .row_edit_product_price_model.erp-mobile-row-editor-active textarea.form-control{
    min-height:96px!important;
    height:auto!important;
  }
  body.erp-pos-v4 .row_edit_product_price_model.erp-mobile-row-editor-active .modal-footer .btn{
    min-height:44px!important;
    padding:8px 18px!important;
    font-size:15px!important;
    font-weight:700!important;
  }
}

/* ======================================================================
   V6.4 — Mobile POS search + camera barcode scanner
   ====================================================================== */
.erp-mobile-camera-slot{display:none!important;}
.erp-barcode-scanner-overlay{display:none;position:fixed;inset:0;z-index:350000;background:rgba(10,18,32,.82);padding:18px;align-items:center;justify-content:center;}
.erp-barcode-scanner-overlay.is-open{display:flex!important;}
body.erp-barcode-scanner-open{overflow:hidden!important;touch-action:none;}
.erp-barcode-scanner-card{width:min(100%,560px);max-height:calc(100vh - 36px);max-height:calc(100dvh - 36px);overflow:auto;background:#fff;border-radius:18px;box-shadow:0 24px 70px rgba(0,0,0,.34);padding:14px;direction:rtl;}
.erp-barcode-scanner-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:12px;color:#172033;}
.erp-barcode-scanner-head>div{min-width:0;}
.erp-barcode-scanner-head strong{display:block;font-size:16px;font-weight:800;margin-bottom:3px;}
.erp-barcode-scanner-head strong i{color:#2f6fed;margin-left:5px;}
.erp-barcode-scanner-head small{display:block;color:#667085;font-size:12px;line-height:1.7;}
.erp-barcode-scanner-close{width:38px;height:38px;min-width:38px;border:1px solid #dfe6f1;border-radius:11px;background:#fff;color:#344054;font-size:16px;display:flex;align-items:center;justify-content:center;}
.erp-barcode-reader-wrap{position:relative;overflow:hidden;border-radius:14px;background:#07111f;min-height:240px;border:1px solid #dbe3ed;}
#erp_barcode_reader{width:100%;min-height:240px;direction:ltr;}
#erp_barcode_reader video{width:100%!important;max-height:58vh!important;object-fit:cover!important;border-radius:14px!important;}
.erp-barcode-scan-line{position:absolute;z-index:4;left:9%;right:9%;top:50%;height:2px;background:#2ecc71;box-shadow:0 0 12px rgba(46,204,113,.9);pointer-events:none;animation:erpBarcodeScanLine 1.8s ease-in-out infinite alternate;}
@keyframes erpBarcodeScanLine{from{transform:translateY(-52px)}to{transform:translateY(52px)}}
.erp-barcode-scanner-status{margin-top:10px;padding:9px 11px;border-radius:10px;background:#eff6ff;color:#2459c8;font-size:12px;font-weight:700;text-align:center;}
.erp-barcode-scanner-status.is-error{background:#fff1f1;color:#b42318;}

@media(max-width:767px){
  body.erp-pos-v4 .erp-barcode-focus{display:none!important;}
  body.erp-pos-v4 .erp-mobile-camera-slot{display:table-cell!important;width:46px!important;}
  body.erp-pos-v4 .erp-mobile-camera-slot>.erp-camera-barcode-scan{display:flex!important;align-items:center!important;justify-content:center!important;width:46px!important;min-width:46px!important;height:46px!important;min-height:46px!important;padding:0!important;background:#2f6fed!important;color:#fff!important;border-color:#2f6fed!important;font-size:16px!important;}
  body.erp-pos-v4 .erp-pos-search-group #search_product{padding-inline-end:10px!important;}
  .erp-barcode-scanner-overlay{padding:max(10px,env(safe-area-inset-top)) 10px max(10px,env(safe-area-inset-bottom));align-items:flex-start;}
  .erp-barcode-scanner-card{width:100%;margin-top:5vh;border-radius:16px;padding:11px;}
  .erp-barcode-reader-wrap,#erp_barcode_reader{min-height:280px;}
  #erp_barcode_reader video{max-height:62vh!important;}
}

/* ==========================================================
   V6.5 FINAL PRINT SAFETY — MUST REMAIN LAST IN THIS FILE
   Prevents header/sidebar/POS controls from entering invoice printouts.
   ========================================================== */
@media print {
  html,
  body.erp-ui-v4,
  body.erp-ui-v4 .wrapper,
  body.erp-ui-v4 .erp-page-shell {
    background: #fff !important;
  }

  /* Application chrome — selectors intentionally outrank screen/mobile rules. */
  html body.erp-ui-v4 .no-print,
  html body.erp-ui-v4:not(.erp-pos-v4) header.main-header.erp-header-v4,
  html body.erp-ui-v4:not(.erp-pos-v4) aside.main-sidebar.erp-sidebar-v4,
  html body.erp-pos-v4 header.erp-pos-header-v4,
  html body.erp-pos-v4 .pos-form-actions,
  html body.erp-ui-v4 .main-footer,
  html body.erp-ui-v4 .scrolltop,
  html body.erp-ui-v4 .modal,
  html body.erp-ui-v4 .modal-backdrop,
  html body.erp-ui-v4 .popover,
  html body.erp-ui-v4 #toast-container {
    display: none !important;
    visibility: hidden !important;
  }

  /* Reset fixed/sticky application layout during print. */
  html body.erp-ui-v4 .wrapper,
  html body.erp-ui-v4 .erp-page-shell,
  html body.erp-ui-v4 .content-wrapper {
    position: static !important;
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    transform: none !important;
    box-shadow: none !important;
  }

  /* When an invoice/receipt is being printed, print ONLY the receipt section. */
  html body.erp-ui-v4.erp-receipt-printing .erp-page-shell > *:not(.print_section) {
    display: none !important;
  }

  html body.erp-ui-v4.erp-receipt-printing .erp-page-shell > .print_section,
  html body.erp-ui-v4.erp-receipt-printing #receipt_section {
    display: block !important;
    visibility: visible !important;
    position: static !important;
    float: none !important;
    width: 100% !important;
    max-width: none !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    overflow: visible !important;
    transform: none !important;
  }

  html body.erp-ui-v4.erp-receipt-printing #receipt_section * {
    visibility: visible !important;
  }

  /* Avoid accidental extra sheets caused by fixed app elements. */
  html body.erp-ui-v4.erp-receipt-printing {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }
}
