@import url("https://fonts.googleapis.com/css2?family=Amiri&family=IBM+Plex+Sans+Arabic:wght@400;600;700&display=swap");
:root { --bg: #f6f1e6; --panel: #fff; --ink: #1d2a2c; --ink-2: #66706f; --line: #e2d8c3; --accent: #0e5a43; --bad: #b3261e; --gold: #b08a35; }
* { box-sizing: border-box; }
body { margin: 0; font-family: "IBM Plex Sans Arabic", Tahoma, sans-serif; background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.6; }
a { color: var(--accent); }
h1 { font-family: Amiri, serif; font-size: 28px; margin: 6px 0 14px; }
h1 small { font-size: 15px; color: var(--ink-2); font-family: inherit; }
h2 { font-size: 16px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 16px 0 4px; }
.muted { color: var(--ink-2); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.num { text-align: center; white-space: nowrap; }
.quran { font-family: Amiri, serif; font-size: 16px; }

.bar { display: flex; align-items: center; gap: 18px; padding: 10px 22px; background: linear-gradient(90deg, #0b4535, #12684e); color: #fdf8ea; flex-wrap: wrap; }
.bar a { color: #e6efe9; text-decoration: none; }
.bar nav { display: flex; gap: 4px; flex-wrap: wrap; }
.bar nav a { padding: 4px 11px; border-radius: 7px; }
.bar nav a.on, .bar nav a:hover { background: rgba(255, 255, 255, .15); color: #fff; }
.grow { flex: 1; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 22px; }

.btn { display: inline-block; border: 1px solid var(--accent); background: var(--accent); color: #fff; padding: 7px 15px; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.bad { background: var(--bad); border-color: var(--bad); }
.btn.small { padding: 3px 10px; font-size: 12px; }
.btn:hover { filter: brightness(1.08); }

.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.alert.ok { background: #e3f3ea; border: 1px solid #a9d8bd; }
.alert.bad { background: #fbe9e7; border: 1px solid #efb1a8; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.stat b { display: block; font-size: 30px; font-family: Amiri, serif; color: var(--accent); line-height: 1.1; }
.stat span { color: var(--ink-2); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.box { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; }
.badge { display: inline-flex; gap: 5px; align-items: center; padding: 1px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
    background: color-mix(in srgb, var(--c) 14%, #fff); color: color-mix(in srgb, var(--c) 80%, #000); border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); white-space: nowrap; }

.head-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters input { flex: 1; min-width: 200px; }
input, select, textarea { font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent); border-color: var(--accent); }
.tbl { width: 100%; border-collapse: collapse; background: var(--panel); }
.tbl.list { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.tbl th { background: #efe7d6; text-align: start; padding: 8px 10px; font-size: 12.5px; }
.tbl td { padding: 7px 10px; border-top: 1px solid var(--line); vertical-align: middle; }
.tbl tr:hover td { background: #fbf8f1; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; width: 100%; }
.cats-edit .inline-form + .inline-form { width: auto; margin-top: 4px; }

.form { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; }
.form.narrow { max-width: 460px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 13px; margin-bottom: 12px; }
.form label input, .form label select, .form label textarea { font-weight: 400; }
.form .row { display: flex; gap: 12px; flex-wrap: wrap; }
.form .row > label { min-width: 140px; }
.form label.inline { flex-direction: row; align-items: center; font-weight: 400; margin: 0; }
.checks-row { display: flex; flex-wrap: wrap; gap: 6px 18px; }
fieldset { border: 1px solid var(--line); border-radius: 9px; padding: 10px 14px; margin: 0 0 14px; }
legend { font-weight: 700; font-size: 13px; padding: 0 6px; color: var(--gold); }
.actions { margin-top: 8px; }
.danger { margin-top: 16px; text-align: end; }
ul.plain { margin: 0; padding-inline-start: 18px; }

/* منتقي متعدد */
.picked { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.picked li { display: flex; gap: 8px; align-items: center; background: #f7f2e7; border-radius: 7px; padding: 4px 8px; }
.picked li .lb { flex: 1; }
.picked li .lb small { color: var(--ink-2); margin-inline-start: 6px; }
.picked li input { width: 220px; padding: 3px 8px; }
.picked li button { border: 0; background: none; color: var(--bad); font-size: 18px; cursor: pointer; line-height: 1; }
.picker-search { position: relative; }
.picker-search input { width: 100%; }
.picker-opts { position: absolute; z-index: 10; top: 100%; inset-inline: 0; background: #fff; border: 1px solid var(--line); border-radius: 8px; max-height: 260px; overflow: auto; box-shadow: 0 8px 24px rgba(0, 0, 0, .12); }
.picker-opts button { display: block; width: 100%; text-align: start; border: 0; background: none; padding: 6px 10px; cursor: pointer; font: inherit; }
.picker-opts button:hover, .picker-opts button.active { background: #efe7d6; }
.picker-opts small { color: var(--ink-2); margin-inline-start: 6px; }

/* صفحة الدخول والتثبيت */
body.auth { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.auth-box { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 26px 28px; width: 100%; max-width: 380px; box-shadow: 0 10px 40px rgba(0, 0, 0, .08); }
.auth-box.wide { max-width: 560px; }
.auth-box label { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; font-weight: 600; }
.checks { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.checks li { padding: 2px 10px; border-radius: 999px; font-size: 12px; }
.checks .ok { background: #e3f3ea; }
.checks .bad { background: #fbe9e7; }
.actions a + a { margin-inline-start: 6px; }

@media (max-width: 760px) {
    .grid2 { grid-template-columns: 1fr; }
    .picked li { flex-wrap: wrap; }
    .picked li input { width: 100%; }
    .inline-form { flex-wrap: wrap; }
}

/* خرائط الإدارة */
.admin-map { height: 340px; border: 1px solid var(--line); border-radius: 10px; margin: 6px 0 14px; z-index: 0; }
.admin-map.tall { height: 420px; }
.leaflet-container { font-family: inherit; }
