@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800&display=swap');

:root{
  --bg:#f4f7fb;
  --bg-accent:#eef4ff;
  --surface:#ffffff;
  --surface-soft:#f9fbff;
  --text:#132238;
  --muted:#708198;
  --line:#dfe7f3;
  --primary:#3f6df6;
  --primary-dark:#2449b7;
  --secondary:#13b8a6;
  --success:#16a34a;
  --warning:#f59e0b;
  --danger:#ef4444;
  --info:#0ea5e9;
  --shadow:0 18px 45px rgba(31,50,81,.08);
  --shadow-sm:0 8px 22px rgba(31,50,81,.08);
  --radius:1.25rem;
  --radius-lg:1.6rem;
}

*{box-sizing:border-box}
html,body{min-height:100%}
body{
  font-family:'Cairo',system-ui,-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
  background:
    radial-gradient(circle at top right, rgba(63,109,246,.08), transparent 30%),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
  color:var(--text);
}
a{text-decoration:none}
main.container-fluid, .cashier-wrapper{max-width:1440px}

.app-shell{min-height:100vh}
.app-navbar{
  background:rgba(10,19,39,.92)!important;
  backdrop-filter: blur(12px);
  border-bottom:1px solid rgba(255,255,255,.08);
}
.app-navbar .navbar-brand{
  font-weight:800;
  letter-spacing:.2px;
}
.app-navbar .nav-link{
  color:rgba(255,255,255,.76)!important;
  border-radius:999px;
  padding:.55rem .95rem!important;
  transition:.2s ease;
}
.app-navbar .nav-link:hover,
.app-navbar .nav-link.active{
  color:#fff!important;
  background:rgba(255,255,255,.12);
}
.app-user-pill{
  background:rgba(255,255,255,.09);
  border:1px solid rgba(255,255,255,.08);
  color:#fff;
  padding:.6rem 1rem;
  border-radius:999px;
}

