:root{
  --bg1:#eff6ff; --bg2:#ecfdf5; --card:#fff; --text:#0f172a; --muted:#64748b;
  --blue:#2563eb; --green:#16a34a; --red:#dc2626; --line:#e5e7eb;
}

*{box-sizing:border-box}

body{
  margin:0;
  font-family:Tahoma,Arial,sans-serif;
  background:linear-gradient(135deg,var(--bg1),var(--bg2));
  color:var(--text);
  min-height:100vh;
}

/* ===== أغلفة الصفحات ===== */
.auth-wrap,.dash-wrap{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:18px;
}

.card{
  width:min(470px,100%);
  background:rgba(255,255,255,.92);
  border:1px solid rgba(255,255,255,.8);
  border-radius:26px;
  padding:22px;
  box-shadow:0 24px 70px rgba(15,23,42,.14);
  backdrop-filter:blur(12px);
}

.dash-card{ width:min(1180px,100%); }

h1{ margin:0 0 10px; font-size:28px; }
h2{ font-size:18px; }

.muted{ color:var(--muted); font-size:14px; line-height:1.8; }

/* ===== عناصر النماذج ===== */
input,button,select{
  width:100%;
  border-radius:15px;
  border:1px solid var(--line);
  padding:13px 14px;
  font-family:inherit;
  font-size:16px;
  margin:7px 0;
  -webkit-appearance:none;
}

button,.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  text-decoration:none;
  border:0;
  background:var(--blue);
  color:#fff;
  font-weight:800;
  cursor:pointer;
  border-radius:12px;
  min-height:44px;
}

.btn-green{ background:var(--green); }
.btn-red{ color:#ef4444; border:1px solid #ff6b6b; background:#fff; }
.btn-light{ background:#f8fafc; color:#0f172a; border:1px solid var(--line); }
.btn-blue{ background:var(--blue); color:#fff; }
.btn-outline{ padding:12px 20px; }

/* ===== الشريط العلوي (لغة + عنوان + إجراءات) ===== */
.topline{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  margin-bottom:14px;
}
.topline h1{ margin:0; flex:1 1 auto; text-align:center; min-width:0; }

.langs{ display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.langs a,.langs a.flag{
  display:inline-flex; align-items:center; justify-content:center;
  width:48px; height:44px;
  border:1px solid #dce5f2; border-radius:12px;
  text-decoration:none; background:#fff; font-size:22px;
  flex-shrink:0;
}
.langs a.active{ border-color:#2563eb; box-shadow:0 0 0 2px rgba(37,99,235,.10); }

.head-actions{ display:flex; gap:10px; flex-wrap:wrap; }
.head-actions .btn{ flex:1 1 auto; white-space:nowrap; }

/* ===== تنبيهات ===== */
.alert{ background:#fff7ed; border:1px solid #fed7aa; color:#9a3412; border-radius:14px; padding:12px; margin:10px 0; font-size:14px; line-height:1.7; }
.alert.ok{ background:#ecfdf5; border-color:#bbf7d0; color:#166534; }

/* ===== إحصائيات أعلى البوابة ===== */
.stats{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
  margin:14px 0;
}
.stat{
  background:#fff;
  border:1px solid var(--line);
  border-radius:18px;
  padding:14px;
  min-width:0;
}
.num{ font-size:22px; font-weight:900; color:var(--blue); word-break:break-word; }

/* ===== قائمة البرامج ===== */
.programs{
  display:grid;
  grid-template-columns:1fr;
  gap:10px;
  margin-top:12px;
}

.program{
  display:grid;
  grid-template-columns:auto 1fr auto;
  align-items:center;
  gap:14px;
  background:#f8fafc;
  border:1px solid var(--line);
  border-radius:18px;
  padding:13px;
}

.program-icon{
  width:46px; height:46px;
  border-radius:13px;
  display:flex; align-items:center; justify-content:center;
  background:transparent!important; box-shadow:none!important; border:0!important;
  font-size:24px;
  flex-shrink:0;
}

.program-info{ text-align:right; min-width:0; }
.program-info .name{ font-weight:900; overflow-wrap:break-word; }

.btn-open{
  border:1px solid #2563eb; color:#2563eb; background:#fff;
  padding:10px 18px; width:auto; flex-shrink:0;
}
.btn-open:hover{ background:#eff6ff; }

/* =========================================================
   نقاط التوقف للموبايل والشاشات الصغيرة
   ========================================================= */

@media (max-width:768px){
  .dash-card{ padding:18px; }
}

@media (max-width:600px){
  body{ font-size:15px; }
  .auth-wrap,.dash-wrap{ padding:12px; align-items:flex-start; padding-top:24px; }
  .card{ padding:16px; border-radius:20px; }
  h1{ font-size:21px; }
  h2{ font-size:16px; }

  .topline{ flex-direction:column; align-items:stretch; }
  .topline h1{ order:1; text-align:center; }
  .langs{ order:2; justify-content:center; }
  .head-actions{ order:3; flex-direction:column; }
  .head-actions .btn{ width:100%; }

  .stats{ grid-template-columns:1fr; }

  .program{ grid-template-columns:1fr; text-align:center; gap:8px; }
  .program-icon{ margin:0 auto; }
  .program-info{ text-align:center; }
  .btn-open{ width:100%; order:3; }
}

@media (max-width:380px){
  .card{ padding:12px; border-radius:16px; }
  h1{ font-size:19px; }
  .langs a,.langs a.flag{ width:42px; height:40px; font-size:19px; }
}
