/* خريطة العراق — ثيم «بلاد الرافدين»
 * لازوردي بوابة عشتار، ذهب الزخارف، طين بابل، خضرة النخيل، رمل الأرض.
 * الخطوط محلية: ريم كوفي للعناوين، IBM Plex Sans Arabic للنص.
 */
@font-face { font-family: 'Reem Kufi'; src: url('/fonts-ui/ReemKufi-Medium.ttf') format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Reem Kufi'; src: url('/fonts-ui/ReemKufi-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Plex Arabic'; src: url('/fonts-ui/IBMPlexSansArabic-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Plex Arabic'; src: url('/fonts-ui/IBMPlexSansArabic-Medium.ttf') format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Plex Arabic'; src: url('/fonts-ui/IBMPlexSansArabic-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }

:root {
  --lapis: #1c3a7a;
  --lapis-2: #2a55b8;
  --lapis-soft: #e8edf8;
  --gold: #d4a843;
  --gold-soft: #f6ecd2;
  --clay: #b5653e;
  --palm: #2f6b4f;
  --sand: #f7f2e8;
  --paper: #fffdf8;
  --ink: #1f1d24;
  --muted: #7a7268;
  --line: #ece4d6;
  --from: #2f6b4f;
  --to: #b5653e;
  --shadow: 0 10px 30px rgba(41, 33, 20, .16), 0 2px 6px rgba(41, 33, 20, .08);
  --radius: 20px;
  --kufi: 'Reem Kufi', 'Plex Arabic', Tahoma, sans-serif;
  --text: 'Plex Arabic', Tahoma, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--sand); }
body, input, button { font-family: var(--text); color: var(--ink); }
#map { position: fixed; inset: 0; }
[hidden] { display: none !important; }
svg { width: 20px; height: 20px; flex: none; }

/* ============ اللوحة ============ */
#sheet {
  position: fixed; z-index: 10; top: 16px; right: 16px;
  width: 392px; max-height: calc(100vh - 32px);
  display: flex; flex-direction: column;
  background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden;
}
/* خيط ذهبي رفيع أعلى اللوحة */
#sheet::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold) 20%, var(--gold) 80%, transparent);
  opacity: .9;
}
.grab { display: none; }

