:root{
  --bg:#f4f7fb; --surface:#ffffff; --surface-2:#f8fafc; --line:#e6edf5; --text:#10233d; --muted:#66758c;
  --primary:#2f80ed; --primary-2:#6c63ff; --success:#17b26a; --danger:#e5484d; --warning:#f59e0b;
  --shadow:0 12px 32px rgba(16,35,61,.08); --shadow-soft:0 8px 20px rgba(16,35,61,.05); --radius:20px;
}
*{box-sizing:border-box} html,body{height:100%} html{color-scheme:light only} body.crm-light{margin:0;background:linear-gradient(180deg,#f6f9fd 0%,#eef4fb 100%);color:var(--text);font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;overflow-x:hidden;overflow-y:auto}
a{text-decoration:none;color:inherit}.muted,.small-note{color:var(--muted)!important}
.mobile-bar{position:sticky;top:0;z-index:1040;display:flex;align-items:center;justify-content:space-between;padding:12px 16px;background:rgba(255,255,255,.96);backdrop-filter:blur(10px);border-bottom:1px solid var(--line);box-shadow:var(--shadow-soft)}
.mobile-brand{font-weight:800;color:var(--text)}
.crm-shell{display:flex;min-height:100vh}.crm-sidebar{width:288px;min-width:288px;background:#fff;border-right:1px solid var(--line);padding:24px 18px;position:sticky;top:0;height:100vh;overflow:auto}
.brand{display:flex;align-items:center;gap:14px}.brand-mark{width:46px;height:46px;border-radius:16px;background:linear-gradient(135deg,var(--primary),var(--primary-2));display:grid;place-items:center;color:#fff;font-weight:800;box-shadow:var(--shadow)}
.brand-title{font-size:1.35rem;font-weight:800}.brand-sub{color:var(--muted);font-size:.92rem}
.crm-main{flex:1;min-width:0;padding:28px 28px 36px}.page-header{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:20px}.page-title{font-size:2rem;font-weight:800;margin:0 0 4px}.page-subtitle{color:var(--muted)}
.topbar-actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap}.pill,.badge-soft{display:inline-flex;gap:8px;align-items:center;padding:9px 14px;border-radius:999px;background:#fff;border:1px solid var(--line);box-shadow:var(--shadow-soft);color:var(--text);font-weight:600}
.user-chip{display:inline-flex;align-items:center;gap:12px;background:#fff;padding:9px 14px;border:1px solid var(--line);border-radius:16px;box-shadow:var(--shadow-soft);color:var(--text)}
.user-chip:hover{border-color:#cfdcf0;transform:translateY(-1px)} .user-chip-icon{width:40px;height:40px;border-radius:12px;display:grid;place-items:center;background:#f3f7fd;color:#35527a;font-size:1.1rem}.user-chip span{display:flex;flex-direction:column;line-height:1.15}.user-chip small{color:var(--muted);font-size:.76rem}
.btn{border-radius:14px;padding:.72rem 1rem;font-weight:700;border:1px solid transparent}.btn-primary{background:linear-gradient(135deg,var(--primary),var(--primary-2));color:#fff;box-shadow:0 12px 24px rgba(47,128,237,.24)} .btn-primary:hover{opacity:.96;color:#fff}
.btn-soft{background:#fff;border:1px solid var(--line);color:var(--text);box-shadow:var(--shadow-soft)} .btn-soft:hover{background:#f8fbff}.btn-outline-danger{border-color:#f5c2c7;color:var(--danger);background:#fff}.btn-icon{width:44px;height:44px;padding:0;display:grid;place-items:center;border-radius:14px}
.crm-card{background:rgba(255,255,255,.96);border:1px solid var(--line);border-radius:24px;box-shadow:var(--shadow);padding:22px}.card-toolbar{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:16px}
.nav-link{display:flex;align-items:center;gap:12px;padding:12px 14px;border-radius:16px;color:#31445f;font-weight:600}.nav-link:hover{background:#f3f7fc}.nav-link.active{background:linear-gradient(135deg,#eef6ff,#f2efff);color:#12345d;border:1px solid #dbe8fb}
.table-wrap{overflow:auto;border-radius:18px;border:1px solid var(--line);background:#fff}.table{--bs-table-bg:transparent}.table-modern thead th,.table-darkglass thead th{background:#f7f9fc;color:#7b8798;font-size:.84rem;text-transform:none;border-bottom:1px solid var(--line);white-space:nowrap;position:sticky;top:0;z-index:1}.table-modern td,.table-modern th,.table-darkglass td,.table-darkglass th{padding:14px 12px;background:#fff;border-color:var(--line);vertical-align:middle}.table-modern tbody tr:hover td,.table-darkglass tbody tr:hover td{background:#fbfdff}
.form-control,.form-select{border-radius:14px;border:1px solid #dbe5f0;background:#fff;min-height:48px;padding:.75rem .95rem}.form-control:focus,.form-select:focus{border-color:#9fc3ff;box-shadow:0 0 0 .25rem rgba(47,128,237,.12)} textarea.form-control{min-height:110px}
.search-row,.toolbar-row{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:12px}.search-row > *{grid-column:span 3}.search-row .wide{grid-column:span 6}
.module-grid{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:22px}.span-12{grid-column:span 12}.span-8{grid-column:span 8}.span-4{grid-column:span 4}
.grid-2,.grid-3{display:grid;gap:14px}.grid-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-3{grid-template-columns:repeat(3,minmax(0,1fr))}
.stat-card .stat-label{color:var(--muted);font-weight:700}.stat-card .stat-value{font-size:2rem;font-weight:800}
.status-badge{display:inline-flex;align-items:center;padding:6px 10px;border-radius:999px;font-size:.8rem;font-weight:700}.status-New{background:#eef6ff;color:#1d4ed8}.status-Confirmation,.status-Confirmed,.status-Paid{background:#eafbf3;color:#15803d}.status-Cancelled{background:#fff0f0;color:#b42318}
.login-shell{min-height:100vh;display:grid;place-items:center;padding:24px;background:radial-gradient(circle at top right,#ddeeff 0,#f5f8fd 45%,#eef4fb 100%)}
.login-card{width:min(100%,520px);background:#fff;border:1px solid var(--line);border-radius:28px;box-shadow:var(--shadow);padding:28px}.login-title{font-size:2.1rem;font-weight:800}.permission-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px 14px;overflow:auto}.form-check{background:#f8fbff;border:1px solid var(--line);padding:10px 12px;border-radius:14px}
.pagination-modern .page-link{border:none;background:#fff;color:var(--text);border-radius:12px;margin:0 4px;box-shadow:var(--shadow-soft)} .pagination-modern .page-item.active .page-link{background:linear-gradient(135deg,var(--primary),var(--primary-2));color:#fff}
.list-actions{display:flex;gap:8px;justify-content:flex-end;flex-wrap:wrap}.modal-content{border:none;border-radius:24px;box-shadow:0 30px 60px rgba(16,35,61,.18)}.modal-header{border-bottom:1px solid var(--line)}.modal-footer{border-top:1px solid var(--line)} .modal-body{max-height:70vh;overflow:auto}
.ops-chip{display:inline-flex;align-items:center;gap:8px;padding:9px 12px;border-radius:999px;background:#fff;border:1px solid var(--line);box-shadow:var(--shadow-soft)}
.assignment-summary{display:grid;gap:4px}.assignment-summary strong{font-size:.95rem}.assignment-summary small{color:var(--muted)}
.table-action-cell{min-width:160px}
@media (max-width: 1199.98px){.crm-sidebar{position:static;height:auto}.crm-main{padding:20px}.span-8,.span-4{grid-column:span 12}.search-row > *,.search-row .wide{grid-column:span 6}}
@media (max-width: 991.98px){.crm-shell{display:block}.crm-main{padding:16px}.page-header{flex-direction:column}.search-row > *,.search-row .wide{grid-column:span 12}.permission-grid,.grid-2,.grid-3{grid-template-columns:1fr}.table-wrap{max-height:none}.offcanvas.offcanvas-start{width:min(88vw,320px)}.crm-card{padding:16px}.topbar-actions{width:100%}.user-chip{width:100%;justify-content:flex-start}}

/* KPI Dashboard Cards */
.kpi-grid{
    display:grid;
    grid-template-columns:repeat(4,1fr);
    gap:20px;
    width:100%;
}

/* Responsive */
@media (max-width:1200px){
    .kpi-grid{
        grid-template-columns:repeat(2,1fr);
    }
}

@media (max-width:768px){
    .kpi-grid{
        grid-template-columns:1fr;
    }
}

/* Card Style */
.crm-card{
    background:#ffffff;
    border-radius:10px;
    padding:20px;
    box-shadow:0 4px 14px rgba(0,0,0,.05);
    position:relative;
}

.stat-card{
    display:flex;
    flex-direction:column;
}

.stat-label{
    font-size:14px;
    color:#6c757d;
}

.stat-value{
    font-size:26px;
    font-weight:600;
    margin-top:6px;
}

.stat-icon{
    position:absolute;
    right:20px;
    top:20px;
    font-size:22px;
    color:#0d6efd;
}

/* SETTINGS MODULE GRID */
.module-grid{
    display:grid;
    grid-template-columns:repeat(2, minmax(0,1fr));
    gap:24px;
    align-items:start;
}

/* Column span */
.span-6{
    width:100%;
}

/* Card styling */
.crm-card{
    background:#fff;
    border-radius:12px;
    padding:22px;
    box-shadow:0 6px 18px rgba(0,0,0,0.05);
    border:1px solid #eef1f5;
}

/* Card header */
.card-toolbar{
    display:flex;
    align-items:center;
    justify-content:space-between;
    margin-bottom:18px;
}

.card-toolbar h5{
    font-size:18px;
    font-weight:600;
    color:#1f2937;
}

/* Notes list */
.crm-card ul{
    padding-left:18px;
    line-height:1.6;
}

.crm-card ul li{
    margin-bottom:8px;
}

/* small note text */
.small-note{
    font-size:13px;
    color:#6c757d;
}

/* Fix long text overflow */
.crm-card{
    word-wrap:break-word;
}

/* Mobile responsive */
@media (max-width:900px){
    .module-grid{
        grid-template-columns:1fr;
    }
}


/* Page Header */
.page-header{
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:18px 28px;
    background:#ffffff;
    border-bottom:1px solid #eef1f5;
    border-radius:10px;          /* انحناء 10% */
    margin-top:-17px;

}

/* Title */
.page-title{
    font-size:28px;
    font-weight:700;
    color:#1f2937;
    margin:0;
}

.page-subtitle{
    font-size:14px;
    color:#6b7280;
    margin-top:4px;
}

/* Right Actions */
.topbar-actions{
    display:flex;
    align-items:center;
    gap:12px;
}

/* User Chip */
.user-chip{
    display:flex;
    align-items:center;
    gap:12px;
    padding:8px 16px;
    background:#f8fafc;
    border-radius:12px;
    text-decoration:none;
    border:1px solid #eef1f5;
    transition:all .25s ease;
}

/* Hover */
.user-chip:hover{
    background:#f1f5f9;
}

/* Icon */
.user-chip-icon{
    display:flex;
    align-items:center;
    justify-content:center;
    width:38px;
    height:38px;
    border-radius:10px;
    background:#e9eef6;
    font-size:20px;
    color:#0d6efd;
}

/* User Info */
.user-chip span{
    display:flex;
    flex-direction:column;
    line-height:1.1;
}

.user-chip strong{
    font-size:14px;
    font-weight:600;
    color:#111827;
}

.user-chip small{
    font-size:12px;
    color:#6b7280;
}

/* Logout Button */
.btn-soft{
    padding:8px 16px;
    border-radius:10px;
    background:#f1f5f9;
    border:1px solid #e5e7eb;
    font-size:14px;
    font-weight:500;
    color:#111827;
    text-decoration:none;
    transition:all .2s ease;
}

.btn-soft:hover{
    background:#e2e8f0;
}

/* Mobile */
@media (max-width:768px){

    .page-header{
        flex-direction:column;
        align-items:flex-start;
        gap:12px;
    }

    .topbar-actions{
        width:100%;
        justify-content:space-between;
    }
    .page-header{
        display:none;
    }


}

/* Tablet only */
@media (min-width:768px) and (max-width:1024px){
    .page-header{
    margin-top:10px;
    }
}

/* User Chip */
.user-chip{
    display:flex;
    align-items:center;
    gap:12px;
    padding:10px 20px;
    background:#f8fafc;
    border-radius:10%;          /* انحناء 10% */
    text-decoration:none;
    border:1px solid #eef1f5;
    transition:all .25s ease;
}

/* Logout Button */
.btn-soft{
    display:flex;
    align-items:center;
    justify-content:center;
    padding:10px 26px;          /* تكبير الزر */
    border-radius:10%;          /* انحناء 10% */
    background:#f1f5f9;
    border:1px solid #e5e7eb;
    font-size:14px;
    font-weight:600;
    color:#111827;
    text-decoration:none;
    transition:all .2s ease;
height:58px;
}

/* Hover */
.btn-soft:hover{
    background:#e2e8f0;
}


#crm-flash{display:none}

@media (max-width: 1024px){
  .table-wrap{border:none;background:transparent;overflow:visible}
  .table-wrap table,.table-wrap thead,.table-wrap tbody,.table-wrap tr,.table-wrap th,.table-wrap td{display:block;width:100%}
  .table-wrap thead{display:none}
  .table-wrap tbody{display:grid;gap:14px}
  .table-wrap tbody tr{background:#fff;border:1px solid var(--line);border-radius:18px;box-shadow:var(--shadow-soft);padding:14px}
  .table-wrap tbody td{border:none!important;padding:8px 0!important;text-align:right!important;position:relative;min-height:24px}
  .table-wrap tbody td::before{content:attr(data-label);float:left;color:var(--muted);font-weight:700;padding-right:12px;text-align:left}
  .table-wrap tbody td:last-child::before{display:none}
  .list-actions{justify-content:flex-start}
  .table-action-cell{min-width:0}
}


.list-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.list-actions .btn {
  position: relative;
  border: none;
  outline: none;
  border-radius: 12px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.2px;
  transition: all 0.25s ease;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

/* زر Edit */
.list-actions .btn-soft.btn-sm {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
}

.list-actions .btn-soft.btn-sm:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.28);
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
}

.list-actions .btn-soft.btn-sm:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2);
}

/* زر Delete */
.list-actions .btn-outline-danger.btn-sm {
  background: #fff;
  color: #dc2626;
  border: 1.5px solid rgba(220, 38, 38, 0.18);
}

.list-actions .btn-outline-danger.btn-sm:hover {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: #fff;
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(220, 38, 38, 0.22);
}

.list-actions .btn-outline-danger.btn-sm:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(220, 38, 38, 0.14);
}

/* تأثير خفيف داخلي */
.list-actions .btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    rgba(255, 255, 255, 0.22),
    rgba(255, 255, 255, 0.02)
  );
  opacity: 0;
  transition: opacity 0.25s ease;
}

.list-actions .btn:hover::before {
  opacity: 1;
}

/* شكل أفضل للفوكس */
.list-actions .btn:focus-visible {
  box-shadow:
    0 0 0 3px rgba(59, 130, 246, 0.18),
    0 8px 20px rgba(15, 23, 42, 0.12);
}

/* تحسين حجم الأزرار الصغيرة */
.list-actions .btn-sm {
  min-width: 84px;
  height: 38px;
}

/* تحسين الفورم داخل السطر */
.list-actions form.d-inline {
  display: inline-flex;
  margin: 0;
}



.list-actions .btn {
  border-radius: 14px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 700;
  box-shadow:
    0 6px 18px rgba(15, 23, 42, 0.08),
    inset 0 1px 0 rgba(255,255,255,0.25);
  backdrop-filter: blur(6px);
}

.btn.btn-soft.btn-sm {
  position: relative;
  border: none;
  outline: none;
  border-radius: 12px;
  padding: 9px 16px;
  min-height: 38px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.2px;
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
  transition: all 0.25s ease;
  overflow: hidden;
}

.btn.btn-soft.btn-sm:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.28);
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
}

.btn.btn-soft.btn-sm:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2);
}

.btn.btn-soft.btn-sm::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    rgba(255, 255, 255, 0.22),
    rgba(255, 255, 255, 0.02)
  );
  opacity: 0;
  transition: opacity 0.25s ease;
}

.btn.btn-soft.btn-sm:hover::before {
  opacity: 1;
}

.btn.btn-soft.btn-sm:focus-visible {
  box-shadow:
    0 0 0 3px rgba(59, 130, 246, 0.18),
    0 8px 20px rgba(15, 23, 42, 0.12);
}



.permission-grid{
display:grid;
grid-template-columns:repeat(3, minmax(0,1fr));
gap:12px;
width:100%;
box-sizing:border-box;
}

.permission-grid .form-check{
display:flex;
align-items:center;
gap:8px;
background:#eef1f4;
padding:10px 12px;
border-radius:10px;
border:1px solid #d7dde4;
margin:0;
width:100%;
box-sizing:border-box;
}

.permission-grid .form-check-input{
margin:0;
flex-shrink:0;
}

.permission-grid .form-check-label{
font-size:14px;
line-height:1.3;
word-break:break-word;
}



/* إصلاح switch داخل grid في صفحة settings */
.grid-2 .form-check.form-switch{
display:flex;
align-items:center;
gap:10px;
width:100%;
max-width:100%;
margin:0;
padding:10px 14px;
border-radius:12px;
background:#eef2f6;
border:1px solid #d9e0e7;
box-sizing:border-box;
}

.grid-2 .form-check-input{
margin:0;
flex-shrink:0;
}

.grid-2 .form-check-label{
flex:1;
word-break:break-word;
}


/* إصلاح switch خارج الكارت في settings */
.crm-card .form-check.form-switch{
display:flex;
align-items:center;
gap:10px;
width:100%;
max-width:100%;
margin:0;
padding:12px 14px;
border-radius:12px;
background:#eef2f6;
border:1px solid #d9e0e7;
box-sizing:border-box;
}

.crm-card .form-check-input{
margin:0;
flex-shrink:0;
}

.crm-card .form-check-label{
flex:1;
word-break:break-word;
}


