/* ألوان برق الإمارات */
:root {
  --red: #b5202e;
  --red-dark: #8f1824;
  --ink: #2b2b2b;
  --slate: #3d3f42;
  --muted: #6b6f75;
  --line: #e4e1dc;
  --bg: #f6f4f1;
  --card: #ffffff;
  --ok: #1e7a4c;
  --ok-bg: #e5f4ec;
  --err: #b5202e;
  --err-bg: #fbe9eb;
  --wait-bg: #fff4dc;
  --wait: #8a5a00;
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "IBM Plex Sans Arabic", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
}
h1 { font-size: 1.35rem; margin: 0 0 4px; }
h2 { font-size: 1.05rem; margin: 0; }
.muted { color: var(--muted); margin: 0; }
.small { font-size: .85rem; }

/* ---- الشعار ---- */
.brand { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.brand-inline { flex-direction: row; align-items: baseline; gap: 10px; }
.brand-mark {
  background: var(--red); color: #fff; font-weight: 700;
  padding: 2px 14px; border-radius: 6px; font-size: 1.4rem;
}
.brand-sub { color: var(--slate); font-weight: 500; }

/* ---- الأزرار ---- */
.btn {
  font: inherit; font-weight: 600; border: 1px solid transparent; cursor: pointer;
  border-radius: 8px; padding: 9px 18px; text-decoration: none; display: inline-block;
  transition: background .15s, border-color .15s;
}
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); }
.btn-ghost { background: transparent; color: var(--slate); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--slate); }
.btn-sm { padding: 6px 14px; font-size: .9rem; }
.btn-block { width: 100%; }

/* ---- صفحة الدخول ---- */
.login-page { background: linear-gradient(180deg, var(--slate) 0 38%, var(--bg) 38%); min-height: 100vh; }
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; }
.login-card {
  background: var(--card); width: 100%; max-width: 380px; border-radius: var(--radius);
  padding: 32px 28px; box-shadow: 0 10px 30px rgba(0,0,0,.12); border-top: 5px solid var(--red);
}
.login-card .brand { margin-bottom: 24px; }
.login-card label { display: block; font-weight: 500; margin: 14px 0 6px; }
.login-card input {
  width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff;
}
.login-card input:focus { outline: 2px solid var(--red); outline-offset: 0; border-color: var(--red); }
.login-card .btn { margin-top: 22px; }
.form-error { color: var(--err); background: var(--err-bg); padding: 8px 12px; border-radius: 8px; margin: 14px 0 0; font-size: .9rem; }
.login-foot { color: var(--muted); font-size: .8rem; letter-spacing: .05em; margin-top: 18px; }

/* ---- لوحة التحكم ---- */
.topbar { background: var(--slate); border-bottom: 4px solid var(--red); }
.topbar-inner { max-width: 1100px; margin: 0 auto; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; }
.topbar .brand-sub, .topbar-user { color: #fff; }
.topbar-user { display: flex; align-items: center; gap: 12px; }
.topbar .btn-ghost { color: #fff; border-color: rgba(255,255,255,.35); }

.container { max-width: 1100px; margin: 0 auto; padding: 28px 16px 60px; }
section + section { margin-top: 40px; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
section > h1 { margin-bottom: 16px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.status-card .result { min-height: 48px; font-size: .92rem; }
.status-card .btn { align-self: flex-start; margin-top: auto; }

.badge { font-size: .78rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.badge-idle { background: #eeece8; color: var(--muted); }
.badge-wait { background: var(--wait-bg); color: var(--wait); }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-err { background: var(--err-bg); color: var(--err); }

.card-soon { background: transparent; border-style: dashed; }
.phase { font-size: .75rem; font-weight: 600; color: var(--red); }

@media (max-width: 520px) {
  .brand-inline .brand-sub { display: none; }
  .section-head .btn { width: 100%; }
}