.page-hero{
  background:linear-gradient(135deg,#0f172a 0%, #183a8a 55%, #2389d7 100%);
  color:#fff;
  border-radius:var(--radius-lg);
  padding:1.25rem 1.25rem;
  box-shadow:var(--shadow);
  position:relative;
  overflow:hidden;
}
.page-hero:before{
  content:'';
  position:absolute;
  inset:auto -60px -60px auto;
  width:180px;height:180px;
  background:rgba(255,255,255,.08);
  border-radius:50%;
}
.page-hero .lead, .page-hero .small{color:rgba(255,255,255,.82)!important}

.card{
  border:1px solid rgba(223,231,243,.88);
  border-radius:var(--radius);
  background:rgba(255,255,255,.94);
  box-shadow:var(--shadow-sm);
}
.card-title{font-weight:700}
.card-header{
  background:transparent;
  border-bottom:1px solid var(--line);
}
.glass-card{
  background:linear-gradient(180deg, rgba(255,255,255,.98) 0%, rgba(248,251,255,.96) 100%);
}
.section-title{font-size:1rem;font-weight:800;margin:0}
.section-subtitle{color:var(--muted);font-size:.9rem}

.stat-card{
  position:relative;
  overflow:hidden;
  padding:.2rem;
}
.stat-card .card-body{padding:1.1rem 1rem}
.stat-card .stat-label{color:var(--muted);font-size:.88rem;font-weight:600}
.stat-card .stat-value{font-size:1.9rem;font-weight:800;line-height:1.1;margin-top:.35rem}
.stat-card .stat-icon{
  width:3rem;height:3rem;border-radius:1rem;
  display:inline-flex;align-items:center;justify-content:center;
  font-weight:800;font-size:1rem;
}
.stat-primary{background:linear-gradient(135deg,rgba(63,109,246,.14),rgba(63,109,246,.03));}
.stat-secondary{background:linear-gradient(135deg,rgba(19,184,166,.14),rgba(19,184,166,.03));}
.stat-warning{background:linear-gradient(135deg,rgba(245,158,11,.16),rgba(245,158,11,.04));}
.stat-danger{background:linear-gradient(135deg,rgba(239,68,68,.14),rgba(239,68,68,.03));}
.stat-primary .stat-icon{background:rgba(63,109,246,.15);color:var(--primary)}
.stat-secondary .stat-icon{background:rgba(19,184,166,.15);color:var(--secondary)}
.stat-warning .stat-icon{background:rgba(245,158,11,.16);color:var(--warning)}
.stat-danger .stat-icon{background:rgba(239,68,68,.15);color:var(--danger)}

.btn{border-radius:1rem;font-weight:700;padding:.7rem 1rem}
.btn-sm{border-radius:.9rem}
.btn-lg{padding:.95rem 1.35rem}
.btn-primary{
  background:linear-gradient(135deg,var(--primary),#5f86ff);
  border-color:transparent;
  box-shadow:0 10px 24px rgba(63,109,246,.26);
}
.btn-primary:hover,.btn-primary:focus{background:linear-gradient(135deg,var(--primary-dark),var(--primary));}
.btn-outline-primary{border-color:rgba(63,109,246,.35);color:var(--primary)}
.btn-outline-primary:hover{background:rgba(63,109,246,.08);color:var(--primary-dark);border-color:rgba(63,109,246,.55)}
.btn-outline-light:hover{color:#091321}

.form-control,.form-select{
  border-radius:1rem;
  border:1px solid var(--line);
  min-height:48px;
  background:#fff;
}
.form-control:focus,.form-select:focus{
  border-color:rgba(63,109,246,.45);
  box-shadow:0 0 0 .25rem rgba(63,109,246,.12);
}
.form-control-lg,.form-select-lg{min-height:56px;border-radius:1.1rem}

.table{--bs-table-bg:transparent;margin-bottom:0}
.table thead th{
  color:#51627a;
  font-size:.84rem;
  text-transform:none;
  border-bottom-width:1px;
  background:rgba(244,247,251,.9);
}
.table th,.table td{vertical-align:middle;padding:.85rem .8rem;border-color:#edf2f8}
.table tbody tr:hover{background:rgba(63,109,246,.03)}

.badge-soft{
  display:inline-flex;align-items:center;gap:.35rem;
  padding:.55rem .8rem;border-radius:999px;font-weight:700;
}
.badge-soft.primary{background:rgba(63,109,246,.12);color:var(--primary)}
.badge-soft.success{background:rgba(22,163,74,.12);color:var(--success)}
.badge-soft.warning{background:rgba(245,158,11,.14);color:#a16207}
.badge-soft.info{background:rgba(14,165,233,.13);color:var(--info)}

.empty-state{padding:1.25rem;border:1px dashed var(--line);border-radius:1rem;background:var(--surface-soft);text-align:center;color:var(--muted)}
.small-scroll{max-height:340px;overflow:auto}
.log-pre{white-space:pre-wrap;background:#111827;color:#f8fafc;padding:1rem;border-radius:1rem;max-height:500px;overflow:auto}
.currency{font-size:10px;color:#8a97a8;vertical-align:baseline;margin-inline-start:3px}

.cashier-body{background:linear-gradient(180deg,#edf3ff 0%, #eef4fb 100%)}
.cashier-wrapper{max-width:1360px;padding-bottom:3rem}
.cashier-pos-shell .card{border-radius:1.4rem}

.pos-hero{
  background:linear-gradient(135deg,#0f172a 0%, #173479 42%, #3f6df6 100%);
  border-radius:1.6rem;
  padding:1rem 1rem;
  color:#fff;
  box-shadow:var(--shadow);
}
.pos-hero p{margin:0;color:rgba(255,255,255,.78)}
.pos-customer-card{position:sticky;top:76px;z-index:10}
.pos-card-head{display:flex;justify-content:space-between;align-items:center;gap:.75rem;margin-bottom:.9rem}
.pos-card-head .title{font-size:1rem;font-weight:800;margin:0}
.pos-card-head .subtitle{font-size:.82rem;color:var(--muted)}
.pos-list{max-height:420px;overflow:auto;padding:.35rem;background:linear-gradient(180deg,#fff,#f8fbff);border-radius:1.15rem;border:1px solid rgba(223,231,243,.9);scrollbar-width:thin;scrollbar-color:rgba(112,129,152,.65) transparent}
.pos-list::-webkit-scrollbar{width:8px}
.pos-list::-webkit-scrollbar-thumb{background:rgba(112,129,152,.45);border-radius:999px}
.pos-search{max-width:240px}
.pos-item-btn{
  position:relative;
  display:flex!important;
  align-items:center!important;
  justify-content:space-between;
  gap:.9rem;
  min-height:86px;
  border:1px solid rgba(223,231,243,.9)!important;
  border-radius:1.1rem!important;
  margin-bottom:.8rem;
  padding:1rem 1rem!important;
  background:linear-gradient(180deg,#fff 0%, #fbfdff 100%)!important;
  transition:transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
  box-shadow:0 8px 18px rgba(31,50,81,.04);
  overflow:hidden;
}
.pos-item-btn::before{content:'';position:absolute;top:10px;bottom:10px;right:0;width:4px;border-radius:999px;opacity:.95}
.pos-list-services .pos-item-btn::before{background:linear-gradient(180deg,rgba(14,165,233,.85),rgba(19,184,166,.85))}
.pos-list-products .pos-item-btn::before{background:linear-gradient(180deg,rgba(63,109,246,.9),rgba(36,73,183,.85))}
.pos-list-services .pos-item-btn:nth-child(even){background:linear-gradient(180deg,#ffffff 0%, #f4fbff 100%)!important}
.pos-list-products .pos-item-btn:nth-child(even){background:linear-gradient(180deg,#ffffff 0%, #f6f8ff 100%)!important}
.pos-item-btn:hover,
.pos-item-btn:focus-visible{transform:translateY(-1px);border-color:rgba(63,109,246,.22)!important;box-shadow:0 14px 24px rgba(31,50,81,.08)}
.pos-item-btn.is-tapped{transform:scale(.985);box-shadow:0 6px 16px rgba(31,50,81,.08)}
.pos-item-btn.is-added{border-color:rgba(22,163,74,.35)!important;background:linear-gradient(180deg,#f8fff9 0%, #eefaf1 100%)!important;box-shadow:0 14px 28px rgba(22,163,74,.12)}
.pos-item-btn.is-added::after{content:'✓ تمت الإضافة';position:absolute;left:.8rem;top:.8rem;font-size:.72rem;font-weight:800;color:#15803d;background:rgba(34,197,94,.12);padding:.2rem .5rem;border-radius:999px}
.pos-entry-content{
  display:grid;
  gap:.4rem;
  flex:1;
  min-width:0;
  text-align:right;
  padding-inline-end:.35rem;
}
.pos-entry-name{
  font-size:1.05rem;
  line-height:1.45;
  font-weight:700;
  white-space:normal;
  word-break:break-word;
}
.pos-item-meta{
  font-size:.83rem;
  color:var(--muted);
  line-height:1.4;
}
.pos-kind-pill,.pos-price-pill{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:999px;
  font-weight:800;
  line-height:1;
  white-space:nowrap;
  flex-shrink:0;
}
.pos-kind-pill{padding:.35rem .6rem;font-size:.72rem;border:1px solid transparent}
.pos-kind-pill.service{background:rgba(14,165,233,.12);color:#0369a1;border-color:rgba(14,165,233,.14)}
.pos-kind-pill.product{background:rgba(63,109,246,.12);color:#2449b7;border-color:rgba(63,109,246,.14)}
.pos-price-pill{
  padding:.72rem 1rem;
  min-width:98px;
  font-size:1rem;
  box-shadow:inset 0 0 0 1px transparent;
}
.pos-price-pill.service{background:linear-gradient(135deg,rgba(14,165,233,.13),rgba(19,184,166,.12));color:#0f5f83;box-shadow:inset 0 0 0 1px rgba(14,165,233,.12)}
.pos-price-pill.product{background:linear-gradient(135deg,rgba(63,109,246,.12),rgba(36,73,183,.11));color:#2449b7;box-shadow:inset 0 0 0 1px rgba(63,109,246,.14)}
.pos-price-pill .currency{opacity:.75}
.customer-matches{
  position:absolute;top:100%;right:0;left:0;z-index:20;max-height:240px;overflow:auto;
  box-shadow:0 18px 45px rgba(11,28,60,.18);border-radius:1rem;border:1px solid var(--line);margin-top:.4rem
}
.pos-summary-wrap{display:grid;gap:1rem}
.pos-summary-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.75rem}
.pos-summary-item{padding:.95rem 1rem;border-radius:1rem;background:linear-gradient(180deg,#fff,#f7faff);border:1px solid var(--line)}
.pos-summary-item .label{color:var(--muted);font-size:.82rem;font-weight:700}
.pos-summary-item .value{font-size:1.15rem;font-weight:800;margin-top:.35rem}
.pos-summary-item.net{background:linear-gradient(135deg,rgba(63,109,246,.12),rgba(19,184,166,.12));border-color:rgba(63,109,246,.18)}
.pos-qty-input{max-width:92px;text-align:center}
.pos-actions{display:flex;justify-content:flex-end;gap:.75rem;flex-wrap:wrap}
.pos-table td:first-child{font-weight:700}

.report-filters .form-control,.report-filters .btn{min-height:52px}
.chart-card canvas{width:100%!important;height:280px!important}

.alert{border:0;border-radius:1rem;box-shadow:var(--shadow-sm)}

@media (max-width: 992px){
  .app-navbar .navbar-collapse{padding-top:.85rem}
  .pos-summary-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}

@media (max-width:768px){
  body{font-size:14.5px}
  .navbar-brand{font-size:1rem}
  .display-6,.stat-card .stat-value{font-size:1.45rem}
  .page-hero,.pos-hero{padding:1rem}
  .cashier-wrapper,.container-fluid{padding-inline:.85rem}
  .pos-customer-card{position:static}
  .pos-list{max-height:320px}
  .pos-search{max-width:100%}
  .pos-summary-grid{grid-template-columns:1fr}
  .pos-actions .btn,#saveInvoiceBtn{width:100%}
  #posTable th:nth-child(2), #posTable td:nth-child(2),
  #posTable th:nth-child(4), #posTable td:nth-child(4){display:none}
}


.modal-xl{max-width:min(920px,calc(100vw - 1rem))}
#entityModal .modal-content{border:0;border-radius:1rem;overflow:hidden}
#entityModal .modal-header{padding:1rem 1.25rem;background:#fff;border-bottom:1px solid rgba(0,0,0,.06)}
#entityModal .modal-header{display:flex;align-items:center;justify-content:flex-start;gap:.75rem}
#entityModal .modal-title{margin-inline-start:0}
#entityModal .btn-close{margin:0}
#entityModal .modal-body{padding:1rem;background:#f8fafc}
#entityModal .card{margin:0;border:0;box-shadow:none!important;background:transparent}
#entityModal .card-body{padding:0}
#entityModal h1.h4{font-size:1.1rem;margin-bottom:1rem!important}
#entityModal form .mt-3{display:flex;justify-content:flex-start}
.pos-stock-meta{font-size:.74rem;color:#7b8798;line-height:1.35}
.pos-item-btn strong{font-size:inherit;white-space:normal}
#servicesList .list-group-item,#productsList .list-group-item{padding:.35rem}
@media (max-width: 767.98px){
  .pos-item-btn{
    min-height:78px;
    padding:.95rem .9rem!important;
    gap:.7rem;
    align-items:center!important;
  }
  .pos-entry-name{
    font-size:.95rem;
    line-height:1.4;
  }
  .pos-item-meta{
    font-size:.76rem;
  }
  .pos-price-pill{
    min-width:86px;
    padding:.62rem .85rem;
    font-size:.95rem;
  }
  .pos-kind-pill{
    padding:.34rem .58rem;
    font-size:.69rem;
  }
  .modal-xl{max-width:calc(100vw - .5rem)}
  #entityModal .modal-body{padding:.9rem}
}


.customer-type-card{
  background:linear-gradient(180deg,#ffffff 0%, #f8fbff 100%);
  border-color:var(--line)!important;
}
.customer-type-badge{
  display:inline-flex;
  align-items:center;
  gap:.45rem;
  border-radius:999px;
  padding:.55rem .9rem;
  font-weight:800;
  line-height:1;
  border:1px solid transparent;
}
.customer-type-icon{font-size:.95rem;line-height:1}
.customer-type-badge.tier-vip,
.discount-theme-card.tier-vip{
  background:linear-gradient(135deg,rgba(147,51,234,.18),rgba(126,34,206,.09));
  color:#6b21a8;
  border-color:rgba(147,51,234,.28)!important;
}
.customer-type-badge.tier-gold,
.discount-theme-card.tier-gold{
  background:linear-gradient(135deg,rgba(245,158,11,.22),rgba(251,191,36,.1));
  color:#a16207;
  border-color:rgba(245,158,11,.3)!important;
}
.customer-type-badge.tier-silver,
.discount-theme-card.tier-silver{
  background:linear-gradient(135deg,rgba(148,163,184,.22),rgba(203,213,225,.11));
  color:#475569;
  border-color:rgba(148,163,184,.28)!important;
}
.customer-type-badge.tier-bronze,
.discount-theme-card.tier-bronze{
  background:linear-gradient(135deg,rgba(180,83,9,.18),rgba(217,119,6,.08));
  color:#92400e;
  border-color:rgba(180,83,9,.24)!important;
}
.customer-type-badge.tier-regular,
.discount-theme-card.tier-regular{
  background:linear-gradient(135deg,rgba(100,116,139,.16),rgba(148,163,184,.08));
  color:#475569;
  border-color:rgba(100,116,139,.22)!important;
}
.customer-type-badge.tier-new,
.discount-theme-card.tier-new{
  background:linear-gradient(135deg,rgba(34,197,94,.18),rgba(74,222,128,.08));
  color:#15803d;
  border-color:rgba(34,197,94,.24)!important;
}
.discount-theme-card .label,
.discount-theme-card .value,
.discount-theme-card .currency{color:inherit}
.discount-theme-card .currency{opacity:.8}

@media (max-width: 767.98px){
  .pos-item-btn strong{margin-inline-start:auto}
  #servicesList .list-group-item,#productsList .list-group-item{padding:.35rem}
}