:root {
  --panel: rgba(16, 24, 44, 0.9);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f1f4fb;
  --muted: #9aa6c2;
  --accent: #ff7a59;
  --accent-2: #2fd0b5;
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "Tajawal", "Geeza Pro", "Segoe UI", Tahoma, sans-serif;
  color: var(--text);
  background: #0e1b3a;
  overflow: hidden;
}
#map { position: fixed; inset: 0; }

.panel {
  position: fixed;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 5;
}

/* الشريط الجانبي */
#sidebar {
  inset-block: 14px;
  inset-inline-start: 14px;
  width: 340px;
  max-width: calc(100vw - 28px);
  padding: 18px 16px;
  overflow-y: auto;
  transition: transform 0.25s ease;
}
body.closed #sidebar { transform: translateX(calc(100% + 30px)); }
html[dir="ltr"] body.closed #sidebar { transform: translateX(calc(-100% - 30px)); }

.brand { text-align: center; margin-bottom: 14px; }
.brand-mark { font-size: 34px; color: var(--accent); line-height: 1; }
.brand h1 { font-size: 21px; font-weight: 800; margin: 6px 0 2px; }
.sub { margin: 0; color: var(--muted); font-size: 13px; }

.row { display: flex; gap: 8px; }
.btn {
  flex: 1;
  font: inherit; font-weight: 700; font-size: 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 12px;
  cursor: pointer;
}
.btn:hover { background: rgba(255, 255, 255, 0.16); }
.btn.ghost { width: 100%; background: transparent; color: var(--muted); }
.btn.primary { background: var(--accent); border-color: transparent; color: #1a0f0a; }
.btn.primary.on { background: var(--accent-2); }

.search { position: relative; margin-top: 10px; }
#search {
  width: 100%;
  font: inherit; font-size: 15px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 16px;
  outline: none;
}
#search:focus { border-color: var(--accent); }
#results {
  list-style: none; margin: 6px 0 0; padding: 4px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--line);
  border-radius: 12px;
  max-height: 260px; overflow-y: auto;
}
#results li {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 8px; cursor: pointer; font-size: 14px;
}
#results li:hover { background: rgba(255, 255, 255, 0.1); }
#results small { color: var(--muted); margin-inline-start: auto; white-space: nowrap; }
#results .empty { color: var(--muted); cursor: default; }

.tip { color: var(--muted); font-size: 12.5px; text-align: center; margin: 10px 0 4px; }

.section-title { font-size: 19px; font-weight: 800; margin: 18px 0 4px; }
.group-title {
  font-size: 13px; font-weight: 800; letter-spacing: 0.02em;
  margin: 12px 0 4px; cursor: pointer;
}
.group-title:hover { text-decoration: underline; }
.cat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 8px; }
.cat {
  display: flex; align-items: center; gap: 6px;
  font: inherit; font-size: 13px; font-weight: 500;
  color: var(--text); background: none; border: 0;
  padding: 4px 6px; border-radius: 8px; cursor: pointer;
  text-align: start; min-width: 0;
}
.cat:hover { background: rgba(255, 255, 255, 0.08); }
.cat .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat .count { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.cat.off { opacity: 0.38; }
.cat.off .name { text-decoration: line-through; }
.cat.done .count { color: var(--accent-2); }

/* لوحة التقدّم */
#progress {
  top: 14px; inset-inline-end: 14px;
  width: 250px; padding: 16px;
}
#progress h2 { font-size: 17px; margin: 0 0 10px; }
.bar { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
#barFill { display: block; height: 100%; width: 0; background: var(--accent-2); transition: width 0.3s; }
#progressText { margin: 8px 0 10px; font-size: 14px; color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 10px; cursor: pointer; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }

/* أدوات التحكم */
#controls {
  position: fixed; bottom: 18px; inset-inline-end: 14px;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end; z-index: 5;
}
.seg {
  display: flex; padding: 4px; gap: 2px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
}
.seg button {
  font: inherit; font-weight: 700; font-size: 13.5px;
  color: var(--muted); background: none; border: 0;
  padding: 7px 16px; border-radius: 999px; cursor: pointer;
}
.seg button.on { background: #fff; color: #10182c; }

.fab {
  position: fixed; z-index: 6;
  width: 40px; height: 40px; border-radius: 50%;
  font-size: 18px; color: var(--text);
  background: var(--panel); border: 1px solid var(--line); cursor: pointer;
}
.fab.edge { top: 22px; inset-inline-start: 366px; transition: inset-inline-start 0.25s ease; }
body.closed .fab.edge { inset-inline-start: 14px; }

#demoBadge {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  z-index: 5; font-size: 13px; padding: 7px 16px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line); color: var(--muted);
  white-space: nowrap;
}

