:root {
  --bg: #0b0f14;
  --bg-raised: #121822;
  --bg-sunken: #0d131b;
  --border: #1e2835;
  --border-strong: #2b3949;
  --text: #e6edf5;
  --text-dim: #93a4b8;
  --text-faint: #64748b;
  --accent: #38bdf8;
  --accent-ink: #052330;

  --critical: #f87171;
  --high: #fb923c;
  --medium: #fbbf24;
  --low: #60a5fa;
  --ok: #34d399;
  --unknown: #94a3b8;

  --radius: 12px;
  --shell: 800px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Noto Sans Arabic", "Noto Sans Hebrew", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(1200px 500px at 50% -10%, rgba(56, 189, 248, 0.10), transparent 70%);
  pointer-events: none;
}

.shell { position: relative; max-width: var(--shell); margin: 0 auto; padding: 48px 20px 90px; }

/* ── الترويسة ومبدّل اللغة ─────────────────────────────────────── */
.langbar { display: flex; gap: 4px; justify-content: center; margin-bottom: 26px; flex-wrap: wrap; }
.langbar button {
  background: none; border: 1px solid transparent; color: var(--text-faint);
  font: inherit; font-size: 13px; padding: 4px 11px; border-radius: 999px; cursor: pointer;
}
.langbar button[aria-current="true"] { color: var(--text); border-color: var(--border-strong); background: var(--bg-raised); }

.masthead { text-align: center; margin-bottom: 32px; }
.masthead h1 { font-size: clamp(28px, 5vw, 40px); line-height: 1.2; margin: 0 0 12px; letter-spacing: -0.02em; }
.masthead p { margin: 0 auto; max-width: 58ch; color: var(--text-dim); font-size: 15px; }

/* ── نموذج الفحص ───────────────────────────────────────────────── */
.scanbox {
  display: flex; gap: 8px; background: var(--bg-sunken);
  border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 8px;
}
.scanbox:focus-within { border-color: var(--accent); }
.scanbox input {
  flex: 1; min-width: 0; background: none; border: none; outline: none; color: var(--text);
  font: inherit; font-size: 17px; padding: 10px 12px; direction: ltr; text-align: start;
}
.scanbox input::placeholder { color: var(--text-faint); }
.scanbox button {
  background: var(--accent); color: var(--accent-ink); border: none; border-radius: 8px;
  font: inherit; font-weight: 650; font-size: 15px; padding: 10px 22px; cursor: pointer; white-space: nowrap;
}
.scanbox button:disabled { opacity: 0.55; cursor: progress; }

.formerror { margin: 10px 2px 0; color: var(--critical); font-size: 14px; }
.disclaimer { margin-top: 14px; color: var(--text-faint); font-size: 12.5px; text-align: center; }
.disclaimer.privacy { margin-top: 5px; color: var(--ok); }

/* ── البطاقات ──────────────────────────────────────────────────── */
.card {
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-top: 20px;
}
.note { color: var(--text-faint); font-size: 13px; margin: 6px 0 0; }
/* داخلَ شريطِ الانتظار: لا فراغَ بين السطرِ العريضِ والتلميحِ تحته */
#progress .note { margin-top: 2px; }

/* ── الدرجتان ──────────────────────────────────────────────────── */
.grades { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 20px; }

.pillar {
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; display: flex; gap: 16px; align-items: center;
}
.grade {
  flex: none; width: 74px; height: 74px; border-radius: 16px; display: grid; place-items: center;
  font-size: 38px; font-weight: 700; line-height: 1; border: 2px solid currentColor;
}
.grade[data-grade="A"] { color: var(--ok); }
.grade[data-grade="B"] { color: #a3e635; }
.grade[data-grade="C"] { color: var(--medium); }
.grade[data-grade="D"] { color: var(--high); }
.grade[data-grade="F"] { color: var(--critical); }

.pillar-name { font-size: 16px; font-weight: 600; }
.pillar-score { color: var(--text-faint); font-size: 13px; }
.tallies { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.tally { font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; }
.tally[data-sev="critical"] { color: var(--critical); }
.tally[data-sev="high"] { color: var(--high); }
.tally[data-sev="medium"] { color: var(--medium); }
.tally[data-sev="low"] { color: var(--low); }
.tally[data-sev="ok"] { color: var(--ok); }
.tally[data-sev="unknown"] { color: var(--unknown); }

.domainbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: baseline;
  justify-content: space-between; margin-top: 24px;
}
.domainbar .name { font-size: 20px; font-weight: 600; direction: ltr; unicode-bidi: isolate; word-break: break-all; }
.domainbar .meta { color: var(--text-faint); font-size: 13px; }

/* ── مجموعات النتائج ───────────────────────────────────────────── */
.grouphead {
  margin: 30px 0 10px; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-faint); font-weight: 600;
}

