/* ───────────────────────── الخريطة التكتيكية ───────────────────────── */
.mp { position: relative; width: 100%; height: 100%; overflow: hidden; background: #0e5e86; border-radius: inherit; outline: none; touch-action: none; cursor: grab; user-select: none; direction: ltr; }
.mp[data-tool="pen"], .mp[data-tool="line"], .mp[data-tool="arrow"], .mp[data-tool="rect"], .mp[data-tool="circle"] { cursor: crosshair; }
.mp[data-tool="mark"], .mp[data-tool="text"] { cursor: copy; }
.mp[data-tool="select"] { cursor: default; }
.mp[data-tool="erase"] { cursor: not-allowed; }
.mp-world { position: absolute; left: 0; top: 0; width: 2000px; height: 2000px; transform-origin: 0 0; will-change: transform; }
.mp-world.fly { transition: transform .45s cubic-bezier(.2, .8, .2, 1); }
.mp-img { position: absolute; left: 0; top: 0; width: 2000px !important; height: 2000px !important; pointer-events: none; transition: filter .3s; }
.mp-sea { position: absolute; left: -4000px; top: -4000px; width: 10000px; height: 10000px; background: #13a8d6; pointer-events: none; transition: filter .3s; }
.mp[data-style="dark"] .mp-sea, .mp[data-style="dark"] .mp-img { filter: invert(1) hue-rotate(185deg) brightness(.85) contrast(1.15) saturate(.8); }
.mp[data-style="dark"] { background: #08131f; }
.mp[data-style="mono"] .mp-sea, .mp[data-style="mono"] .mp-img { filter: grayscale(1) contrast(1.15) brightness(.95); }
.mp[data-style="mono"] { background: #6b7280; }
.mp-svg { position: absolute; left: 0; top: 0; width: 2000px !important; height: 2000px !important; overflow: visible; }
.mp-svg .mi { cursor: pointer; }
.mp-svg .mi .hit { pointer-events: stroke; }
.mp-svg .mi.sel > :not(.hit) { filter: drop-shadow(0 0 6px #fff) drop-shadow(0 0 3px #3fa9ff); }
.mp-grid line { stroke: rgba(10, 30, 60, .35); stroke-width: 1.4; stroke-dasharray: 6 6; }
.mp[data-style="dark"] .mp-grid line { stroke: rgba(150, 210, 255, .35); }
.mp-grid .gl { font: 700 30px Rajdhani, sans-serif; fill: rgba(10, 30, 60, .6); text-anchor: middle; }
.mp[data-style="dark"] .mp-grid .gl { fill: rgba(150, 210, 255, .75); }
.mp-pins { position: absolute; inset: 0; pointer-events: none; }
.pin { position: absolute; transform: translate(-50%, -100%); pointer-events: auto; cursor: pointer; display: grid; justify-items: center; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .45)); }
.pin svg { display: block; }
.pin.sel svg { filter: drop-shadow(0 0 5px #fff) drop-shadow(0 0 8px #3fa9ff); }
.pin-l { position: absolute; top: 100%; margin-top: 2px; white-space: nowrap; font-size: 12.5px; font-weight: 700; color: #fff; background: rgba(5, 12, 24, .82); padding: 1px 8px; border-radius: 6px; border: 1px solid rgba(255, 255, 255, .15); direction: rtl; }
.mtx { position: absolute; transform: translate(-50%, -50%); pointer-events: auto; cursor: pointer; white-space: nowrap; font-weight: 800; color: var(--c); text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 6px #fff, 0 2px 4px rgba(0, 0, 0, .3); padding: 0 4px; direction: rtl; }
.mtx.sel { outline: 2px dashed #3fa9ff; outline-offset: 3px; border-radius: 4px; }
.mh { position: absolute; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid #1f7cff; transform: translate(-50%, -50%); pointer-events: auto; cursor: move; box-shadow: 0 2px 6px rgba(0, 0, 0, .4); }
.mh.bend { background: #1f7cff; border-color: #fff; width: 18px; height: 18px; }
.mp-hud { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); pointer-events: none; }
.mp-coord { font-size: 12px; color: #fff; background: rgba(5, 12, 24, .72); padding: 3px 10px; border-radius: 99px; }
.mp-coord:empty { display: none; }
.mp.compact .mp-hud { display: none; }

.map-page { display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 14px; height: calc(100vh - var(--top) - 56px); min-height: 520px; }
.map-page.full { position: fixed; inset: 0; z-index: 45; height: 100vh; padding: 12px; background: var(--bg); }
.mp-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mp-bar .sh-ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: rgba(63, 169, 255, .12); color: var(--blue); }
.mp-boards { max-width: 300px; height: 40px; font-weight: 700; }
.mp-save { font-size: 13px; } .mp-save.ok { color: var(--green); } .mp-save.amber { color: var(--amber); } .mp-save.err { color: var(--red); }
.mp-wrap { position: relative; border-radius: 16px; overflow: hidden; border: 1px solid var(--line2); box-shadow: var(--shadow); min-height: 0; }
.mp-host { position: absolute; inset: 0; }
.mp-tools { position: absolute; top: 12px; right: 12px; z-index: 3; width: 74px; max-height: calc(100% - 24px); overflow-y: auto; display: flex; flex-direction: column; gap: 4px; padding: 8px 6px; border-radius: 16px; background: var(--plate-up); border: 1px solid var(--line2); box-shadow: var(--shadow); scrollbar-width: none; }
.mp-tools > button { display: grid; justify-items: center; gap: 2px; padding: 7px 2px; border-radius: 10px; border: 0; background: transparent; color: var(--ink2); font-size: 10.5px; font-weight: 700; }
.mp-tools > button svg { width: 20px; height: 20px; }
.mp-tools > button:hover { background: rgba(63, 169, 255, .08); color: var(--ink); }
.mp-tools > button.on { background: var(--blue); color: #fff; }
.ln-ic { display: block; width: 20px; height: 3px; background: currentColor; border-radius: 2px; transform: rotate(-35deg); margin: 8px 0; }
.mt-sep { height: 1px; background: var(--line2); margin: 4px 6px; flex-shrink: 0; }
.mt-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 0 4px; }
.mt-cols button, .mt-custom { width: 100%; aspect-ratio: 1; border-radius: 7px; border: 2px solid rgba(127, 127, 127, .35); cursor: pointer; padding: 0; position: relative; }
.mt-cols button.on { border-color: var(--blue); box-shadow: 0 0 0 2px var(--plate-up), 0 0 0 4px var(--blue); }
.mt-custom { background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); display: grid; place-items: center; color: #fff; }
.mt-custom svg { width: 14px; height: 14px; }
.mt-custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.mt-sw { display: grid; gap: 2px; justify-items: center; padding: 4px; }
.mt-sw input { width: 60px; }
.mt-sw b { font-size: 12px; }
.mt-tg { padding: 6px 2px; border-radius: 8px; border: 1px solid var(--line2); background: transparent; color: var(--ink2); font-size: 10.5px; font-weight: 700; }
.mt-tg.on { background: rgba(63, 169, 255, .15); color: var(--blue); border-color: var(--blue); }
.mp-marks { position: absolute; top: 12px; right: 96px; z-index: 3; width: 300px; max-height: calc(100% - 24px); overflow-y: auto; padding: 12px; border-radius: 16px; background: var(--plate-up); border: 1px solid var(--line2); box-shadow: var(--shadow); }
.mm-h { font-size: 13px; margin-bottom: 10px; display: flex; } .mm-h b { display: flex; gap: 6px; align-items: center; }
.mm-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.mm-grid button { display: grid; justify-items: center; gap: 2px; padding: 6px 2px 4px; border-radius: 10px; border: 1px solid var(--line); background: var(--plate); color: var(--ink2); }
.mm-grid button small { font-size: 10.5px; font-weight: 600; }
.mm-grid button.on { border-color: var(--blue); background: rgba(63, 169, 255, .14); }
.mm-grid.sm { grid-template-columns: repeat(6, 1fr); }
.mm-grid.row-1 { display: flex; gap: 4px; }
.mm-grid.row-1 button { padding: 4px; }
.mp-edit { position: absolute; bottom: 14px; right: 98px; z-index: 3; width: min(440px, calc(100% - 320px)); padding: 12px 14px; border-radius: 14px; background: var(--plate-up); border: 1px solid var(--line2); box-shadow: var(--shadow); display: grid; gap: 8px; }
.me-h { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.me-note { margin: 0; color: var(--ink2); font-size: 14px; line-height: 1.8; white-space: pre-wrap; }
.mp-list { position: absolute; top: 12px; left: 12px; z-index: 3; width: 260px; max-height: calc(100% - 210px); overflow-y: auto; padding: 12px; border-radius: 16px; background: var(--plate-up); border: 1px solid var(--line2); box-shadow: var(--shadow); display: grid; gap: 4px; align-content: start; }
.mp-list h4 { margin: 0 0 6px; font-size: 14px; display: flex; gap: 6px; align-items: center; }
.mp-list .li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 9px; border: 1px solid transparent; background: transparent; color: var(--ink); text-align: start; font-size: 13.5px; }
.mp-list .li:hover, .mp-list .li.on { background: rgba(63, 169, 255, .1); border-color: var(--line2); }
.li-c { width: 14px; height: 14px; border-radius: 4px; flex-shrink: 0; border: 1px solid rgba(255, 255, 255, .3); }
.mp-zoom { position: absolute; bottom: 14px; left: 192px; z-index: 3; display: grid; gap: 4px; }
.mp-zoom button { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line2); background: var(--plate-up); color: var(--ink); display: grid; place-items: center; box-shadow: var(--shadow); font-size: 20px; }
.mp-mini { position: absolute; bottom: 14px; left: 14px; z-index: 3; width: 168px; height: 168px; border-radius: 12px; overflow: hidden; border: 2px solid rgba(255, 255, 255, .55); box-shadow: var(--shadow); cursor: pointer; background: #0e5e86; }
.mp-mini img { width: 100%; height: 100%; display: block; }
.mp-mini i { position: absolute; border: 2px solid #ff2b4a; background: rgba(255, 43, 74, .12); pointer-events: none; }
.pick-map { height: min(62vh, 640px); border-radius: 14px; overflow: hidden; border: 1px solid var(--line2); }
.home-map { height: 460px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line2); position: relative; }
.home-map .hm-go { position: absolute; bottom: 14px; right: 14px; z-index: 3; }
.loc-msg { width: 300px; height: 190px; border-radius: 12px; overflow: hidden; position: relative; border: 1px solid var(--line2); cursor: pointer; }
.loc-msg .mp { cursor: pointer; }
@media (max-width: 900px) {
  .map-page { height: calc(100vh - var(--top) - 40px); }
  .mp-tools { width: 60px; } .mp-tools > button span, .mp-tools [data-u] span { display: none; }
  .mp-marks { right: 80px; width: calc(100% - 96px); }
  .mp-edit { right: 80px; width: calc(100% - 96px); bottom: 190px; }
  .mp-mini { width: 110px; height: 110px; } .mp-zoom { left: 132px; }
  .mp-list { width: calc(100% - 96px); }
}
