:root{
  --bg:#f6f7fb;
  --surface:#ffffff;
  --surface2:#fbfbff;
  --text:#0f172a;
  --muted:#64748b;
  --line:#e6e8f0;

  --primary:#2563eb;
  --primary2:#7c3aed;
  --danger:#ef4444;
  --success:#16a34a;

  --shadow: 0 14px 40px rgba(15, 23, 42, .08);
  --shadow2: 0 8px 18px rgba(15, 23, 42, .06);
  --radius:18px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  background:
    radial-gradient(900px 500px at 10% 0%, rgba(37,99,235,.10), transparent 55%),
    radial-gradient(900px 500px at 90% 10%, rgba(124,58,237,.10), transparent 55%),
    var(--bg);
  color:var(--text);
  font-family: Poppins, system-ui, -apple-system, Segoe UI, Arial;
}

body.rtl{ font-family: "IBM Plex Sans Arabic", system-ui, -apple-system, Segoe UI, Arial; }

a{color:inherit; text-decoration:none}

.layout{display:flex; min-height:100vh; gap:18px; padding:18px}

/* Sidebar (Clean, card-like) */
.sidebar{
  width:290px;
  background: linear-gradient(180deg, var(--surface), var(--surface2));
  border:1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow2);
  padding:14px;
  position:sticky; top:18px; height: calc(100vh - 36px);
  display:flex; flex-direction:column;
}

.sidebar-brand{
  display:flex; gap:12px; align-items:center;
  padding:12px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(37,99,235,.10), rgba(124,58,237,.10));
  border:1px solid rgba(37,99,235,.15);
}

.sidebar-logo{
  width:48px; height:48px;
  border-radius:16px;
  object-fit:cover;
  background:#fff;
  border:1px solid rgba(15,23,42,.08);
}

.sb-title{font-weight:800; letter-spacing:.2px}
.sb-sub{font-size:12px; color:var(--muted); margin-top:2px}

.sb-section{margin-top:16px; font-size:12px; color:var(--muted); padding:0 6px; font-weight:700}

.sb-link{
  margin-top:10px;
  display:flex; align-items:center; gap:10px;
  padding:12px 12px;
  border-radius:16px;
  border:1px solid transparent;
  background: transparent;
  transition: .18s ease;
  font-weight:700;
}
.sb-link:hover{
  background: rgba(37,99,235,.08);
  border-color: rgba(37,99,235,.18);
  transform: translateY(-1px);
}

.sb-row{display:flex; gap:8px; margin-top:10px}
.sb-bottom{margin-top:auto}

/* Main */
.main{
  flex:1;
  background: transparent;
}
.container{
  max-width:1200px;
  margin:0 auto;
}

/* Topbar (White, premium) */
.topbar{
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow2);
  padding:14px 16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
}

.brand{display:flex; align-items:center; gap:12px}
.logo{
  width:44px; height:44px;
  border-radius:16px;
  object-fit:cover;
  border:1px solid rgba(15,23,42,.08);
  background:#fff;
}
.brand-title{font-weight:900}
.brand-sub{font-size:12px; color:var(--muted); margin-top:2px}

.topbar-actions{display:flex; align-items:center; gap:10px}

/* Buttons & chips */
.chip{
  padding:10px 12px;
  border-radius:14px;
  border:1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 6px 14px rgba(15,23,42,.05);
  font-weight:800;
  font-size:12px;
  transition:.18s ease;
}
.chip:hover{transform: translateY(-1px)}
.chip.danger{border-color: rgba(239,68,68,.28); color:#b91c1c; background: #fff5f5}

.btn{
  padding:11px 14px;
  border-radius:14px;
  border:1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 8px 18px rgba(15,23,42,.06);
  font-weight:900;
  cursor:pointer;
  transition:.18s ease;
}
.btn:hover{transform: translateY(-1px)}
.btn.primary{
  border-color: rgba(37,99,235,.25);
  background: linear-gradient(135deg, rgba(37,99,235,.12), rgba(124,58,237,.10));
  color:#0b1b49;
}
.btn.danger{
  border-color: rgba(239,68,68,.28);
  background: rgba(239,68,68,.08);
  color:#7f1d1d;
}

/* Panels */
.panel{
  margin-top:14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow2);
  padding:14px;
}

.badge{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:7px 10px;
  border-radius:999px;
  border:1px solid var(--line);
  background: #fff;
  font-weight:900;
  font-size:12px;
  color: var(--muted);
}

.row{display:flex; gap:10px; flex-wrap:wrap; align-items:center}
.field{display:flex; flex-direction:column; gap:6px; min-width:180px}

label{font-size:12px; color:var(--muted); font-weight:800}
input, select{
  padding:11px 12px;
  border-radius:14px;
  border:1px solid var(--line);
  background: #fff;
  color: var(--text);
  outline:none;
  box-shadow: 0 8px 18px rgba(15,23,42,.04);
}
input:focus, select:focus{
  border-color: rgba(37,99,235,.35);
  box-shadow: 0 0 0 4px rgba(37,99,235,.10), 0 10px 22px rgba(15,23,42,.06);
}

