/* מפת שטח: רקע מרווה בהיר כמו נייר מפה, כתום של דגל ניווט כצבע מוביל, ספרות במונו לאזימוטים ומרחקים */
:root {
  --bg: #eef1ec;
  --surface: #ffffff;
  --surface-2: #e4e9e2;
  --line: #cfd7cc;
  --fg: #18211c;
  --muted: #5b6a60;
  --accent: #e2570f;          /* כתום דגל ניווט */
  --accent-fg: #ffffff;
  --accent-soft: #fde6d8;
  --ok: #1f8a4c;  --ok-soft: #dcf2e4;
  --warn: #b7791f; --warn-soft: #fbefd3;
  --bad: #c2362b;  --bad-soft: #fadedb;
  --flag-white: #ffffff;
  --shadow: 0 1px 2px rgb(24 33 28 / .06), 0 6px 18px rgb(24 33 28 / .07);
  --f-display: "Secular One", "Rubik", "Arial Hebrew", sans-serif;
  --f-body: "Assistant", "Rubik", "Segoe UI", Arial, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --r: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111613; --surface: #1a211d; --surface-2: #222b26; --line: #2f3a33;
    --fg: #e5ece6; --muted: #98a79c;
    --accent: #ff7a33; --accent-fg: #1a0d05; --accent-soft: #3a2316;
    --ok: #4cc27c; --ok-soft: #173323; --warn: #e6b04f; --warn-soft: #3a2f17; --bad: #f0675b; --bad-soft: #3d1c19;
    --flag-white: #f1f1f1;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 6px 18px rgb(0 0 0 / .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 16px/1.5 var(--f-body);
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { font-family: var(--f-display); font-weight: 400; line-height: 1.2; margin: 0; text-wrap: balance; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p { margin: 0; }
.mono, .num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.label { font-size: .78rem; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
[hidden] { display: none !important; }

/* ---------- כפתורים ושדות ---------- */
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--fg);
  font: 600 1rem var(--f-body); padding: 10px 16px; border-radius: var(--r); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
}
.btn:hover { background: var(--surface-2); }
.btn:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, .opt:focus-within {
  outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.btn.danger.armed { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { min-height: 34px; padding: 5px 10px; font-size: .9rem; }
.btn.big { min-height: 56px; font-size: 1.1rem; width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

input[type=text], input[type=number], textarea, select {
  width: 100%; font: 1rem var(--f-body); color: var(--fg); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; min-height: 44px;
}
textarea { min-height: 96px; resize: vertical; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 420px) { .grid2 { grid-template-columns: 1fr; } }

/* ---------- צ׳יפים ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: .82rem; font-weight: 600; background: var(--surface-2); color: var(--fg); white-space: nowrap;
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.team-chip { color: #fff; background: var(--team, var(--muted)); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); }

/* דגל נקודת ציון: ריבוע מחולק באלכסון, לבן וכתום */
.ctrl {
  --s: 30px; width: var(--s); height: var(--s); flex: none; display: inline-grid; place-items: center;
  background: linear-gradient(135deg, var(--flag-white) 0 50%, var(--accent) 50% 100%);
  border: 2px solid var(--accent); border-radius: 3px;
}
.ctrl span { font: 700 .8rem var(--f-mono); color: #18211c; background: var(--flag-white); border-radius: 3px; padding: 0 3px; line-height: 1.2; }
.ctrl.lg { --s: 48px; }
.ctrl.lg span { font-size: 1.05rem; }
.ctrl.done { filter: grayscale(1); opacity: .55; }

/* ---------- טוסט ---------- */
#toast {
  position: fixed; inset-inline: 0; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); margin-inline: auto;
  width: max-content; max-width: calc(100% - 32px); background: var(--fg); color: var(--bg);
  padding: 10px 18px; border-radius: 999px; font-weight: 600; z-index: 9000;
  opacity: 0; transform: translateY(12px); transition: .2s; pointer-events: none;
}
#toast.show { opacity: 1; transform: none; }
#toast.ok { background: var(--ok); color: #fff; }
#toast.bad { background: var(--bad); color: #fff; }

/* ---------- מפה ---------- */
.map { background: var(--surface-2); border-radius: 12px; overflow: hidden; position: relative; }
.map-fallback { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; text-align: center; color: var(--muted); }
.leaflet-container { font-family: var(--f-body) !important; background: var(--surface-2) !important; }
.pin-me { width: 18px; height: 18px; border-radius: 50%; background: var(--team, #2563eb); border: 3px solid #fff; box-shadow: 0 0 0 2px var(--team, #2563eb), 0 2px 6px rgb(0 0 0 / .4); }
.pin-dev { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.pin-dev b { width: 16px; height: 16px; border-radius: 50%; background: var(--team); border: 3px solid #fff; box-shadow: 0 1px 4px rgb(0 0 0 / .45); }
.pin-dev i { font: 700 11px var(--f-body); font-style: normal; background: var(--team); color: #fff; padding: 0 6px; border-radius: 6px; white-space: nowrap; }
.pin-dev.stale { opacity: .45; }

.demo-banner {
  background: var(--warn-soft); color: var(--warn); font-weight: 600; font-size: .875rem; text-align: center;
  padding-block: 6px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}

@keyframes pulse { 0%,100% { transform: scale(1); opacity: 1 } 50% { transform: scale(1.35); opacity: .45 } }
.pulse { animation: pulse 1.6s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } #toast { transition: none; } }

/* כפתורי מעבר בין סוגי מפה */
.map-switch { display: flex; background: var(--surface, #fff); border-radius: 10px; box-shadow: 0 1px 6px rgba(0,0,0,.3); overflow: hidden; }
.map-switch button { appearance: none; border: 0; background: transparent; color: var(--fg, #222); font: 700 .9rem var(--f-body, sans-serif); padding: 9px 12px; cursor: pointer; }
.map-switch button + button { border-inline-start: 1px solid var(--line, #ddd); }
.map-switch button[aria-pressed="true"] { background: var(--accent, #e2570f); color: var(--accent-fg, #fff); }
