

.incoming-table thead th{
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.2;
  padding-top: 10px;
  padding-bottom: 10px;
}
.incoming-table td:nth-child(7){
  width: 12%;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}
.incoming-table td:nth-child(7) .badge{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 78px;
}
.incoming-table td.actions-cell{
  overflow: visible;
  text-overflow: clip;
}
.incoming-table .actions-stack{
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
}
.incoming-table .btn-del-row{
  background: #e8f0ff;
  border: 1px solid #d2e0ff;
  color: #0b3b7a;
  padding: 7px 12px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
}
.incoming-table .btn-del-row:hover{
  filter: brightness(0.98);
}
:root{
  --blue1:#0b2e5e;
  --blue2:#0f4aa2;
  --blue3:#1b6bd6;
  --bg:#f3f5f8;
  --card:#ffffff;
  --muted:#6b7280;
  --border:#e5e7eb;
  --shadow: 0 12px 28px rgba(0,0,0,.09);
  --radius: 14px;
}
*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: "Cairo", system-ui, -apple-system, Segoe UI, Arial, sans-serif;
  direction: rtl;
  background:
    radial-gradient(1200px 500px at 85% -20%, rgba(27,107,214,.22), transparent 60%),
    radial-gradient(1200px 500px at 10% 110%, rgba(15,74,162,.14), transparent 60%),
    var(--bg);
  color:#0f172a;
}
a{ color:inherit; text-decoration:none; }
.container{ max-width:1200px; margin:0 auto; padding:18px; }

.topbar{
  background: linear-gradient(90deg, var(--blue1), var(--blue2));
  color:#fff;
  border-bottom:3px solid rgba(255,255,255,.14);
}
.topbar .inner{
  display:flex; align-items:center; justify-content:space-between; gap:14px;
  padding:14px 18px;
}
.brand{ display:flex; align-items:center; gap:12px; }
.logo{
  width:46px; height:46px; border-radius:12px;
  background: rgba(255,255,255,.15);
  border:1px solid rgba(255,255,255,.18);
  display:grid; place-items:center;
  font-size:22px;
}
.brand h1{ margin:0; font-size:18px; font-weight:1000; letter-spacing:.2px; }
.brand .sub{ font-size:12px; opacity:.88; }

.userbox{
  display:flex; align-items:center; gap:10px;
  background: rgba(255,255,255,.12);
  border:1px solid rgba(255,255,255,.18);
  padding:8px 10px; border-radius:999px;
}
.role{
  font-size:12px; opacity:.95;
  padding:2px 10px; border-radius:999px;
  background: rgba(255,255,255,.18);
  font-weight:900;
}