/* KPI cards (different style) */
.grid{
  margin-top:14px;
  display:grid;
  grid-template-columns: repeat(12, 1fr);
  gap:14px;
}
.card{
  grid-column: span 4;
  background: linear-gradient(180deg, #fff, #fbfbff);
  border:1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding:16px;
  position:relative;
  overflow:hidden;
}
.card::before{
  content:"";
  position:absolute;
  width:240px; height:240px;
  right:-120px; top:-140px;
  background: radial-gradient(circle at 30% 30%, rgba(37,99,235,.25), transparent 65%);
  transform: rotate(10deg);
}
.card:nth-child(2)::before{
  background: radial-gradient(circle at 30% 30%, rgba(124,58,237,.25), transparent 65%);
}
.card:nth-child(3)::before{
  background: radial-gradient(circle at 30% 30%, rgba(22,163,74,.20), transparent 65%);
}

.card h3{margin:0; font-size:13px; color:var(--muted); font-weight:900; position:relative}
.card .value{
  margin-top:10px;
  font-size:34px;
  font-weight:900;
  position:relative;
}

/* Tabs */
.tabs{display:flex; gap:8px; flex-wrap:wrap}
.tab{
  padding:10px 12px;
  border-radius:14px;
  border:1px solid var(--line);
  background: #fff;
  box-shadow: 0 8px 18px rgba(15,23,42,.05);
  font-weight:900;
  cursor:pointer;
  transition:.18s ease;
}
.tab:hover{transform: translateY(-1px)}
.tab.active{
  border-color: rgba(37,99,235,.28);
  background: linear-gradient(135deg, rgba(37,99,235,.12), rgba(124,58,237,.10));
}

/* Table */
.table{
  width:100%;
  border-collapse:separate;
  border-spacing:0 10px;
  margin-top:10px;
}
.table th{
  text-align:start;
  font-size:12px;
  color:var(--muted);
  font-weight:900;
  padding:8px 10px;
}
.table td{
  padding:12px 10px;
  background:#fff;
  border-top:1px solid var(--line);
  border-bottom:1px solid var(--line);
}
.table tr td:first-child{
  border-inline-start:1px solid var(--line);
  border-start-start-radius:14px;
  border-end-start-radius:14px;
}
.table tr td:last-child{
  border-inline-end:1px solid var(--line);
  border-start-end-radius:14px;
  border-end-end-radius:14px;
}

/* Alerts */
.alert{
  margin-top:12px;
  padding:12px 14px;
  border-radius:14px;
  border:1px solid rgba(37,99,235,.20);
  background: rgba(37,99,235,.08);
  font-weight:900;
  color:#0b1b49;
}
.alert.danger{
  border-color: rgba(239,68,68,.22);
  background: rgba(239,68,68,.08);
  color:#7f1d1d;
}

/* Login (Different, clean) */
.login-wrap{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:18px;
}
.login-card{
  width:min(520px, 96vw);
  background: #fff;
  border:1px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--shadow);
  padding:18px;
}
.login-head{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding-bottom:10px;
  border-bottom:1px dashed rgba(15,23,42,.10);
}

/* Responsive */
@media (max-width: 900px){
  .layout{flex-direction:column}
  .sidebar{width:100%; height:auto; position:relative; top:0}
  .card{grid-column: span 12;}
}
/* ===== Users Page Enhancements ===== */
.section-head{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  margin-top:14px;
}
.section-title{
  font-size:14px; font-weight:900; color:var(--text);
}
.kpis{
  display:grid; grid-template-columns: repeat(12, 1fr);
  gap:12px; margin-top:12px;
}
.kpi{
  grid-column: span 4;
  background: linear-gradient(180deg, #fff, #fbfbff);
  border:1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow2);
  padding:14px;
  display:flex; align-items:center; justify-content:space-between;
}
.kpi .label{font-size:12px; color:var(--muted); font-weight:900}
.kpi .num{font-size:24px; font-weight:900}

.form-grid{
  display:grid;
  grid-template-columns: repeat(12, 1fr);
  gap:12px;
  margin-top:12px;
  align-items:end;
}
.form-grid .field{min-width:unset}
.col-3{grid-column: span 3}
.col-4{grid-column: span 4}
.col-5{grid-column: span 5}
.col-6{grid-column: span 6}
.col-12{grid-column: span 12}

.switches{
  display:flex; gap:10px; flex-wrap:wrap;
}
.toggle-pill{
  display:inline-flex; align-items:center; gap:10px;
  padding:10px 12px;
  border-radius: 999px;
  border:1px solid var(--line);
  background:#fff;
  box-shadow: 0 8px 18px rgba(15,23,42,.05);
  font-weight:900;
}
.toggle-pill input{width:18px; height:18px}
.muted{color:var(--muted); font-weight:800; font-size:12px}

.table-actions{
  display:flex; gap:8px; align-items:center;
}
.btn.small{padding:9px 12px; border-radius:12px; font-weight:900; font-size:12px}

@media (max-width: 900px){
  .kpi{grid-column: span 12}
  .col-3,.col-4,.col-5,.col-6{grid-column: span 12}
}
/* Force same font everywhere (inputs/select/buttons) */
:root{
  --font-en: "Poppins", system-ui, -apple-system, "Segoe UI", Arial;
  --font-ar: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Arial;
}

/* Default */
body{ font-family: var(--font-en); }
body.rtl{ font-family: var(--font-ar); }

/* Important: form controls do NOT always inherit font */
input, select, textarea, button, option, label, table, th, td, .btn, .chip, .badge {
  font-family: inherit !important;
}
