@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800;900&display=swap');
:root{--blue:#0b63ce;--blue2:#155eef;--bg:#f3f7ff;--card:#fff;--text:#10213f;--muted:#6b7a90;--border:#dbe7f7;--danger:#dc2626;--green:#16a34a;--dark:#0f172a;--shadow:0 18px 46px rgba(15,23,42,.08)}
*{box-sizing:border-box}
body{margin:0;background:linear-gradient(180deg,#f6faff,#eef5ff);font-family:Cairo,Tahoma,Arial;color:var(--text);overflow-x:hidden}
button,input,select,textarea{font-family:inherit}
button{cursor:pointer}
.login{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:20px}
.login-card{background:white;border:1px solid var(--border);border-radius:28px;box-shadow:var(--shadow);width:100%;max-width:430px;padding:28px}
.logo-row{display:flex;align-items:center;justify-content:center;gap:14px;margin-bottom:22px}.logo{width:62px;height:62px;border-radius:22px;background:linear-gradient(135deg,#0b63ce,#22c55e);display:grid;place-items:center;color:white;font-weight:900;font-size:28px}.brand{display:flex;align-items:center;gap:12px;margin-bottom:26px}.brand h2{color:#155eef;margin:0}
h1,h2,h3{margin:0}.sub{color:var(--muted);font-weight:600}
.app{display:grid;grid-template-columns:280px 1fr;min-height:100vh;direction:rtl}.sidebar{background:#fff;border-left:1px solid var(--border);padding:22px;position:sticky;top:0;height:100vh;box-shadow:-10px 0 40px rgba(15,23,42,.03);z-index:20}.main{padding:26px;min-width:0}
.nav{display:flex;flex-direction:column;gap:8px}.nav button{background:transparent;color:#334155;border:0;border-radius:16px;padding:13px 16px;font-size:16px;font-weight:900;text-align:right}.nav button.active,.nav button:hover{background:#eaf2ff;color:#155eef}.logout{position:absolute;bottom:22px;left:22px;right:22px}
.topbar{display:flex;justify-content:space-between;align-items:center;margin-bottom:22px}.menu-btn{display:none}
.card{background:white;border:1px solid var(--border);border-radius:24px;box-shadow:var(--shadow);padding:18px;margin-bottom:18px}.cards{display:grid;grid-template-columns:repeat(5,1fr);gap:14px;margin-bottom:18px}
.stat{background:white;border:1px solid var(--border);border-radius:22px;padding:18px;box-shadow:var(--shadow);min-height:110px;position:relative;overflow:hidden}.stat:after{content:'';position:absolute;left:-25px;bottom:-25px;width:95px;height:95px;border-radius:32px;background:#eaf2ff}.stat .t{font-weight:900;color:#334155}.stat .v{font-size:28px;font-weight:900;color:#155eef;margin-top:6px;position:relative;z-index:1}.stat .m{color:var(--muted);font-size:13px;position:relative;z-index:1}
.form-grid{display:grid;grid-template-columns:repeat(12,1fr);gap:12px}.col-12{grid-column:span 12}.col-6{grid-column:span 6}.col-4{grid-column:span 4}.col-3{grid-column:span 3}.col-2{grid-column:span 2}
label{font-weight:800;font-size:14px;margin-bottom:6px;display:block}input,select,textarea{width:100%;border:1px solid #cfe0f5;border-radius:14px;background:white;padding:12px 14px;font-size:15px;outline:none}textarea{min-height:78px;resize:vertical}input:focus,select:focus,textarea:focus{border-color:#79aef8;box-shadow:0 0 0 4px rgba(21,94,239,.08)}
.btn{border:0;border-radius:14px;padding:11px 16px;background:var(--blue);color:white;font-weight:900;display:inline-flex;align-items:center;justify-content:center;gap:7px}.btn.secondary{background:#64748b}.btn.danger{background:var(--danger)}.btn.green{background:var(--green)}.btn.dark{background:var(--dark)}.btn.light{background:#eaf2ff;color:#155eef}.btn.small{padding:8px 11px;font-size:13px;border-radius:12px}.btn:disabled{opacity:.45;cursor:not-allowed}
.table-tools{display:flex;justify-content:space-between;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:12px}.search-row{display:flex;gap:8px;align-items:center}.search-row input{min-width:270px;height:44px}.table-wrap{overflow:auto;border-radius:18px;border:1px solid var(--border);background:white}table{width:100%;border-collapse:collapse;min-width:820px}th,td{padding:12px;border-bottom:1px solid #eaf0f8;text-align:right;white-space:nowrap}th{background:#f8fbff;font-weight:900;color:#334155}
th input{margin-top:8px;height:34px;border-radius:10px;padding:6px;font-size:12px}.actions{display:flex;gap:7px;flex-wrap:wrap}.badge{display:inline-block;border-radius:999px;padding:5px 10px;background:#eaf2ff;color:#155eef;font-weight:900;font-size:12px}
.rows{display:flex;flex-direction:column;gap:10px}.line{display:grid;grid-template-columns:1.3fr 1fr 1fr 1fr .7fr;gap:10px;align-items:center}.line.sale{grid-template-columns:1fr 1.6fr 1fr 1fr .4fr}.total-box{background:#eef6ff;border:1px solid #cfe0f5;border-radius:16px;padding:14px;font-weight:900;color:#155eef;text-align:center}
.alert{padding:13px 16px;border-radius:16px;margin-bottom:14px;font-weight:800}.alert.success{background:#dcfce7;color:#166534}.alert.error{background:#fee2e2;color:#991b1b}
.modal-back{position:fixed;inset:0;background:rgba(15,23,42,.55);display:none;align-items:center;justify-content:center;z-index:100;padding:15px}.modal{background:white;width:100%;max-width:900px;max-height:88vh;overflow:auto;border-radius:28px;padding:22px;box-shadow:0 30px 90px rgba(0,0,0,.25)}.modal-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:15px}.close{background:#eaf2ff;color:#155eef;border:0;border-radius:14px;width:42px;height:42px;font-size:18px;font-weight:900}
.pager{display:flex;gap:8px;justify-content:center;align-items:center;margin:12px 0;flex-wrap:wrap}
@media(max-width:1000px){.app{grid-template-columns:1fr}.sidebar{position:fixed;right:0;top:0;width:min(84vw,320px);transform:translateX(110%);transition:.25s;height:100vh}.sidebar.open{transform:translateX(0)}.menu-btn{display:inline-flex}.overlay{position:fixed;inset:0;background:rgba(15,23,42,.55);z-index:15;display:none}.overlay.show{display:block}.main{padding:18px}.topbar{position:sticky;top:0;background:#f3f7ff;z-index:10;padding:10px 0}.cards{grid-template-columns:1fr}.col-6,.col-4,.col-3,.col-2{grid-column:span 12}.line,.line.sale{grid-template-columns:1fr}.search-row{width:100%;display:grid;grid-template-columns:1fr auto}.search-row input{min-width:0}.modal{border-radius:22px;max-height:86vh}}
@media print{.sidebar,.topbar,.table-tools,.actions,.btn,.menu-btn,.pager{display:none!important}.app{display:block}.main{padding:0}.card{box-shadow:none;border:0}.table-wrap{overflow:visible;border:0}table{min-width:0}.no-print{display:none!important}}


/* v2 table/filter/mobile improvements */
th input{
  color:#0f172a !important;
  background:#fff !important;
  caret-color:#155eef !important;
}
th input::placeholder{color:#94a3b8 !important}
.page-size-select{
  width:auto;
  height:38px;
  border-radius:12px;
  padding:5px 10px;
  font-size:13px;
}
.mobile-cards{display:none}
.mobile-card{
  background:#fff;
  border:1px solid var(--border);
  border-radius:18px;
  padding:14px;
  margin-bottom:12px;
  box-shadow:0 10px 26px rgba(15,23,42,.06);
}
.mobile-card-row{
  display:flex;
  justify-content:space-between;
  gap:12px;
  padding:8px 0;
  border-bottom:1px dashed #e2e8f0;
}
.mobile-card-row:last-child{border-bottom:0}
.mobile-card-label{color:#64748b;font-weight:800;font-size:13px}
.mobile-card-value{font-weight:800;text-align:left;direction:rtl;max-width:62%;word-break:break-word}
.mobile-card .actions{margin-top:10px;justify-content:flex-start}
@media(max-width:760px){
  .table-wrap{display:none}
  .mobile-cards{display:block}
  .pager{position:sticky;bottom:8px;background:#ffffffdd;backdrop-filter:blur(8px);padding:8px;border-radius:16px;border:1px solid var(--border);z-index:5}
  .table-tools{align-items:stretch}
  .table-tools > div{width:100%}
}
@media print{
  .mobile-cards,.pager,.page-size-select{display:none!important}
}


/* Purchase tabs */
.tabs{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:14px}
.tab-btn{border:0;border-radius:14px;padding:10px 16px;font-weight:900;background:#eaf2ff;color:#155eef}
.tab-btn.active{background:#155eef;color:#fff}
.tab-panel{display:none}
.tab-panel.active{display:block}


/* V4: clean separated table filters and reliable pager */
thead tr.filter-row th{
  background:#fff !important;
  padding:8px !important;
  vertical-align:middle !important;
}
thead tr.filter-row input{
  width:100% !important;
  min-width:105px !important;
  height:38px !important;
  font-size:12px !important;
  border-radius:12px !important;
  padding:6px 9px !important;
  color:#0f172a !important;
  background:#fff !important;
  border:1px solid #cfe0f5 !important;
  margin:0 !important;
  display:block !important;
}
thead tr.filter-row input::placeholder{color:#94a3b8 !important}
thead tr.title-row th{
  white-space:nowrap;
  vertical-align:middle;
}
.fc-pager{
  display:flex;
  gap:8px;
  justify-content:center;
  align-items:center;
  margin:12px 0;
  flex-wrap:wrap;
}
.fc-pager select{
  width:auto;
  height:38px;
  border-radius:12px;
  padding:5px 10px;
}
.fc-pager button:disabled{opacity:.45;cursor:not-allowed}
@media(max-width:760px){
  .table-wrap{display:none !important}
  .mobile-cards{display:block !important}
  .fc-pager{position:sticky;bottom:8px;background:#ffffffdd;backdrop-filter:blur(8px);padding:8px;border-radius:16px;border:1px solid var(--border);z-index:5}
}
@media print{
  .filter-row,.fc-pager,.pager,.mobile-cards{display:none!important}
}


/* V5 Hostinger-like professional UI */
:root{
  --blue:#2f6df6;
  --blue2:#155eef;
  --bg:#eef3f9;
  --card:#ffffff;
  --text:#0f172a;
  --muted:#64748b;
  --border:#dbe3ef;
  --soft:#f8fafc;
  --shadow:0 10px 28px rgba(15,23,42,.06);
}
body{
  background:#eef3f9 !important;
}
.app{
  grid-template-columns:280px 1fr !important;
  direction:rtl;
}
.sidebar{
  background:#fff !important;
  border-left:1px solid #dbe3ef !important;
  box-shadow:none !important;
  padding:18px 14px !important;
}
.brand{
  justify-content:center;
  padding:6px 0 22px;
  border-bottom:1px solid #eef2f7;
  margin-bottom:18px !important;
}
.brand .logo{
  width:38px !important;
  height:38px !important;
  border-radius:10px !important;
  font-size:21px !important;
  background:#2f6df6 !important;
}
.brand h2{
  font-size:22px !important;
  color:#020617 !important;
}
.nav button{
  display:flex;
  align-items:center;
  justify-content:flex-start;
  gap:11px;
  padding:13px 16px !important;
  border-radius:9px !important;
  color:#0f172a !important;
  font-size:16px !important;
  font-weight:800 !important;
}
.nav button.active,.nav button:hover{
  background:#2f6df6 !important;
  color:#fff !important;
}
.nav button::before{
  content:'';
  width:18px;
  height:18px;
  display:inline-block;
  opacity:.8;
  background:currentColor;
  mask: radial-gradient(circle at 50% 50%, #000 35%, transparent 37%);
}
.logout{
  border-radius:10px !important;
}
.main{
  padding:0 !important;
  background:#eef3f9;
}
.topbar{
  height:70px;
  background:#fff;
  border-bottom:1px solid #dbe3ef;
  padding:0 36px !important;
  margin:0 !important;
  display:flex;
  flex-direction:row-reverse;
}
.topbar h2{
  font-size:20px;
}
.user-chip{
  display:flex;
  align-items:center;
  gap:10px;
  direction:ltr;
}
.user-avatar{
  width:34px;
  height:34px;
  border-radius:50%;
  background:#e8f0ff;
  color:#2f6df6;
  display:grid;
  place-items:center;
  font-weight:900;
}
.lang-btn{
  width:36px;
  height:36px;
  border:0;
  background:#fff;
  border-radius:50%;
  display:grid;
  place-items:center;
  font-weight:900;
}
.content-shell{
  max-width:1420px;
  margin:0 auto;
  padding:36px 28px;
}
.page-heading{
  text-align:center;
  margin-bottom:28px;
}
.page-heading h1{
  font-size:32px;
  font-weight:900;
}
.page-heading p{
  color:#64748b;
  font-size:16px;
}
.card{
  border:1px solid #dbe3ef !important;
  border-radius:12px !important;
  box-shadow:none !important;
  background:#fff !important;
}
.btn{
  border-radius:9px !important;
  box-shadow:0 4px 10px rgba(47,109,246,.12);
}
.btn.light{
  background:#edf4ff !important;
  color:#2f6df6 !important;
}
input,select,textarea{
  border-radius:9px !important;
}
.table-wrap{
  border-radius:12px !important;
}
table{
  font-size:15px;
}
th{
  background:#fff !important;
  color:#64748b !important;
  letter-spacing:.02em;
}
td{
  background:#fff;
}
tr:hover td{
  background:#f8fafc;
}
.modal-back{
  background:rgba(0,0,0,.72) !important;
}
.modal{
  max-width:560px !important;
  border-radius:10px !important;
  padding:26px !important;
  box-shadow:0 30px 80px rgba(0,0,0,.3) !important;
}
.modal.wide{
  max-width:980px !important;
}
.modal-head h2{
  font-size:21px !important;
}
.close{
  background:#fff !important;
  color:#334155 !important;
  width:32px !important;
  height:32px !important;
  border-radius:8px !important;
}
.cards{
  grid-template-columns:repeat(4,1fr) !important;
}
.stat{
  border-radius:12px !important;
  min-height:100px !important;
  box-shadow:none !important;
}
.stat:after{
  display:none;
}
@media(max-width:1000px){
  .app{grid-template-columns:1fr !important}
  .topbar{padding:0 18px !important}
  .content-shell{padding:22px 14px}
  .page-heading h1{font-size:25px}
  .cards{grid-template-columns:1fr !important}
}