.searchbar { display: flex; align-items: center; gap: 6px; padding: 12px 12px 10px; }
.brand {
  flex: none; width: 40px; height: 40px; display: grid; place-items: center;
  color: var(--lapis); border-radius: 12px; background: var(--lapis-soft);
}
.brand img { width: 28px; height: 32px; display: block; }
.searchbar input {
  flex: 1; min-width: 0; height: 44px; padding: 0 14px;
  border: 1.5px solid transparent; border-radius: 14px; outline: none;
  background: var(--sand); font-size: 15.5px;
  transition: border-color .15s, background .15s;
}
.searchbar input:focus { border-color: var(--lapis-2); background: #fff; }
.searchbar input::placeholder { color: #a39a8d; }
input[type=search]::-webkit-search-cancel-button { display: none; }

.icon-btn {
  flex: none; width: 40px; height: 40px; border: 0; border-radius: 12px;
  display: grid; place-items: center; background: transparent; color: var(--muted); cursor: pointer;
  transition: background .15s, color .15s, transform .1s;
}
.icon-btn:hover, .icon-btn:focus-visible { background: var(--sand); color: var(--ink); outline: none; }
.icon-btn:active { transform: scale(.94); }
.icon-btn.accent { background: var(--lapis); color: #fff; box-shadow: 0 3px 10px rgba(28, 58, 122, .3); }
.icon-btn.accent:hover { background: var(--lapis-2); color: #fff; }

.view { overflow-y: auto; padding: 0 0 12px; scrollbar-width: thin; }
#view-place, #view-route { padding: 0 18px 18px; }

/* ============ الترحيب ============ */
#view-home { padding: 4px 18px 16px; }
.hello { padding: 6px 0 14px; }
.hello-name { font-family: var(--kufi); font-weight: 700; font-size: 26px; color: var(--lapis); line-height: 1.3; }
.hello-line { color: var(--muted); font-size: 14.5px; margin-top: 2px; }
#greet { color: var(--clay); font-weight: 500; }
.near-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 700; color: var(--muted); letter-spacing: .02em; margin-bottom: 10px;
}
.near-title::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line), transparent); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button {
  position: relative; border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 999px; padding: 7px 14px 7px 12px; font-size: 14px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  transition: border-color .15s, background .15s, transform .1s;
}
/* نجمة ثمانية صغيرة قبل كل خدمة */
.chips button::before {
  content: ""; width: 9px; height: 9px; background: var(--gold);
  clip-path: polygon(50% 0, 63% 25%, 93% 21%, 76% 50%, 93% 79%, 63% 75%, 50% 100%, 37% 75%, 7% 79%, 24% 50%, 7% 21%, 37% 25%);
}
.chips button:hover { border-color: var(--lapis-2); background: var(--lapis-soft); }
.chips button:active { transform: scale(.96); }

/* ============ النتائج ============ */
.group-title { padding: 12px 18px 6px; font-size: 12.5px; color: var(--muted); font-weight: 700; }
.item {
  display: flex; gap: 12px; align-items: center; width: 100%;
  padding: 10px 18px; border: 0; background: none; text-align: right; cursor: pointer;
  transition: background .12s;
}
.item:hover, .item:focus-visible { background: var(--sand); outline: none; }
.item .ic {
  flex: none; width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center; background: var(--sand);
}
.item .ic i { display: block; width: 22px; height: 22px; background-repeat: no-repeat; }
.item .ic svg { width: 16px; height: 16px; fill: var(--gold); }
.item .ic.area { background: var(--lapis-soft); }
.item .ic.area svg { fill: var(--lapis); }
.item .tx { min-width: 0; flex: 1; }
.item .nm { display: block; font-weight: 500; font-size: 15px; line-height: 1.5; }
.item .sub { display: block; font-size: 12.5px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .km { flex: none; font-size: 12.5px; color: var(--lapis); font-weight: 500;
  background: var(--lapis-soft); border-radius: 999px; padding: 2px 9px; }
.empty { padding: 18px; color: var(--muted); font-size: 14px; }
.link-btn { display: block; width: 100%; padding: 12px; border: 0; background: none;
  color: var(--lapis-2); font-weight: 500; cursor: pointer; }

/* ============ بطاقة المكان ============ */
/* شريط زخرفي: نجوم ثمانية لازوردية خفيفة */
.card-band {
  height: 54px; margin: 0 -18px 0; border-bottom: 1px solid var(--line);
  background-color: var(--lapis-soft);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44' viewBox='0 0 64 64'%3E%3Cpath fill='%231c3a7a' fill-opacity='.09' d='M32 6l7.6 7.6H50.4V24.4L58 32l-7.6 7.6V50.4H39.6L32 58l-7.6-7.6H13.6V39.6L6 32l7.6-7.6V13.6H24.4z'/%3E%3Ccircle cx='32' cy='32' r='5' fill='%23d4a843' fill-opacity='.35'/%3E%3C/svg%3E");
  background-size: 44px 44px;
}
.place-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding-top: 14px; }
.place-head h2 { margin: 4px 0 0; font-size: 21px; line-height: 1.45; font-weight: 700; }
.kufi { font-family: var(--kufi); color: var(--lapis); font-size: 24px !important; }
.pill { display: inline-block; font-size: 12px; font-weight: 700; color: var(--clay);
  background: #f8e9e0; border-radius: 999px; padding: 2px 10px; }
.pill:empty { display: none; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; margin-top: 6px; }
.dist { margin-top: 6px; font-size: 13.5px; color: var(--palm); font-weight: 500; }
.dist:empty { display: none; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 10px; }
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); background: #fff; border-radius: 14px;
  padding: 9px 15px; font-size: 14.5px; cursor: pointer; transition: background .15s, transform .1s;
}
.btn:hover { background: var(--sand); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--lapis); border-color: var(--lapis); color: #fff; box-shadow: 0 4px 12px rgba(28, 58, 122, .28); }
.btn.primary:hover { background: var(--lapis-2); }
.btn.icon-only { padding: 9px 11px; }
.btn svg { width: 18px; height: 18px; }
.coords { color: #a39a8d; font-size: 12px; direction: ltr; text-align: right; font-variant-numeric: tabular-nums; }

/* ============ الاتجاهات ============ */
#view-route .place-head { padding-top: 4px; }
.route-points { position: relative; margin: 14px 0 10px; }
.rail { position: absolute; right: 5px; top: 22px; bottom: 22px; border-right: 2px dotted #cfc5b4; }
.rp { position: relative; display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.rp input {
  flex: 1; min-width: 0; height: 42px; padding: 0 13px;
  border: 1.5px solid transparent; border-radius: 13px; background: var(--sand); font-size: 14.5px; outline: none;
}
.rp input:focus { border-color: var(--lapis-2); background: #fff; }
.dot { flex: none; width: 12px; height: 12px; border-radius: 50%; border: 3px solid; background: var(--paper); z-index: 1; }
.dot.from { border-color: var(--from); }
.dot.to { border-color: var(--to); background: var(--to); }
#rp-suggest:not(:empty) {
  position: absolute; z-index: 5; left: 0; right: 22px; top: 100%;
  max-height: 280px; overflow-y: auto; background: var(--paper); border-radius: 14px; box-shadow: var(--shadow);
}
.modes { display: flex; gap: 6px; padding: 4px; background: var(--sand); border-radius: 14px; }
.modes label { flex: 1; }
.modes input { position: absolute; opacity: 0; pointer-events: none; }
.modes span {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 4px; border-radius: 11px; font-size: 13.5px; color: var(--muted); cursor: pointer;
  transition: background .15s, color .15s;
}
.modes svg { width: 18px; height: 18px; }
.modes input:checked + span { background: #fff; color: var(--lapis); font-weight: 700; box-shadow: 0 2px 6px rgba(41, 33, 20, .1); }
.modes input:focus-visible + span { outline: 2px solid var(--lapis-2); }

#route-summary { margin-top: 14px; }
#route-summary .big { font-family: var(--kufi); font-size: 30px; font-weight: 700; color: var(--lapis); line-height: 1.2; }
.route-opts { display: grid; gap: 8px; }
.route-opt {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 12px; width: 100%;
  padding: 11px 14px; border: 1.5px solid var(--line); border-radius: 16px; background: #fff;
  text-align: right; cursor: pointer; transition: border-color .15s, background .15s;
}
.route-opt:hover { border-color: #cfc5b4; }
.route-opt.on { border-color: var(--lapis); background: var(--lapis-soft); }
.route-opt .rt { font-family: var(--kufi); font-size: 21px; font-weight: 700; color: var(--ink); }
.route-opt.on .rt { color: var(--lapis); }
.route-opt .rd { color: var(--muted); font-size: 13.5px; }
.route-opt .rg { font-size: 12px; font-weight: 700; color: #8a6a1f; background: var(--gold-soft); border-radius: 999px; padding: 2px 10px; }
#route-steps { list-style: none; margin: 12px 0 0; padding: 0; }
#route-steps li {
  display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-bottom: 1px solid var(--line);
  font-size: 14.5px; cursor: pointer; border-radius: 10px;
}
#route-steps li:hover { background: var(--sand); }
#route-steps .arrow { flex: none; width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center;
  background: var(--lapis-soft); color: var(--lapis); font-size: 16px; }
#route-steps .d { flex: none; color: var(--muted); font-size: 12.5px; }
#route-steps .t { flex: 1; line-height: 1.6; }

/* ============ متفرقات ============ */
#toast {
  position: fixed; z-index: 30; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(10px);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 14px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; white-space: nowrap;
}
#toast.show { opacity: .95; transform: translateX(-50%); }

.fab {
  position: fixed; z-index: 9; left: 16px; bottom: 48px;
  width: 48px; height: 48px; border-radius: 16px; border: 0; background: var(--paper);
  box-shadow: var(--shadow); color: var(--lapis); cursor: pointer; display: grid; place-items: center;
}
.fab svg { width: 24px; height: 24px; }
.fab:hover { color: var(--lapis-2); }

.maplibregl-ctrl-group { border-radius: 14px !important; box-shadow: var(--shadow) !important; overflow: hidden; }
.maplibregl-ctrl-group button { width: 38px; height: 38px; }
.maplibregl-ctrl-attrib { font-size: 11px; background: rgba(255, 253, 248, .85) !important; border-radius: 10px; }
.maplibregl-ctrl-scale { border-color: var(--muted); color: var(--muted); background: rgba(255, 253, 248, .8); font-family: var(--text); }
.pin-me { width: 20px; height: 20px; border-radius: 50%; background: var(--lapis-2);
  border: 3px solid #fff; animation: me-pulse 2.2s ease-out infinite; }
/* موقعك: هالة تنبض بهدوء حتى تُرى بسرعة */
@keyframes me-pulse {
  0%   { box-shadow: 0 2px 8px rgba(0,0,0,.3), 0 0 0 0 rgba(42, 85, 184, .45); }
  100% { box-shadow: 0 2px 8px rgba(0,0,0,.3), 0 0 0 18px rgba(42, 85, 184, 0); }
}
@media (prefers-reduced-motion: reduce) { .pin-me { animation: none; box-shadow: 0 2px 8px rgba(0,0,0,.3), 0 0 0 8px rgba(42, 85, 184, .2); } }

/* ============ الهاتف: لوحة سفلية ============ */
@media (max-width: 640px) {
  #sheet {
    top: auto; right: 0; left: 0; bottom: 0; width: auto;
    max-height: 62vh; border-radius: 24px 24px 0 0;
    padding-bottom: max(env(safe-area-inset-bottom), 6px);
  }
  #sheet::before { display: none; }
  .grab { display: block; width: 42px; height: 5px; margin: 9px auto 0; border-radius: 5px; background: var(--line); }
  .searchbar { padding-top: 8px; }
  .hello { padding: 0 0 10px; }
  .hello-name { font-size: 22px; }
  .chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -18px; padding: 0 18px 4px; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chips button { flex: none; }
  #sheet:has(#view-route:not([hidden])) { height: 44vh; max-height: 44vh; }
  #sheet:has(#view-results:not([hidden])) { max-height: 46vh; }
  #toast { bottom: auto; top: 18px; }
  .fab { bottom: auto; top: 16px; left: 16px; }
  /* الهاتف: التكبير بإصبعين، فتُخفى أزرار +/−؛ ذكر OSM والمقياس فوق، حتى لا تغطيهما اللوحة */
  .maplibregl-ctrl-group { display: none; }
  .maplibregl-ctrl-bottom-left { top: 74px; bottom: auto; left: 8px; }
  .maplibregl-ctrl-bottom-right { top: 74px; bottom: auto; }
}

/* ============ مربعات الخدمات فوق الخريطة ============ */
#tiles {
  position: fixed; z-index: 9; top: 16px; left: 16px; right: 424px;
  display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 10px;
  scrollbar-width: none; direction: rtl;
}
#tiles::-webkit-scrollbar { display: none; }
.tile {
  flex: none; width: 78px; height: 88px; padding: 0; border: 0; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  border-radius: 20px; background: rgba(255, 253, 248, .94);
  box-shadow: 0 6px 18px rgba(41, 33, 20, .14), 0 1px 3px rgba(41, 33, 20, .08), inset 0 0 0 1px rgba(236, 228, 214, .9);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: transform .15s, box-shadow .15s, background .15s;
}
.tile:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(41, 33, 20, .18), inset 0 0 0 1px var(--gold); }
.tile:active { transform: scale(.95); }
.tile:focus-visible { outline: 2px solid var(--lapis-2); outline-offset: 2px; }
.tile .ti { width: 38px; height: 38px; border-radius: 13px; display: grid; place-items: center; background: var(--lapis-soft); }
.tile .ti svg { width: 26px; height: 26px; fill: none; stroke: var(--lapis); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tile .tl { font-size: 12.5px; font-weight: 500; color: var(--ink); line-height: 1; white-space: nowrap; }
.tile.on { background: var(--lapis); box-shadow: 0 8px 20px rgba(28, 58, 122, .35); }
.tile.on .ti { background: rgba(255, 255, 255, .14); }
.tile.on .ti svg { stroke: #fff; }
.tile.on .tl { color: #fff; }

.tip { display: flex; gap: 8px; align-items: flex-start; color: var(--muted); font-size: 13px; line-height: 1.7;
  background: var(--sand); border-radius: 14px; padding: 10px 12px; }
.tip svg { width: 14px; height: 14px; fill: var(--gold); margin-top: 4px; }

@media (max-width: 640px) {
  #tiles { top: 10px; left: 0; right: 0; padding: 2px 12px 10px; gap: 8px; }
  .tile { width: 66px; height: 66px; border-radius: 18px; gap: 4px; }
  .tile .ti { width: 32px; height: 32px; border-radius: 11px; }
  .tile .ti svg { width: 22px; height: 22px; }
  .tile .tl { font-size: 11.5px; }
  .fab { top: 92px; }
  .maplibregl-ctrl-bottom-left { top: 152px !important; }
  .maplibregl-ctrl-bottom-right { top: 152px !important; }
  #toast { top: 96px; }
  .tip { display: none; }
}

/* بطاقة السياق: حول أي نقطة وضمن أي مسافة */
.ctx {
  flex: none; height: 88px; min-width: 112px; padding: 9px 12px; border-radius: 20px;
  display: flex; flex-direction: column; justify-content: center; gap: 5px;
  background: var(--lapis); color: #fff; box-shadow: 0 8px 20px rgba(28, 58, 122, .3);
}
.ctx .cw { display: flex; flex-direction: column; line-height: 1.3; }
.ctx .cl { font-size: 11.5px; opacity: .75; }
.ctx b { font-size: 14px; font-weight: 700; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx button { border: 0; cursor: pointer; font-size: 12.5px; border-radius: 10px; padding: 3px 9px; align-self: flex-start; }
.ctx .cr { background: rgba(255, 255, 255, .16); color: #fff; }
.ctx .cr:hover { background: rgba(255, 255, 255, .26); }
.ctx .cb { background: var(--gold); color: var(--ink); font-weight: 700; }
.ctx .cn { font-size: 11.5px; opacity: .85; max-width: 150px; }
.tile .td { font-size: 11px; font-weight: 700; color: var(--palm); line-height: 1; }
.tile.on .td { color: var(--gold); }
.pin-ref-old { width: 22px; height: 22px; border-radius: 50%; background: var(--paper);
  border: 5px solid var(--lapis); box-shadow: 0 0 0 4px rgba(212, 168, 67, .55), 0 2px 8px rgba(0, 0, 0, .3); }
@media (max-width: 640px) {
  .tile { height: 76px; }
  .ctx { height: 76px; min-width: 100px; padding: 7px 10px; border-radius: 18px; }
  .ctx b { font-size: 13px; max-width: 110px; }
  .fab { top: 102px; }
  .maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right { top: 162px !important; }
}

/* دبوس نقطة البحث المختارة */
.ref-pin { display: flex; flex-direction: column; align-items: center; cursor: pointer; filter: drop-shadow(0 4px 6px rgba(0,0,0,.3)); }
.ref-pin .rp-shape { width: 40px; height: 52px; }
.ref-pin .rp-shape path { fill: var(--lapis); stroke: #fff; stroke-width: 2.5; }
.ref-pin .rp-shape use { fill: var(--gold); }
.ref-pin .rp-label { margin-bottom: 4px; max-width: 170px; padding: 3px 10px; border-radius: 10px;
  background: var(--lapis); color: #fff; font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border: 1.5px solid var(--gold); }
.ctx .cw { background: none; border: 0; padding: 0; color: inherit; text-align: right; cursor: pointer; font: inherit; }
.ctx .cw:hover b { text-decoration: underline; text-underline-offset: 3px; }

/* تعليمات الطريق: المسافة ثم الفعل ثم المعلم */
#route-steps .pre { color: var(--lapis); font-weight: 700; }
#route-steps .lm { display: inline-block; margin-inline-start: 6px; padding: 0 8px; border-radius: 8px;
  background: var(--gold-soft); color: #7a5a14; font-size: 13px; font-weight: 500; line-height: 1.8; }

.hello-sub { font-family: var(--text); font-size: 14px; font-weight: 500; color: var(--muted); margin-inline-start: 6px; }
body.routing #tiles { display: none; }
@media (max-width: 640px) { body.routing .fab { top: 16px; } body.routing .maplibregl-ctrl-bottom-left, body.routing .maplibregl-ctrl-bottom-right { top: 74px !important; } }

/* «عندي باج» */
.badge-sw { display: flex; align-items: center; gap: 8px; margin: 10px 2px 0; font-size: 13px; color: var(--muted); cursor: pointer; }
.badge-sw input { position: absolute; opacity: 0; pointer-events: none; }
.badge-sw .sw { flex: none; width: 34px; height: 20px; border-radius: 20px; background: var(--line); position: relative; transition: background .15s; }
.badge-sw .sw::after { content: ""; position: absolute; top: 2px; right: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: right .15s; }
.badge-sw input:checked + .sw { background: var(--lapis); }
.badge-sw input:checked + .sw::after { right: 16px; }
.badge-sw input:focus-visible + .sw { outline: 2px solid var(--lapis-2); }
.badge-sw svg { width: 18px; height: 18px; }
/* شارات العوائق */
.flags { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.flags:empty { display: none; }
.flag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; color: #3d4a3a;
  background: #eef0ea; border-radius: 8px; padding: 1px 8px 1px 6px; margin-inline-start: 6px; line-height: 1.9; }
.flag svg { width: 15px; height: 15px; }
.flag.warn { color: #8a2f25; background: #f9e5e1; }
#route-summary .flags { margin-top: 6px; }
.flags .flag { margin-inline-start: 0; }

/* زر الحساب */
#acct { text-decoration: none; }
#acct.in { background: var(--gold-soft); color: var(--lapis); font-family: var(--kufi); font-weight: 700; font-size: 17px; }
.flag.route-warn { display: flex; margin: 0 0 10px; padding: 8px 10px; font-size: 13px; line-height: 1.7; border-radius: 12px; }

.verify-tip { display: block; margin-bottom: 8px; background: var(--lapis-soft); color: var(--lapis); text-decoration: none; font-weight: 500; }
@media (max-width: 640px) { .verify-tip:not([hidden]) { display: block; } }

/* ---------- الملاحة الناطقة (nav.js) ---------- */
.nav-go { width: 100%; justify-content: center; margin: 4px 0 12px; font-size: 16px; padding: 12px; }
.trip-btn { width: 100%; justify-content: center; margin: 8px 0; }
body.navigating #sheet, body.navigating #tiles, body.navigating #locate { display: none; }
#nav { position: fixed; inset: 0; pointer-events: none; z-index: 30; font-family: var(--sans, inherit); }
#nav > * { pointer-events: auto; }
.nav-head { position: absolute; top: calc(10px + env(safe-area-inset-top)); left: 12px; right: 12px; max-width: 520px; margin-inline: auto; pointer-events: none !important; }
.nav-head > * { pointer-events: auto; }
.nav-top { display: flex; gap: 12px; align-items: center; transition: padding .25s; background: var(--lapis, #1c3a7a); color: #fff; border-radius: 18px; padding: 12px 16px;
  box-shadow: 0 10px 28px rgba(15, 25, 50, .35); border-top: 3px solid var(--gold); }
.nav-arrow { flex: none; width: 52px; height: 52px; transition: width .25s, height .25s; }
.nav-arrow svg { display: block; width: 100%; height: 100%; }
.nav-dist, .nav-act { transition: font-size .25s; }
/* قرب الانعطافة: العلامة تكبر حتى تُرى بنظرة */
.nav-top.near { padding: 16px 18px; }
.nav-top.near .nav-arrow { width: 104px; height: 104px; }
.nav-top.near .nav-dist { font-size: 44px; }
.nav-top.near .nav-act { font-size: 20px; }
.nav-top.now { background: var(--gold); color: #1d1503; border-top-color: #fff; }
.nav-top.now .nav-dist { color: #1d1503; }
.nav-top.now .nav-arrow { animation: nav-pulse .7s ease-in-out infinite alternate; }
@keyframes nav-pulse { to { transform: scale(1.12); } }
.nav-main { flex: 1; min-width: 0; }
.nav-dist { font-family: var(--kufi, inherit); font-size: 28px; font-weight: 700; color: var(--gold); line-height: 1.1; }
.nav-act { font-size: 17px; font-weight: 600; line-height: 1.5; }
.nav-lm { display: inline-block; margin-top: 4px; font-size: 13px; background: rgba(212, 168, 67, .2); color: #f6ecd2; border-radius: 8px; padding: 2px 8px; }
.nav-next { width: fit-content; margin-inline-start: 12px; background: #fffdf8; color: var(--lapis, #1c3a7a);
  border-radius: 0 0 12px 12px; padding: 6px 14px; font-size: 14px; font-weight: 600; box-shadow: 0 6px 14px rgba(0,0,0,.15); }
.nav-ready { position: absolute; top: 45%; left: 50%; transform: translate(-50%, -50%); background: #fffdf8; border-radius: 20px; padding: 18px 26px;
  text-align: center; box-shadow: 0 12px 30px rgba(0,0,0,.25); border: 2px solid var(--gold); }
.nav-ready b { display: block; font-family: var(--kufi, inherit); font-size: 24px; color: var(--lapis, #1c3a7a); }
.nav-ready span { font-size: 14px; color: #555; }
.nav-recenter { position: absolute; bottom: calc(110px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  background: var(--lapis-2, #2a55b8); color: #fff; border: 0; border-radius: 999px; padding: 10px 18px; font: inherit; font-weight: 700; box-shadow: 0 6px 16px rgba(0,0,0,.25); }
.nav-bottom { position: absolute; bottom: calc(12px + env(safe-area-inset-bottom)); left: 12px; right: 12px; max-width: 520px; margin-inline: auto;
  display: flex; align-items: center; gap: 10px; background: #fffdf8; border-radius: 18px; padding: 10px 12px; box-shadow: 0 10px 26px rgba(0,0,0,.22); }
.nav-stats { flex: 1; display: flex; justify-content: space-around; text-align: center; }
.nav-stats b { display: block; font-size: 18px; color: var(--lapis, #1c3a7a); }
.nav-stats small { font-size: 12px; color: #777; }
.nav-btn { border: 0; border-radius: 12px; padding: 10px 12px; font: inherit; font-size: 16px; background: #f1ece0; cursor: pointer; }
.nav-btn.end { background: #b5653e; color: #fff; font-weight: 700; }
.nav-btn.hud-btn { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 10px; background: #1c3a7a; color: #fff; line-height: 1; }
.nav-btn.hud-btn span { font-size: 18px; } .nav-btn.hud-btn small { font-size: 11.5px; font-weight: 700; }
.nav-btn.hud-btn.glow { animation: hud-glow 1s ease-in-out 9 alternate; }
@keyframes hud-glow { to { box-shadow: 0 0 0 6px rgba(212, 168, 67, .75); } }
@media (max-width: 360px) { .nav-bottom { gap: 6px; padding: 8px; } .nav-stats b { font-size: 16px; } }
.nav-said { position: absolute; bottom: calc(92px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%) translateY(10px); opacity: 0;
  transition: .25s; background: rgba(28, 58, 122, .92); color: #fff; padding: 6px 14px; border-radius: 12px; font-size: 14px; max-width: 90vw; text-align: center; }
.nav-said.show { opacity: 1; transform: translateX(-50%); }
.nav-me { width: 40px; height: 40px; filter: drop-shadow(0 3px 6px rgba(0,0,0,.35)); }
.nav-me svg { width: 100%; height: 100%; }
#rec-pill { position: fixed; z-index: 31; top: calc(10px + env(safe-area-inset-top)); left: 12px; display: flex; align-items: center; gap: 8px;
  background: #fffdf8; border-radius: 999px; padding: 6px 6px 6px 12px; box-shadow: 0 6px 16px rgba(0,0,0,.2); font-size: 13px; font-weight: 600; }
body.navigating #rec-pill { top: auto; bottom: calc(150px + env(safe-area-inset-bottom)); }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #c0392b; animation: recblink 1.2s infinite; }
@keyframes recblink { 50% { opacity: .25; } }
#rec-stop { border: 0; border-radius: 999px; background: #b5653e; color: #fff; padding: 4px 12px; font: inherit; font-weight: 700; cursor: pointer; }
#nav-dlg { position: fixed; inset: 0; z-index: 40; background: rgba(20, 25, 40, .45); display: grid; place-items: center; padding: 16px; }
#nav-dlg[hidden] { display: none; }
.nd-card { background: #fffdf8; border-radius: 20px; padding: 20px; max-width: 420px; width: 100%; border-top: 3px solid var(--gold); box-shadow: 0 16px 40px rgba(0,0,0,.3); }
.nd-card h3 { margin: 0 0 8px; color: var(--lapis, #1c3a7a); font-size: 20px; }
.nd-card p { margin: 0 0 12px; line-height: 1.8; color: #333; }
.nd-check { display: block; background: var(--gold-soft); border-radius: 12px; padding: 10px 12px; margin-bottom: 14px; line-height: 1.7; cursor: pointer; }
.nd-check small { color: #7a5a14; }
.nd-actions { display: flex; gap: 8px; }
.nd-actions .btn { flex: 1; justify-content: center; }
body.navigating .maplibregl-ctrl-bottom-left, body.navigating .maplibregl-ctrl-bottom-right { display: none; }

/* رموز الطريق: الشرح ودليل الرموز */
.traffic-fab { left: 128px !important; font-size: 21px; opacity: .55; }
.traffic-fab.on { opacity: 1; box-shadow: 0 0 0 2px var(--gold), var(--shadow); }
.legend-fab { left: 72px !important; font-family: var(--kufi, inherit); font-size: 22px; font-weight: 700; }
#legend { position: fixed; z-index: 12; left: 16px; bottom: 104px; width: min(320px, calc(100vw - 32px)); max-height: 60vh; overflow: auto;
  background: var(--paper); border-radius: 18px; box-shadow: var(--shadow); padding: 12px 14px; border-top: 3px solid var(--gold); }
@media (max-width: 640px) { #legend { top: 150px; bottom: auto; } }
.lg-h { font-family: var(--kufi, inherit); font-weight: 700; color: var(--lapis); font-size: 17px; margin-bottom: 6px; }
.lg-row { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; border-bottom: 1px solid rgba(0,0,0,.06); }
.lg-row svg { width: 28px; height: 28px; flex: none; }
.lg-row b { display: block; font-size: 14px; color: var(--ink, #222); }
.lg-row span { font-size: 12.5px; color: #666; line-height: 1.6; }
.sign-pop .maplibregl-popup-content { border-radius: 16px; padding: 12px 14px; border-top: 3px solid var(--gold); font-family: inherit; }
.sign-info .si-h { display: flex; align-items: center; gap: 8px; font-size: 16px; color: var(--lapis); }
.sign-info .si-h svg { width: 30px; height: 30px; }
.sign-info .si-name { font-weight: 600; margin-top: 4px; }
.sign-info p { margin: 6px 0 0; font-size: 13px; line-height: 1.7; color: #444; }
.sign-info .si-note { color: #7a5a14; }
.si-src { font-size: 11px; color: #999; margin-top: 6px; }
/* المركبة على الطريق */
.veh { width: 38px; height: 38px; filter: drop-shadow(0 3px 5px rgba(0,0,0,.35)); }
.veh svg { width: 100%; height: 100%; }
.go-row { display: flex; gap: 8px; margin: 4px 0 12px; }
.go-row .nav-go { margin: 0; flex: 1; }
.voice-btn { flex: none; }
#route-steps li.on { background: var(--gold-soft); border-radius: 12px; }
/* إعدادات الصوت */
.vs-opts { display: grid; gap: 6px; margin: 8px 0 12px; }
.vs-opts label { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid rgba(0,0,0,.1); border-radius: 12px; cursor: pointer; }
.vs-opts label:has(input:checked) { border-color: var(--lapis-2); background: #eef3ff; }
.vs-opts small { color: #777; }
.nd-card select { width: 100%; height: 40px; border-radius: 10px; border: 1px solid rgba(0,0,0,.15); padding: 0 8px; font: inherit; margin-bottom: 10px; }
.nd-card .vs-l { font-weight: 700; font-size: 14px; color: var(--lapis); }
.nav-dlg-wrap { position: fixed; inset: 0; z-index: 41; background: rgba(20, 25, 40, .45); display: grid; place-items: center; padding: 16px; }
.nav-dlg-wrap[hidden] { display: none; }

/* اختيار نقطة من الخريطة */
body.picking #sheet, body.picking #tiles, body.picking .fab, body.picking #legend { display: none !important; }
#picker[hidden] { display: none; }
.pk-pin { position: fixed; z-index: 20; left: 50%; top: 50%; width: 46px; height: 46px; transform: translate(-50%, -100%); pointer-events: none;
  color: var(--terra, #b5653e); filter: drop-shadow(0 4px 6px rgba(0,0,0,.35)); }
.pk-pin svg { width: 100%; height: 100%; }
.pk-pin::after { content: ""; position: absolute; left: 50%; bottom: -4px; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 3px rgba(212,168,67,.35); }
.pk-bar { position: fixed; z-index: 21; left: 12px; right: 12px; bottom: calc(16px + env(safe-area-inset-bottom)); max-width: 520px; margin-inline: auto;
  background: var(--paper); border-radius: 18px; box-shadow: var(--shadow); padding: 12px; border-top: 3px solid var(--gold); }
.pk-t { font-weight: 600; color: var(--lapis); margin-bottom: 10px; text-align: center; }
.pk-actions { display: flex; gap: 8px; }
.pk-actions .btn { flex: 1; justify-content: center; }
.pk-actions .btn.primary { flex: 2; }

/* المفضلة */
.favs { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.favs[hidden] { display: none; }
.fav-chip { border: 1px solid rgba(28,58,122,.18); background: #fff; color: var(--lapis); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 14px; cursor: pointer; }
.fav-chip.add { border-style: dashed; color: #777; background: transparent; }
.fav-chip:hover { border-color: var(--gold); }
#place-fav.on { color: var(--gold); border-color: var(--gold); }
#place-fav { font-size: 20px; }
.fav-note { background: var(--gold-soft); color: #7a5a14; border-radius: 10px; padding: 6px 10px; margin: 6px 0; font-size: 14px; }
.fav-ic { font-size: 18px; display: grid; place-items: center; }
.fd-in { width: 100%; height: 40px; border-radius: 10px; border: 1px solid rgba(0,0,0,.15); padding: 0 10px; font: inherit; margin: 4px 0 10px; box-sizing: border-box; }
.fav-kinds { grid-template-columns: repeat(3, 1fr); }
.btn.danger { color: #b5653e; }

/* «بلّغ»: بلاغات السائقين (reports.js) */
.rep-fab { left: 128px !important; width: auto; padding: 0 14px 0 12px; display: flex; gap: 6px; align-items: center;
  background: var(--gold); color: var(--lapis); font: inherit; font-family: var(--kufi, inherit); font-weight: 700; font-size: 17px; }
.rep-fab:hover { color: var(--lapis); filter: brightness(1.05); }
.rep-fab svg { width: 20px; height: 20px; }
body.navigating .rep-fab { top: auto !important; left: auto !important; right: 12px; bottom: calc(150px + env(safe-area-inset-bottom)); z-index: 31; }
.rep-card { max-width: 440px; }
.rep-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 6px 0 12px; }
.rep-grid[hidden] { display: none; }
.rep-kind { border: 1px solid rgba(28, 58, 122, .14); background: #fff; border-radius: 14px; padding: 10px 4px 8px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px; font: inherit; font-size: 13px; font-weight: 600; color: var(--ink, #222); line-height: 1.4; }
.rep-kind img { width: 42px; height: 42px; }
.rep-kind:hover, .rep-kind:focus-visible { border-color: var(--gold); background: var(--gold-soft); outline: none; }
.rep-where-a { margin-bottom: 12px; }
.rep-info .si-h img { width: 32px; height: 32px; }
.rep-acts { display: flex; gap: 6px; margin-top: 10px; }
.rep-acts .btn { flex: 1; justify-content: center; padding: 7px 8px; font-size: 13.5px; }
.rep-acts .btn.on { border-color: var(--lapis-2); background: #eef3ff; }
.lg-row img { width: 28px; height: 28px; flex: none; }
.lg-rep { margin-top: 10px; }
@media (max-width: 380px) { .rep-grid { gap: 6px; } .rep-kind { font-size: 12px; } .rep-kind img { width: 36px; height: 36px; } }
.rep-acts .btn { white-space: nowrap; gap: 4px; }

/* ---------- أماكن المستخدمين: صفحة المحل، «أضف مكانك»، التقييم، التبليغ (places.js) ---------- */
.home-add { display: flex; gap: 8px; margin: 8px 0; }
.home-add .btn { flex: 1; justify-content: center; }
.home-add .btn[hidden] { display: none; }
.item .up-star, .pl-line .up-star, .pl-rev .up-star { color: #b8860b; font-weight: 700; }
.up-open { color: var(--palm); font-weight: 600; }
.up-shut { color: var(--clay); font-weight: 600; }
#place-extra { margin-top: 10px; }
#place-extra:empty { display: none; }
.pl-status { background: var(--gold-soft); color: #6b4e10; border-radius: 12px; padding: 9px 12px; margin-bottom: 10px; font-size: 14px; line-height: 1.7; }
.pl-status.held, .pl-status.rejected { background: #fbe9e3; color: #8a3d1f; }
.pl-line { font-size: 14.5px; margin: 4px 0 8px; }
.pl-verified { display: inline-block; margin-inline-start: 8px; padding: 1px 8px; border-radius: 999px; background: #e4f1ea; color: var(--palm); font-size: 12px; font-weight: 700; }
.pl-about { margin: 6px 0; line-height: 1.8; font-size: 14.5px; white-space: pre-line; }
.pl-row { font-size: 14px; color: #4a4439; margin: 4px 0; line-height: 1.7; }
.pl-contact { display: flex; gap: 8px; margin: 10px 0; }
.pl-contact .btn { flex: 1; justify-content: center; text-decoration: none; }
.pl-contact .pl-wa { background: #e7f7ec; border-color: #bfe5cb; color: #1c7a3d; }
.pl-photos { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: thin; }
.pl-ph { flex: 0 0 auto; width: 104px; height: 84px; border-radius: 12px; border: 1px solid var(--line); background: var(--sand); padding: 0; overflow: hidden; position: relative; cursor: pointer; font: inherit; color: var(--lapis); }
.pl-ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pl-ph.pending img { opacity: .45; }
.pl-ph.pending span { position: absolute; inset: auto 0 0 0; background: rgba(0,0,0,.6); color: #fff; font-size: 10.5px; padding: 2px; text-align: center; }
.pl-ph.add { border-style: dashed; font-weight: 700; }
.pl-reviews { display: grid; gap: 8px; margin: 6px 0 10px; }
.pl-rev { background: var(--sand); border-radius: 12px; padding: 8px 12px; font-size: 14px; position: relative; }
.pl-rev p { margin: 4px 0 0; line-height: 1.7; }
.pl-rev .pl-flag { position: absolute; inset-inline-end: 6px; top: 2px; width: auto; padding: 4px 6px; font-size: 11.5px; color: var(--muted); }
.pl-foot { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.pl-foot .link-btn { width: auto; padding: 8px 6px; font-size: 13px; }
.pl-foot.osm { border-top: 1px solid var(--line); padding-top: 4px; justify-content: space-between; }
.pl-dlg { align-items: start; overflow-y: auto; }
.pl-dlg .nd-card { margin: auto; }
.pl-form { max-width: 460px; }
.pl-f { display: block; }
.pl-f[hidden] { display: none; }
.pl-form textarea.fd-in, .pl-dlg textarea.fd-in { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.6; }
.pl-where { display: flex; align-items: center; justify-content: space-between; background: var(--lapis-soft); border-radius: 10px; padding: 2px 10px; margin-bottom: 10px; font-size: 13px; direction: rtl; }
.pl-where .link-btn { width: auto; padding: 8px 4px; }
.pl-check { display: flex; gap: 8px; align-items: center; margin: 0 0 10px; font-size: 14px; cursor: pointer; }
.pl-hmode { grid-template-columns: repeat(3, 1fr); }
.pl-hmode label { padding: 7px 8px; font-size: 13.5px; }
.pl-hours { background: var(--sand); border-radius: 12px; padding: 10px; margin-bottom: 10px; }
.pl-hours[hidden] { display: none; }
.pl-shift { display: flex; align-items: center; gap: 6px; font-size: 13px; margin-bottom: 6px; }
.pl-shift span:first-child { flex: 1; }
.pl-shift .pl-time { width: 104px; margin: 0; height: 36px; direction: ltr; }
.pl-days { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.pl-day { border: 1px solid rgba(0,0,0,.15); background: #fff; border-radius: 999px; padding: 4px 10px; font: inherit; font-size: 12.5px; cursor: pointer; }
.pl-day.on { background: var(--clay); border-color: var(--clay); color: #fff; }
.pl-stars { display: flex; justify-content: center; gap: 6px; margin: 6px 0 10px; direction: ltr; }
.pl-star { border: 0; background: none; font-size: 38px; line-height: 1; color: #cfc6b4; cursor: pointer; padding: 0 2px; }
.pl-star.on { color: #d4a843; }
.pl-reasons label { font-size: 14px; }
.pl-light { position: fixed; inset: 0; z-index: 60; background: rgba(10, 12, 20, .92); display: grid; grid-template-rows: 1fr auto; place-items: center; padding: 12px; gap: 10px; }
.pl-light img { max-width: 100%; max-height: 100%; min-height: 0; border-radius: 10px; object-fit: contain; }
.pl-light-bar { display: flex; gap: 8px; }
.pl-mine-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* ---------- عدّاد السرعة وحد السرعة ---------- */
.nav-speed { position: absolute; left: 12px; bottom: calc(150px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 6px; direction: ltr;
  border: 0; background: none; padding: 0; font: inherit; cursor: pointer; }
.nav-kmh { display: grid; place-items: center; width: 62px; height: 62px; border-radius: 50%; background: #fffdf8; box-shadow: 0 6px 16px rgba(0,0,0,.25); line-height: 1; }
.nav-kmh b { font-family: var(--kufi, inherit); font-size: 24px; color: var(--lapis, #1c3a7a); margin-top: 8px; }
.nav-kmh small { font-size: 10.5px; color: #777; margin-bottom: 8px; }
.nav-limit { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%; background: #fff; border: 6px solid #d2232a; color: #111;
  font-family: var(--kufi, inherit); font-weight: 700; font-size: 20px; line-height: 1; box-shadow: 0 6px 16px rgba(0,0,0,.25); }
.nav-limit[hidden] { display: none; }
.nav-speed.over .nav-kmh { background: #d2232a; animation: nav-pulse .5s ease-in-out infinite alternate; }
.nav-speed.over .nav-kmh b, .nav-speed.over .nav-kmh small { color: #fff; }
/* ---------- العرض المكبّر / على الزجاج (HUD) ---------- */
.nav-hud { position: absolute; inset: 0; z-index: 5; background: #000; color: #fff; display: flex; flex-direction: column; }
.nav-hud[hidden] { display: none; }
.hud-in { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.5vh; padding: 3vh 5vw; text-align: center; }
.hud-in.flip { transform: scaleY(-1); }
.hud-arrow { width: min(46vw, 38vh); height: min(46vw, 38vh); color: #7fd4ff; }
.hud-arrow svg { width: 100%; height: 100%; }
.hud-dist { font-family: var(--kufi, inherit); font-weight: 700; font-size: min(17vw, 13vh); line-height: 1.1; color: #ffd76a; }
.hud-act { font-size: min(6vw, 4.2vh); font-weight: 600; max-width: 100%; }
.hud-row { display: flex; align-items: center; justify-content: center; gap: 5vw; margin-top: 2vh; direction: ltr; }
.hud-row .nav-limit { width: min(20vw, 13vh); height: min(20vw, 13vh); font-size: min(8vw, 5vh); border-width: min(2vw, 1.4vh); box-shadow: none; }
.hud-kmh b { font-family: var(--kufi, inherit); font-size: min(15vw, 10vh); line-height: 1; }
.hud-kmh small { font-size: min(4vw, 2.6vh); color: #aaa; margin-inline-start: 4px; }
.hud-eta { font-size: min(4.6vw, 3.2vh); color: #bbb; }
.hud-dist small { font-family: 'Plex Arabic', var(--plex, inherit), sans-serif; font-weight: 700; font-size: .42em; margin-inline-start: .15em; }
body.hud-on .rep-fab, body.hud-on #rec-pill { display: none !important; }
.nav-hud.over .hud-kmh b { color: #ff5a5f; }
.hud-bar { display: flex; gap: 10px; justify-content: center; padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); }
.hud-bar button { border: 1px solid #444; background: #151515; color: #ddd; border-radius: 12px; padding: 10px 16px; font: inherit; font-size: 15px; }
@media (orientation: landscape) and (max-height: 520px) {
  .hud-in { flex-direction: row; flex-wrap: wrap; column-gap: 5vw; }
  .hud-arrow { width: 44vh; height: 44vh; } .hud-dist { font-size: 22vh; } .hud-act { flex-basis: 100%; order: 3; font-size: 6vh; } .hud-row { order: 2; margin: 0; } .hud-eta { order: 4; flex-basis: 100%; }
}

/* خريطة إيران التجريبية (iran.js) — الزر لأصحاب صلاحية «iran» فقط */
.ir-fab { left: 232px !important; width: auto; padding: 0 12px; display: flex; gap: 5px; align-items: center;
  font: inherit; font-family: var(--kufi, inherit); font-size: 15px; font-weight: 700; color: var(--muted, #6b6b6b); }
.ir-fab span { font-size: 18px; line-height: 1; }
.ir-fab.on { background: var(--lapis); color: #fff; }
body.navigating .ir-fab, body.picking .ir-fab, body.hud-on .ir-fab { display: none !important; }

/* الموكب: الخدمات وأزرار صاحبه */
.pl-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.pl-tags .pill { font-size: 12.5px; }
.pl-owner { margin-top: 10px; padding: 10px; border: 1px dashed rgba(28,58,122,.35); border-radius: 12px; }

/* دبابيس نتائج البحث / أقرب الخدمات — العنصر الخارجي تتحكم به MapLibre (موضع/تحويل)، فلا نلمس position/transform عليه */
.hit-pin { width: 36px; height: 44px; padding: 0; border: 0; background: none; cursor: pointer; z-index: 3; }
.hit-pin .hp { position: absolute; left: 1px; top: 1px; width: 34px; height: 34px; border-radius: 50% 50% 50% 4px; transform: rotate(-45deg);
  background: #d93025; border: 2.5px solid #fff; box-shadow: 0 3px 8px rgba(0,0,0,.4); }
.hit-pin svg { position: absolute; left: 9px; top: 4px; width: 18px; height: 18px; fill: #fff; }
.hit-pin b { position: absolute; left: 0; right: 0; top: 21px; text-align: center; color: #fff; font: 800 12px/1 system-ui, sans-serif; text-shadow: 0 1px 2px rgba(0,0,0,.6); }

/* رسالة من المدير */
.ann-card { position: fixed; z-index: 40; top: calc(12px + env(safe-area-inset-top)); inset-inline: 12px; max-width: 460px; margin-inline: auto; padding: 14px 16px; border-radius: 18px;
  background: var(--paper, #fffdf8); color: var(--ink, #222); box-shadow: 0 10px 30px rgba(0,0,0,.28); border: 2px solid var(--gold, #d4a843); }
.ann-card p { margin: 6px 0 10px; font-size: 14px; line-height: 1.7; white-space: pre-wrap; }
.ann-row { display: flex; gap: 8px; justify-content: flex-end; }
.ann-row button, .ann-row a { border: 0; border-radius: 12px; padding: 8px 18px; font: 700 14px inherit; font-family: inherit; cursor: pointer; text-decoration: none; background: var(--lapis, #1f3a7a); color: #fff; }
.ann-row a { background: var(--gold, #d4a843); color: #1d1c19; }

/* ===== ٢١/١١: ترتيب الجوال الجديد ===== */
.trow, .quick { display: contents; }
/* ذكر الحقوق: «© OpenStreetMap · @shakhis» فقط في أسفل الصفحة، والباقي بالنقر */
.attr-fixed { position: fixed !important; left: 6px; bottom: calc(var(--sheet-h, 0px) + 4px); z-index: 45; margin: 0 !important; float: none !important;
  width: max-content; max-width: calc(100vw - 12px); direction: ltr; }
.attr-fixed .maplibregl-ctrl-attrib-inner { direction: rtl; white-space: normal; padding: 4px 9px; }
.maplibregl-ctrl-attrib-button { width: auto !important; min-width: 0; height: 20px !important; padding: 0 9px !important; background-image: none !important;
  font: 11px/20px var(--text, inherit); color: var(--ink, #333); border-radius: 10px; white-space: nowrap; display: block; }
.maplibregl-ctrl-attrib-button::after { content: "© Shakhis\A © OpenStreetMap"; white-space: pre; }
.attr-fixed .maplibregl-ctrl-attrib-button { position: static !important; height: auto !important; font: 10.5px/14px var(--text, inherit); padding: 3px 9px !important; text-align: left; }
@media (max-width: 640px) {
  /* الشريط العلوي: «ضمن ١ كم» ثم أقرب الخدمات، سطر واحد يتمرر، كل مربع بأيقونة صغيرة يمين الكلمة */
  body:not(.navigating) #tiles { top: 8px; left: 0; right: 0; padding: 0 10px; gap: 6px; flex-direction: row; overflow-x: auto; scrollbar-width: none; }
  .ctx { display: contents; }
  .ctx .cw, .ctx .cn, .ctx .cb { display: none; }
  .ctx .cr, .ctx .cb { flex: none; height: 36px; padding: 0 13px; border-radius: 18px; border: 0; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
  .ctx .cr { background: var(--lapis); color: #fff; box-shadow: 0 6px 16px rgba(28, 58, 122, .3); }
  .ctx .cb { background: var(--gold); color: var(--ink); }
  .tile { flex: none; width: auto; height: 36px; padding: 0 12px 0 13px; flex-direction: row; gap: 6px; border-radius: 18px; }
  .tile .ti { display: grid; width: 20px; height: 20px; border-radius: 0; background: none; }
  .tile .ti svg { width: 18px; height: 18px; }
  .tile .tl { font-size: 13px; }
  .tile .td { font-size: 11.5px; }
  /* أزرار الخريطة: عمود تحت الشريط، «موقعي» ثم «بلّغ» ثم «؟»، وأصغر */
  body:not(.navigating) .fab { left: 10px; width: 40px; height: 40px; border-radius: 13px; }
  body:not(.navigating) #locate { top: 56px; }
  body:not(.navigating) .rep-fab { left: 10px !important; top: 102px; width: 40px; padding: 0; justify-content: center; }
  body:not(.navigating) .rep-fab span { display: none; }
  body:not(.navigating) .rep-fab svg { width: 20px; height: 20px; }
  body:not(.navigating) .legend-fab { left: 10px !important; top: 148px; font-size: 19px; }
  body:not(.navigating) .traffic-fab { left: 10px !important; top: 194px; font-size: 18px; }
  body:not(.navigating) .ir-fab { left: 10px !important; top: 240px; width: 40px; padding: 0; justify-content: center; gap: 0; font-size: 0; }
  .maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right { top: 56px !important; bottom: auto !important; }
  .maplibregl-ctrl-bottom-left { left: 56px !important; right: auto !important; direction: ltr; }
  #toast { top: 60px; }
  #legend { top: 56px; left: 56px; bottom: auto; }
  /* الصفحة الرئيسية: أزرار سريعة بأيقونات تحت البحث بدل أزرار كبيرة */
  .quick { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 0 0 6px; }
  .quick::-webkit-scrollbar { display: none; }
  .quick .favs, .quick .home-add { display: contents; }
  .quick .btn, .quick .favs button, .quick .favs a { flex: none; width: auto; height: 36px; padding: 0 13px; margin: 0; font-size: 13px; border-radius: 18px; white-space: nowrap; max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
  .hello { padding-bottom: 6px; }
  /* الاتجاهات: بعد حساب المسار تُضغط البطاقة العلوية ويثبت «انطلق» أسفل اللوحة */
  #view-route:has(#route-summary:not([hidden])) .route-points { margin: 6px 0 6px; }
  #view-route:has(#route-summary:not([hidden])) .rp { margin-bottom: 4px; }
  #view-route:has(#route-summary:not([hidden])) .rp input { height: 36px; }
  #view-route:has(#route-summary:not([hidden])) #rp-hint { display: none; }
  #view-route:has(#route-summary:not([hidden])) .badge-sw { margin-top: 6px; }
  #view-route > .go-row { position: sticky; bottom: 0; z-index: 3; background: var(--paper, #fffdf8); padding: 8px 0 6px; box-shadow: 0 -8px 12px -8px rgba(41,33,20,.18); }
}
/* الحقوق: بلا مربع ولا لون، خط أصغر مع هالة بيضاء خفيفة ليبقى مقروءاً على الخريطة (يعود الخلفية عند فتحه) */
.maplibregl-ctrl-attrib.attr-fixed:not([open]) { background: transparent !important; box-shadow: none !important; }
.attr-fixed:not([open]) .maplibregl-ctrl-attrib-button { padding: 0 4px !important; font: 9.5px/12px var(--text, inherit); color: #4a4438;
  text-shadow: 0 0 2px #fff, 0 0 3px #fff, 0 0 4px #fff; }
/* الحقوق: الحاوية دائماً شفافة تماماً؛ الخلفية للنص الطويل المفتوح فقط */
.maplibregl-ctrl-attrib.attr-fixed, .maplibregl-ctrl-attrib.attr-fixed.maplibregl-compact, .maplibregl-ctrl-attrib.attr-fixed.maplibregl-compact-show { background: transparent !important; box-shadow: none !important; border: 0 !important; }
.attr-fixed .maplibregl-ctrl-attrib-button { padding: 0 4px !important; font: 9.5px/12px var(--text, inherit); color: #4a4438; text-shadow: 0 0 2px #fff, 0 0 3px #fff, 0 0 4px #fff; background-color: transparent !important; }
.attr-fixed .maplibregl-ctrl-attrib-inner { background: rgba(255, 253, 248, .95); border-radius: 10px; }

/* الجوال: اللوحة الرئيسية مطوية (بحث + ترحيب مختصر)، تتمدد بالسحب للأعلى أو بلمس المقبض أو بالتركيز على البحث */
@media (max-width: 640px) {
  .grab { height: 22px; margin: 0 auto; background: none; position: relative; cursor: pointer; touch-action: none; }
  .grab::after { content: ''; position: absolute; left: 50%; top: 9px; width: 42px; height: 5px; margin-left: -21px; border-radius: 5px; background: var(--line); }
  #sheet:has(#view-home:not([hidden])):not(.exp) .hello-name,
  #sheet:has(#view-home:not([hidden])):not(.exp) .quick,
  #sheet:has(#view-home:not([hidden])):not(.exp) #view-home > .tip { display: none; }
  #sheet:has(#view-home:not([hidden])):not(.exp) .hello { padding: 0 0 4px; }
  #sheet:has(#view-home:not([hidden])):not(.exp) #view-home { padding-bottom: 6px; }
  #sheet.exp .hello-name { font-size: 20px; }
}

/* أيقونات دائرية للأزرار السريعة، وبطاقات أفقية لنتائج «أقرب …» (الجوال) */
.quick i, .fav-chip i { font-style: normal; margin-inline-end: 4px; }
@media (max-width: 640px) {
  .quick { gap: 14px; justify-content: flex-start; padding: 4px 0 8px; }
  .quick .btn, .quick .favs .fav-chip, #view-home .quick button { flex: none; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 62px; height: auto; max-width: 70px; padding: 0; border: 0; background: none; box-shadow: none; font-size: 12px; color: var(--ink, #2b2418); white-space: normal; text-align: center; line-height: 1.25; overflow: visible; }
  .quick .btn i, .quick .fav-chip i { display: grid; place-items: center; width: 48px; height: 48px; margin: 0; border-radius: 50%; background: #eef1f8; font-size: 22px; }
  .quick .fav-chip.add i { background: transparent; border: 1.5px dashed #b9b2a2; }
  .quick .btn span, .quick .fav-chip span { display: block; max-width: 66px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #sheet:has(#results.cards) { max-height: none; height: auto; }
  #results.cards { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: none; counter-reset: n; }
  #results.cards::-webkit-scrollbar { display: none; }
  #results.cards .group-title { display: none; }
  #results.cards .item { flex: none; width: 150px; flex-direction: column; align-items: flex-start; gap: 4px; padding: 10px; border-radius: 14px; background: #fff; box-shadow: 0 1px 5px rgba(0,0,0,.12); counter-increment: n; position: relative; }
  #results.cards .item > :first-child { display: none; }
  #results.cards .item .nm::before { content: counter(n, arabic-indic) " · "; color: #d93025; font-weight: 700; }
  #results.cards .item .nm { font-size: 14px; font-weight: 700; display: block; }
  #results.cards .item .sub { display: block; font-size: 12px; max-height: 2.6em; overflow: hidden; }
  #results.cards .item .km { order: 3; font-size: 18px; font-weight: 700; color: var(--lapis); }
  #results.cards .link-btn { flex: none; align-self: center; white-space: nowrap; padding: 0 12px; }
}

/* الجوال: شريط البحث في الأعلى (كالتطبيق)، تحته «ضمن N كم» والمربعات ثم عمود الأزرار؛ اللوحة السفلية للمحتوى فقط */
@media (max-width: 640px) {
  body { --off: 62px; }
  body.routing { --off: 0px; }
  body:not(.navigating) #search-form { position: fixed; z-index: 12; top: 8px; left: 10px; right: 10px; padding: 6px 8px;
    background: var(--paper); border-radius: 20px; box-shadow: var(--shadow); }
  body.routing:not(.navigating) #search-form, body.picking #search-form { display: none; }
  body:not(.navigating) #tiles { top: calc(8px + var(--off)); }
  body:not(.navigating) #locate { top: calc(56px + var(--off)); }
  body:not(.navigating) .rep-fab { top: calc(102px + var(--off)); }
  body:not(.navigating) .legend-fab { top: calc(148px + var(--off)); }
  body:not(.navigating) .traffic-fab { top: calc(194px + var(--off)); }
  body:not(.navigating) .ir-fab { top: calc(240px + var(--off)); }
  .maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right { top: calc(56px + var(--off)) !important; }
  #toast { top: calc(60px + var(--off)); }
  #legend { top: calc(56px + var(--off)); }
  #sheet .grab { margin-bottom: 2px; }
}
.rv { display: block; font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.4; }
@media (max-width: 640px) {
  #sheet:has(#route-summary:not([hidden])) { height: 58vh; max-height: 58vh; }
}

/* تفاصيل محلات OSM */
.osm-det { margin: 8px 0; padding: 10px 12px; border-radius: 14px; background: #fff; border: 1px solid var(--line); }
.od-row { font-size: 14px; }
.od-on { color: #1a8a4a; font-weight: 700; }
.od-off { color: #b3261e; font-weight: 700; }
.od-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.od-acts .btn { min-height: 36px; padding: 0 12px; font-size: 13.5px; text-decoration: none; }
.od-meta { margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.open-filter { margin: 0 0 6px; }
.open-filter.on { font-weight: 700; color: #1a8a4a; }
#results.only-open .item[data-open="0"] { display: none; }

/* المطالبة بملكية محل (claims.js) */
.cl-wrap { margin-top: 8px; }
.cl-badge { color: #1a8a4a; font-weight: 700; font-size: 13.5px; margin-top: 8px; }
.cl-status { font-weight: 700; margin: 6px 0; }
.cl-sms, .cl-photo, .cl-owner { padding: 10px; border: 1px dashed var(--line); border-radius: 12px; margin-top: 8px; display: grid; gap: 6px; }
.cl-t { font-weight: 700; font-size: 14px; }
.cl-code { font-size: 22px; letter-spacing: 2px; font-family: monospace; direction: ltr; text-align: center; background: #fff; border-radius: 10px; padding: 8px; }
.cl-owner input { min-height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; font: inherit; }
.cl-link { font-size: 13px; }
.pl-jump { display: flex; gap: 6px; overflow-x: auto; margin: 8px 0 2px; padding-bottom: 2px; scrollbar-width: none; }
.pl-jump::-webkit-scrollbar { display: none; }
.pl-jump[hidden] { display: none; }
.pl-jump .chip { flex: 0 0 auto; border: 1px solid var(--line); background: var(--lapis-soft); color: var(--lapis); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.pl-jump .chip { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; line-height: 1.4; }
.pl-jump .chip .ci { font-size: 14px; line-height: 1; }
@media (max-width: 520px) {
  .actions { flex-wrap: nowrap; gap: 5px; }
  .actions .btn { padding: 9px 8px; font-size: 13px; min-width: 0; white-space: nowrap; gap: 5px; }
  .actions .btn.icon-only { padding: 9px 8px; flex: none; }
  .actions #place-go { flex: 1 1 0; justify-content: center; }
  #place-around .lbl { display: none; }
}
.osm-det.od-top { margin: 10px 0 0; }

/* سطح المكتب: أزرار التكبير في أسفل اليسار لا تغطيها أزرار الخريطة، وكل زر في مكانه بلا تراكب */
@media (min-width: 641px) {
  .maplibregl-ctrl-bottom-left { bottom: 34px; }
  body:not(.navigating) #locate { left: 64px; }
  .legend-fab { left: 120px !important; }
  .traffic-fab { left: 176px !important; }
  body:not(.navigating) .rep-fab { left: 232px !important; }      /* «بلّغ» و«إيران» عريضان: آخر الصف */
  body:not(.navigating) .ir-fab { left: 324px !important; }      /* آخر الصف: عرضه متغير فلا يغطي غيره */
}

/* هاتف وموقع المكان (المصادر الإضافية) */
.contact-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0 4px; }
.contact-row .btn { text-decoration: none; display: inline-flex; align-items: center; gap: 4px; min-height: 40px; padding: 0 12px; }

.contact-row .contact-info { flex-basis: 100%; font-size: 13.5px; line-height: 1.5; color: var(--ink-2, #444); }

/* الهاتف: اللوحة تُمرَّر دائماً، والاتجاهات تتمدد بالسحب (مهم للشاشات الصغيرة مثل iPhone SE) */
@media (max-width: 640px) {
  .view { flex: 1 1 auto; min-height: 0; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
  #sheet:has(#view-route:not([hidden])) { height: 58vh; max-height: 58vh; height: 58dvh; max-height: 58dvh; }
  #sheet.exp:has(#view-route:not([hidden])) { height: 90vh; max-height: 90vh; height: 90dvh; max-height: 90dvh; }
  /* أثناء الكتابة: المساحة كلها للحقل واقتراحاته */
  body.kb #sheet { border-radius: 0 0 18px 18px; padding-bottom: 6px; }
  body.kb #view-route .place-head, body.kb #view-route .modes, body.kb #view-route .badge-sw, body.kb #rp-hint, body.kb #route-summary, body.kb #route-steps, body.kb #view-route > .go-row { display: none; }
  body.kb #rp-suggest:not(:empty) { position: static; max-height: none; box-shadow: none; }
  body.kb .view { padding-bottom: 8px; }
}
@media (max-width: 640px) and (max-height: 700px) {
  #sheet:has(#view-route:not([hidden])) { height: 64vh; max-height: 64vh; height: 64dvh; max-height: 64dvh; }
  #view-route .place-head h2 { font-size: 18px; }
  .route-points { margin: 6px 0; } .rp { margin-bottom: 5px; } .rp input { height: 36px; }
  #rp-hint { display: none; }
}
#rp-tolls-row:not([hidden]) { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
#rp-tolls-row input { width: auto; }

/* طبقات الخريطة (layers.js) */
#mode-transit[hidden] { display: none; }
.layers-fab { left: 120px !important; font-size: 21px; }
#layers-panel { position: fixed; z-index: 13; left: 16px; bottom: 104px; width: min(300px, calc(100vw - 32px)); background: var(--paper); border-radius: 16px; box-shadow: var(--shadow); padding: 12px 14px; }
#layers-panel label { display: flex; gap: 10px; align-items: center; margin: 10px 0 0; color: inherit; font-size: 14px; }
#layers-panel input { width: 18px; height: 18px; flex: none; }
.lp-legend { width: 100%; margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--lapis); padding: 8px; font: inherit; font-weight: 700; cursor: pointer; }
.lg-x { float: left; border: 0; background: transparent; font-size: 18px; cursor: pointer; }
body.navigating .layers-fab, body.navigating #layers-panel, body.picking .layers-fab, body.picking #layers-panel, body.hud-on .layers-fab { display: none !important; }
@media (max-width: 640px) {
  body:not(.navigating) .layers-fab { left: 10px !important; top: calc(148px + var(--off, 0px)); width: 40px; font-size: 18px; }
  #layers-panel { left: 60px; bottom: auto; top: 150px; width: min(280px, calc(100vw - 76px)); }
}

/* تجنّب الترابي، وزر الطوارئ ولوحته */
.rp-opt { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.rp-opt input { width: auto; }
.sos-fab { left: 176px !important; font-size: 20px; }
#sos { position: fixed; inset: 0; z-index: 70; background: rgba(41,33,20,.45); display: flex; align-items: flex-end; justify-content: center; }
.sos-box { position: relative; background: var(--paper); width: 100%; max-width: 460px; max-height: 82vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 16px 16px calc(18px + env(safe-area-inset-bottom)); }
.sos-x { position: absolute; left: 12px; top: 10px; border: 0; background: transparent; font-size: 20px; }
.sos-h { font-size: 19px; color: #b3261e; }
.sos-nums { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 12px; }
.sos-num { flex: 1 1 100px; display: flex; flex-direction: column; align-items: center; padding: 10px; border-radius: 14px; background: #b3261e; color: #fff; text-decoration: none; }
.sos-num b { font-size: 24px; } .sos-num span { font-size: 12px; text-align: center; }
.sos-row { display: flex; gap: 8px; align-items: center; border-top: 1px solid var(--line); padding: 9px 0; }
.sos-row > div { flex: 1; display: flex; flex-direction: column; }
.sos-go { border: 0; border-radius: 10px; background: var(--lapis); color: #fff; padding: 8px 12px; font: inherit; }
body.navigating .sos-fab, body.picking .sos-fab, body.hud-on .sos-fab { display: none !important; }
@media (max-width: 640px) { body:not(.navigating) .sos-fab { left: 10px !important; top: calc(194px + var(--off, 0px)); width: 40px; font-size: 17px; } }

/* مجموعات العائلة والسفر (groups.js) */
#view-groups { padding: 0 18px 18px; }
#gr-title { overflow-wrap: anywhere; }
#gr-open { position: relative; }
.gr-badge { position: absolute; top: -4px; inset-inline-start: 2px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: #c0392b; color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.gr-badge[hidden] { display: none; }
.gr-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.gr-row .fd-in { flex: 1; min-width: 120px; width: auto; margin: 0; }
.gr-who { flex: 1; min-width: 0; cursor: pointer; overflow-wrap: anywhere; }
.gr-who b { display: block; } .gr-who span { display: block; margin: 0; }
.gr-item { display: block; width: 100%; text-align: start; margin: 8px 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; font: inherit; color: var(--ink); cursor: pointer; overflow-wrap: anywhere; }
.gr-item span { display: block; }
.gr-invite, .gr-share { margin: 10px 0; padding: 10px 12px; border-radius: 14px; background: var(--gold-soft); line-height: 1.7; overflow-wrap: anywhere; }
.gr-tabs { display: flex; gap: 6px; margin: 8px 0; }
.gr-tabs button { flex: 1; padding: 8px 4px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font: inherit; font-size: 13.5px; color: var(--ink); cursor: pointer; }
.gr-tabs button.on { background: var(--lapis); border-color: var(--lapis); color: #fff; }
.gr-h { margin: 16px 0 4px; font-weight: 700; color: var(--lapis); }
.gr-log { max-height: 34vh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.gr-msg { align-self: flex-start; max-width: 85%; padding: 6px 10px; border-radius: 14px; background: #fff; border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; }
.gr-msg.mine { align-self: flex-end; background: var(--lapis-soft); }
.gr-msg small { display: block; color: var(--muted); font-size: 11.5px; }
.gr-msg .link-btn { font-size: 11.5px; padding: 0; }
.gr-send { position: sticky; bottom: 0; flex-wrap: nowrap; background: var(--paper); padding: 6px 0; }
.gr-pin { display: flex; flex-direction: column; align-items: center; pointer-events: none; }
.gr-pin i { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #6b3fa0; color: #fff; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.35); font-style: normal; font-weight: 700; order: 2; }
.gr-pin span { order: 1; max-width: 120px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 1px 8px; margin-bottom: 2px; border-radius: 8px; background: #fff; font-size: 12px; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.gr-chip { position: fixed; z-index: 20; bottom: 14px; left: 50%; transform: translateX(-50%); white-space: nowrap; padding: 8px 16px; border: 0; border-radius: 999px; background: #6b3fa0; color: #fff; font: inherit; font-size: 13.5px; box-shadow: var(--shadow); cursor: pointer; }
.gr-chip[hidden] { display: none; }
@media (max-width: 640px) {
  #sheet:has(#view-groups:not([hidden])) { height: 58vh; max-height: 58vh; }
  #sheet.kb:has(#view-groups:not([hidden])), body.kb #sheet:has(#view-groups:not([hidden])) { height: auto; max-height: none; }
  .gr-chip { bottom: auto; top: 66px; }
  .gr-log { max-height: 24vh; }
}
