/* اللوحة المركزية لكل أماكن بهجة — نفس هوية لوحة المرشد (فيروزي + كحلي + برتقالي) */
@font-face { font-family: "Tajawal"; font-weight: 400; font-display: swap; src: url("fonts/tajawal-arabic-400.woff2") format("woff2"); }
@font-face { font-family: "Tajawal"; font-weight: 700; font-display: swap; src: url("fonts/tajawal-arabic-700.woff2") format("woff2"); }
@font-face { font-family: "Tajawal"; font-weight: 800; font-display: swap; src: url("fonts/tajawal-arabic-800.woff2") format("woff2"); }
@font-face { font-family: "Cairo"; font-weight: 800; font-display: swap; src: url("fonts/cairo-arabic-800.woff2") format("woff2"); }

:root {
  --teal: #1ca7b2; --teal-dark: #13838c; --navy: #0f3380; --navy-deep: #0b2256; --orange: #f3940f; --gold: #f4bb4a;
  --bg: #f1f6f9; --panel: #ffffff; --panel2: #f5f9fb; --border: #e3ecf1; --text: #16233f; --muted: #51617a;
  --ok: #0e9f6e; --warn: #d97706; --bad: #dc2626; --violet: #7c3aed;
  --shadow: 0 6px 24px rgba(15, 51, 128, 0.08);
}
:root[data-theme="dark"] {
  --bg: #0b1426; --panel: #12203a; --panel2: #172846; --border: #24385c; --text: #e6edf7; --muted: #9fb0c8;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1426; --panel: #12203a; --panel2: #172846; --border: #24385c; --text: #e6edf7; --muted: #9fb0c8;
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font-family: "Tajawal", "Segoe UI", Tahoma, Arial, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.6; }
h1, h2, h3 { font-family: "Cairo", "Tajawal", sans-serif; margin: 0; }
a { color: var(--teal); }
button, input, select, textarea { font: inherit; color: inherit; }

