/* V7 — live mobile GPS sharing */
#gps-live-map { scroll-margin-top: 150px; margin-bottom: 16px; }
.gps-live-panel { background:#fff; border:1px solid #dce7e2; border-radius:22px; overflow:hidden; box-shadow:0 12px 34px rgba(14,51,41,.07); }
.gps-live-heading { display:flex; justify-content:space-between; align-items:flex-start; gap:16px; padding:19px 20px 13px; }
.gps-live-heading h2 { margin:0 0 4px; font-size:18px; color:#14231f; }
.gps-live-heading p { margin:0; color:#71817b; font-size:11px; line-height:1.7; }
.gps-live-controls { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.gps-live-status { display:inline-flex; align-items:center; gap:7px; border-radius:999px; padding:7px 11px; background:#e9f8f2; color:#137256; font-size:10px; font-weight:900; white-space:nowrap; }
.gps-live-status::before { content:""; width:7px; height:7px; border-radius:50%; background:#23bf8e; box-shadow:0 0 0 5px rgba(35,191,142,.13); }
.gps-live-button { border:1px solid #d9e8e1; background:#edf5f1; color:#0b3b2e; border-radius:11px; min-height:38px; padding:0 13px; font:inherit; font-size:11px; font-weight:800; cursor:pointer; }
.gps-live-map-wrap { position:relative; margin:0 16px; border-radius:17px; overflow:hidden; border:1px solid #d7e4df; background:#eef4f1; }
#gps-map-canvas { width:100%; height:480px; direction:ltr; }
.gps-map-empty { position:absolute; inset:0; z-index:500; display:grid; place-items:center; padding:30px; text-align:center; background:linear-gradient(135deg,rgba(246,250,248,.95),rgba(231,243,237,.95)); color:#52645e; }
.gps-map-empty[hidden] { display:none; }
.gps-map-empty strong { display:block; color:#0b3b2e; font-size:17px; margin-bottom:7px; }
.gps-map-empty span { display:block; font-size:11px; line-height:1.9; max-width:520px; }
.gps-live-footer { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 18px 17px; color:#71817b; font-size:10px; }
.gps-live-footer strong { color:#0b3b2e; }
.gps-person-marker { width:38px; height:38px; border-radius:50% 50% 50% 12px; transform:rotate(-45deg); border:3px solid white; box-shadow:0 7px 20px rgba(0,0,0,.24); display:grid; place-items:center; color:white; background:#168a68; }
.gps-person-marker > span { transform:rotate(45deg); font-size:10px; font-weight:900; direction:rtl; }
.gps-person-marker.stationary { background:#d48806; }
.gps-person-marker.emergency { background:#d9363e; animation:gpsPulse 1.2s infinite; }
.gps-person-marker.offline { background:#6f7c77; }
@keyframes gpsPulse { 50% { box-shadow:0 0 0 12px rgba(217,54,62,.15),0 7px 20px rgba(0,0,0,.24); } }
.gps-popup { direction:rtl; min-width:190px; font-family:'Cairo',sans-serif; }
.gps-popup strong { display:block; font-size:14px; margin-bottom:5px; color:#0b3b2e; }
.gps-popup span { display:block; font-size:10px; line-height:1.8; color:#52645e; }
.gps-privacy-note { background:#fff8ee; border:1px solid #f4dfbf; color:#7a6250; border-radius:13px; padding:10px 13px; margin:0 16px 16px; font-size:10px; line-height:1.8; }

.mobile-live-location-banner { background:linear-gradient(135deg,#0f8b68,#0b4b39); color:white; border-radius:18px; margin:0 0 13px; padding:14px 15px; display:flex; align-items:center; gap:12px; box-shadow:0 12px 26px rgba(11,75,57,.18); }
.mobile-live-location-banner .gps-pulse { width:13px; height:13px; border-radius:50%; background:#72f0c0; box-shadow:0 0 0 7px rgba(114,240,192,.16); flex:0 0 auto; }
.mobile-live-location-banner strong,.mobile-live-location-banner span { display:block; }
.mobile-live-location-banner strong { font-size:13px; }
.mobile-live-location-banner span { color:rgba(255,255,255,.78); font-size:9px; margin-top:2px; line-height:1.7; }
.mobile-background-warning { margin-top:9px; color:#8b5f09; background:#fff7df; border:1px solid #f1d795; border-radius:12px; padding:10px; font-size:9px; line-height:1.8; }
.zones-panel { display:none !important; }
.engineering-nav-item[data-nav-key="zones"] { display:none !important; }

@media (max-width:700px) {
  .gps-live-heading { display:block; padding:15px; }
  .gps-live-controls { margin-top:10px; }
  .gps-live-map-wrap { margin:0 8px; }
  #gps-map-canvas { height:390px; }
  .gps-live-footer { display:block; padding:10px 12px 14px; }
  .gps-live-footer span { display:block; margin-top:5px; }
  .gps-privacy-note { margin:0 8px 10px; }
}

/* V9 — reliable map rendering and SOS light/sound alarm */
#gps-map-canvas { position:relative; z-index:2; background:transparent; }
.gps-live-map-wrap { background-color:#eaf3ef; background-image:linear-gradient(rgba(20,82,64,.07) 1px,transparent 1px),linear-gradient(90deg,rgba(20,82,64,.07) 1px,transparent 1px); background-size:32px 32px; }

/* Essential Leaflet layout is kept locally so markers still render if the CDN stylesheet is delayed. */
.leaflet-container{overflow:hidden;outline:0;font-family:Arial,Helvetica,sans-serif}.leaflet-pane,.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-tile-container,.leaflet-pane>svg,.leaflet-pane>canvas,.leaflet-zoom-box{position:absolute;left:0;top:0}.leaflet-container img.leaflet-tile{max-width:none!important;max-height:none!important;width:256px;height:256px;padding:0}.leaflet-tile{visibility:hidden}.leaflet-tile-loaded{visibility:inherit}.leaflet-zoom-animated{transform-origin:0 0}.leaflet-map-pane{z-index:400}.leaflet-tile-pane{z-index:200}.leaflet-overlay-pane{z-index:400}.leaflet-shadow-pane{z-index:500}.leaflet-marker-pane{z-index:600}.leaflet-tooltip-pane{z-index:650}.leaflet-popup-pane{z-index:700}.leaflet-control{position:relative;z-index:800;pointer-events:auto}.leaflet-top,.leaflet-bottom{position:absolute;z-index:1000;pointer-events:none}.leaflet-top{top:0}.leaflet-right{right:0}.leaflet-bottom{bottom:0}.leaflet-left{left:0}.leaflet-control-zoom{margin:10px;border:1px solid #ccdcd5;border-radius:8px;overflow:hidden;box-shadow:0 3px 12px rgba(0,0,0,.12)}.leaflet-control-zoom a{display:block;width:30px;height:30px;line-height:30px;text-align:center;background:#fff;color:#173d31;text-decoration:none;font-weight:900}.leaflet-popup{position:absolute;text-align:center;margin-bottom:20px}.leaflet-popup-content-wrapper{background:#fff;border-radius:13px;box-shadow:0 5px 20px rgba(0,0,0,.22);padding:1px}.leaflet-popup-content{margin:13px 18px;line-height:1.4}.leaflet-popup-tip-container{width:40px;height:20px;position:absolute;left:50%;margin-left:-20px;overflow:hidden;pointer-events:none}.leaflet-popup-tip{width:17px;height:17px;padding:1px;margin:-10px auto 0;transform:rotate(45deg);background:#fff;box-shadow:3px 3px 8px rgba(0,0,0,.14)}

.gps-fallback-layer { position:absolute; inset:0; z-index:3; pointer-events:none; overflow:hidden; transition:opacity .25s ease; background:linear-gradient(135deg,rgba(233,245,239,.94),rgba(218,238,229,.92)); }
.gps-fallback-layer.tiles-ready { opacity:0; visibility:hidden; }
.gps-fallback-grid { position:absolute; inset:0; background-image:linear-gradient(rgba(11,75,57,.12) 1px,transparent 1px),linear-gradient(90deg,rgba(11,75,57,.12) 1px,transparent 1px); background-size:44px 44px; }
.gps-fallback-label { position:absolute; left:16px; top:15px; color:#588075; font-size:9px; font-weight:900; letter-spacing:1.5px; }
#gps-fallback-markers { position:absolute; inset:0; }
.gps-fallback-person { position:absolute; transform:translate(-50%,-50%); border:0; background:transparent; display:grid; justify-items:center; pointer-events:auto; cursor:pointer; min-width:90px; color:#0b3b2e; }
.gps-fallback-person b { width:40px; height:40px; display:grid; place-items:center; border-radius:50% 50% 50% 12px; transform:rotate(-45deg); background:#168a68; border:3px solid #fff; box-shadow:0 6px 18px rgba(0,0,0,.23); color:#fff; }
.gps-fallback-person b::first-line { transform:rotate(45deg); }
.gps-fallback-person span { margin-top:8px; background:rgba(255,255,255,.96); border:1px solid #d4e5dd; border-radius:999px; padding:4px 9px; font-size:9px; font-weight:900; white-space:nowrap; box-shadow:0 5px 15px rgba(11,59,46,.1); }
.gps-fallback-person.stationary b { background:#d48806; }.gps-fallback-person.offline b{background:#687b74}.gps-fallback-person.emergency b{background:#d51f2d;animation:gpsFallbackSos .75s infinite alternate}.gps-fallback-person.emergency span{color:#ae1722;border-color:#f3aab0}
@keyframes gpsFallbackSos{to{box-shadow:0 0 0 18px rgba(217,54,62,.2),0 6px 18px rgba(0,0,0,.25)}}

.gps-alarm-enable { background:#fff5e9; border-color:#efcf9c; color:#8e5700; }

.sos-alarm-overlay[hidden]{display:none!important}.sos-alarm-overlay{position:fixed;inset:0;z-index:20000;display:grid;place-items:start center;padding:18px;background:rgba(107,0,8,.28);backdrop-filter:blur(3px);animation:sosOverlayFlash .85s infinite alternate;pointer-events:none}.sos-alarm-card{pointer-events:auto;width:min(880px,calc(100vw - 30px));display:grid;grid-template-columns:86px minmax(0,1fr) auto;align-items:center;gap:18px;color:#fff;background:linear-gradient(135deg,#b90e1b,#e52f3b);border:4px solid #fff;border-radius:24px;padding:20px 22px;box-shadow:0 20px 70px rgba(107,0,8,.55),0 0 0 9px rgba(229,47,59,.24);animation:sosCardPulse .7s infinite alternate}.sos-alarm-beacon{width:78px;height:78px;border-radius:50%;display:grid;place-items:center;background:#fff;color:#c91420;box-shadow:0 0 0 10px rgba(255,255,255,.18)}.sos-alarm-beacon span{font-size:52px;line-height:1;font-weight:1000}.sos-alarm-kicker{display:block;font-size:11px;font-weight:1000;letter-spacing:1.5px;color:#ffe4e6}.sos-alarm-copy h2{margin:3px 0 8px;font-size:25px}.sos-alarm-copy p{margin:8px 0 0;font-size:10px;color:#ffe8ea;line-height:1.7}.sos-alarm-people{display:grid;gap:5px}.sos-person-row{display:flex;gap:9px;align-items:center;flex-wrap:wrap}.sos-person-row strong{font-size:15px}.sos-person-row span{font-size:10px;background:rgba(255,255,255,.15);padding:4px 8px;border-radius:999px}.sos-alarm-actions{display:grid;gap:7px;min-width:190px}.sos-alarm-actions button{border:0;border-radius:11px;min-height:40px;padding:0 12px;font:inherit;font-size:10px;font-weight:900;cursor:pointer}.sos-alarm-primary{background:#fff;color:#b90e1b}.sos-alarm-secondary{background:rgba(80,0,6,.32);color:#fff;border:1px solid rgba(255,255,255,.36)!important}.sos-alarm-overlay.sound-muted{animation:none;background:rgba(107,0,8,.16)}.sos-alarm-overlay.sound-muted .sos-alarm-card{animation:none}.sos-alarm-overlay.sound-muted #sos-enable-audio{display:inline-flex!important}
body.sos-alarm-active::before{content:"";position:fixed;inset:0;z-index:19990;pointer-events:none;border:14px solid #f11425;box-shadow:inset 0 0 80px rgba(241,20,37,.56);animation:sosScreenLight .55s infinite alternate}
@keyframes sosOverlayFlash{from{background:rgba(107,0,8,.18)}to{background:rgba(220,0,17,.42)}}@keyframes sosCardPulse{from{transform:scale(.992)}to{transform:scale(1.006)}}@keyframes sosScreenLight{from{opacity:.45}to{opacity:1}}

@media(max-width:760px){.sos-alarm-overlay{padding:8px}.sos-alarm-card{grid-template-columns:58px 1fr;padding:14px;gap:11px}.sos-alarm-beacon{width:54px;height:54px}.sos-alarm-beacon span{font-size:38px}.sos-alarm-copy h2{font-size:18px}.sos-alarm-actions{grid-column:1/-1;grid-template-columns:1fr 1fr;min-width:0}.sos-alarm-actions button:first-child{grid-column:1/-1}.gps-fallback-person span{max-width:120px;overflow:hidden;text-overflow:ellipsis}.gps-live-controls .gps-live-button{font-size:9px;padding:0 9px}}
@media(prefers-reduced-motion:reduce){.sos-alarm-overlay,.sos-alarm-card,body.sos-alarm-active::before,.gps-fallback-person.emergency b{animation-duration:1.8s}}
