/* ===== Flexo-Account Theme ===== */
:root{
  --flexo-blue:#163066;
  --flexo-blue-dark:#163066;
  --flexo-blue-light:#eaf1ff;
  --flexo-gradient:#163066;
}
*{font-family:'Sarabun','Prompt',sans-serif;}
body{background:#f4f6fb;color:#2c3345;font-size:15px;}

/* ===== Navbar ===== */
.flexo-navbar{
  background:var(--flexo-gradient);
  box-shadow:0 2px 10px rgba(22,48,102,.25);
  padding:.35rem .85rem;
}
.flexo-navbar .navbar-brand{color:#fff;font-weight:700;font-size:1.12rem;display:flex;align-items:center;gap:.4rem;margin-right:.7rem;}
.flexo-logo{
  width:34px;height:34px;border-radius:9px;background:#fff;color:var(--flexo-blue);
  display:inline-flex;align-items:center;justify-content:center;font-weight:800;font-size:1.15rem;
  box-shadow:0 2px 6px rgba(0,0,0,.15);
}
.flexo-navbar .nav-link{
  color:rgba(255,255,255,.92)!important;font-weight:500;border-radius:8px;
  padding:.45rem .62rem!important;margin:0 1px;transition:.15s;white-space:nowrap;
}
.flexo-navbar .nav-link:hover{background:rgba(255,255,255,.15);}
.flexo-navbar .nav-link:focus{outline:none;box-shadow:0 0 0 2px rgba(255,255,255,.22);}
.flexo-navbar .nav-item.active > .nav-link,
.flexo-navbar .nav-link.active{background:rgba(255,255,255,.22);color:#fff!important;}
.flexo-main-nav > .nav-item > .flexo-mega-toggle:focus,
.flexo-main-nav > .nav-item.mega-open > .nav-link{
  background:#0f6df5;
  color:#fff!important;
}
.flexo-main-nav > .nav-item.active > .nav-link{
  background:rgba(255,255,255,.17);
  box-shadow:inset 0 -2px 0 rgba(255,255,255,.18);
  position:relative;
}
.flexo-main-nav > .nav-item.active > .nav-link:after,
.flexo-main-nav > .nav-item > .flexo-mega-toggle:focus:after,
.flexo-main-nav > .nav-item.mega-open > .nav-link:after{
  content:"";
  position:absolute;
  left:50%;
  bottom:-7px;
  transform:translateX(-50%);
  width:0;
  height:0;
  border-left:7px solid transparent;
  border-right:7px solid transparent;
  border-bottom:7px solid #f7faff;
}
.flexo-navbar .nav-link i{margin-right:.35rem;}
.flexo-main-nav{align-items:stretch;}
.flexo-main-nav > .nav-item > .nav-link{
  min-height:58px;display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:2px;font-size:.78rem;line-height:1.1;text-align:center;
}
.flexo-main-nav > .nav-item > .nav-link i{font-size:1.15rem;margin-right:0;}
.flexo-main-nav > .nav-item > .nav-link .caret{display:none;}
.flexo-navbar .dropdown-toggle::after{display:none;}
.flexo-navbar .dropdown-menu{border:none;border-radius:12px;box-shadow:0 10px 30px rgba(20,40,90,.18);padding:.45rem;}
.flexo-navbar .dropdown-item{border-radius:8px;padding:.55rem .75rem;}
.flexo-navbar .dropdown-item:hover{background:var(--flexo-blue-light);color:var(--flexo-blue-dark);}

.flexo-profile img,.flexo-profile .avatar-circle{
  width:34px;height:34px;border-radius:50%;object-fit:cover;border:2px solid rgba(255,255,255,.6);
}
.avatar-circle{background:#fff;color:var(--flexo-blue);display:inline-flex;align-items:center;justify-content:center;font-weight:700;}
.flexo-profile .profile-dropdown-menu{
  width:390px;max-width:calc(100vw - 24px);padding:12px;border:1px solid #e7ecf5;
  border-radius:16px;box-shadow:0 18px 48px rgba(17,43,92,.22);overflow:visible;
}
.profile-dropdown-header{
  padding:8px 10px 12px;color:#172b4d;font-size:1rem;line-height:1.45;white-space:normal;
}
.profile-dropdown-header small{font-size:.8rem;font-weight:400;}
.profile-active-branch{
  display:flex;align-items:flex-start;gap:10px;margin:0 4px 10px;padding:12px 14px;
  color:#183b78;background:#f3f7ff;border:1px solid #dce8fb;border-radius:12px;
}
.profile-active-branch > i{margin-top:3px;color:#2563c7;flex:0 0 auto;}
.profile-active-branch div{min-width:0;line-height:1.4;}
.profile-active-branch b{display:block;font-size:.9rem;}
.profile-active-branch span{display:block;margin-top:2px;color:#45556f;font-size:.85rem;white-space:normal;overflow-wrap:anywhere;}
.profile-branch-form{padding:0 4px 6px;}
.profile-branch-form .form-control{
  width:100%;height:38px;padding:6px 32px 6px 10px;border-color:#cbd6e6;border-radius:9px;
  color:#243858;background-color:#fff;font-size:.84rem;
}
.flexo-profile .profile-dropdown-menu .dropdown-divider{margin:7px 4px;}
.flexo-profile .profile-dropdown-menu .dropdown-item{padding:.65rem .75rem;}

@media (max-width:575.98px){
  .flexo-profile .profile-dropdown-menu{position:fixed;top:64px;right:12px;left:12px;width:auto;max-width:none;margin:0!important;}
}

/* ===== Mega Dropdown ===== */
.flexo-mega{
  position:absolute;top:100%;left:0;z-index:1050;min-width:640px;max-width:94vw;
  background:#fff;border-radius:14px;box-shadow:0 12px 40px rgba(20,40,90,.18);
  padding:14px;display:none;margin-top:6px;
}
.flexo-main-nav > .nav-item:nth-child(2) .flexo-mega{left:165px;}
.flexo-main-nav > .nav-item:nth-child(3) .flexo-mega{left:190px;}
.flexo-main-nav > .nav-item:nth-child(4) .flexo-mega{left:205px;}
.flexo-main-nav > .nav-item:nth-child(5) .flexo-mega{left:245px;}
.flexo-main-nav > .nav-item:nth-child(6) .flexo-mega{left:310px;}
.flexo-main-nav > .nav-item:nth-child(7) .flexo-mega{left:380px;}
.flexo-main-nav > .nav-item:nth-child(8) .flexo-mega{left:470px;}
.flexo-main-nav > .nav-item:nth-child(9) .flexo-mega{left:500px;}
.flexo-main-nav > .nav-item:nth-child(10) .flexo-mega{left:585px;}
.flexo-main-nav > .nav-item:nth-child(11) .flexo-mega{left:620px;}
.flexo-main-nav > .nav-item:nth-child(12) .flexo-mega{left:660px;}
.flexo-main-nav > .nav-item:nth-child(13) .flexo-mega{left:720px;}
.flexo-main-nav > .nav-item:nth-child(14) .flexo-mega{left:760px;}
.flexo-main-nav > .nav-item:nth-child(15) .flexo-mega{left:auto;right:.85rem;}
#mega-purchase{min-width:580px;}
#mega-purchase .flexo-mega-col.right{max-width:250px;}
#mega-ar{min-width:560px;}
#mega-ar .flexo-mega-col.right{max-width:250px;}
#mega-ap{min-width:560px;}
#mega-ap .flexo-mega-col.right{max-width:250px;}
#mega-finance{min-width:620px;}
#mega-finance .flexo-mega-col.right{max-width:260px;}
#mega-inventory{min-width:650px;}
#mega-inventory .flexo-mega-col.right{max-width:260px;}
#mega-tax{min-width:620px;}
#mega-tax .flexo-mega-col.right{max-width:270px;}
#mega-accounting{min-width:620px;}
#mega-accounting .flexo-mega-col.right{max-width:260px;}
#mega-assets{min-width:580px;}
#mega-assets .flexo-mega-col.right{max-width:260px;}
#mega-reports{min-width:760px;}
#mega-reports .flexo-mega-col:first-child{
  display:grid;
  grid-template-columns:repeat(2,minmax(220px,1fr));
  align-content:start;
}
#mega-reports .flexo-mega-col:first-child .mega-item + .mega-item{border-top:none;}
#mega-reports .flexo-mega-col.right{max-width:270px;}
#mega-master{min-width:760px;}
#mega-master .flexo-mega-col:first-child{
  display:grid;
  grid-template-columns:repeat(2,minmax(220px,1fr));
  align-content:start;
}
#mega-master .flexo-mega-col:first-child .mega-item + .mega-item{border-top:none;}
#mega-master .flexo-mega-col.right{max-width:270px;}
#mega-users{min-width:560px;}
#mega-users .flexo-mega-col.right{max-width:260px;}
#mega-settings{min-width:580px;}
#mega-settings .flexo-mega-col.right{max-width:260px;}
.flexo-mega.show{display:block;animation:megaIn .15s ease;}
@keyframes megaIn{from{opacity:0;transform:translateY(-6px);}to{opacity:1;transform:none;}}
@media (min-width:1200px){
  .flexo-main-nav > .nav-item:nth-child(14),
  .flexo-main-nav > .nav-item:nth-child(15){position:relative!important;}
  .flexo-main-nav > .nav-item:nth-child(14) > .flexo-mega,
  .flexo-main-nav > .nav-item:nth-child(15) > .flexo-mega{left:auto;right:0;}
}
.flexo-mega-row{display:flex;gap:10px;}
.flexo-mega-row.three-col{gap:0;}
.flexo-mega-col{flex:1;min-width:0;}
.flexo-mega-col.right{max-width:260px;border-left:1px solid #eef0f5;padding-left:14px;}
.flexo-mega-wide{min-width:700px;padding:18px 14px;border-bottom:3px solid var(--flexo-blue-dark);}
.flexo-mega-wide .flexo-mega-col{padding:0 16px;}
.flexo-mega-wide .flexo-mega-col + .flexo-mega-col{border-left:1px solid #e7ebf3;}
.flexo-mega-wide .mega-item{padding:12px 0;border-radius:8px;}
.flexo-mega-wide .mega-item + .mega-item{border-top:none;}
.flexo-mega-wide .mega-item:hover{padding-left:8px;padding-right:8px;}
.flexo-mega-ar{min-width:560px;}
.flexo-mega-ap{min-width:560px;}
.flexo-mega-finance{min-width:620px;}
.flexo-mega-inventory{min-width:650px;}
.flexo-mega-tax{min-width:620px;}
.flexo-mega-accounting{min-width:740px;}
.flexo-mega-assets{min-width:580px;}
.flexo-mega-reports{min-width:760px;}
.flexo-mega-master{min-width:760px;}
.flexo-mega-users{min-width:560px;}
.flexo-mega-settings{min-width:580px;}
.mega-col-title{color:var(--flexo-blue);font-weight:700;font-size:.92rem;margin:0 0 10px 6px;}
.mega-item{
  display:flex;align-items:center;gap:12px;padding:11px 12px;border-radius:10px;
  color:#2c3345;text-decoration:none;transition:.12s;
}
.mega-item + .mega-item{border-top:1px solid #f1f3f8;}
.mega-item:hover{background:var(--flexo-blue-light);color:var(--flexo-blue-dark);text-decoration:none;}
.mega-item .mi-ico{
  width:34px;height:34px;border-radius:9px;background:var(--flexo-blue-light);color:var(--flexo-blue);
  display:flex;align-items:center;justify-content:center;flex-shrink:0;
}
#mega-sales .flexo-mega-col:first-child .mega-item:nth-child(1) .mi-ico{background:#e8f8fb;color:#0891b2;}
#mega-sales .flexo-mega-col:first-child .mega-item:nth-child(2) .mi-ico{background:#fff3e6;color:#f97316;}
#mega-sales .flexo-mega-col:first-child .mega-item:nth-child(3) .mi-ico{background:#eaf2ff;color:#2563eb;}
#mega-sales .flexo-mega-col:first-child .mega-item:nth-child(4) .mi-ico{background:#eafaf0;color:#16a34a;}
#mega-sales .flexo-mega-col:first-child .mega-item:nth-child(5) .mi-ico{background:#f4e8ff;color:#9333ea;}
#mega-sales .flexo-mega-col:first-child .mega-item:nth-child(6) .mi-ico{background:#fff0f0;color:#ef4444;}
#mega-sales .flexo-mega-col:first-child .mega-item:nth-child(7) .mi-ico{background:#e8fbfb;color:#0f9f9a;}
#mega-sales .flexo-mega-col.right .mega-item:nth-of-type(1) .mi-ico{background:#edf5ff;color:#2563eb;}
#mega-sales .flexo-mega-col.right .mega-item:nth-of-type(2) .mi-ico{background:#fff7e6;color:#f59e0b;}
#mega-sales .flexo-mega-col.right .mega-item:nth-of-type(3) .mi-ico{background:#ecfdf5;color:#16a34a;}
#mega-sales .flexo-mega-col.right .mega-item:nth-of-type(4) .mi-ico{background:#fff0f0;color:#ef4444;}
#mega-purchase .flexo-mega-col:first-child .mega-item:nth-child(1) .mi-ico{background:#ecfdf5;color:#16a34a;}
#mega-purchase .flexo-mega-col:first-child .mega-item:nth-child(2) .mi-ico{background:#f4e8ff;color:#9333ea;}
#mega-purchase .flexo-mega-col:first-child .mega-item:nth-child(3) .mi-ico{background:#e8fbfb;color:#0f9f9a;}
#mega-purchase .flexo-mega-col:first-child .mega-item:nth-child(4) .mi-ico{background:#fff3e6;color:#f97316;}
#mega-purchase .flexo-mega-col:first-child .mega-item:nth-child(5) .mi-ico{background:#fff0f0;color:#ef4444;}
#mega-purchase .flexo-mega-col:first-child .mega-item:nth-child(6) .mi-ico{background:#f1e8ff;color:#7c3aed;}
#mega-purchase .flexo-mega-col:first-child .mega-item:nth-child(7) .mi-ico{background:#fff7e6;color:#f59e0b;}
#mega-purchase .flexo-mega-col:first-child .mega-item:nth-child(8) .mi-ico{background:#eaf2ff;color:#2563eb;}
#mega-purchase .flexo-mega-col.right .mega-item:nth-of-type(1) .mi-ico{background:#edf5ff;color:#2563eb;}
#mega-purchase .flexo-mega-col.right .mega-item:nth-of-type(2) .mi-ico{background:#fff7e6;color:#f59e0b;}
#mega-purchase .flexo-mega-col.right .mega-item:nth-of-type(3) .mi-ico{background:#ecfdf5;color:#16a34a;}
#mega-purchase .flexo-mega-col.right .mega-item:nth-of-type(4) .mi-ico{background:#f4e8ff;color:#9333ea;}
#mega-ar .flexo-mega-col:first-child .mega-item:nth-child(1) .mi-ico{background:#fff0f7;color:#db2777;}
#mega-ar .flexo-mega-col:first-child .mega-item:nth-child(2) .mi-ico{background:#f1e8ff;color:#7c3aed;}
#mega-ar .flexo-mega-col:first-child .mega-item:nth-child(3) .mi-ico{background:#ecfdf5;color:#16a34a;}
#mega-ar .flexo-mega-col:first-child .mega-item:nth-child(4) .mi-ico{background:#fff0f7;color:#db2777;}
#mega-ar .flexo-mega-col:first-child .mega-item:nth-child(5) .mi-ico{background:#e8fbfb;color:#0891b2;}
#mega-ar .flexo-mega-col:first-child .mega-item:nth-child(6) .mi-ico{background:#fff7e6;color:#f59e0b;}
#mega-ar .flexo-mega-col:first-child .mega-item:nth-child(7) .mi-ico{background:#ecfdf5;color:#16a34a;}
#mega-ar .flexo-mega-col:first-child .mega-item:nth-child(8) .mi-ico{background:#fff0f0;color:#ef4444;}
#mega-ar .flexo-mega-col.right .mega-item:nth-of-type(1) .mi-ico{background:#edf5ff;color:#2563eb;}
#mega-ar .flexo-mega-col.right .mega-item:nth-of-type(2) .mi-ico{background:#fff3e6;color:#f97316;}
#mega-ar .flexo-mega-col.right .mega-item:nth-of-type(3) .mi-ico{background:#eaf2ff;color:#2563eb;}
#mega-ar .flexo-mega-col.right .mega-item:nth-of-type(4) .mi-ico{background:#f1e8ff;color:#7c3aed;}
#mega-ar .ar-payment-item .mi-ico{background:#fff0f7;color:#db2777;}
#mega-ar .ar-age-item .mi-ico{background:#fff7e6;color:#f59e0b;}
#mega-ar .ar-followup-item .mi-ico{background:#ecfdf5;color:#16a34a;}
#mega-ar .ar-cashflow-item .mi-ico{background:#eaf2ff;color:#2563eb;}
#mega-ap .mega-item .mi-ico{background:#f1f5f9;color:#475569;}
#mega-ap .flexo-mega-col:first-child .mega-item:nth-child(1) .mi-ico{background:#fff7e6;color:#d97706;}
#mega-ap .flexo-mega-col:first-child .mega-item:nth-child(2) .mi-ico{background:#fff0f0;color:#dc2626;}
#mega-ap .flexo-mega-col:first-child .mega-item:nth-child(3) .mi-ico{background:#eef2ff;color:#4f46e5;}
#mega-ap .flexo-mega-col:first-child .mega-item:nth-child(4) .mi-ico{background:#ecfdf5;color:#15803d;}
#mega-ap .flexo-mega-col:first-child .mega-item:nth-child(5) .mi-ico{background:#eaf2ff;color:#2563eb;}
#mega-ap .flexo-mega-col:first-child .mega-item:nth-child(6) .mi-ico{background:#fff0f0;color:#dc2626;}
#mega-ap .flexo-mega-col:first-child .mega-item:nth-child(7) .mi-ico{background:#e8fbfb;color:#0e7490;}
#mega-ap .flexo-mega-col:first-child .mega-item:nth-child(8) .mi-ico{background:#fff7e6;color:#d97706;}
#mega-ap .flexo-mega-col:first-child .mega-item:nth-child(9) .mi-ico{background:#f4e8ff;color:#7c3aed;}
#mega-ap .flexo-mega-col.right .mega-item:nth-child(2) .mi-ico{background:#edf5ff;color:#2563eb;}
#mega-ap .flexo-mega-col.right .mega-item:nth-child(3) .mi-ico{background:#fff3e6;color:#ea580c;}
#mega-ap .flexo-mega-col.right .mega-item:nth-child(4) .mi-ico{background:#f4e8ff;color:#7c3aed;}
#mega-ap .flexo-mega-col.right .mega-item:nth-child(5) .mi-ico{background:#e8fbfb;color:#0e7490;}
#mega-ap .flexo-mega-col.right .mega-item:nth-child(6) .mi-ico{background:#ecfdf5;color:#15803d;}
#mega-ap .flexo-mega-col.right .mega-item:nth-child(7) .mi-ico{background:#fff0f7;color:#be185d;}
#mega-finance .flexo-mega-col:first-child .mega-item:nth-child(1) .mi-ico{background:#ecfdf5;color:#16a34a;}
#mega-finance .flexo-mega-col:first-child .mega-item:nth-child(2) .mi-ico{background:#fff0f0;color:#ef4444;}
#mega-finance .flexo-mega-col:first-child .mega-item:nth-child(3) .mi-ico{background:#e8fbfb;color:#0891b2;}
#mega-finance .flexo-mega-col:first-child .mega-item:nth-child(4) .mi-ico{background:#fff7e6;color:#f59e0b;}
#mega-finance .flexo-mega-col:first-child .mega-item:nth-child(5) .mi-ico{background:#f4e8ff;color:#9333ea;}
#mega-finance .flexo-mega-col:first-child .mega-item:nth-child(6) .mi-ico{background:#edf5ff;color:#2563eb;}
#mega-finance .flexo-mega-col:first-child .mega-item:nth-child(7) .mi-ico{background:#f1e8ff;color:#7c3aed;}
#mega-finance .flexo-mega-col:first-child .mega-item:nth-child(8) .mi-ico{background:#ecfdf5;color:#16a34a;}
#mega-finance .flexo-mega-col:first-child .mega-item:nth-child(9) .mi-ico{background:#fff3e6;color:#f97316;}
#mega-finance .flexo-mega-col:first-child .mega-item:nth-child(10) .mi-ico{background:#fff7e6;color:#f59e0b;}
#mega-finance .flexo-mega-col.right .mega-item:nth-of-type(1) .mi-ico{background:#edf5ff;color:#2563eb;}
#mega-finance .flexo-mega-col.right .mega-item:nth-of-type(2) .mi-ico{background:#e8fbfb;color:#0891b2;}
#mega-finance .flexo-mega-col.right .mega-item:nth-of-type(3) .mi-ico{background:#f4e8ff;color:#9333ea;}
#mega-finance .flexo-mega-col.right .mega-item:nth-of-type(4) .mi-ico{background:#fff7e6;color:#f59e0b;}
#mega-inventory .flexo-mega-col:first-child .mega-item:nth-child(1) .mi-ico{background:#ecfdf5;color:#16a34a;}
#mega-inventory .flexo-mega-col:first-child .mega-item:nth-child(2) .mi-ico{background:#fff3e6;color:#f97316;}
#mega-inventory .flexo-mega-col:first-child .mega-item:nth-child(3) .mi-ico{background:#f4e8ff;color:#9333ea;}
#mega-inventory .flexo-mega-col:first-child .mega-item:nth-child(4) .mi-ico{background:#edf5ff;color:#2563eb;}
#mega-inventory .flexo-mega-col:first-child .mega-item:nth-child(5) .mi-ico{background:#e8fbfb;color:#0891b2;}
#mega-inventory .flexo-mega-col:first-child .mega-item:nth-child(6) .mi-ico{background:#ecfdf5;color:#16a34a;}
#mega-inventory .flexo-mega-col:first-child .mega-item:nth-child(7) .mi-ico{background:#fff0f0;color:#ef4444;}
#mega-inventory .flexo-mega-col:first-child .mega-item:nth-child(8) .mi-ico{background:#f1e8ff;color:#7c3aed;}
#mega-inventory .flexo-mega-col:first-child .mega-item:nth-child(9) .mi-ico{background:#fff7e6;color:#f59e0b;}
#mega-inventory .flexo-mega-col:first-child .mega-item:nth-child(10) .mi-ico{background:#e8fbfb;color:#0891b2;}
#mega-inventory .flexo-mega-col:first-child .mega-item:nth-child(11) .mi-ico{background:#fff3e6;color:#f97316;}
#mega-inventory .flexo-mega-col:first-child .mega-item:nth-child(12) .mi-ico{background:#edf5ff;color:#2563eb;}
#mega-inventory .flexo-mega-col.right .mega-item:nth-of-type(1) .mi-ico{background:#ecfdf5;color:#16a34a;}
#mega-inventory .flexo-mega-col.right .mega-item:nth-of-type(2) .mi-ico{background:#edf5ff;color:#2563eb;}
#mega-inventory .flexo-mega-col.right .mega-item:nth-of-type(3) .mi-ico{background:#f1e8ff;color:#7c3aed;}
#mega-inventory .flexo-mega-col.right .mega-item:nth-of-type(4) .mi-ico{background:#fff0f0;color:#ef4444;}
#mega-tax .flexo-mega-col:first-child .mega-item:nth-child(1) .mi-ico{background:#fff3e6;color:#f97316;}
#mega-tax .flexo-mega-col:first-child .mega-item:nth-child(2) .mi-ico{background:#ecfdf5;color:#16a34a;}
#mega-tax .flexo-mega-col:first-child .mega-item:nth-child(3) .mi-ico{background:#f1e8ff;color:#7c3aed;}
#mega-tax .flexo-mega-col:first-child .mega-item:nth-child(4) .mi-ico{background:#edf5ff;color:#2563eb;}
#mega-tax .flexo-mega-col:first-child .mega-item:nth-child(5) .mi-ico{background:#fff7e6;color:#f59e0b;}
#mega-tax .flexo-mega-col:first-child .mega-item:nth-child(6) .mi-ico{background:#e8fbfb;color:#0891b2;}
#mega-tax .flexo-mega-col:first-child .mega-item:nth-child(7) .mi-ico{background:#fff0f7;color:#db2777;}
#mega-tax .flexo-mega-col:first-child .mega-item:nth-child(8) .mi-ico{background:#ecfdf5;color:#16a34a;}
#mega-tax .flexo-mega-col:first-child .mega-item:nth-child(9) .mi-ico{background:#edf5ff;color:#2563eb;}
#mega-tax .flexo-mega-col:first-child .mega-item:nth-child(10) .mi-ico{background:#f4e8ff;color:#9333ea;}
#mega-tax .flexo-mega-col:first-child .mega-item:nth-child(11) .mi-ico{background:#fff0f0;color:#ef4444;}
#mega-tax .flexo-mega-col.right .mega-item:nth-of-type(1) .mi-ico{background:#fff7e6;color:#f59e0b;}
#mega-tax .flexo-mega-col.right .mega-item:nth-of-type(2) .mi-ico{background:#edf5ff;color:#2563eb;}
#mega-tax .flexo-mega-col.right .mega-item:nth-of-type(3) .mi-ico{background:#f4e8ff;color:#9333ea;}
#mega-tax .flexo-mega-col.right .mega-item:nth-of-type(4) .mi-ico{background:#fff0f0;color:#ef4444;}
#mega-accounting .flexo-mega-col:first-child .mega-item:nth-child(1) .mi-ico{background:#edf5ff;color:#2563eb;}
#mega-accounting .flexo-mega-col:first-child .mega-item:nth-child(2) .mi-ico{background:#f1e8ff;color:#7c3aed;}
#mega-accounting .flexo-mega-col:first-child .mega-item:nth-child(3) .mi-ico{background:#fff3e6;color:#f97316;}
#mega-accounting .flexo-mega-col:first-child .mega-item:nth-child(4) .mi-ico{background:#ecfdf5;color:#16a34a;}
#mega-accounting .flexo-mega-col:first-child .mega-item:nth-child(5) .mi-ico{background:#e8fbfb;color:#0891b2;}
#mega-accounting .flexo-mega-col:first-child .mega-item:nth-child(6) .mi-ico{background:#fff0f0;color:#ef4444;}
#mega-accounting .flexo-mega-col:first-child .mega-item:nth-child(7) .mi-ico{background:#fff7e6;color:#f59e0b;}
#mega-accounting .flexo-mega-col:first-child .mega-item:nth-child(8) .mi-ico{background:#f4e8ff;color:#9333ea;}
#mega-accounting .flexo-mega-col:first-child .mega-item:nth-child(9) .mi-ico{background:#fff0f0;color:#ef4444;}
#mega-accounting .flexo-mega-col:first-child .mega-item:nth-child(10) .mi-ico{background:#ecfdf5;color:#16a34a;}
#mega-accounting .flexo-mega-col:first-child .mega-item:nth-child(11) .mi-ico{background:#edf5ff;color:#2563eb;}
#mega-accounting .flexo-mega-col:first-child .mega-item:nth-child(12) .mi-ico{background:#fff3e6;color:#f97316;}
#mega-accounting .flexo-mega-col:first-child .mega-item:nth-child(13) .mi-ico{background:#e8fbfb;color:#0891b2;}
#mega-accounting .flexo-mega-col.right .mega-item:nth-of-type(1) .mi-ico{background:#edf5ff;color:#2563eb;}
#mega-accounting .flexo-mega-col.right .mega-item:nth-of-type(2) .mi-ico{background:#f4e8ff;color:#9333ea;}
#mega-accounting .flexo-mega-col.right .mega-item:nth-of-type(3) .mi-ico{background:#fff0f0;color:#ef4444;}
#mega-accounting .flexo-mega-col.right .mega-item:nth-of-type(4) .mi-ico{background:#e8fbfb;color:#0891b2;}
#mega-assets .flexo-mega-col:first-child .mega-item:nth-child(1) .mi-ico{background:#edf5ff;color:#2563eb;}
#mega-assets .flexo-mega-col:first-child .mega-item:nth-child(2) .mi-ico{background:#f1e8ff;color:#7c3aed;}
#mega-assets .flexo-mega-col:first-child .mega-item:nth-child(3) .mi-ico{background:#fff7e6;color:#f59e0b;}
#mega-assets .flexo-mega-col:first-child .mega-item:nth-child(4) .mi-ico{background:#ecfdf5;color:#16a34a;}
#mega-assets .flexo-mega-col:first-child .mega-item:nth-child(5) .mi-ico{background:#e8fbfb;color:#0891b2;}
#mega-assets .flexo-mega-col:first-child .mega-item:nth-child(6) .mi-ico{background:#fff0f0;color:#ef4444;}
#mega-assets .flexo-mega-col:first-child .mega-item:nth-child(7) .mi-ico{background:#fff3e6;color:#f97316;}
#mega-assets .flexo-mega-col:first-child .mega-item:nth-child(8) .mi-ico{background:#f4e8ff;color:#9333ea;}
#mega-assets .flexo-mega-col.right .mega-item:nth-of-type(1) .mi-ico{background:#edf5ff;color:#2563eb;}
#mega-assets .flexo-mega-col.right .mega-item:nth-of-type(2) .mi-ico{background:#fff7e6;color:#f59e0b;}
#mega-assets .flexo-mega-col.right .mega-item:nth-of-type(3) .mi-ico{background:#fff3e6;color:#f97316;}
#mega-assets .flexo-mega-col.right .mega-item:nth-of-type(4) .mi-ico{background:#f4e8ff;color:#9333ea;}
#mega-report-data .flexo-mega-col:first-child .mega-item:nth-child(1) .mi-ico{background:#eaf2ff;color:#2563eb;}
#mega-report-data .flexo-mega-col:first-child .mega-item:nth-child(2) .mi-ico{background:#fff3e6;color:#f97316;}
#mega-report-data .flexo-mega-col:first-child .mega-item:nth-child(3) .mi-ico{background:#ecfdf5;color:#16a34a;}
#mega-report-data .flexo-mega-col:first-child .mega-item:nth-child(4) .mi-ico{background:#fff0f7;color:#db2777;}
#mega-report-data .flexo-mega-col:first-child .mega-item:nth-child(5) .mi-ico{background:#f4e8ff;color:#9333ea;}
#mega-report-data .flexo-mega-col:first-child .mega-item:nth-child(6) .mi-ico{background:#e8fbfb;color:#0891b2;}
#mega-report-data .flexo-mega-col.right .mega-item:nth-of-type(1) .mi-ico{background:#fff7e6;color:#f59e0b;}
#mega-report-data .flexo-mega-col.right .mega-item:nth-of-type(2) .mi-ico{background:#fff0f0;color:#ef4444;}
#mega-report-data .flexo-mega-col:nth-child(2) .mega-item:nth-child(1) .mi-ico{background:#e8f8fb;color:#0891b2;}
#mega-report-data .flexo-mega-col:nth-child(2) .mega-item:nth-child(2) .mi-ico{background:#fff3e6;color:#f97316;}
#mega-report-data .flexo-mega-col:nth-child(2) .mega-item:nth-child(3) .mi-ico{background:#f0fdf4;color:#15803d;}
#mega-report-data .flexo-mega-col:nth-child(2) .mega-item:nth-child(4) .mi-ico{background:#f4e8ff;color:#9333ea;}
#mega-report-data{min-width:1120px;}
#mega-report-data .flexo-mega-col:first-child{flex:1.8;}
#mega-report-data .flexo-mega-col:nth-child(2){flex:2;}
#mega-report-data .flexo-mega-col.right{flex:1.4;max-width:340px;}
#mega-report-data .flexo-mega-col:first-child .mega-item{white-space:nowrap;}
#mega-report-data .flexo-mega-col:first-child .mega-item small{white-space:nowrap;}
#mega-reports .flexo-mega-col:first-child .mega-item:nth-child(1) .mi-ico{background:#ecfdf5;color:#16a34a;}
#mega-reports .flexo-mega-col:first-child .mega-item:nth-child(2) .mi-ico{background:#f4e8ff;color:#9333ea;}
#mega-reports .flexo-mega-col:first-child .mega-item:nth-child(3) .mi-ico{background:#e8fbfb;color:#0891b2;}
#mega-reports .flexo-mega-col:first-child .mega-item:nth-child(4) .mi-ico{background:#fff7e6;color:#f59e0b;}
#mega-reports .flexo-mega-col:first-child .mega-item:nth-child(5) .mi-ico{background:#edf5ff;color:#2563eb;}
#mega-reports .flexo-mega-col:first-child .mega-item:nth-child(6) .mi-ico{background:#fff0f7;color:#db2777;}
#mega-reports .flexo-mega-col:first-child .mega-item:nth-child(7) .mi-ico{background:#fff3e6;color:#f97316;}
#mega-reports .flexo-mega-col:first-child .mega-item:nth-child(8) .mi-ico{background:#ecfdf5;color:#16a34a;}
#mega-reports .flexo-mega-col:first-child .mega-item:nth-child(9) .mi-ico{background:#fff7e6;color:#f59e0b;}
#mega-reports .flexo-mega-col:first-child .mega-item:nth-child(10) .mi-ico{background:#f1e8ff;color:#7c3aed;}
#mega-reports .flexo-mega-col:first-child .mega-item:nth-child(11) .mi-ico{background:#fff0f0;color:#ef4444;}
#mega-reports .flexo-mega-col:first-child .mega-item:nth-child(12) .mi-ico{background:#e8fbfb;color:#0891b2;}
#mega-reports .flexo-mega-col:first-child .mega-item:nth-child(13) .mi-ico{background:#edf5ff;color:#2563eb;}
#mega-reports .flexo-mega-col.right .mega-item:nth-of-type(1) .mi-ico{background:#ecfdf5;color:#16a34a;}
#mega-reports .flexo-mega-col.right .mega-item:nth-of-type(2) .mi-ico{background:#f4e8ff;color:#9333ea;}
#mega-reports .flexo-mega-col.right .mega-item:nth-of-type(3) .mi-ico{background:#e8fbfb;color:#0891b2;}
#mega-reports .flexo-mega-col.right .mega-item:nth-of-type(4) .mi-ico{background:#edf5ff;color:#2563eb;}
#mega-master .flexo-mega-col:first-child .mega-item:nth-child(1) .mi-ico{background:#edf5ff;color:#2563eb;}
#mega-master .flexo-mega-col:first-child .mega-item:nth-child(2) .mi-ico{background:#f1e8ff;color:#7c3aed;}
#mega-master .flexo-mega-col:first-child .mega-item:nth-child(3) .mi-ico{background:#fff0f7;color:#db2777;}
#mega-master .flexo-mega-col:first-child .mega-item:nth-child(4) .mi-ico{background:#fff3e6;color:#f97316;}
#mega-master .flexo-mega-col:first-child .mega-item:nth-child(5) .mi-ico{background:#ecfdf5;color:#16a34a;}
#mega-master .flexo-mega-col:first-child .mega-item:nth-child(6) .mi-ico{background:#f4e8ff;color:#9333ea;}
#mega-master .flexo-mega-col:first-child .mega-item:nth-child(7) .mi-ico{background:#e8fbfb;color:#0891b2;}
#mega-master .flexo-mega-col:first-child .mega-item:nth-child(8) .mi-ico{background:#fff7e6;color:#f59e0b;}
#mega-master .flexo-mega-col:first-child .mega-item:nth-child(9) .mi-ico{background:#edf5ff;color:#2563eb;}
#mega-master .flexo-mega-col:first-child .mega-item:nth-child(10) .mi-ico{background:#ecfdf5;color:#16a34a;}
#mega-master .flexo-mega-col:first-child .mega-item:nth-child(11) .mi-ico{background:#fff0f0;color:#ef4444;}
#mega-master .flexo-mega-col:first-child .mega-item:nth-child(12) .mi-ico{background:#e8fbfb;color:#0891b2;}
#mega-master .flexo-mega-col:first-child .mega-item:nth-child(13) .mi-ico{background:#f1e8ff;color:#7c3aed;}
#mega-master .flexo-mega-col.right .mega-item:nth-of-type(1) .mi-ico{background:#fff0f7;color:#db2777;}
#mega-master .flexo-mega-col.right .mega-item:nth-of-type(2) .mi-ico{background:#fff3e6;color:#f97316;}
#mega-master .flexo-mega-col.right .mega-item:nth-of-type(3) .mi-ico{background:#ecfdf5;color:#16a34a;}
#mega-master .flexo-mega-col.right .mega-item:nth-of-type(4) .mi-ico{background:#e8fbfb;color:#0891b2;}
#mega-users .flexo-mega-col:first-child .mega-item:nth-child(1) .mi-ico{background:#ecfdf5;color:#16a34a;}
#mega-users .flexo-mega-col:first-child .mega-item:nth-child(2) .mi-ico{background:#edf5ff;color:#2563eb;}
#mega-users .flexo-mega-col:first-child .mega-item:nth-child(3) .mi-ico{background:#f1e8ff;color:#7c3aed;}
#mega-users .flexo-mega-col.right .mega-item:nth-of-type(1) .mi-ico{background:#edf5ff;color:#2563eb;}
#mega-users .flexo-mega-col.right .mega-item:nth-of-type(2) .mi-ico{background:#fff7e6;color:#f59e0b;}
#mega-users .flexo-mega-col.right .mega-item:nth-of-type(3) .mi-ico{background:#ecfdf5;color:#16a34a;}
#mega-settings .flexo-mega-col:first-child .mega-item:nth-child(1) .mi-ico{background:#edf5ff;color:#2563eb;}
#mega-settings .flexo-mega-col:first-child .mega-item:nth-child(2) .mi-ico{background:#fff7e6;color:#f59e0b;}
#mega-settings .flexo-mega-col:first-child .mega-item:nth-child(3) .mi-ico{background:#f1e8ff;color:#7c3aed;}
#mega-settings .flexo-mega-col:first-child .mega-item:nth-child(4) .mi-ico{background:#ecfdf5;color:#16a34a;}
#mega-settings .flexo-mega-col:first-child .mega-item:nth-child(5) .mi-ico{background:#fff3e6;color:#f97316;}
#mega-settings .flexo-mega-col:first-child .mega-item:nth-child(6) .mi-ico{background:#e8fbfb;color:#0891b2;}
#mega-settings .flexo-mega-col:first-child .mega-item:nth-child(7) .mi-ico{background:#f4e8ff;color:#9333ea;}
#mega-settings .flexo-mega-col.right .mega-item:nth-of-type(1) .mi-ico{background:#ecfdf5;color:#16a34a;}
#mega-settings .flexo-mega-col.right .mega-item:nth-of-type(2) .mi-ico{background:#fff7e6;color:#f59e0b;}
#mega-settings .flexo-mega-col.right .mega-item:nth-of-type(3) .mi-ico{background:#fff3e6;color:#f97316;}
#mega-settings .flexo-mega-col.right .mega-item:nth-of-type(4) .mi-ico{background:#f4e8ff;color:#9333ea;}
.mega-item .mi-arrow{display:none;}
.mega-item small{display:block;color:#8a92a6;font-size:.78rem;}
.mega-create{
  display:flex;align-items:center;gap:12px;padding:14px;border-radius:12px;
  background:var(--flexo-blue-light);text-decoration:none;margin-bottom:8px;
}
.mega-create:hover{background:#dce8ff;text-decoration:none;}
.mega-create .plus{
  width:40px;height:40px;border-radius:50%;background:var(--flexo-gradient);color:#fff;
  display:flex;align-items:center;justify-content:center;font-size:1.2rem;
}
.mega-create b{color:var(--flexo-blue-dark);}

/* ===== Cards ===== */
.flexo-card{
  background:#fff;border:none;border-radius:16px;box-shadow:0 4px 18px rgba(30,50,100,.06);
  transition:transform .18s, box-shadow .18s;
}
.shortcut-card{text-align:center;padding:26px 18px;height:100%;}
.shortcut-card:hover{transform:translateY(-6px);box-shadow:0 12px 30px rgba(30,50,100,.14);}
.shortcut-icon{
  width:110px;height:110px;border-radius:50%;margin:0 auto 14px;
  display:flex;align-items:center;justify-content:center;font-size:2.6rem;
}
.shortcut-card h6{font-weight:600;margin-bottom:14px;min-height:44px;display:flex;align-items:center;justify-content:center;}

/* KPI */
.kpi-card{border-radius:14px;padding:16px 18px;color:#fff;box-shadow:0 6px 16px rgba(0,0,0,.08);}
.kpi-card .kpi-label{opacity:.9;font-size:.85rem;}
.kpi-card .kpi-value{font-size:1.5rem;font-weight:700;}
.kpi-card .kpi-ico{font-size:1.8rem;opacity:.35;}

/* Buttons */
.btn-flexo{background:var(--flexo-gradient);border:none;color:#fff;border-radius:9px;font-weight:500;}
.btn-flexo:hover{color:#fff;filter:brightness(1.05);box-shadow:0 4px 12px rgba(37,99,217,.35);}
.btn-outline-flexo{border:1px solid var(--flexo-blue);color:var(--flexo-blue);border-radius:9px;background:#fff;}
.btn-outline-flexo:hover{background:var(--flexo-blue);color:#fff;}

/* Tables */
.table thead th{background:#f7f9fd;border-top:none;font-weight:600;color:#5a6478;white-space:nowrap;}
.table-hover tbody tr:hover{background:#f6f9ff;}

.page-title{font-weight:700;color:#1f2a44;}

/* ===== Purchase request list ===== */
.purchase-request-page{background:#f7f9fd;min-height:calc(100vh - 76px);}
.purchase-request-head{gap:14px;}
.purchase-request-page,
.purchase-request-page .form-control,
.purchase-request-page .btn,
.purchase-request-page .table{font-size:inherit;}
.purchase-request-filter label{color:#374151;font-weight:500;}
.purchase-request-filter .form-control{border-color:#d5dbe5;}
.purchase-request-filter .form-control:focus{
  border-color:var(--flexo-blue);box-shadow:0 0 0 3px rgba(37,99,217,.12);
}
.purchase-request-table{overflow:hidden;}
.purchase-request-table .table tbody td{vertical-align:middle;border-top-color:#e3e7ee;}
.purchase-request-table .table tbody td:first-child a{color:#0784c6;font-weight:500;}
.purchase-request-table .table tbody td:first-child a:hover{color:#075f91;}
.purchase-reference-icons{display:inline-flex;align-items:center;gap:5px;margin-left:8px;}
.purchase-reference-icon{
  display:inline-flex;align-items:center;justify-content:center;
  width:28px;height:28px;border-radius:4px;color:#17212b;
  background:#fff;text-decoration:none;vertical-align:middle;
}
.purchase-reference-icon:hover,
.purchase-reference-icon:focus{
  color:#0784c6;background:#eef6fb;text-decoration:none;outline:none;
  box-shadow:0 0 0 3px rgba(7,132,198,.12);
}
.tooltip{pointer-events:none;}
.tooltip-inner{font-family:'Sarabun',sans-serif;max-width:280px;padding:7px 10px;}
.purchase-request-table .btn-light{
  background:#fff;border-color:#f1f3f6;min-width:32px;
}
.purchase-request-table .btn-light:hover{background:#edf3fb;border-color:#dbe5f2;}

@media (max-width:767.98px){
  .purchase-request-page{padding:18px 14px!important;}
  .purchase-request-head{align-items:stretch!important;}
  .purchase-request-head .btn{width:100%;margin-top:10px;}
  .purchase-request-filter .col-md-4{display:flex;gap:8px;}
  .purchase-request-filter .col-md-4 .btn,
  .purchase-request-filter .col-md-4 a{flex:1;}
  .purchase-request-table .table{min-width:860px;}
}

/* ===== Dashboard Home ===== */
.app-main{min-height:calc(100vh - 76px);}
.dashboard-page{
  padding:18px 34px 24px;
  background:#f7faff;
}
.dashboard-head{
  display:flex;align-items:center;justify-content:space-between;gap:18px;margin-bottom:18px;
}
.dashboard-head .page-title{font-size:1.7rem;color:#0f172a;}
.dashboard-head .wave{font-size:1.35rem;}
.date-chip,.small-select{
  display:inline-flex;align-items:center;gap:10px;border:1px solid #d8e2ef;background:#fff;color:#334155;
  border-radius:6px;padding:10px 16px;font-weight:600;box-shadow:0 3px 10px rgba(30,50,100,.04);
}
.small-select{padding:7px 12px;font-size:.86rem;}
.date-chip-wrap{position:relative;}
.date-chip{cursor:pointer;}
.date-chip-menu{
  display:none;position:absolute;top:calc(100% + 8px);right:0;z-index:20;background:#fff;
  border:1px solid #d8e2ef;border-radius:8px;box-shadow:0 10px 26px rgba(30,50,100,.12);padding:12px;
}
.date-chip-menu.show{display:block;}
.date-chip-form{display:flex;align-items:center;gap:8px;}
.date-chip-form select{min-width:120px;}
.dash-card{
  background:#fff;border:1px solid #dce7f5;border-radius:8px;box-shadow:0 6px 18px rgba(30,50,100,.06);
}
.kpi-grid{
  display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:16px;margin-bottom:16px;
}
.kpi-tile{
  min-height:106px;padding:18px;display:flex;align-items:center;gap:16px;overflow:hidden;
}
.kpi-toggle{
  position:relative;cursor:pointer;transition:transform .18s ease,box-shadow .18s ease;
}
.kpi-toggle:hover,.kpi-toggle:focus{
  transform:translateY(-2px);box-shadow:0 10px 24px rgba(109,40,217,.15);outline:none;
}
.kpi-toggle:focus-visible{box-shadow:0 0 0 3px rgba(139,92,246,.22),0 10px 24px rgba(109,40,217,.15);}
.metric-toggle-icon{
  position:absolute;right:12px;top:12px;color:#8b5cf6;font-size:.72rem;
  transition:transform .28s ease;
}
.kpi-toggle[aria-expanded="true"] .metric-toggle-icon{transform:rotate(180deg);}
.metric-icon{
  width:54px;height:54px;border-radius:16px;display:flex;align-items:center;justify-content:center;
  color:#fff;font-size:1.42rem;box-shadow:0 8px 18px rgba(15,23,42,.16);flex-shrink:0;
}
.metric-body{min-width:0;}
.metric-label,.status-title{font-weight:600;color:#334155;font-size:.88rem;}
.metric-value{
  color:#0f172a;font-size:1.55rem;font-weight:800;line-height:1.1;white-space:nowrap;
}
.metric-trend{font-size:.78rem;color:#64748b;margin-top:7px;white-space:nowrap;}
.metric-trend i{color:#16a34a;margin-right:4px;}
.accent-green{border-color:#bae6c6}.accent-green .metric-icon{background:linear-gradient(135deg,#22c55e,#16a34a)}
.accent-orange{border-color:#fed7aa}.accent-orange .metric-icon{background:linear-gradient(135deg,#fb923c,#f97316)}
.accent-blue{border-color:#bfdbfe}.accent-blue .metric-icon{background:linear-gradient(135deg,#60a5fa,#2563eb)}
.accent-purple{border-color:#ddd6fe}.accent-purple .metric-icon{background:linear-gradient(135deg,#8b5cf6,#6d28d9)}
.accent-pink{border-color:#fbcfe8}.accent-pink .metric-icon{background:linear-gradient(135deg,#ec4899,#db2777)}
.accent-cyan{border-color:#bae6fd}.accent-cyan .metric-icon{background:linear-gradient(135deg,#06b6d4,#0284c7)}

.receivable-breakdown{
  display:grid;grid-template-rows:0fr;opacity:0;margin:0;
  transition:grid-template-rows .3s ease,opacity .22s ease,margin .3s ease;
}
.receivable-breakdown.is-open{grid-template-rows:1fr;opacity:1;margin:0 0 16px;}
.receivable-breakdown-inner{min-height:0;overflow:hidden;}
.receivable-card-grid{
  display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px;padding:2px 0 4px;
}
.receivable-branch-card{
  min-height:92px;padding:15px 18px;display:flex;align-items:center;gap:13px;
  color:#1f2937;text-decoration:none;border-color:#ddd6fe;
  background:linear-gradient(135deg,#fff 58%,#f5f3ff);
  transition:transform .18s ease,box-shadow .18s ease,border-color .18s ease;
}
.receivable-branch-card:hover{
  color:#1f2937;text-decoration:none;transform:translateY(-2px);
  border-color:#a78bfa;box-shadow:0 10px 22px rgba(109,40,217,.12);
}
.receivable-branch-icon{
  width:46px;height:46px;border-radius:13px;display:flex;align-items:center;justify-content:center;
  flex:0 0 auto;color:#fff;font-size:1.15rem;background:linear-gradient(135deg,#a78bfa,#6d28d9);
  box-shadow:0 7px 15px rgba(109,40,217,.2);
}
.receivable-branch-body{display:block;min-width:0;}
.receivable-branch-body strong{display:block;color:#475569;font-size:.88rem;white-space:nowrap;}
.receivable-branch-body b{display:inline-block;color:#0f172a;font-size:1.22rem;line-height:1.25;}
.receivable-branch-body small{color:#64748b;margin-left:3px;}
.receivable-branch-arrow{margin-left:auto;color:#8b5cf6;font-size:.8rem;}
.sales-branch-card{
  border-color:#bbf7d0;
  background:linear-gradient(135deg,#fff 58%,#f0fdf4);
}
.sales-branch-card:hover{
  border-color:#4ade80;box-shadow:0 10px 22px rgba(22,163,74,.12);
}
.sales-branch-card .receivable-branch-icon{
  background:linear-gradient(135deg,#4ade80,#16a34a);
  box-shadow:0 7px 15px rgba(22,163,74,.2);
}
.sales-branch-card .receivable-branch-arrow{color:#16a34a;}
.payable-branch-card{
  border-color:#fbcfe8;
  background:linear-gradient(135deg,#fff 58%,#fdf2f8);
}
.payable-branch-card:hover{
  border-color:#f472b6;box-shadow:0 10px 22px rgba(219,39,119,.12);
}
.payable-branch-card .receivable-branch-icon{
  background:linear-gradient(135deg,#f472b6,#db2777);
  box-shadow:0 7px 15px rgba(219,39,119,.2);
}
.payable-branch-card .receivable-branch-arrow{color:#db2777;}

.status-grid{
  display:grid;grid-template-columns:1.05fr 1.05fr 1.05fr 1fr;gap:16px;margin-bottom:16px;
}
.status-tile{
  min-height:80px;padding:16px 18px;display:flex;align-items:center;gap:14px;color:#1f2937;text-decoration:none;
}
.status-tile:hover{color:#1f2937;text-decoration:none;box-shadow:0 10px 24px rgba(30,50,100,.1);}
.status-icon{
  width:48px;height:48px;border-radius:12px;display:flex;align-items:center;justify-content:center;font-size:1.35rem;flex-shrink:0;
}
.status-number{font-size:1.18rem;font-weight:800;color:#0f172a;line-height:1.1;}
.status-unit{font-size:.78rem;color:#64748b;}
.status-arrow{margin-left:auto;color:#64748b;}
.status-danger{border-color:#fecaca}.status-danger .status-icon{background:#fff1f2;color:#ef4444}
.status-teal{border-color:#bdebe5}.status-teal .status-icon{background:#ecfeff;color:#0f9f9a}
.status-slate{border-color:#d7dee9}.status-slate .status-icon{background:#f1f5f9;color:#475569}
.status-amber{border-color:#fed7aa}.status-amber .status-icon{background:#fffbeb;color:#f59e0b}

.dashboard-layout{
  display:grid;grid-template-columns:1.55fr .49fr .49fr;gap:16px;align-items:stretch;
}
.panel{padding:16px 18px;}
.panel h6{margin:0;color:#0f172a;font-size:1rem;font-weight:800;}
.panel-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px;}
.panel-head.compact{margin-bottom:10px;}
.panel-head a{font-size:.82rem;font-weight:700;color:#2563eb;}
.chart-panel{height:270px;}
.chart-panel canvas{width:100%!important;height:210px!important;}
.main-chart{grid-column:1 / 2;grid-row:1 / 2;}
.donut-panel{grid-column:2 / 4;grid-row:1 / 2;display:flex;flex-direction:column;overflow:hidden;}
.donut-panel .panel-head{flex:0 0 auto;}
.donut-wrap{position:relative;flex:1 1 auto;min-height:0;width:100%;overflow:hidden;}
.donut-wrap canvas{position:absolute;inset:0;width:100%!important;height:100%!important;}
.shortcut-panel{grid-column:1 / 2;grid-row:2 / 3;}
.alert-panel{grid-column:2 / 3;grid-row:2 / 3;}
.activity-panel{grid-column:3 / 4;grid-row:2 / 3;}
.shortcut-grid{
  display:grid;grid-template-columns:repeat(8,minmax(80px,1fr));gap:18px;margin-top:14px;
}
.shortcut-mini{
  min-height:94px;border:1px solid #e5ecf5;border-radius:8px;display:flex;flex-direction:column;
  align-items:center;justify-content:center;gap:11px;color:#1e293b;text-decoration:none;background:#fff;
  box-shadow:0 5px 12px rgba(30,50,100,.04);transition:.14s;
}
.shortcut-mini:hover{transform:translateY(-3px);text-decoration:none;color:#0f172a;box-shadow:0 10px 20px rgba(30,50,100,.1);}
.shortcut-mini span{font-size:1.95rem;line-height:1;}
.shortcut-mini strong{font-size:.9rem;font-weight:700;text-align:center;}
.shortcut-blue span{color:#2563eb}.shortcut-green span{color:#16a34a}.shortcut-purple span{color:#a855f7}
.shortcut-red span{color:#ef4444}.shortcut-teal span{color:#0f9f9a}.shortcut-orange span{color:#f97316}

/* ===== Sales Menu Page ===== */
.sales-menu-page{min-height:calc(100vh - 76px);}
.sales-head{margin-top:2px;}
.sales-kpi-grid{grid-template-columns:repeat(4,minmax(0,1fr));}
.sales-status-grid{grid-template-columns:repeat(3,minmax(0,1fr));}
.sales-menu-page .dashboard-layout{grid-template-columns:1.45fr .48fr .48fr;}
.sales-menu-page .metric-value{font-size:1.45rem;}
.notice,.activity-row{
  display:flex;align-items:center;gap:12px;border-radius:6px;padding:11px 12px;margin-top:9px;border:1px solid #e5ecf5;
}
.notice i{font-size:1.45rem;width:24px;text-align:center;}
.notice div,.activity-row div{min-width:0;flex:1;}
.notice strong,.activity-row strong{display:block;font-size:.86rem;color:#1e293b;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.notice span,.activity-row small{display:block;font-size:.77rem;color:#64748b;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.notice time,.activity-row time{font-size:.74rem;color:#64748b;white-space:nowrap;}
.notice-danger{background:#fff7f7;border-color:#fecaca}.notice-danger i{color:#ef4444}
.notice-warning{background:#fffbeb;border-color:#fed7aa}.notice-warning i{color:#f59e0b}
.notice-info{background:#eff6ff;border-color:#bfdbfe}.notice-info i{color:#2563eb}
.activity-row{padding:10px 0;border:none;border-bottom:1px solid #eef2f7;border-radius:0;margin-top:0;}
.activity-row:last-child{border-bottom:none;}
.activity-row > span{
  width:30px;height:30px;border-radius:6px;background:#eff6ff;color:#2563eb;display:flex;align-items:center;justify-content:center;flex-shrink:0;
}
.activity-row:nth-of-type(3) > span{background:#ecfdf5;color:#16a34a}
.activity-row:nth-of-type(4) > span{background:#fff7ed;color:#f97316}
.activity-row:nth-of-type(5) > span{background:#faf5ff;color:#a855f7}

@media (max-width:1500px){
  .kpi-grid{grid-template-columns:repeat(3,minmax(0,1fr));}
  .sales-kpi-grid{grid-template-columns:repeat(2,minmax(0,1fr));}
  .shortcut-grid{grid-template-columns:repeat(4,minmax(90px,1fr));}
}
@media (max-width:1199px){
  .dashboard-page{padding:18px 20px 24px;}
  .receivable-card-grid{grid-template-columns:repeat(2,minmax(0,1fr));}
  .status-grid{grid-template-columns:repeat(2,minmax(0,1fr));}
  .dashboard-layout{grid-template-columns:1fr 1fr;}
  .main-chart,.donut-panel,.shortcut-panel{grid-column:1 / 3;grid-row:auto;}
  .alert-panel,.activity-panel{grid-column:auto;grid-row:auto;}
}
@media (max-width:767px){
  .dashboard-head{align-items:flex-start;flex-direction:column;}
  .date-chip{width:100%;justify-content:space-between;}
  .kpi-grid,.status-grid,.dashboard-layout{grid-template-columns:1fr;}
  .receivable-card-grid{grid-template-columns:1fr;}
  .main-chart,.donut-panel,.shortcut-panel,.alert-panel,.activity-panel{grid-column:1;grid-row:auto;}
  .shortcut-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;}
  .metric-value{font-size:1.35rem;}
  .chart-panel{height:300px;}
  .chart-panel canvas{height:230px!important;}
  .donut-wrap{height:auto!important;}
  .donut-wrap canvas{height:100%!important;}
}

/* ===== Purchase Overview ===== */
.purchase-overview{min-height:calc(100vh - 76px);color:#172033;}
.purchase-overview-head{margin-top:2px;}
.purchase-overview-head .page-title i{font-size:1.35rem;margin-right:7px;}
.purchase-overview-actions{display:flex;align-items:center;gap:9px;}
.purchase-overview-filter{
  padding:13px 16px;margin-bottom:16px;display:flex;align-items:center;justify-content:space-between;gap:20px;
}
.purchase-overview-filter > div:first-child{display:flex;flex-direction:column;}
.purchase-overview-filter .filter-caption{font-size:.78rem;color:#64748b;font-weight:600;}
.purchase-overview-filter .filter-caption i{color:#2563eb;margin-right:5px;}
.purchase-overview-filter strong{font-size:.9rem;color:#1e293b;margin-top:2px;}
.purchase-overview-filter .filter-fields{display:flex;align-items:center;gap:8px;}
.purchase-overview-filter .form-control{width:158px;height:38px;font-size:.86rem;border-color:#d9e2ef;}
.purchase-overview-filter .filter-fields > span{color:#64748b;font-size:.82rem;}
.purchase-overview-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px;margin-bottom:16px;}
.purchase-kpi{
  min-height:116px;padding:18px;display:flex;align-items:center;gap:15px;color:#172033;text-decoration:none;
  transition:transform .15s ease,box-shadow .15s ease;border-top-width:3px;
}
.purchase-kpi:hover{color:#172033;text-decoration:none;transform:translateY(-2px);box-shadow:0 12px 26px rgba(30,50,100,.11);}
.purchase-kpi-icon{
  width:52px;height:52px;border-radius:15px;display:flex;align-items:center;justify-content:center;
  font-size:1.35rem;flex:0 0 auto;
}
.purchase-kpi > span:last-child{display:flex;flex-direction:column;min-width:0;}
.purchase-kpi small{font-weight:700;color:#526176;font-size:.82rem;}
.purchase-kpi strong{font-size:1.65rem;line-height:1.14;color:#101827;white-space:nowrap;}
.purchase-kpi em{font-size:.74rem;color:#7b8798;font-style:normal;margin-top:4px;}
.kpi-blue{border-top-color:#2563eb}.kpi-blue .purchase-kpi-icon{background:#eaf2ff;color:#2563eb}
.kpi-amber{border-top-color:#f59e0b}.kpi-amber .purchase-kpi-icon{background:#fff7df;color:#d88700}
.kpi-green{border-top-color:#16a34a}.kpi-green .purchase-kpi-icon{background:#eafaf0;color:#16a34a}
.kpi-purple{border-top-color:#7c3aed}.kpi-purple .purchase-kpi-icon{background:#f2ebff;color:#7c3aed}
.purchase-workflow{padding:17px 20px;margin-bottom:16px;}
.purchase-section-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;}
.purchase-section-head.compact{align-items:center;margin-bottom:12px;}
.purchase-section-head h5{font-size:1rem;font-weight:800;color:#14213d;margin:0;}
.purchase-section-head p{font-size:.77rem;color:#7a8798;margin:3px 0 0;}
.purchase-section-head > a{font-size:.78rem;font-weight:700;color:#2563eb;white-space:nowrap;}
.workflow-rate{
  padding:7px 11px;border-radius:20px;background:#eff6ff;color:#55708f;font-size:.75rem;white-space:nowrap;
}
.workflow-rate b{color:#2563eb;font-size:.92rem;margin-right:3px;}
.workflow-track{display:flex;align-items:center;gap:9px;margin-top:16px;}
.workflow-step{
  flex:1;min-width:0;padding:12px 13px;border-radius:8px;display:flex;align-items:center;gap:10px;
  border:1px solid #e3eaf3;color:#27364b;text-decoration:none;background:#fbfdff;
}
.workflow-step:hover{text-decoration:none;color:#172033;box-shadow:0 6px 14px rgba(30,50,100,.08);}
.workflow-step > i{width:34px;height:34px;border-radius:9px;display:flex;align-items:center;justify-content:center;flex:0 0 auto;}
.workflow-step span{display:flex;flex-direction:column;}
.workflow-step small{font-size:.72rem;color:#718096;font-weight:600;white-space:nowrap;}
.workflow-step strong{font-size:1.15rem;line-height:1.1;}
.step-slate > i{background:#eef2f7;color:#64748b}.step-amber > i{background:#fff6dd;color:#d88900}
.step-green > i{background:#e9f9ef;color:#16a34a}.step-blue > i{background:#eaf2ff;color:#2563eb}
.step-purple > i{background:#f3ecff;color:#7c3aed}
.workflow-arrow{color:#c1cad7;font-size:.72rem;}
.purchase-overview-grid{display:grid;grid-template-columns:minmax(0,1.65fr) minmax(310px,.75fr);gap:16px;}
.purchase-panel{padding:17px 18px;min-width:0;}
.purchase-chart-panel{min-height:310px;}
.purchase-chart-wrap{height:238px;}
.purchase-chart-wrap canvas{width:100%!important;height:100%!important;}
.purchase-attention{min-height:310px;}
.attention-row,.order-row{
  display:flex;align-items:center;gap:11px;padding:11px 3px;border-top:1px solid #edf1f6;color:#233047;text-decoration:none;
}
.attention-row:hover,.order-row:hover{text-decoration:none;color:#2563eb;background:#fbfdff;}
.attention-row > .fa-chevron-right{font-size:.68rem;color:#a0aec0;margin-left:auto;}
.attention-icon{
  width:34px;height:34px;border-radius:9px;background:#fff6dd;color:#d88900;
  display:flex;align-items:center;justify-content:center;flex:0 0 auto;
}
.attention-copy{display:flex;flex-direction:column;min-width:0;}
.attention-copy strong,.order-row strong{font-size:.83rem;}
.attention-copy small,.order-row small{font-size:.72rem;color:#7b8798;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.overview-empty{height:205px;display:flex;flex-direction:column;align-items:center;justify-content:center;color:#8b98aa;text-align:center;}
.overview-empty i{font-size:2.3rem;color:#22b15f;margin-bottom:8px;}
.overview-empty strong{font-size:.9rem;color:#526176;}
.overview-empty span{font-size:.75rem;margin-top:3px;}
.overview-empty.small{height:155px;}
.purchase-request-list{padding:0;overflow:hidden;}
.purchase-request-list .purchase-section-head{padding:17px 18px 3px;}
.overview-table thead th{font-size:.75rem;color:#607086;background:#f8fafc;border-top:0;border-bottom:1px solid #e5ebf2;padding:.72rem;}
.overview-table tbody td{font-size:.8rem;vertical-align:middle;border-color:#edf1f6;padding:.72rem;}
.overview-table tbody td:first-child a{font-weight:700;color:#1478bd;}
.overview-po-count{
  display:inline-flex;align-items:center;justify-content:center;min-width:24px;height:24px;border-radius:12px;
  background:#eaf2ff;color:#2563eb;font-size:.72rem;font-weight:800;
}
.purchase-order-list{padding-bottom:8px;}
.order-row{justify-content:space-between;}
.order-row > span{display:flex;flex-direction:column;min-width:0;}
.order-row > span:first-child{max-width:58%;}
.order-row .order-total{text-align:right;align-items:flex-end;}
.order-row .order-total strong{color:#172033;}

@media (max-width:1199px){
  .purchase-overview-kpis{grid-template-columns:repeat(2,minmax(0,1fr));}
  .purchase-overview-grid{grid-template-columns:1fr;}
}
@media (max-width:767px){
  .purchase-overview-actions{width:100%;display:grid;grid-template-columns:1fr 1fr;}
  .purchase-overview-actions .btn{font-size:.78rem;}
  .purchase-overview-filter{align-items:stretch;flex-direction:column;}
  .purchase-overview-filter .filter-fields{display:grid;grid-template-columns:1fr 1fr;}
  .purchase-overview-filter .filter-fields > span{display:none;}
  .purchase-overview-filter .form-control{width:100%;}
  .purchase-overview-kpis{grid-template-columns:1fr;}
  .workflow-track{align-items:stretch;flex-direction:column;}
  .workflow-step{width:100%;}
  .workflow-arrow{transform:rotate(90deg);align-self:center;}
  .purchase-request-list .table{min-width:760px;}
}

/* Login */
.login-shell{
  min-height:100vh;
  display:grid;
  grid-template-columns:minmax(520px, .84fr) minmax(520px, 1fr);
  background:#f7f9fd;
  color:#14213d;
}
.login-hero{
  position:relative;
  overflow:hidden;
  background:
    linear-gradient(90deg, rgba(7,24,70,.22), rgba(7,24,70,.08)),
    url('../images/login-bg.png') left center / cover no-repeat;
}
.login-hero:before{
  content:"";
  position:absolute;
  inset:0;
  background:linear-gradient(180deg, rgba(6,23,67,.12), rgba(6,23,67,.26));
}
.login-hero-content{
  position:relative;
  z-index:1;
  min-height:100vh;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  padding:86px 74px 66px;
  color:#fff;
}
.login-brand-row{display:flex;align-items:center;gap:18px;}
.login-brand-mark{
  width:70px;
  height:70px;
  border-radius:16px;
  object-fit:contain;
  background:#fff;
  box-shadow:0 14px 34px rgba(0,0,0,.16);
}
.login-brand-name{
  font-size:2.15rem;
  line-height:1;
  font-weight:800;
  letter-spacing:0;
}
.login-brand-name span{color:#35dcff;}
.login-brand-subtitle{margin-top:8px;font-size:1.05rem;color:rgba(255,255,255,.86);}
.login-hero-copy{margin-top:70px;}
.login-hero-copy h1{
  margin:0 0 24px;
  font-size:3rem;
  line-height:1.26;
  font-weight:800;
  letter-spacing:0;
  text-shadow:0 10px 28px rgba(0,0,0,.18);
}
.login-hero-copy h1 span{color:#3fe7ff;}
.login-hero-copy p{
  margin:0;
  color:rgba(255,255,255,.9);
  font-size:1.12rem;
  line-height:1.8;
}
.login-feature-grid{
  display:grid;
  grid-template-columns:repeat(4, minmax(0, 1fr));
  gap:14px;
  margin-top:auto;
  max-width:800px;
}
.login-feature-item{
  min-width:0;
  padding:18px 12px 16px;
  text-align:center;
  color:rgba(255,255,255,.88);
  background:rgba(255,255,255,.10);
  border:1px solid rgba(255,255,255,.16);
  border-radius:16px;
  box-shadow:0 10px 28px rgba(0,18,65,.14);
  backdrop-filter:blur(5px);
  -webkit-backdrop-filter:blur(5px);
}
.login-feature-item i{
  display:flex;
  align-items:center;
  justify-content:center;
  width:48px;
  height:48px;
  margin:0 auto 12px;
  color:#5d87ff;
  font-size:1.75rem;
  text-shadow:0 0 18px rgba(74,210,255,.45);
}
.login-feature-item strong{
  display:block;
  margin-bottom:5px;
  font-size:1rem;
  color:#fff;
}
.login-feature-item span{
  display:block;
  font-size:.88rem;
  line-height:1.55;
}
.login-panel{
  min-height:100vh;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  padding:42px 40px;
  background:
    radial-gradient(circle at 20% 18%, rgba(17,127,255,.08), transparent 30%),
    linear-gradient(180deg, #ffffff 0%, #f7f9fd 100%);
}
.login-card{
  width:100%;
  max-width:540px;
  padding:42px 40px 36px;
  background:rgba(255,255,255,.96);
  border:1px solid rgba(215,224,240,.82);
  border-radius:18px;
  box-shadow:0 28px 70px rgba(23,43,77,.16);
}
.login-card-logo{
  display:block;
  width:86px;
  height:86px;
  margin:0 auto 18px;
  border-radius:20px;
  object-fit:contain;
  box-shadow:0 14px 34px rgba(25,110,255,.22);
}
.login-card-title{
  margin:0;
  text-align:center;
  font-size:2rem;
  line-height:1.1;
  font-weight:800;
  letter-spacing:0;
  color:#17213d;
}
.login-card-title span{
  color:#1476ff;
}
.login-card-subtitle{
  margin:8px 0 30px;
  text-align:center;
  color:#7c879b;
  font-size:1rem;
}
.login-card label{
  margin-bottom:8px;
  font-weight:600;
  color:#28364f;
}
.login-input .input-group-text{
  width:54px;
  justify-content:center;
  border-color:#d8e1f0;
  border-right:0;
  background:#e9eef6;
  color:#6a7487;
  font-size:1.05rem;
}
.login-input .form-control{
  height:50px;
  border-color:#d8e1f0;
  background:#eaf2ff;
  color:#111827;
  font-size:1.04rem;
  font-weight:500;
}
.login-input .form-control:focus{
  border-color:#4f95ff;
  background:#eef6ff;
  box-shadow:0 0 0 .16rem rgba(18,116,255,.18);
}
.login-eye{
  height:50px;
  min-width:52px;
  border:1px solid #d8e1f0;
  border-left:0;
  background:#eaf2ff;
  color:#657184;
}
.login-options{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  margin:8px 0 22px;
}
.login-check{
  display:flex;
  align-items:center;
  gap:8px;
  margin:0!important;
  color:#28364f;
  font-weight:500!important;
}
.login-check input{
  width:21px;
  height:21px;
  accent-color:#2e73ff;
}
.login-options a{
  color:#1476ff;
  font-weight:700;
  text-decoration:none;
  white-space:nowrap;
}
.login-primary{
  height:54px;
  border:0;
  border-radius:9px;
  background:linear-gradient(90deg, #2e57ff 0%, #08bde1 100%);
  color:#fff;
  font-size:1.1rem;
  font-weight:700;
  box-shadow:0 12px 26px rgba(21,113,255,.24);
}
.login-primary:hover{color:#fff;filter:brightness(.98);}
.login-divider{
  position:relative;
  margin:24px 46px 20px;
  text-align:center;
  color:#8d97a9;
}
.login-divider:before{
  content:"";
  position:absolute;
  top:50%;
  left:0;
  right:0;
  height:1px;
  background:#dce3ef;
}
.login-divider span{
  position:relative;
  z-index:1;
  padding:0 18px;
  background:#fff;
}
.login-secondary{
  height:52px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  border:1px solid #2f76ff;
  border-radius:9px;
  color:#1f4eaa;
  font-weight:700;
  background:#fff;
}
.login-secondary:hover{
  color:#163b8a;
  background:#f3f8ff;
}
.login-default-user{
  margin-top:18px;
  text-align:center;
  color:#8b95a8;
  font-size:.95rem;
}
.login-footer{
  margin-top:28px;
  color:#7f8799;
  font-size:.95rem;
  text-align:center;
}

@media (max-width:1199px){
  .login-shell{grid-template-columns:1fr;}
  .login-hero-content{min-height:520px;padding:46px 34px 34px;}
  .login-panel{min-height:auto;padding:36px 22px 30px;}
  .login-feature-grid{gap:14px;}
}

@media (max-width:767px){
  .login-hero-content{min-height:430px;padding:30px 22px;}
  .login-brand-mark{width:56px;height:56px;border-radius:13px;}
  .login-brand-name{font-size:1.55rem;}
  .login-hero-copy{margin-top:44px;}
  .login-hero-copy h1{font-size:2.15rem;}
  .login-hero-copy p{font-size:1rem;}
  .login-feature-grid{grid-template-columns:repeat(2, minmax(0, 1fr));}
  .login-card{padding:32px 24px 28px;}
}

@media (max-width:480px){
  .login-panel{padding:24px 14px;}
  .login-card{padding:28px 18px 24px;}
  .login-options{align-items:flex-start;flex-direction:column;gap:10px;}
  .login-divider{margin-left:16px;margin-right:16px;}
}

@media (max-width:1199px){
  .flexo-mega{position:static;min-width:100%;box-shadow:none;margin-top:0;}
  .flexo-mega-row{flex-direction:column;}
  .flexo-mega-row.three-col{gap:8px;}
  .flexo-mega-col.right{border-left:none;border-top:1px solid #eef0f5;padding-left:0;padding-top:10px;margin-top:6px;}
  .flexo-mega-wide{border-bottom:none;padding:8px 10px;}
  .flexo-mega-wide .flexo-mega-col{padding:0;}
  .flexo-mega-wide .flexo-mega-col + .flexo-mega-col{border-left:none;border-top:1px solid #eef0f5;padding-top:8px;}
  .flexo-main-nav > .nav-item > .nav-link{
    min-height:auto;flex-direction:row;justify-content:flex-start;text-align:left;font-size:.95rem;
  }
  .flexo-main-nav > .nav-item > .nav-link i{width:22px;text-align:center;margin-right:.35rem;}
  .flexo-main-nav > .nav-item > .nav-link .caret{margin-left:.25rem;margin-top:0;}
  .flexo-navbar .dropdown-menu{box-shadow:none;border-radius:8px;margin-left:1.5rem;background:rgba(255,255,255,.96);}
}

/* ===== Document form (quotation/invoice) ===== */
.sales-record-filter-grid{display:grid;grid-template-columns:minmax(200px,1.55fr) minmax(110px,.65fr) minmax(95px,.55fr) 175px 175px 150px;gap:10px;align-items:end;}
.sales-record-filter-grid.has-branch{grid-template-columns:minmax(180px,1.3fr) minmax(105px,.72fr) minmax(100px,.6fr) minmax(90px,.5fr) 175px 175px 150px;}
.sales-record-filter-grid label{font-size:.82rem;font-weight:600;margin-bottom:.35rem;white-space:nowrap;}
.sales-record-filter-grid .form-control{min-width:0;}
.sales-record-filter-actions{display:flex;gap:6px;white-space:nowrap;}
.sales-record-filter-actions .btn{flex:1;padding-left:.65rem;padding-right:.65rem;}
@media (max-width:1199px){
  .sales-record-filter-grid,.sales-record-filter-grid.has-branch{grid-template-columns:repeat(2,minmax(0,1fr));}
  .sales-record-filter-search{grid-column:span 2;}
  .sales-record-filter-actions{justify-content:flex-end;}
}
@media (max-width:575px){
  .sales-record-filter-grid,.sales-record-filter-grid.has-branch{grid-template-columns:minmax(0,1fr);}
  .sales-record-filter-search{grid-column:auto;}
  .sales-record-filter-actions .btn{flex:1;}
}
.invoice-filter-grid{display:grid;grid-template-columns:minmax(200px,1.55fr) minmax(110px,.65fr) minmax(95px,.55fr) 175px 175px 150px;gap:10px;align-items:end;}
.invoice-filter-grid label{font-size:.82rem;font-weight:600;margin-bottom:.35rem;white-space:nowrap;}
.invoice-filter-grid .form-control{min-width:0;}
.invoice-filter-actions{display:flex;gap:6px;white-space:nowrap;}
.invoice-filter-actions .btn{flex:1;padding-left:.65rem;padding-right:.65rem;}
@media (max-width:1199px){
  .invoice-filter-grid{grid-template-columns:repeat(2,minmax(0,1fr));}
  .invoice-filter-search{grid-column:span 2;}
  .invoice-filter-actions{justify-content:flex-end;}
}
@media (max-width:575px){
  .invoice-filter-grid{grid-template-columns:minmax(0,1fr);}
  .invoice-filter-search{grid-column:auto;}
  .invoice-filter-actions .btn{flex:1;}
}
.inv-row-hidden{display:none !important;}
.doc-lookup{position:relative;}
.doc-suggest{
  position:absolute;top:100%;left:0;right:0;z-index:1040;background:#fff;border-radius:10px;
  box-shadow:0 10px 30px rgba(20,40,90,.18);max-height:280px;overflow-y:auto;display:none;margin-top:4px;
}
.doc-suggest.show{display:block;}
.doc-suggest .ds-item{padding:9px 14px;cursor:pointer;border-bottom:1px solid #f1f3f8;}
.doc-suggest .ds-item:last-child{border-bottom:none;}
.doc-suggest .ds-item:hover,.doc-suggest .ds-item.active{background:var(--flexo-blue-light);}
.doc-suggest .ds-item small{display:block;color:#8a92a6;}
.doc-suggest .ds-empty{padding:12px 14px;color:#8a92a6;font-size:.875rem;}
.doc-suggest .ds-group-label{padding:7px 14px 4px;font-size:.72rem;font-weight:700;color:#a3abbd;text-transform:uppercase;letter-spacing:.03em;}
.item-table .desc-col{position:relative;overflow:visible;}
.item-table .product-suggest{
  top:38px;
  min-width:360px;
  z-index:1060;
}
.gr-import-table .desc-col{position:relative;overflow:visible;}
.gr-import-table .product-suggest{
  top:38px;
  min-width:360px;
  z-index:1060;
}
.item-table th{font-size:.82rem;white-space:nowrap;}
.item-table td{vertical-align:top;}
.item-table td.text-center,
.item-table td.f-amount{padding-top:.55rem;}
.item-table input{min-width:80px;}
.item-table .desc-col{min-width:220px;}
/* ป้องกัน dropdown สินค้าถูกตัดโดย overflow ของ Bootstrap table-responsive */
@media (min-width:768px){
  .doc-item-table-wrap{overflow:visible;}
}
@media (max-width:767px){
  .item-table .product-suggest{min-width:280px;}
}
.doc-summary{background:#f7f9fd;border-radius:12px;padding:16px 20px;}
.doc-summary .row-line{display:flex;justify-content:space-between;padding:5px 0;}
.doc-summary .row-line.grand{border-top:2px solid #dde3ee;margin-top:6px;padding-top:10px;font-weight:700;font-size:1.15rem;color:var(--flexo-blue-dark);}
.gr-mode-toggle{display:flex;gap:10px;flex-wrap:wrap;margin-bottom:4px;}
.gr-mode-option{display:flex;align-items:center;gap:8px;border:1px solid #ced4da;border-radius:8px;padding:8px 14px;cursor:pointer;font-size:.88rem;font-weight:500;color:#26314d;transition:border-color .15s,background .15s;}
.gr-mode-option input{margin:0;}
.gr-mode-option:has(input:checked),.gr-mode-option.is-active{border-color:var(--flexo-blue,#3b6fe0);background:var(--flexo-blue-light,#eaf2ff);color:#173b78;}
.po-picker-trigger{display:flex;align-items:center;gap:12px;width:100%;border:1px solid #ced4da;border-radius:8px;background:#fff;padding:9px 14px;text-align:left;cursor:pointer;transition:border-color .15s,box-shadow .15s;}
.po-picker-trigger:hover{border-color:var(--flexo-blue,#3b6fe0);}
.po-picker-trigger:focus{outline:none;border-color:var(--flexo-blue,#3b6fe0);box-shadow:0 0 0 3px rgba(59,111,224,.12);}
.po-picker-trigger .ppt-icon{color:#a3abbd;font-size:.85rem;flex:0 0 auto;}
.po-picker-trigger .ppt-body{flex:1;min-width:0;}
.po-picker-trigger .ppt-placeholder{color:#8a92a6;font-size:.88rem;}
.po-picker-trigger .ppt-selected{display:flex;flex-direction:column;line-height:1.35;}
.po-picker-trigger .ppt-vendor{color:#26314d;font-size:.9rem;}
.po-picker-trigger .ppt-selected small{color:#5a7bd6;font-weight:600;}
.po-picker-trigger .ppt-arrow{color:#c7cede;font-size:.75rem;flex:0 0 auto;}
.po-vendor-chip{display:flex;align-items:center;justify-content:space-between;background:var(--flexo-blue-light,#eaf2ff);color:#173b78;border-radius:8px;padding:7px 12px;margin:10px 0;font-size:.85rem;}
.po-vendor-chip b{font-weight:700;}
.po-vendor-chip-clear{background:none;border:0;color:#5a7bd6;font-weight:600;cursor:pointer;font-size:.78rem;}
.po-vendor-chip-clear:hover{color:#2f52b0;text-decoration:underline;}
.po-picker-search{position:relative;}
.po-picker-search i{position:absolute;left:12px;top:50%;transform:translateY(-1px);color:#a3abbd;font-size:.8rem;pointer-events:none;}
.po-picker-search input{width:100%;border:1px solid #e3e7f0;border-radius:8px;padding:8px 12px 8px 34px;font-size:.9rem;background:#f8f9fc;transition:border-color .15s,background .15s;}
.po-picker-search input:focus{outline:none;border-color:var(--flexo-blue,#3b6fe0);background:#fff;}
.po-picker-search .doc-suggest{margin-top:2px;}
.po-picker-toolbar,.dn-toolbar{display:flex;align-items:center;gap:14px;padding:10px 2px 8px;font-size:.78rem;}
.po-toolbar-link{background:none;border:0;padding:0;color:#5a7bd6;font-weight:600;cursor:pointer;display:inline-flex;align-items:center;gap:4px;}
.po-toolbar-link:hover{color:#2f52b0;text-decoration:underline;}
.po-toolbar-link.po-clear-all{color:#8a92a6;}
.po-toolbar-link.po-clear-all:hover{color:#c0392b;}
.po-selected-badge{margin-left:auto;background:var(--flexo-blue-light,#eaf2ff);color:#2f52b0;font-weight:700;border-radius:20px;padding:3px 10px;display:inline-flex;align-items:center;gap:5px;font-size:.76rem;}
.po-check-list,.dn-check-list{max-height:320px;overflow-y:auto;border:1px solid #dde3ee;border-radius:10px;}
.po-check-list::-webkit-scrollbar,.dn-check-list::-webkit-scrollbar{width:7px;}
.po-check-list::-webkit-scrollbar-thumb,.dn-check-list::-webkit-scrollbar-thumb{background:#d7dce6;border-radius:10px;}
.po-check-item{position:relative;display:flex;align-items:flex-start;gap:9px;padding:9px 12px 9px 38px;margin:0;border-bottom:1px solid #f1f3f8;cursor:pointer;font-size:.85rem;transition:background .12s;}
.po-check-item:last-child{border-bottom:0;}
.po-check-item:hover{background:#f5f8ff;}
.po-check-item input{position:absolute;opacity:0;pointer-events:none;}
.po-check-item .po-check-mark{position:absolute;left:12px;top:11px;width:17px;height:17px;border:2px solid #c7cede;border-radius:5px;background:#fff;transition:all .15s;}
.po-check-item .po-check-mark:after{content:'';position:absolute;left:4px;top:0px;width:4px;height:8px;border:solid #fff;border-width:0 2px 2px 0;transform:rotate(45deg);opacity:0;}
.po-check-item.is-selected .po-check-mark{background:var(--flexo-blue,#3b6fe0);border-color:var(--flexo-blue,#3b6fe0);}
.po-check-item.is-selected .po-check-mark:after{opacity:1;}
.po-check-item.is-selected{background:#eaf2ff;}
.po-check-item .po-item-body{flex:1;min-width:0;}
.po-check-item .po-doc-no{font-weight:700;color:#26314d;}
.po-check-item.is-selected .po-doc-no{color:#173b78;}
.po-check-item .po-meta{display:flex;justify-content:space-between;align-items:center;margin-top:2px;color:#8a92a6;font-size:.78rem;}
.po-check-item .po-amount{font-weight:600;color:#3b6fe0;}
.po-check-item.po-row-hidden{display:none;}
.po-browse-item{position:relative;display:flex;align-items:center;gap:10px;padding:10px 14px;margin:0;border-bottom:1px solid #f1f3f8;cursor:pointer;font-size:.85rem;transition:background .12s;}
.po-browse-item:last-child{border-bottom:0;}
.po-browse-item:hover{background:#f5f8ff;}
.po-browse-item .po-browse-body{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px;}
.po-browse-item .po-doc-no{font-weight:700;color:#26314d;}
.po-browse-item .po-browse-vendor{color:#5a7bd6;font-weight:600;font-size:.8rem;}
.po-browse-item .po-browse-vendor i{font-size:.7rem;margin-right:2px;}
.po-browse-item .po-meta{display:flex;justify-content:space-between;align-items:center;color:#8a92a6;font-size:.78rem;}
.po-browse-item .po-amount{font-weight:600;color:#3b6fe0;}
.po-browse-item .po-browse-arrow{color:#c7cede;font-size:.72rem;flex:0 0 auto;}
.po-empty-state{display:flex;flex-direction:column;align-items:center;gap:6px;padding:26px 10px;color:#a3abbd;font-size:.83rem;}
.po-empty-state i{font-size:1.4rem;opacity:.7;}
.po-picker-summary{display:flex;align-items:baseline;gap:6px;margin-right:auto;font-size:.83rem;color:#6b7488;}
.po-picker-summary b{font-size:1.05rem;color:var(--flexo-blue-dark,#173b78);}
.po-picker-summary small{color:#a3abbd;}
.po-picker-modal .modal-body{padding:20px 24px;}
.po-picker-modal .modal-footer{align-items:center;}

/* Journal entry account lookup (สมุดรายวัน/รายการปรับปรุงบัญชี) */
.acc-results{display:none;position:fixed;z-index:2000;max-height:320px;overflow-y:auto;background:#fff;border:1px solid #cbd5e1;border-radius:.4rem;box-shadow:0 6px 18px rgba(0,0,0,.12);}
.acc-results.show{display:block;}
.acc-option{display:block;width:100%;padding:.5rem .75rem;border:0;border-bottom:1px solid #edf0f4;background:#fff;text-align:left;color:#1f2937;font-size:.85rem;}
.acc-option:last-child{border-bottom:0;}
.acc-option:hover,.acc-option.active{background:#eef5ff;}
.acc-code{font-weight:700;color:#17366d;margin-right:.4rem;}
.acc-empty{padding:.85rem;text-align:center;color:#6c757d;font-size:.85rem;}

/* Print */
@media print{
  .flexo-navbar,.no-print,.btn,.footer{display:none!important;}
  body{background:#fff;}
}

/* การ์ดแจ้งเตือนลูกค้ารายตัว (invoice_reminder_note) — เป็น toast แยกจาก SweetAlert2
   เพราะ SweetAlert2 แสดงได้ทีละใบ ถ้าใช้ Swal.fire ซ้อนกัน ใบหลังจะทับใบแรกจนมองไม่เห็น */
.flexo-reminder-toast{
  position:fixed;top:16px;right:16px;z-index:2200;width:320px;max-width:90vw;
  background:#fff;border-left:4px solid #f0ad4e;border-radius:5px;
  box-shadow:0 0 1px rgba(0,0,0,.075),0 1px 2px rgba(0,0,0,.075),1px 2px 4px rgba(0,0,0,.075),1px 3px 8px rgba(0,0,0,.075),2px 4px 16px rgba(0,0,0,.075);
  padding:16px 40px 16px 16px;
  font-size:1rem;color:#545454;overflow:hidden;
  animation:flexo-reminder-in .25s ease-out;
}
.flexo-reminder-toast .flexo-reminder-title{font-weight:700;color:#b8860b;margin-bottom:4px;display:flex;align-items:center;gap:6px;font-size:1rem;}
.flexo-reminder-toast .flexo-reminder-text{font-size:1rem;white-space:pre-line;word-break:break-word;}
.flexo-reminder-toast .flexo-reminder-close{
  position:absolute;top:10px;right:12px;border:0;background:none;color:#94a3b8;font-size:1.25rem;line-height:1;cursor:pointer;
}
.flexo-reminder-toast .flexo-reminder-close:hover{color:#475569;}
.flexo-reminder-toast .flexo-reminder-progress{position:absolute;left:0;bottom:0;height:3px;background:#f0ad4e;width:100%;animation:flexo-reminder-shrink 15s linear forwards;}
@keyframes flexo-reminder-in{from{transform:translateY(-10px);opacity:0;}to{transform:translateY(0);opacity:1;}}
@keyframes flexo-reminder-shrink{from{width:100%;}to{width:0;}}