header {
  background: linear-gradient(135deg, var(--navy-deep) 0%, var(--navy) 55%, var(--teal-dark) 100%);
  border-bottom: 3px solid var(--orange); color: #fff; padding: 10px 18px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 40px; height: 40px; border-radius: 10px; background: #fff; padding: 2px; }
.brand h1 { font-size: 18px; }
.brand small { display: block; font-size: 12px; opacity: .8; }
nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
nav a { color: #fff; text-decoration: none; padding: 6px 12px; border-radius: 10px; font-weight: 700; font-size: 14px; opacity: .85; }
nav a.active, nav a:hover { background: rgba(255, 255, 255, .16); opacity: 1; }
.who { font-size: 13px; display: flex; gap: 8px; align-items: center; }

main { max-width: 1240px; margin: 0 auto; padding: 18px 16px 60px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 14px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.card-h h2 { font-size: 17px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.kpi { background: var(--panel2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.kpi .v { font-family: "Cairo", sans-serif; font-size: 22px; font-weight: 800; }
.kpi .l { font-size: 12.5px; color: var(--muted); }

.btn { border: 1px solid var(--border); background: var(--panel); border-radius: 10px; padding: 6px 14px; cursor: pointer; font-weight: 700; font-size: 14px; }
.btn:hover { border-color: var(--teal); }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.orange { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 3px 10px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: default; }
header .btn { background: rgba(255, 255, 255, .12); color: #fff; border-color: rgba(255, 255, 255, .3); }

.pill { display: inline-block; font-size: 12px; font-weight: 800; padding: 1px 9px; border-radius: 10px; background: var(--panel2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.p-ok { background: rgba(14, 159, 110, .12); color: var(--ok); border-color: transparent; }
.p-bad { background: rgba(220, 38, 38, .1); color: var(--bad); border-color: transparent; }
.p-warn { background: rgba(217, 119, 6, .12); color: var(--warn); border-color: transparent; }
.p-info { background: rgba(28, 167, 178, .12); color: var(--teal-dark); border-color: transparent; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: right; padding: 8px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12.5px; color: var(--muted); font-weight: 800; background: var(--panel2); position: sticky; top: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--panel2); }
.table-wrap { overflow-x: auto; }

.place { cursor: pointer; transition: transform .1s; }
.place:hover { transform: translateY(-2px); border-color: var(--teal); }
.place h3 { font-size: 17px; margin-bottom: 4px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #9ca3af; margin-inline-end: 6px; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(14, 159, 110, .18); }

.bar { height: 7px; background: var(--border); border-radius: 4px; overflow: hidden; min-width: 70px; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, #10b981, #059669); }

.ev { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: 14px; }
.ev .t { color: var(--muted); font-size: 12.5px; white-space: nowrap; min-width: 92px; }
.lv-violation { border-inline-start: 3px solid var(--bad); padding-inline-start: 8px; }
.lv-warning { border-inline-start: 3px solid var(--warn); padding-inline-start: 8px; }
.lv-info { border-inline-start: 3px solid var(--teal); padding-inline-start: 8px; }

.form { display: grid; gap: 10px; }
.form label { display: grid; gap: 4px; font-size: 13.5px; font-weight: 700; }
.form label.chk { display: flex; align-items: center; gap: 8px; }
.form label.chk input { width: auto; margin: 0; }
.form input, .form select, .form textarea { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; background: var(--panel); }
.card td > input:not([type=checkbox]) { width: 100%; box-sizing: border-box; border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; background: var(--panel); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; max-height: 220px; overflow: auto; padding: 6px; border: 1px solid var(--border); border-radius: 10px; }
.checks label { font-weight: 400; display: flex; gap: 6px; align-items: center; }

.modal-bg { position: fixed; inset: 0; background: rgba(11, 34, 86, .55); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal { background: var(--panel); border-radius: 16px; padding: 18px 20px; width: 100%; max-width: 560px; max-height: 90vh; overflow: auto; border: 1px solid var(--border); }
.modal h2 { font-size: 17px; margin-bottom: 12px; }

.login { max-width: 380px; margin: 60px auto; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--navy-deep); color: #fff; padding: 10px 18px; border-radius: 12px; z-index: 200; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
.toast.err { background: var(--bad); }
pre.report { white-space: pre-wrap; font-family: inherit; background: var(--panel2); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; margin: 0; }
.shots { display: flex; gap: 8px; flex-wrap: wrap; }
.shots img { width: 220px; border-radius: 10px; border: 1px solid var(--border); cursor: zoom-in; }
.code-box { font-family: Consolas, monospace; font-size: 22px; font-weight: 800; letter-spacing: 2px; background: var(--panel2); border: 2px dashed var(--teal); border-radius: 12px; padding: 10px; text-align: center; direction: ltr; }

@media (max-width: 640px) {
  header { padding: 8px 12px; }
  nav { order: 3; flex-basis: 100%; overflow-x: auto; flex-wrap: nowrap; }
  main { padding: 12px 10px 40px; }
  .shots img { width: 100%; }
}

/* القائمة المختصرة: «📚 المحتوى» و«⚙️ الإدارة» */
.nav-more { position: relative; }
.nav-more > summary { list-style: none; cursor: pointer; color: #fff; padding: 6px 12px; border-radius: 10px; font-weight: 700; font-size: 14px; opacity: .85; white-space: nowrap; }
.nav-more > summary::-webkit-details-marker { display: none; }
.nav-more > summary::after { content: " ▾"; font-size: 11px; }
.nav-more[open] > summary, .nav-more.has-active > summary, .nav-more > summary:hover { background: rgba(255, 255, 255, .16); opacity: 1; }
.nav-menu { position: absolute; top: calc(100% + 6px); inset-inline-start: 0; z-index: 50; min-width: 210px; display: flex; flex-direction: column; gap: 2px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 6px; box-shadow: 0 14px 34px rgba(0, 0, 0, .22); }
.nav-menu a { color: var(--text); opacity: 1; padding: 8px 12px; }
.nav-menu a.active, .nav-menu a:hover { background: var(--panel2); }
/* أدوات المكان في قائمة واحدة */
.place-menu { position: relative; display: inline-block; margin-top: 10px; }
.place-menu > summary { list-style: none; }
.place-menu > summary::-webkit-details-marker { display: none; }
.place-menu .pm-list { position: absolute; z-index: 40; top: calc(100% + 4px); inset-inline-start: 0; min-width: 230px; display: flex; flex-direction: column; gap: 4px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 6px; box-shadow: 0 14px 34px rgba(0, 0, 0, .22); }
.place-menu .pm-list .btn { justify-content: flex-start; width: 100%; text-align: start; }
@media (max-width: 700px) {
  .nav-menu { position: fixed; inset: auto 8px 8px 8px; top: auto; }
}

/* صفوف عناوين المجموعات (الصف الدراسي / المكان) في الجداول */
table.grouped tr.gh td { background: var(--panel2); font-weight: 800; padding: 7px 10px; }
.checks label { white-space: nowrap; }