.btn{
  border:0;
  padding:10px 14px;
  border-radius: 12px;
  cursor:pointer;
  font-weight:1000;
  transition:.12s transform, .12s opacity;
  display:inline-flex;
  align-items:center;
  gap:8px;
}
.btn:active{ transform: scale(.98); }
.btn-primary{ background: linear-gradient(180deg, var(--blue3), var(--blue2)); color:#fff; }
.btn-secondary{ background:#fff; border:1px solid var(--border); color:#0f172a; }
.btn-muted{ background:#eef2ff; border:1px solid #e0e7ff; color:#1e3a8a; }
.btn-danger{ background: linear-gradient(180deg, #ef4444, #b91c1c); color:#fff; }

.shell{
  display:grid;
  grid-template-columns: 260px 1fr;
  gap:16px;
  margin-top:16px;
}

.sidebar{
  background: linear-gradient(180deg, rgba(11,46,94,.98), rgba(15,74,162,.96));
  color:#fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border:1px solid rgba(255,255,255,.08);
  overflow:hidden;
}
.nav{ padding:12px; display:flex; flex-direction:column; gap:8px; }
.nav a{
  display:flex; align-items:center; gap:10px;
  padding:12px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.10);
  font-weight:1000;
}
.nav a:hover{ background: rgba(255,255,255,.10); }
.nav a.active{
  background: rgba(255,255,255,.18);
  border-color: rgba(255,255,255,.22);
}

.main{ min-height: calc(100vh - 140px); }

.card{
  background: var(--card);
  border:1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.card .hd{
  padding:14px 16px;
  border-bottom: 1px solid var(--border);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.card .hd h2{
  margin:0;
  font-size:16px;
  font-weight:1000;
}
.card .bd{ padding:16px; }

.grid{
  display:grid;
  grid-template-columns: repeat(12, 1fr);
  gap:12px;
}
.field{ grid-column: span 4; }
.field.half{ grid-column: span 6; }
.field.full{ grid-column: 1 / -1; }

label{
  display:block;
  font-size:12px;
  color: var(--muted);
  margin-bottom:6px;
  font-weight:1000;
}
input, select, textarea{
  width:100%;
  padding:10px 12px;
  border-radius: 12px;
  border:1px solid var(--border);
  outline:none;
  background:#fff;
  font-family:inherit;
}
textarea{ min-height: 92px; resize: vertical; }

.tablewrap{
  /* نعرض الجدول كامل بدون Scroll أفقي */
  overflow-x:hidden;
  overflow-y:auto;
  border-radius: 12px;
  border:1px solid var(--border);
}
table{ width:100%; border-collapse: collapse; background:#fff; }

/* Incoming table: fixed professional column widths (no horizontal scroll) */
table.incoming-table{
  width:100%;
  table-layout:fixed;
}
table.incoming-table th,
table.incoming-table td{
  overflow:hidden;
  text-overflow:ellipsis;
}
/* Allow wrapping for long Arabic text */
table.incoming-table td{
  white-space:normal;
  word-break:break-word;
}
/* Keep action buttons in one line */
table.incoming-table td:last-child{
  white-space:nowrap;
}

/* Column width distribution (sum = 100%) */
table.incoming-table th:nth-child(1), table.incoming-table td:nth-child(1){ width:7%; }
table.incoming-table th:nth-child(2), table.incoming-table td:nth-child(2){ width:9%; }
table.incoming-table th:nth-child(3), table.incoming-table td:nth-child(3){ width: 18%; }
table.incoming-table th:nth-child(4), table.incoming-table td:nth-child(4){ width: 12%; }
table.incoming-table th:nth-child(5), table.incoming-table td:nth-child(5){ width:9%; }
table.incoming-table th:nth-child(6), table.incoming-table td:nth-child(6){ width:8%; }
table.incoming-table th:nth-child(7), table.incoming-table td:nth-child(7){ width: 12%; }
table.incoming-table th:nth-child(8), table.incoming-table td:nth-child(8){ width:10%; }
table.incoming-table th:nth-child(9), table.incoming-table td:nth-child(9){ width:8%; }
table.incoming-table th:nth-child(10), table.incoming-table td:nth-child(10){ width: 7%; }
th, td{
  padding:10px 10px;
  border-bottom:1px solid var(--border);
  font-size:13px;
  vertical-align: top;
}
th{
  background: linear-gradient(180deg, #0b2e5e, #0f4aa2);
  color:#fff;
  position: sticky;
  top:0;
  z-index:1;
  text-align:right;
  white-space:nowrap;
}
tr:hover td{ background:#f8fafc; }

.pills{ display:flex; flex-wrap:wrap; gap:8px; }
.pill{
  padding:6px 10px;
  border-radius: 999px;
  background:#f1f5f9;
  border:1px solid var(--border);
  font-size:12px;
  font-weight:1000;
}

.kpis{
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap:12px;
  margin-bottom:12px;
}
.kpi{
  padding:14px;
  border-radius: var(--radius);
  background: #fff;
  border:1px solid var(--border);
  box-shadow: var(--shadow);
}
.kpi .n{ font-size:22px; font-weight:1000; }
.kpi .t{ font-size:12px; color:var(--muted); font-weight:1000; }

.notice{
  padding:10px 12px;
  border-radius: 12px;
  background:#fff7ed;
  border:1px solid #fed7aa;
  color:#9a3412;
  font-weight:1000;
  font-size:12px;
}
.success{
  background:#ecfdf5;
  border-color:#a7f3d0;
  color:#065f46;
}

.footer{
  margin-top:16px;
  padding:14px 18px;
  color:#334155;
  font-size:12px;
  opacity:.9;
  text-align:center;
}

.hr{ border:0; border-top:1px solid var(--border); margin:12px 0; }

.login-wrap{
  min-height: 100vh;
  display:grid;
  place-items:center;
  padding:18px;
}
.login-card{
  width:min(980px, 100%);
  display:grid;
  grid-template-columns: 1fr 1fr;
  overflow:hidden;
  border-radius: 18px;
  box-shadow: var(--shadow);
  border:1px solid var(--border);
  background:#fff;
}
.login-left{
  background: linear-gradient(180deg, var(--blue1), var(--blue2));
  color:#fff;
  padding:22px;
}
.login-left h2{ margin:0 0 8px; font-size:20px; font-weight:1000; }
.login-left p{ margin:0; opacity:.9; line-height:1.7; }
.login-right{ padding:22px; }

.badge{
  font-size:11px;
  font-weight:1000;
  padding:4px 8px;
  border-radius:999px;
  border:1px solid var(--border);
  background:#f8fafc;
  color:#0f172a;
}
.badge.blue{ background:#eff6ff; border-color:#dbeafe; color:#1e3a8a; }
.badge.red{ background:#fef2f2; border-color:#fecaca; color:#991b1b; }
.badge.green{ background:#ecfdf5; border-color:#a7f3d0; color:#065f46; }

.modal{
  display:none;
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.45);
  z-index:9999;
  padding:18px;
}
.modal .panel{
  max-width:980px;
  margin:0 auto;
}

@media (max-width: 980px){
  .shell{ grid-template-columns: 1fr; }
  .login-card{ grid-template-columns: 1fr; }
  .kpis{ grid-template-columns: repeat(2, 1fr); }
}

/* Logo image support */
.logo{ overflow:hidden; }
.logo img{ width:100%; height:100%; object-fit:contain; display:block; }

/* tabs */
.tabs{ display:flex; gap:10px; flex-wrap:wrap; }
.tab{
  background:#e9effa;
  border:1px solid rgba(0,0,0,.08);
  padding:10px 14px;
  border-radius:12px;
  cursor:pointer;
  font-weight:800;
}
.tab.active{
  background:#0f4aa2;
  color:#fff;
}
.pill{
  display:inline-block;
  padding:6px 10px;
  border-radius:999px;
  background:#f3f6ff;
  border:1px solid rgba(0,0,0,.06);
  font-size:12px;
  color:#2a3b57;
}
.hint{ font-size:12px; color:#6b7280; margin-top:6px; }
/* Login brand (dual logos) */
.login-brand{display:flex; flex-direction:column; align-items:center; text-align:center; gap:16px;}
.login-brand .logos{display:flex; align-items:center; justify-content:center; gap:14px; width:100%;}
.login-brand .logos .logo{width:120px; height:120px; display:flex; align-items:center; justify-content:center; overflow:hidden; background:none; border:none; border-radius:0;}
.login-brand .logos .logo img{width:100%; height:100%; object-fit:contain; padding:0;}
.login-brand .titles h1{margin:0; font-weight:1000; font-size:22px; line-height:1.2;}
.login-brand .titles .sub{margin-top:6px; font-size:14px; opacity:.95; font-weight:800;}
.login-brand .titles .sub2{margin-top:6px; font-size:13px; opacity:.9; font-weight:800;}




/* ===== Layout: keep footer visible, avoid page scroll ===== */
html, body { height: 100%; }
body { overflow: hidden; }

/* Make page a column: header + content + footer */
body { display: flex; flex-direction: column; }

/* Top header stays at top (normal flow) */
.topbar { flex: 0 0 auto; }

/* Content area should fill remaining height and scroll internally if needed */
.container.shell {
  flex: 1 1 auto;
  min-height: 0;           /* IMPORTANT for internal scrolling */
  overflow: hidden;        /* prevent page scroll */
}

/* Sidebar and main can scroll inside if content exceeds */
.sidebar { overflow: auto; }
.main { overflow: auto; min-height: 0; }

/* Footer always visible */
.footer {
  flex: 0 0 auto;
  position: sticky;
  bottom: 0;
  z-index: 50;
}


/* ===== Responsive fixes ===== */
/* Prevent accidental shrinking when using flex layout */
.container.shell { display: flex; gap: 18px; }
.sidebar { flex: 0 0 320px; }
.main { flex: 1 1 auto; }

/* Allow tables/forms to fit */
.tablewrap { overflow-x: auto; }
table { min-width: 720px; }

/* Mobile / Tablet */
@media (max-width: 992px){
  body { overflow: auto; }            /* on small screens allow normal scroll */
  body { display: block; }            /* avoid complex nested scroll on mobile */

  .topbar { position: sticky; top: 0; z-index: 60; }
  .container.shell { display: block; overflow: visible; }
  .sidebar { width: 100%; flex: none; margin-bottom: 12px; }
  .sidebar .nav{
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 10px;
    scrollbar-width: thin;
  }
  .sidebar .nav a{
    flex: 0 0 auto;
    min-width: 140px;
    text-align: center;
  }
  .main { overflow: visible; }

  .topbar .inner{
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .brand{
    justify-content: space-between;
    gap: 10px;
  }
  .brand .logo{ width: 52px; height: 52px; }
  .userbox{ justify-content: space-between; width: 100%; }
}

/* Small phones */
@media (max-width: 520px){
  .brand{ flex-direction: column; align-items: center; text-align: center; }
  .userbox{ flex-wrap: wrap; justify-content: center; gap: 8px; }
  .btn{ width: 100%; }
  input, select, textarea{ width: 100%; }
  /* Keep other tables readable on mobile, but allow Incoming table to fit without horizontal scroll */
  table:not(.incoming-table) { min-width: 620px; }
  .footer{ font-size: 12px; padding: 10px; }
}

.topbar .logo{display:flex;align-items:center;justify-content:center;background:none;border:none;border-radius:0;padding:0;margin:0;min-width:auto;width:auto;}

.topbar .logo img{height:76px;width:auto;object-fit:contain;}


/* Header logo: show full image (no clipping) */
.topbar .logo{overflow:visible; flex-shrink:0; width:auto; height:auto; background:none; border:none; border-radius:0; padding:0; margin:0;}
.topbar .logo img{height:76px !important; max-height:76px !important; width:auto !important; max-width:none !important; object-fit:contain; display:block;}

.badge.yellow{background:#fffbeb;border-color:#fde68a;color:#92400e;}


/* ===== 2026-05 Full-width responsive enhancement ===== */
.container{
  width:100%;
  max-width:none;
  margin:0;
  padding:18px 22px;
}
.topbar .inner.container{
  width:100%;
  max-width:none;
  padding:14px 22px;
}
.container.shell{
  width:100%;
  max-width:none;
  gap:18px;
  padding-top:18px;
  padding-bottom:18px;
}
.sidebar{
  flex:0 0 312px;
  width:312px;
}
.main{
  flex:1 1 auto;
  min-width:0;
}
.card .hd{
  padding:18px 20px;
}
.card .bd{
  padding:18px 20px;
}
.kpis{
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap:14px;
}
.kpi{
  padding:18px;
}
.kpi .n{
  font-size:30px;
}
.kpi .t{
  font-size:14px;
}
.brand h1{
  font-size: clamp(20px, 1.25vw + 14px, 28px);
  line-height:1.2;
}
.brand .sub{
  font-size: clamp(22px, 1.4vw + 12px, 30px);
  font-weight:1000;
  opacity:1;
  line-height:1.2;
  margin-top:4px;
}
.login-brand .titles .sub{
  font-size:26px;
  font-weight:1000;
  opacity:1;
}
.login-brand .titles h1{
  font-size:24px;
}
.tablewrap{
  overflow:auto;
  max-width:100%;
  border-radius:14px;
}
table{
  width:100%;
  min-width:980px;
}
.tablewrap table,
.tablewrap .incoming-table{
  font-size:14px;
}
th, td{
  padding:14px 12px;
  font-size:14px;
  line-height:1.55;
}
th{
  font-size:14px;
}
table.incoming-table{
  min-width:1100px;
}
.incoming-table thead th{
  padding-top:12px;
  padding-bottom:12px;
}
.incoming-table .actions-stack{
  gap:8px;
}
.incoming-table .btn-del-row,
.btn{
  padding:11px 16px;
}
.topbar .logo img{
  height:84px !important;
  max-height:84px !important;
}
@media (max-width: 1200px){
  .sidebar{
    flex-basis:280px;
    width:280px;
  }
  .kpis{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 992px){
  .container,
  .topbar .inner.container,
  .container.shell{
    padding:12px;
  }
  .brand h1{
    font-size:20px;
  }
  .brand .sub{
    font-size:22px;
  }
  .sidebar{
    width:100%;
    flex:none;
  }
  table,
  table.incoming-table{
    min-width:860px;
  }
}
@media (max-width: 520px){
  .brand .sub{
    font-size:20px;
  }
  .kpi .n{
    font-size:24px;
  }
  table,
  table.incoming-table{
    min-width:760px;
  }
}

/* ===== 2026-05 fine tune header + incoming actions ===== */
.brand h1{
  font-size: clamp(18px, 0.95vw + 12px, 24px);
  line-height: 1.15;
}
.brand .sub{
  font-size: clamp(16px, 0.8vw + 10px, 21px);
  font-weight: 1000;
  line-height: 1.18;
  margin-top: 4px;
}
.login-brand .titles h1{
  font-size: 22px;
}
.login-brand .titles .sub{
  font-size: 20px;
}

/* Make user area and title area breathe better */
.topbar .inner{
  align-items:center;
}
.userbox{
  gap: 8px;
  padding: 10px 12px;
}

/* Incoming action buttons */
.incoming-table td.actions-cell{
  min-width: 132px;
}
.incoming-table .actions-stack{
  gap: 10px;
}
.incoming-table .btn-action{
  width: 100%;
  justify-content: center;
  min-height: 42px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 1000;
  letter-spacing: 0;
  box-shadow: 0 3px 10px rgba(15, 74, 162, .10);
}
.incoming-table .btn-action.btn-edit-row{
  background: linear-gradient(180deg, #eef4ff, #dbeafe);
  border: 1px solid #bfd5ff;
  color: #0b3b7a;
}
.incoming-table .btn-action.btn-edit-row:hover{
  background: linear-gradient(180deg, #e3efff, #cfe2ff);
}
.incoming-table .btn-action.btn-follow-row{
  background: #ffffff;
  border: 1px solid #cfd8e8;
  color: #1f2f4d;
}
.incoming-table .btn-action.btn-follow-row:hover{
  background: #f8fbff;
  border-color: #b7c6e2;
}
.incoming-table .btn-action .ico{
  font-size: 14px;
  line-height: 1;
}

@media (max-width: 992px){
  .brand h1{
    font-size: 18px;
  }
  .brand .sub{
    font-size: 17px;
  }
}
@media (max-width: 520px){
  .brand h1{
    font-size: 16px;
  }
  .brand .sub{
    font-size: 15px;
  }
  .incoming-table .btn-action{
    min-height: 38px;
    font-size: 12px;
    padding: 9px 12px;
  }
}

/* ===== 2026-05 user management delete + incoming registered by ===== */
.btn-delete-user{
  margin-inline-start: 6px;
  min-height: 40px;
  border-radius: 12px;
  font-weight: 1000;
}
.btn-delete-user:disabled{
  opacity: .45;
  cursor: not-allowed;
  filter: grayscale(.4);
}
/* Incoming table now has 11 columns including registered-by user */
table.incoming-table{
  min-width: 1250px;
}
table.incoming-table th:nth-child(1), table.incoming-table td:nth-child(1){ width:6%; }
table.incoming-table th:nth-child(2), table.incoming-table td:nth-child(2){ width:8%; }
table.incoming-table th:nth-child(3), table.incoming-table td:nth-child(3){ width:17%; }
table.incoming-table th:nth-child(4), table.incoming-table td:nth-child(4){ width:11%; }
table.incoming-table th:nth-child(5), table.incoming-table td:nth-child(5){ width:8%; }
table.incoming-table th:nth-child(6), table.incoming-table td:nth-child(6){ width:8%; }
table.incoming-table th:nth-child(7), table.incoming-table td:nth-child(7){ width:7%; }
table.incoming-table th:nth-child(8), table.incoming-table td:nth-child(8){ width:10%; }
table.incoming-table th:nth-child(9), table.incoming-table td:nth-child(9){ width:8%; }
table.incoming-table th:nth-child(10), table.incoming-table td:nth-child(10){ width:9%; }
table.incoming-table th:nth-child(11), table.incoming-table td:nth-child(11){ width:8%; }
@media (max-width: 992px){
  table.incoming-table{ min-width: 1050px; }
}