/* أسماء المناطق */
.region-label {
  font-weight: 800; font-size: 22px; color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
  pointer-events: none; white-space: nowrap; opacity: 0.92;
}

/* النافذة المنبثقة */
.maplibregl-popup-content {
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px; min-width: 230px;
  font-family: inherit; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}
.maplibregl-popup-tip { display: none; }
.maplibregl-popup-close-button { color: var(--muted); font-size: 20px; inset-inline-end: 6px; right: auto; left: auto; }
.pop h3 { margin: 0 0 6px; font-size: 17px; padding-inline-end: 18px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 700;
  padding: 3px 10px; border-radius: 999px; color: #10182c;
}
.pop .region { color: var(--muted); font-size: 12.5px; margin-inline-start: 6px; }
.pop p { margin: 10px 0 12px; font-size: 14px; line-height: 1.6; color: #d5dcee; }
.pop .btn { width: 100%; }

@media (max-width: 760px) {
  #sidebar { width: calc(100vw - 28px); inset-block: 70px 14px; }
  .fab.edge, body.closed .fab.edge { inset-inline-start: 14px; top: 16px; }
  #progress { width: 200px; padding: 12px; inset-inline-end: 14px; top: 14px; }
  .region-label { font-size: 16px; }
  #demoBadge { display: none; }
}

/* ───── إضافات app.js ───── */
#map { background: #2f8fb5; }
body[data-theme="night"] #map { background: #0d2244; }
.maplibregl-canvas { outline: none; }
.cat .emoji { width: 18px; text-align: center; flex: none; }
.cat:focus-visible, .group-title:focus-visible, .btn:focus-visible, .seg button:focus-visible, .cluster:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
#results li.active { background: rgba(255, 255, 255, 0.14); }
#results .rname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#progress .btn.primary { width: 100%; margin-bottom: 8px; }
.pop .row { align-items: stretch; }
.pop .btn.icon { flex: none; width: 44px; padding: 0; }
.pop p.gap { margin: 6px 0; }

/* أدوات إضافية */
.seg.readout {
  padding: 7px 14px; font-size: 12.5px; font-weight: 700; color: var(--muted);
  font-variant-numeric: tabular-nums; direction: ltr;
}
.seg.tool {
  font: inherit; font-weight: 700; font-size: 13.5px; color: var(--text);
  padding: 9px 16px; cursor: pointer; align-items: center; gap: 6px;
}
.seg.tool.on { background: var(--accent); color: #1a0f0a; border-color: transparent; }
#measureInfo {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 6;
  background: var(--panel); border: 1px solid var(--accent); border-radius: 999px;
  padding: 8px 18px; font-weight: 700; font-size: 14px; max-width: calc(100vw - 40px); text-align: center;
}
#toast {
  position: fixed; bottom: 62px; left: 50%; transform: translate(-50%, 12px); z-index: 20;
  background: #10182c; color: var(--text); border: 1px solid var(--line); border-radius: 999px;
  padding: 9px 18px; font-size: 14px; font-weight: 700; opacity: 0; pointer-events: none;
  transition: opacity 0.2s, transform 0.2s; max-width: calc(100vw - 40px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* دوائر التجميع */
.cluster {
  font: inherit; font-weight: 800; color: #10182c; cursor: pointer;
  border: 3px solid rgba(255, 255, 255, 0.85); border-radius: 50%;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35); padding: 0;
}
.cluster.sm { width: 32px; height: 32px; font-size: 13px; background: #8ab4ff; }
.cluster.md { width: 40px; height: 40px; font-size: 14px; background: #2fd0b5; }
.cluster.lg { width: 48px; height: 48px; font-size: 15px; background: #ffc247; }
.cluster.xl { width: 58px; height: 58px; font-size: 17px; background: #ff7a59; }
.cluster:hover { filter: brightness(1.12); }

/* تلميح الاسم */
.maplibregl-popup.tip { pointer-events: none; z-index: 3; }
.maplibregl-popup.tip .maplibregl-popup-content {
  min-width: 0; padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; white-space: nowrap;
}
.maplibregl-popup { z-index: 4; }

/* أزرار MapLibre */
.maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right { bottom: 232px; }
.maplibregl-ctrl-bottom-left .maplibregl-ctrl { margin-left: 16px; }
.maplibregl-ctrl-bottom-right .maplibregl-ctrl { margin-right: 16px; }
.maplibregl-ctrl-group { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.maplibregl-ctrl-group button { width: 36px; height: 36px; }
.maplibregl-ctrl-group button + button { border-top-color: var(--line); }
.maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1); }

@media (max-width: 760px) {
  .seg.readout { display: none; }
  .maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right { bottom: 190px; }
  #toast { bottom: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  #sidebar, .fab.edge, #barFill, #toast { transition: none; }
}
#map { font: inherit; }
.region-label { z-index: 2; letter-spacing: 0; }
.cluster { z-index: 1; }

@media (max-width: 760px) {
  #sidebar { z-index: 8; }
  body:not(.closed) #progress, body:not(.closed) #controls,
  body:not(.closed) .maplibregl-ctrl-bottom-left, body:not(.closed) .maplibregl-ctrl-bottom-right { display: none; }
  .fab.edge { z-index: 9; }
  #progress h2 { font-size: 15px; margin-bottom: 8px; }
  #controls { inset-inline: 10px; bottom: 12px; flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 6px; }
  .seg button { padding: 7px 12px; }
  .seg.tool { padding: 9px 12px; }
  .maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right { bottom: 110px; }
}

/* صورة المكان أعلى نافذة التفاصيل */
.pop-img { display: block; width: calc(100% + 32px); max-width: none; height: 160px; object-fit: cover; margin: -14px -16px 12px; border-radius: 13px 13px 0 0; background: #0d1322; }
.pop-img + h3 { padding-inline-end: 0; }

/* أيقونات التصنيفات كصور */
img.ico { width: 22px; height: 22px; flex: none; object-fit: contain; vertical-align: middle; }
.cat img.ico.emoji { width: 22px; }
.pop .chip { display: inline-flex; align-items: center; gap: 6px; }
.pop .chip img.ico { width: 20px; height: 20px; }
#results li img.ico { width: 24px; height: 24px; }

/* ───── ستايل بنفسجي ووردي بألوان مسطّحة بلا تدرّج (تصميم أصلي بروح GTA VI، بلا شعارها ولا خطها) ───── */
:root {
  --panel: rgba(84, 30, 98, 0.95);
  --line: rgba(255, 170, 225, 0.3);
  --text: #fff6fc;
  --muted: #e6bfdc;
  --accent: #ff8a3d;
  --accent-2: #3be8c9;
  --hot: #ff5f9e;
  --radius: 20px;
}
body { background: #2a0a45; }
.panel, .seg, .fab, #toast, #measureInfo, #demoBadge, .maplibregl-popup-content, .maplibregl-ctrl-group {
  box-shadow: 0 12px 34px rgba(40, 6, 60, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
#toast { background: var(--panel); }
#sidebar { scrollbar-width: thin; scrollbar-color: #ff6aa9 transparent; }
#sidebar::-webkit-scrollbar { width: 6px; }
#sidebar::-webkit-scrollbar-thumb { background: #ff6aa9; border-radius: 9px; }

.brand { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.brand-mark { color: var(--hot); }
.brand h1, .section-title, #progress h2, .pop h3, .region-label {
  font-family: "Lalezar", "Tajawal", sans-serif; font-weight: 400; letter-spacing: 0.01em;
}
.brand h1 {
  font-size: 34px; line-height: 1.1; margin: 4px 0 2px;
  color: #ffc24d; text-shadow: 0 2px 0 rgba(40, 6, 60, 0.55);
}
.sub { color: #ffd9ee; }
.section-title { font-size: 25px; color: #fff; margin-top: 20px; }
.group-title { font-size: 13.5px; text-transform: uppercase; filter: brightness(1.25) saturate(1.1); }
#progress h2 { font-size: 23px; }
.pop h3 { font-size: 21px; line-height: 1.25; }
.region-label { text-shadow: 0 2px 0 rgba(60, 10, 80, 0.75), 0 0 14px rgba(255, 79, 154, 0.55); }

.btn { background: rgba(255, 255, 255, 0.12); border-color: var(--line); }
.btn:hover { background: rgba(255, 255, 255, 0.22); }
.btn.primary { background: var(--hot); color: #2a0a2e; box-shadow: 0 6px 16px rgba(255, 61, 143, 0.35); }
.btn.primary:hover { filter: brightness(1.08); background: var(--hot); }
.btn.primary.on { background: var(--accent-2); box-shadow: none; }
.btn.ghost { color: #ffd9ee; }
#search { background: rgba(30, 6, 50, 0.55); }
#search::placeholder { color: #d9a9cc; }
#search:focus { border-color: #ff6aa9; box-shadow: 0 0 0 3px rgba(255, 106, 169, 0.25); }
#results { background: rgba(30, 6, 50, 0.8); }
.cat:hover, #results li:hover, #results li.active { background: rgba(255, 255, 255, 0.14); }
.cat .count { color: #ffd0ea; }
.bar { background: rgba(30, 6, 50, 0.55); height: 10px; }
#barFill { background: var(--hot); }
.check input { accent-color: #ff4f9a; }
.seg button { color: #f0cbe4; }
.seg button.on { background: var(--hot); color: #2a0a2e; }
.seg.tool.on { background: var(--hot); color: #2a0a2e; }
.pop p { color: #ffe9f6; }
.chip { color: #2a0a2e; }
.cluster { color: #2a0a2e; border-color: rgba(255, 255, 255, 0.92); box-shadow: 0 5px 16px rgba(60, 8, 80, 0.45); }
.cluster.sm { background: #8fe3ff; }
.cluster.md { background: #ffa3dc; }
.cluster.lg { background: #ffc24d; }
.cluster.xl { background: #ff4f8f; color: #fff; }

/* نخيل في خلفية القائمة الرئيسية: الصورة assets/palms.webp التي وفّرها صاحب المشروع */
#sidebar {
  background: url("assets/palms.webp") no-repeat center bottom / 112% auto, var(--panel);
  background-blend-mode: soft-light, normal;
}

/* ───── اللوحة العلوية: تبويبات + عنوان + تتبّع ───── */
#progress { width: 320px; max-width: calc(100vw - 28px); max-height: calc(100vh - 262px); overflow-y: auto; padding: 14px; scrollbar-width: thin; scrollbar-color: #ff6aa9 transparent; }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); background: rgba(255, 255, 255, 0.14); border-radius: 14px; overflow: hidden; }
.tabs button { font: inherit; font-weight: 700; font-size: 13.5px; color: var(--text); background: none; border: 0; padding: 9px 4px 10px; cursor: pointer; display: grid; gap: 3px; justify-items: center; }
.tabs button + button { border-inline-start: 1px solid rgba(255, 255, 255, 0.18); }
.tabs button:hover { background: rgba(255, 255, 255, 0.1); }
.tabs button.on { background: var(--hot); color: #2a0a2e; }
.tabs button:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
.tab-ico { font-size: 17px; line-height: 1; }
#progress h2.maptitle { font-family: "Lalezar", "Tajawal", sans-serif; font-weight: 400; font-size: 22px; line-height: 1.15; color: #fff0b3; margin: 14px 2px 10px; letter-spacing: 0.01em; }
.track { background: rgba(255, 255, 255, 0.1); border-radius: 14px; padding: 11px 12px 9px; margin-bottom: 12px; }
.track-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; font-weight: 800; letter-spacing: 0.04em; margin-bottom: 7px; }
#progress #progressText { margin: 0; font-size: 12.5px; color: var(--text); font-variant-numeric: tabular-nums; direction: ltr; }
.track .bar { height: 8px; background: rgba(255, 255, 255, 0.22); }
.track #barFill { background: #fff; border-radius: 99px; min-width: 8px; }
.track-note { margin: 8px 0 0; font-size: 12.5px; color: #f3d6ea; }
#tabPane { margin-top: 10px; background: rgba(30, 6, 50, 0.4); border-radius: 14px; padding: 10px; max-height: 30vh; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #ff6aa9 transparent; display: grid; gap: 6px; }
#tabPane[hidden] { display: none; }
#tabPane textarea, #tabPane .item input { font: inherit; font-size: 14px; color: var(--text); background: rgba(30, 6, 50, 0.6); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; width: 100%; outline: none; resize: vertical; }
#tabPane textarea:focus, #tabPane .item input:focus { border-color: #ff6aa9; }
#tabPane .btn { width: 100%; flex: none; }
#tabPane .empty { margin: 4px 2px; font-size: 13px; color: var(--muted); }
#tabPane .item { display: flex; align-items: center; gap: 8px; font: inherit; font-size: 13.5px; color: var(--text); background: rgba(255, 255, 255, 0.09); border: 0; border-radius: 10px; padding: 7px 9px; text-align: start; width: 100%; min-width: 0; }
#tabPane .item.link { cursor: pointer; }
#tabPane .item.link:hover { background: rgba(255, 255, 255, 0.17); }
#tabPane .item .body { flex: 1; min-width: 0; display: grid; gap: 1px; overflow-wrap: anywhere; }
#tabPane .item small { color: #ffd0ea; font-size: 11.5px; font-weight: 700; }
#tabPane .item input { flex: 1; min-width: 0; padding: 5px 8px; }
#tabPane .item .num { font-size: 12px; font-variant-numeric: tabular-nums; color: #ffd0ea; direction: ltr; white-space: nowrap; }
#tabPane .item.full .num { color: var(--accent-2); font-weight: 800; }
#tabPane .x { font: inherit; font-size: 18px; line-height: 1; color: var(--muted); background: none; border: 0; cursor: pointer; padding: 2px 6px; border-radius: 8px; flex: none; }
#tabPane .x:hover { background: rgba(255, 255, 255, 0.18); color: #fff; }
.note-for { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 12.5px; font-weight: 700; color: #fff0b3; }
.cl-locs { display: grid; gap: 2px; padding: 2px 8px 6px; }
.cl-locs .check { margin: 0; font-size: 13px; padding: 3px 0; }
.cl-locs .lname { overflow-wrap: anywhere; }
.cl-locs .lname:hover { text-decoration: underline; }
.pop .pnote { margin: -4px 0 12px; padding: 7px 10px; font-size: 13px; background: rgba(30, 6, 50, 0.45); border-radius: 10px; color: #fff0b3; overflow-wrap: anywhere; }
/* علامات المستخدم على الخريطة */
.umark { width: 26px; height: 26px; padding: 0; border: 3px solid #fff; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: #ff5f9e; box-shadow: 0 4px 10px rgba(40, 6, 60, 0.5); cursor: pointer; z-index: 2; }
.umark::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: #fff; }
@media (max-width: 760px) {
  #progress { width: min(300px, calc(100vw - 80px)); padding: 10px; }
  .tabs button { font-size: 12px; padding: 7px 2px 8px; }
  #progress h2.maptitle { font-size: 19px; margin: 10px 2px 8px; }
  #tabPane { max-height: 38vh; }
}

/* أيقونات الواجهة SVG */
.ui-ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.tabs .ui-ico.tab-ico { width: 20px; height: 20px; }
.brand-mark .ui-ico { width: 34px; height: 34px; }
.fab .ui-ico { width: 20px; height: 20px; vertical-align: middle; }
.btn .ui-ico { margin-inline-end: 4px; }
.btn.icon .ui-ico { margin: 0; }
.pop .pnote { display: flex; gap: 8px; align-items: flex-start; }
.pop .pnote .ui-ico { margin-top: 2px; }
.ico-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #0d1322; flex: none; }

/* ───── تهدئة التصميم: أوزان أخف، مقاسات أصغر، مسافات مرتّبة ───── */
:root { --radius: 14px; }
body { font-size: 13.5px; font-weight: 400; }
.panel, .seg, .fab, #toast, #measureInfo, #demoBadge, .maplibregl-popup-content, .maplibregl-ctrl-group { box-shadow: 0 6px 18px rgba(40, 6, 60, 0.32); }

/* القائمة الجانبية */
#sidebar { width: 300px; padding: 14px 14px 16px; }
.fab.edge { inset-inline-start: 324px; top: 18px; }
.fab { width: 34px; height: 34px; }
.fab .ui-ico { width: 17px; height: 17px; }
.brand { margin-bottom: 12px; padding-bottom: 10px; text-align: start; display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; }
.brand-mark { grid-row: span 2; line-height: 0; }
.brand-mark .ui-ico { width: 26px; height: 26px; stroke-width: 1.8; }
.brand h1 { font-size: 22px; margin: 0; text-shadow: none; line-height: 1.15; }
.sub { font-size: 12px; }
.btn { font-weight: 500; font-size: 13px; padding: 7px 12px; }
.btn.primary { font-weight: 600; box-shadow: none; }
#search { font-size: 13.5px; padding: 8px 14px; }
.search { margin-top: 8px; }
.tip { font-size: 12px; margin: 8px 0 2px; }
.section-title { font-family: inherit; font-weight: 700; font-size: 15px; margin: 16px 0 2px; }
.group-title { font-size: 11.5px; font-weight: 700; letter-spacing: 0.03em; margin: 10px 0 3px; }
.cat-grid { gap: 0 8px; }
.cat { font-size: 12.5px; font-weight: 400; padding: 3px 4px; gap: 6px; }
.cat .count { font-size: 11.5px; }
img.ico, .cat img.ico.emoji { width: 18px; height: 18px; }
#results li { font-size: 13px; padding: 6px 8px; }
#results li img.ico { width: 20px; height: 20px; }

/* اللوحة العلوية */
#progress { width: 272px; padding: 10px; }
.tabs { border-radius: 10px; }
.tabs button { font-size: 12px; font-weight: 500; padding: 7px 4px 8px; gap: 2px; }
.tabs .ui-ico.tab-ico { width: 16px; height: 16px; stroke-width: 1.8; }
#progress h2.maptitle { font-family: inherit; font-weight: 700; font-size: 14px; margin: 10px 2px 8px; letter-spacing: 0; }
.track { padding: 9px 10px 8px; margin-bottom: 9px; border-radius: 10px; }
.track-head { font-size: 11.5px; font-weight: 600; letter-spacing: 0; margin-bottom: 6px; }
#progress #progressText { font-size: 11.5px; }
.track .bar { height: 6px; }
.track-note { font-size: 11.5px; margin-top: 6px; }
.check { font-size: 12.5px; margin-bottom: 8px; }
.check input { width: 14px; height: 14px; }
#progress .btn.primary { margin-bottom: 6px; }
#tabPane { padding: 8px; border-radius: 10px; gap: 5px; }
#tabPane textarea, #tabPane .item input { font-size: 13px; padding: 6px 9px; }
#tabPane .item { font-size: 12.5px; padding: 5px 8px; border-radius: 8px; }
#tabPane .item small { font-weight: 500; font-size: 11px; }
#tabPane .item.full .num { font-weight: 600; }
.cl-locs .check { font-size: 12.5px; }

/* أدوات التحكم */
#controls { gap: 6px; bottom: 14px; }
.seg { padding: 3px; }
.seg button { font-size: 12px; font-weight: 500; padding: 5px 12px; }
.seg.tool { font-size: 12px; font-weight: 500; padding: 7px 12px; }
.seg.tool .ui-ico { width: 15px; height: 15px; }
.seg.readout { font-size: 11.5px; font-weight: 500; padding: 5px 12px; }
.maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right { bottom: 176px; }
.maplibregl-ctrl-group { border-radius: 10px; }
.maplibregl-ctrl-group button { width: 30px; height: 30px; }

/* الخريطة: أسماء المناطق والتجميع والنوافذ */
.region-label { font-family: inherit; font-weight: 700; text-shadow: 0 1px 3px rgba(40, 6, 60, 0.75); }
.cluster { font-weight: 600; border-width: 2px; box-shadow: 0 2px 8px rgba(40, 6, 60, 0.35); }
.cluster.sm { width: 26px; height: 26px; font-size: 11.5px; }
.cluster.md { width: 32px; height: 32px; font-size: 12px; }
.cluster.lg { width: 38px; height: 38px; font-size: 12.5px; }
.cluster.xl { width: 44px; height: 44px; font-size: 13px; }
.maplibregl-popup-content { padding: 12px 14px; border-radius: 12px; min-width: 220px; }
.pop h3 { font-family: inherit; font-weight: 700; font-size: 15px; line-height: 1.35; }
.chip { font-size: 11.5px; font-weight: 600; padding: 2px 9px; }
.pop .chip img.ico { width: 16px; height: 16px; }
.pop .region { font-size: 12px; }
.pop p { font-size: 13px; margin: 8px 0 10px; }
.pop .btn.icon { width: 36px; }
.pop-img { margin: -12px -14px 10px; width: calc(100% + 28px); height: 140px; border-radius: 11px 11px 0 0; }
.maplibregl-popup.tip .maplibregl-popup-content { font-size: 12px; font-weight: 500; padding: 4px 10px; }
#toast { font-size: 12.5px; font-weight: 500; padding: 7px 14px; }
#measureInfo { font-size: 12.5px; font-weight: 500; padding: 6px 14px; }
@media (max-width: 760px) {
  #sidebar { width: calc(100vw - 28px); }
  .fab.edge, body.closed .fab.edge { inset-inline-start: 14px; }
  #progress { width: min(260px, calc(100vw - 70px)); }
}

/* ───── لوحة ألوان أغنى: بنفسجي، موف، وردي باهت، كريمي، خوخي ───── */
:root {
  --panel: rgba(118, 66, 116, 0.96);
  --box: rgba(255, 255, 255, 0.1);
  --field: #643a63;
  --tabbg: #a06b97;
  --pale: #f6c5d2;
  --cream: #fff3b0;
  --peach: #ffd2a0;
  --ink: #2b1230;
  --line: rgba(255, 255, 255, 0.2);
  --muted: #e2c6dc;
  --hot: var(--pale);
  --accent: var(--pale);
}
.brand h1, #progress h2.maptitle, .tab-title { color: var(--cream); }
.brand-mark { color: var(--peach); }
.section-title { color: #fff; }
.btn.primary, .seg button.on, .seg.tool.on, .tabs button.on { background: var(--pale); color: var(--ink); }
.btn.primary:hover { background: #fbd6df; filter: none; }
.btn { background: var(--box); }
.tabs { background: var(--tabbg); }
.tabs button + button { border-inline-start-color: rgba(255, 255, 255, 0.22); }
#search, .tsearch, #tabPane textarea, #tabPane .item input { background: var(--field); }
#search:focus, #tabPane textarea:focus { border-color: var(--pale); box-shadow: none; }
#results { background: #56305a; }
.track, .acct { background: var(--box); }
.bar, .track .bar { background: rgba(255, 255, 255, 0.25); }
#barFill, .track #barFill { background: #fff; }
.check input, .cl-row input { accent-color: var(--pale); }
.cat .count, #tabPane .item .num, #tabPane .item small { color: var(--muted); }
.cluster.sm { background: #cfe9ff; } .cluster.md { background: var(--pale); } .cluster.lg { background: var(--peach); } .cluster.xl { background: var(--cream); color: var(--ink); }
.umark { background: var(--peach); }
#sidebar { scrollbar-color: var(--pale) transparent; }
#sidebar::-webkit-scrollbar-thumb { background: var(--pale); }

/* ───── عروض التبويبات ───── */
#progress.tabbed > .maptitle, #progress.tabbed > .track, #progress.tabbed > .check, #progress.tabbed > #touchMark, #progress.tabbed > #reset { display: none; }
#progress.tabbed { max-height: calc(100vh - 200px); }
.tab-back { display: flex; align-items: center; gap: 8px; width: calc(100% + 20px); margin: -10px -10px 10px; padding: 10px 12px; font: inherit; font-size: 11.5px; font-weight: 600; letter-spacing: 0.03em; color: #fff; background: rgba(255, 255, 255, 0.07); border: 0; border-bottom: 1px solid var(--line); cursor: pointer; text-align: start; }
.tab-back[hidden] { display: none; }
.tab-back:hover { background: rgba(255, 255, 255, 0.13); }
html[dir="rtl"] .tab-back .ui-ico { transform: scaleX(-1); }
#tabPane { background: none; padding: 0; margin-top: 10px; max-height: none; overflow: visible; gap: 8px; }
.tab-title { margin: 2px 2px 0; font-size: 16px; font-weight: 700; }
.acct { border-radius: 10px; padding: 9px 11px; display: grid; gap: 3px; }
.acct-h { font-size: 11px; font-weight: 600; letter-spacing: 0.03em; }
.acct-l { font-size: 12.5px; }
.lnk { font: inherit; color: #fff; background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.lnk:hover { color: var(--cream); }
.tsearch { display: flex; align-items: center; gap: 8px; border-radius: 999px; padding: 7px 12px; color: var(--cream); cursor: text; }
.tsearch input { flex: 1; min-width: 0; font: inherit; font-size: 13px; color: #fff; background: none; border: 0; outline: none; }
.tsearch input::placeholder { color: #cfa9c9; }
.tsearch:focus-within { outline: 1px solid var(--pale); }
.sec-h { display: flex; align-items: center; justify-content: space-between; margin: 6px 2px 0; font-size: 12.5px; font-weight: 700; color: var(--peach); }
.tgs { display: flex; gap: 10px; }
.tg { font: inherit; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; color: #c9a3c3; background: none; border: 0; padding: 0; cursor: pointer; }
.tg.on { color: #fff; }
.tlist { display: grid; gap: 5px; }
#tabPane .empty { font-size: 12.5px; color: #fff; line-height: 1.6; margin: 2px; }
.cl-locs { padding: 2px 4px 6px; }
.cl-row { display: flex; align-items: center; gap: 7px; padding: 2px 0; min-width: 0; }
.cl-row input { width: 14px; height: 14px; flex: none; }
.cl-row .lname { flex: 1; min-width: 0; font: inherit; font-size: 12.5px; color: #fff; background: none; border: 0; padding: 0; cursor: pointer; text-align: start; overflow-wrap: anywhere; }
.cl-row .lname:hover { text-decoration: underline; }
.pop .pin-lists { margin: -2px 0 10px; font-size: 12px; color: var(--peach); }
.pop .btn.icon.act { background: var(--pale); color: var(--ink); }
.pop .btn.icon.sel { width: 44px; padding: 0 4px; appearance: none; -webkit-appearance: none; text-align: center; text-align-last: center; font-size: 15px; }
.pop .btn.icon.sel option { color: #000; }

/* ───── نافذة الحساب ───── */
.dlg { border: 1px solid var(--line); border-radius: 14px; padding: 0; background: #764274; color: var(--text); width: min(340px, calc(100vw - 32px)); box-shadow: 0 18px 50px rgba(30, 6, 50, 0.55); font: inherit; }
.dlg::backdrop { background: rgba(30, 8, 44, 0.55); }
.dlg form { display: grid; gap: 10px; padding: 18px 18px 16px; position: relative; }
.dlg h3 { margin: 0 0 2px; font-size: 16px; font-weight: 700; color: var(--cream); }
.dlg label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.dlg input { font: inherit; font-size: 14px; color: #fff; background: var(--field); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; outline: none; }
.dlg input:focus { border-color: var(--pale); }
.dlg .btn { width: 100%; margin-top: 2px; }
.dlg .btn:disabled { opacity: 0.6; cursor: default; }
.dlg .err { margin: 0; font-size: 12.5px; color: #ffd0d0; background: rgba(120, 10, 30, 0.35); border-radius: 8px; padding: 6px 9px; }
.dlg .lnk { justify-self: center; font-size: 12.5px; }
.dlg .x { position: absolute; top: 8px; inset-inline-end: 8px; font: inherit; font-size: 20px; line-height: 1; color: var(--muted); background: none; border: 0; cursor: pointer; padding: 2px 8px; border-radius: 8px; }
.dlg .x:hover { background: rgba(255, 255, 255, 0.15); color: #fff; }
.dlg [hidden] { display: none; }
.track-note .lnk { font-size: inherit; }

/* الجوال: لوحة علوية أقصر حتى تبقى الخريطة ظاهرة */
@media (max-width: 760px) {
  #progress { display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; }
  #progress > * { flex: 1 1 100%; margin: 0; }
  #progress > .maptitle { display: none; }
  #progress .track { padding: 7px 9px; }
  #progress .track-note { display: none; }
  #progress > .check { margin: 0; }
  #progress > #touchMark, #progress > #reset { flex: 1 1 calc(50% - 3px); width: auto; margin: 0; padding: 6px 8px; font-size: 12px; }
  #progress.tabbed { display: block; }
  #progress.tabbed > .tab-back { margin: -10px -10px 8px; }
}

/* شريط الحساب أعلى اللوحة */
.acct-bar { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.acct-bar .btn { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 6px 8px; font-size: 12.5px; white-space: nowrap; }
.acct-bar .btn .ui-ico { width: 15px; height: 15px; margin: 0; }
.acct-bar .who { flex: 2; min-width: 0; display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--cream); }
.acct-bar .who .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#progress.tabbed > .acct-bar { display: none; }
@media (max-width: 760px) { #progress > .acct-bar { margin: 0; } }

/* تأكيد البريد واستعادة كلمة المرور */
.verify-note { margin: -2px 0 8px; padding: 6px 9px; font-size: 12px; line-height: 1.6; color: var(--cream); background: rgba(255, 243, 176, 0.12); border-radius: 8px; }
.verify-note[hidden] { display: none; }
.verify-note .lnk { font-size: inherit; }
#progress.tabbed > .verify-note { display: none; }
.dlg .err.ok { color: #dcffe9; background: rgba(20, 110, 70, 0.4); }
@media (max-width: 760px) { #progress > .verify-note { margin: 0; } }

/* أزرار التكبير فوق عمود الأدوات: الموضع يُحسب في app.js (fitNav) ويُمرَّر عبر --nav-bottom.
   القيمة الاحتياطية للحظة قبل تشغيل السكربت. هذه القاعدة الأخيرة فتغلب القيم الثابتة السابقة. */
.maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right { bottom: var(--nav-bottom, 176px); }