/* ── بطاقة نتيجة واحدة ─────────────────────────────────────────── */
.finding {
  background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; margin-top: 12px; border-inline-start: 3px solid var(--unknown);
}
.finding[data-sev="critical"] { border-inline-start-color: var(--critical); }
.finding[data-sev="high"] { border-inline-start-color: var(--high); }
.finding[data-sev="medium"] { border-inline-start-color: var(--medium); }
.finding[data-sev="low"] { border-inline-start-color: var(--low); }
.finding[data-sev="ok"] { border-inline-start-color: var(--ok); }

.finding-head { display: flex; gap: 12px; align-items: baseline; justify-content: space-between; }
.finding-title { font-size: 16px; font-weight: 600; margin: 0; }
.sevtag { flex: none; font-size: 12px; padding: 2px 9px; border-radius: 999px; border: 1px solid currentColor; }
.sevtag[data-sev="critical"] { color: var(--critical); }
.sevtag[data-sev="high"] { color: var(--high); }
.sevtag[data-sev="medium"] { color: var(--medium); }
.sevtag[data-sev="low"] { color: var(--low); }
.sevtag[data-sev="ok"] { color: var(--ok); }
.sevtag[data-sev="unknown"] { color: var(--unknown); }

.block { margin-top: 12px; }
.block-label {
  font-size: 11.5px; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--text-faint); font-weight: 600; margin-bottom: 3px;
}
.block-body { font-size: 14.5px; color: var(--text-dim); margin: 0; }

.block.risk .block-label { color: var(--high); }
.block.risk .block-body { color: #f3d9c4; }

.evidence {
  display: block; background: var(--bg-sunken); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px; color: var(--text-dim); direction: ltr; text-align: start;
  overflow-x: auto; white-space: pre-wrap; word-break: break-all;
}

.fixlock {
  margin-top: 12px; padding-top: 11px; border-top: 1px dashed var(--border-strong);
  font-size: 13.5px; color: var(--accent);
}

/* ── بوابة التواصل ─────────────────────────────────────────────── */
.gate { border-color: var(--accent); background: linear-gradient(180deg, rgba(56,189,248,0.09), rgba(56,189,248,0.02)); }
.gate h2 { margin: 0 0 8px; font-size: 21px; }
.gate p { margin: 0 0 16px; color: var(--text-dim); font-size: 15px; }
.gate strong { color: var(--text); }
.contacts { display: flex; flex-wrap: wrap; gap: 10px; }
.contacts a {
  display: inline-flex; align-items: center; gap: 7px; background: var(--accent); color: var(--accent-ink);
  text-decoration: none; font-weight: 650; font-size: 15px; padding: 11px 18px; border-radius: 9px;
}
.contacts a.secondary { background: transparent; color: var(--text); border: 1px solid var(--border-strong); }

/* ── أقسام مطويّة ──────────────────────────────────────────────── */
details { margin-top: 20px; }
details > summary { cursor: pointer; color: var(--text-dim); font-size: 14px; list-style: none; padding: 6px 0; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "▸ "; color: var(--text-faint); }
details[open] > summary::before { content: "▾ "; }

.simple { list-style: none; margin: 0; padding: 0; }
.simple li { display: flex; gap: 11px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--border); font-size: 14.5px; }
.simple li:first-child { border-top: none; }
.dot { flex: none; width: 9px; height: 9px; border-radius: 50%; margin-top: 7px; background: var(--unknown); }
.dot[data-sev="ok"] { background: var(--ok); }

.textbtn {
  background: none; border: none; color: var(--accent); font: inherit; font-size: 14px;
  cursor: pointer; padding: 0; margin-top: 22px;
}

.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

@media (max-width: 620px) {
  .shell { padding: 32px 15px 64px; }
  .scanbox { flex-direction: column; }
  .scanbox button { width: 100%; }
  .grades { grid-template-columns: 1fr; }
  .finding-head { flex-direction: column; gap: 6px; }
  .sevtag { align-self: flex-start; }
}
