:root{
  --bg:#0a0e18;
  --panel:#111826;
  --panel2:#141d2f;
  --border:#232f45;
  --text:#e7ecf5;
  --muted:#8b98af;
  --accent:#3b82f6;
  --accent2:#2563eb;
  --green:#22c55e;
  --red:#ef4444;
  --yellow:#f59e0b;
}
*{box-sizing:border-box;}
body{
  margin:0;
  font-family:"Tahoma","Segoe UI",system-ui,sans-serif;
  background:var(--bg);
  color:var(--text);
  min-height:100vh;
}
.hidden{display:none !important;}
.muted{color:var(--muted);}

/* ---------- تسجيل الدخول ---------- */
.login-screen{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  background:radial-gradient(circle at 30% 20%, #14203a 0%, #0a0e18 60%);
}
.login-card{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:16px;
  padding:40px 32px;
  width:340px;
  text-align:center;
  box-shadow:0 20px 60px rgba(0,0,0,.5);
}
.login-logo{font-size:40px;margin-bottom:8px;}
.login-card h1{font-size:20px;margin:4px 0;}
.login-card input{
  width:100%;
  margin-top:20px;
  padding:12px 14px;
  border-radius:10px;
  border:1px solid var(--border);
  background:#0d1420;
  color:var(--text);
  font-size:14px;
}
.login-card button{
  width:100%;
  margin-top:16px;
  padding:12px;
  border:none;
  border-radius:10px;
  background:linear-gradient(90deg, var(--accent), var(--accent2));
  color:white;
  font-weight:bold;
  cursor:pointer;
  font-size:14px;
}
.error-text{color:var(--red);margin-top:12px;font-size:13px;min-height:16px;}

/* ---------- تخطيط عام ---------- */
.app{display:flex;min-height:100vh;}
.sidebar{
  width:260px;
  flex-shrink:0;
  background:var(--panel);
  border-left:1px solid var(--border);
  display:flex;
  flex-direction:column;
  padding:18px 14px;
  position:sticky;
  top:0;
  height:100vh;
  overflow-y:auto;
}
.brand{display:flex;align-items:center;gap:10px;padding:6px 8px 18px;border-bottom:1px solid var(--border);margin-bottom:12px;}
.brand-badge{
  width:38px;height:38px;border-radius:10px;
  background:linear-gradient(135deg, var(--accent), #7c3aed);
  display:flex;align-items:center;justify-content:center;font-weight:bold;
}
.brand-name{font-weight:bold;font-size:15px;}
.brand-sub{font-size:11px;color:var(--muted);}

.nav-list{flex:1;display:flex;flex-direction:column;gap:2px;overflow-y:auto;}
.nav-group-title{
  font-size:11px;color:var(--muted);margin:14px 8px 6px;letter-spacing:.5px;
}
.nav-item{
  display:flex;align-items:center;gap:10px;
  padding:10px 10px;
  border-radius:9px;
  cursor:pointer;
  color:var(--text);
  font-size:13.5px;
  transition:.15s;
}
.nav-item:hover{background:var(--panel2);}
.nav-item.active{background:var(--accent2);color:#fff;}

.logout-btn{
  margin-top:12px;padding:10px;border-radius:9px;border:1px solid var(--border);
  background:transparent;color:var(--muted);cursor:pointer;font-size:13px;
}
.logout-btn:hover{background:#2a1418;color:var(--red);border-color:#3a1c22;}

/* ---------- المحتوى ---------- */
.content{flex:1;min-width:0;}
.topbar{
  display:flex;align-items:center;justify-content:space-between;
  padding:18px 28px;border-bottom:1px solid var(--border);
  position:sticky;top:0;background:rgba(10,14,24,.9);backdrop-filter:blur(6px);z-index:5;
}
.topbar h2{margin:0;font-size:18px;}
.topbar-actions{display:flex;align-items:center;gap:12px;}
.status-text{font-size:12.5px;color:var(--muted);}
.page-body{padding:24px 28px 60px;max-width:1100px;}

/* ---------- عناصر عامة ---------- */
.btn{
  padding:9px 16px;border-radius:9px;border:1px solid var(--border);
  background:var(--panel2);color:var(--text);cursor:pointer;font-size:13px;font-weight:600;
}
.btn:hover{filter:brightness(1.15);}
.btn-primary{background:linear-gradient(90deg, var(--accent), var(--accent2));border:none;color:#fff;}
.btn-danger{background:linear-gradient(90deg, #ef4444, #b91c1c);border:none;color:#fff;}
.btn-ghost{background:transparent;}
.btn-sm{padding:6px 10px;font-size:12px;border-radius:7px;}

.card{
  background:var(--panel);border:1px solid var(--border);border-radius:14px;
  padding:20px;margin-bottom:18px;
}
.card h3{margin:0 0 4px;font-size:15px;}
.card .card-desc{color:var(--muted);font-size:12.5px;margin-bottom:16px;}

.grid-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:14px;margin-bottom:20px;}
.stat-card{
  background:var(--panel);border:1px solid var(--border);border-radius:14px;padding:18px;
}
.stat-card .num{font-size:26px;font-weight:bold;}
.stat-card .lbl{color:var(--muted);font-size:12.5px;margin-top:4px;}

.field{margin-bottom:16px;}
.field label{display:block;font-size:12.5px;color:var(--muted);margin-bottom:6px;}
.field input[type=text], .field input[type=number], .field input[type=color],
.field textarea, .field select{
  width:100%;padding:10px 12px;border-radius:9px;border:1px solid var(--border);
  background:#0d1420;color:var(--text);font-size:13px;font-family:inherit;
}
.field textarea{min-height:90px;resize:vertical;line-height:1.6;}
.field.field-idlist textarea{min-height:70px;font-family:monospace;direction:ltr;text-align:left;}
.field.field-json textarea{min-height:160px;font-family:monospace;direction:ltr;text-align:left;font-size:12px;}
.field-hint{font-size:11px;color:var(--muted);margin-top:4px;}
.color-row{display:flex;gap:10px;align-items:center;}
.color-row input[type=color]{width:46px;padding:2px;height:38px;}
.checkbox-row{display:flex;align-items:center;gap:8px;}
.checkbox-row input{width:16px;height:16px;}

.section-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:6px;}

.ticket-card{border:1px solid var(--border);border-radius:12px;padding:16px;margin-bottom:14px;background:var(--panel2);}
.ticket-card-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px;}
.ticket-card-head input[type=text]{font-weight:bold;font-size:14px;}
.pill{display:inline-block;padding:3px 10px;border-radius:20px;font-size:11px;background:#182238;color:var(--muted);}

.log-box{
  background:#050810;border:1px solid var(--border);border-radius:10px;padding:14px;
  font-family:monospace;font-size:12px;height:340px;overflow-y:auto;white-space:pre-wrap;line-height:1.6;
}

.token-field{display:flex;gap:10px;}
.token-field input{flex:1;}

.toast{
  position:fixed;bottom:24px;left:24px;background:var(--panel2);border:1px solid var(--border);
  padding:12px 18px;border-radius:10px;font-size:13px;z-index:50;box-shadow:0 10px 30px rgba(0,0,0,.4);
}
.toast.success{border-color:#1d5c34;color:#4ade80;}
.toast.error{border-color:#5c1d1d;color:#f87171;}

.add-btn{
  display:flex;align-items:center;justify-content:center;gap:8px;
  padding:10px;border-radius:9px;border:1px dashed var(--border);
  background:transparent;color:var(--muted);cursor:pointer;width:100%;font-size:13px;
}
.add-btn:hover{color:var(--accent);border-color:var(--accent);}

@media (max-width:900px){
  .app{flex-direction:column;}
  .sidebar{width:100%;height:auto;position:relative;}
}
