/* Layout: sticky header, one centered column (max 72rem), cards in a responsive grid. Palette: Red Sea teal on cool neutrals. */
:root {
  --canvas: #f4f6f8;
  --surface: #ffffff;
  --ink: #16232d;
  --muted: #5a6772;
  --line: #e1e6ea;
  --sea: #a8571a;
  --sea-strong: #8a4513;
  --sea-soft: #f7ebdf;
  --danger: #b42318;
  --warn-bg: #e8eef3;
  --warn-ink: #33475a;
  --font: "IBM Plex Sans Arabic", ui-sans-serif, system-ui, sans-serif;
  --shadow: 0 1px 2px rgb(15 27 34 / 0.04), 0 4px 16px rgb(15 27 34 / 0.05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas: #0f171d; --surface: #17222a; --ink: #eef2f5; --muted: #9aa8b2; --line: #27353e;
    --sea: #e0944f; --sea-strong: #f0b178; --sea-soft: #3a2616; --danger: #ff8a7d;
    --warn-bg: #1d2c37; --warn-ink: #a9bccb;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 4px 16px rgb(0 0 0 / 0.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --canvas: #0f171d; --surface: #17222a; --ink: #eef2f5; --muted: #9aa8b2; --line: #27353e;
  --sea: #e0944f; --sea-strong: #f0b178; --sea-soft: #3a2616; --danger: #ff8a7d;
  --warn-bg: #1d2c37; --warn-ink: #a9bccb;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 4px 16px rgb(0 0 0 / 0.25);
  color-scheme: dark;
}
:root { --ok: #1a7f4b; --ok-bg: #e3f4ea; --pend-bg: #fdf1d6; --pend-ink: #7a4b00; --bad-bg: #fde7e4; --on-sea: #ffffff; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --ok: #5fd08f; --ok-bg: #12301f; --pend-bg: #3a2f12; --pend-ink: #f2cf84; --bad-bg: #3b1a17; --on-sea: #1f1206; }
}
:root[data-theme="dark"] { --ok: #5fd08f; --ok-bg: #12301f; --pend-bg: #3a2f12; --pend-ink: #f2cf84; --bad-bg: #3b1a17; --on-sea: #1f1206; }
body {
  background: var(--canvas); color: var(--ink); font-family: var(--font); line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  padding-block: 0;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px);
  z-index: 30; background: var(--canvas);
}
h1, h2, h3 { line-height: 1.35; font-weight: 600; text-wrap: balance; }
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--sea); outline-offset: 2px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: 10px; border: 1px solid transparent;
  font-size: 14px; font-weight: 500; color: var(--ink); background: transparent;
  transition: background-color .2s ease, transform .2s ease, border-color .2s ease;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { height: 36px; padding: 0 14px; font-size: 13px; }
.btn-primary { background: var(--sea); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--sea-strong); }
:root[data-theme="dark"] .btn-primary { color: #1f1206; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-primary { color: #1f1206; } }
.btn-quiet { background: var(--surface); border-color: var(--line); }
.btn-quiet:hover:not(:disabled) { background: var(--canvas); }
.btn-ghost:hover { background: var(--line); }
.field {
  width: 100%; height: 44px; padding: 0 14px; border-radius: 10px; font: inherit; font-size: 14px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  transition: border-color .2s ease, box-shadow .2s ease;
}
textarea.field { height: auto; padding: 10px 14px; }
.field::placeholder { color: var(--muted); }
.field:focus { outline: none; border-color: var(--sea); box-shadow: 0 0 0 4px var(--sea-soft); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 24px; box-shadow: var(--shadow); }
.lift { transition: transform .3s ease, box-shadow .3s ease; }
.lift:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgb(15 27 34 / 0.12); }
.tabular { font-variant-numeric: tabular-nums; }
.badge-ok { display: inline-flex; align-items: center; gap: 4px; background: var(--ok-bg); color: var(--ok); border-radius: 9999px; padding: 3px 10px; font-size: 12px; font-weight: 600; box-shadow: 0 1px 3px rgb(0 0 0 / 0.18); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-day { aspect-ratio: 1; min-height: 36px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); font: inherit; font-size: 14px; cursor: pointer; transition: background-color .15s ease; }
.cal-day:hover:not(:disabled) { background: var(--sea-soft); }
.cal-day:disabled { color: var(--muted); opacity: .45; text-decoration: line-through; cursor: not-allowed; }
.cal-day.in { background: var(--sea-soft); border-radius: 0; }
.cal-day.edge { background: var(--sea); color: var(--on-sea); }
.logo-chip { display: flex; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 3px 10px; }
.logo-chip img { height: 44px; width: auto; display: block; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ---------- خريطة الأحياء ---------- */
.map-box { height: min(70vh, 640px); min-height: 360px; border-radius: 14px; border: 1px solid var(--line); overflow: hidden; background: #e8e4dc; z-index: 0; }
.map-list { max-height: 60vh; overflow-y: auto; padding-inline-end: 2px; }
.leaflet-container { font-family: inherit; }
.dist-label { display: flex; align-items: center; gap: 4px; transform: translate(-50%, -50%); white-space: nowrap; pointer-events: auto;
  font: 600 11px/1.2 "IBM Plex Sans Arabic", system-ui, sans-serif; color: #3b2a1c; text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 2px #fff; cursor: pointer; }
.dist-label span { padding: 1px 2px; }
.dist-label b { min-width: 18px; padding: 1px 6px; border-radius: 999px; background: var(--sea); color: #fff; text-shadow: none; font-size: 11px; text-align: center; }
.dist-label.has span { font-weight: 700; }
.dist-label.on span { background: var(--sea); color: #fff; border-radius: 6px; padding: 1px 6px; text-shadow: none; }
.dist-label.special { color: #6b7079; font-weight: 500; cursor: default; pointer-events: none; }
.map-lo .dist-label:not(.has):not(.on) { display: none; }
/* عند التصغير: عدّاد الإعلانات فقط بلا اسم، حتى لا تتراكب أسماء الأحياء المتجاورة (الاسم يظهر عند التقريب) */
.map-lo .dist-label.has:not(.on) span { display: none; }
.map-lo .dist-label.has b { min-width: 24px; padding: 3px 7px; font-size: 12px; box-shadow: 0 1px 4px rgb(0 0 0 / .3); }
@media (max-width: 640px) { .map-box { height: 58vh; min-height: 320px; } .map-list { max-height: none; } }
