*{box-sizing:border-box}:root{
  --bg:#0B1F3A;
  --surface:#13233a;
  --surface2:#1a2f4d;
  --line:#3d5a80;
  --text:#ffffff;
  --muted:#e6eef8;
  --primary:#0B1F3A;
  --primary-press:#06285f;
  --blue:#1A6B7A;
  --ok:#059669;
  --warn:#D97706;
  --danger:#DC2626;
  --info:#0EA5E9;
  --fb:#1877F2;
  --input-bg:#F8FAFC;
  --input-text:#0F172A;
}html,body{margin:0;min-height:100%;font-family:Arial,"Noto Sans Arabic",sans-serif;color:var(--text);background:var(--bg)}body{background:linear-gradient(#07111dcc,#07111ff5),url("./assets/nature.jpg") center/cover fixed}.ticker{height:36px;overflow:hidden;background:#030b14;border-bottom:1px solid #263247;white-space:nowrap}.ticker-track{display:flex;gap:28px;align-items:center;height:100%;width:max-content;animation:ticker 34s linear infinite}.ticker a,.ticker span{font-size:13px;text-decoration:none;color:#e2e8f0}.ticker span{color:#fbbf24}@keyframes ticker{from{transform:translateX(0)}to{transform:translateX(50%)}}.topbar{height:72px;display:flex;align-items:center;justify-content:space-between;padding:0 20px;background:#0d1728ee;border-bottom:1px solid var(--line);position:sticky;top:0;z-index:1000;backdrop-filter:blur(10px)}.brand{display:flex;gap:10px;align-items:center}.brand b{display:block;font-size:20px}.brand small{color:var(--muted)}.flag-waving{display:inline-block;font-size:30px;animation:flag 2.4s ease-in-out infinite}@keyframes flag{0%,100%{transform:rotate(0) skewY(0)}50%{transform:rotate(-2deg) skewY(-5deg)}}.small{font-size:22px}.auth-tools{display:flex;gap:8px;align-items:center}.auth-tools span{color:var(--muted)}main{max-width:1350px;margin:auto;padding:18px}.panel{background:var(--surface);border:1px solid var(--line);border-radius:16px;padding:18px;box-shadow:0 14px 40px #0006;backdrop-filter:blur(7px)}.login-panel{max-width:540px;margin:60px auto}.login-mark{font-size:45px}.login-panel input{width:100%;display:block;background:#07111f;color:#fff;border:1px solid #334155;border-radius:10px;padding:13px;margin:10px 0}.row,.hero-actions,.phone-row{display:flex;gap:9px;flex-wrap:wrap}button{border:1px solid #334155;background:#172033;color:#fff;border-radius:10px;padding:10px 14px;cursor:pointer}button:hover{filter:brightness(1.1)}button.active{outline:2px solid #38bdf8}.primary{background:var(--blue)}.danger{background:#b91c1c;border-color:#ef4444}.big{font-weight:800;padding:14px 18px}.glass{background:#0b1628c9;backdrop-filter:blur(8px)}a{color:inherit}.hero{min-height:410px;border-radius:22px;overflow:hidden;background:linear-gradient(90deg,#06101dcc,#06101d45),url("./assets/maqam-echahid.jpg") center/cover;display:flex;align-items:flex-end;box-shadow:0 22px 65px #0008;margin-bottom:16px}.hero-overlay{padding:34px}.hero h1{font-size:54px;margin:8px 0}.hero p{font-size:21px;color:#e2e8f0}.tabs{display:flex;gap:8px;overflow:auto;padding:8px 0 14px}.tabs button{flex:0 0 auto}.tabs button.active{background:var(--blue)}.section-title,.section-head{display:flex;justify-content:space-between;align-items:center;gap:12px}.eyebrow{color:#60a5fa;font-size:12px}.feature-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:14px}.feature-card{min-height:145px;text-align:right;background:linear-gradient(145deg,#10213a,#0a1424);border:1px solid var(--line);border-radius:18px;padding:18px;display:flex;flex-direction:column;gap:8px}.feature-card span{font-size:31px}.feature-card b{font-size:18px}.feature-card small{color:var(--muted)}.notice{margin-top:14px}.institution-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:16px}.institution-card{overflow:hidden;border:1px solid var(--line);border-radius:18px;background:#0d1728ee}.institution-card>img{width:100%;height:230px;object-fit:contain;background:#f7fafc}.inst-body{padding:16px}.inst-body h3{display:flex;align-items:center;gap:7px}.phone-row a{background:#0a1424;border:1px solid var(--line);border-radius:9px;padding:8px 10px;text-decoration:none}.map-search{width:100%;margin:12px 0 6px}.official{display:block;text-align:center;color:#93c5fd;text-decoration:none;padding:8px}.guide-grid,.hazard-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:12px}.guide-grid article,.hazard-grid article{background:#0a1424;border:1px solid var(--line);border-radius:14px;padding:15px}.guide-grid p,.hazard-grid p{line-height:1.75;color:#e8eef7}.medical-note{color:#fbbf24}.stats{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin-bottom:14px}.stats div{background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:15px}.stats b{display:block;font-size:28px}.stats span{color:var(--muted)}.map-toolbar{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:12px}.map-toolbar>span{color:var(--muted);font-size:12px}.grid{display:grid;grid-template-columns:1.5fr 1fr;gap:14px}.map-panel{min-height:560px}#map{height:500px;border-radius:12px;overflow:hidden}.feed{display:grid;gap:10px}.item{border:1px solid var(--line);border-radius:12px;padding:13px;background:#0a1424}.item strong{display:block}.meta{color:var(--muted);font-size:13px;margin-top:5px}.pill{display:inline-block;border-radius:99px;padding:3px 8px;font-size:11px}.critical{background:#7f1d1d}.high{background:#9a3412}.medium{background:#854d0e}.low{background:#166534}.live{color:#4ade80;font-size:12px}.truck-pin{font-size:34px;text-align:center;filter:drop-shadow(0 3px 4px #000)}textarea{width:100%;background:#07111f;color:#fff;border:1px solid #334155;border-radius:10px;padding:12px;margin:8px 0}.ai-output{white-space:pre-wrap;background:#07111f;border:1px solid var(--line);border-radius:10px;padding:14px;min-height:120px}.msg{color:#fbbf24;min-height:22px}footer{text-align:center;color:#8fa1b6;padding:30px 15px;font-size:12px}footer a{color:#93c5fd}@media(max-width:1000px){.feature-grid{grid-template-columns:repeat(2,1fr)}.institution-grid{grid-template-columns:1fr}.guide-grid,.hazard-grid{grid-template-columns:repeat(2,1fr)}.grid{grid-template-columns:1fr}}@media(max-width:650px){main{padding:10px}.topbar{padding:0 10px}.brand small{display:none}.hero{min-height:430px}.hero-overlay{padding:22px}.hero h1{font-size:40px}.hero p{font-size:18px}.feature-grid,.guide-grid,.hazard-grid{grid-template-columns:1fr}.stats{grid-template-columns:repeat(2,1fr)}#map{height:420px}}
.embeddedMap{margin-top:12px}.embeddedMap iframe{width:100%;height:280px;border:0;border-radius:12px}.area-label{background:#0b1728;color:#fff;border:1px solid #38bdf8;border-radius:8px;padding:3px 6px;font-weight:700;white-space:nowrap}.grid.two{grid-template-columns:repeat(2,1fr)}select,input[type=number]{width:100%;background:#07111f;color:#fff;border:1px solid #334155;border-radius:10px;padding:12px;margin-top:6px}@media(max-width:650px){.grid.two{grid-template-columns:1fr}}
.unit-pin{font-size:25px;text-align:center;filter:drop-shadow(0 2px 3px #000)}.official-map iframe{height:600px}.official-map{margin-top:12px}
.official-units-map{height:560px;margin-top:14px;border-radius:14px;overflow:hidden;border:1px solid var(--line)}
.map-result-mini{min-height:40px;margin:8px 0}.internal-map-note{padding:10px;border:1px solid var(--line);border-radius:10px;background:#0a1424;color:#e8eef7}

.pricing-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:16px;margin-top:18px}.price-card{background:#0a1424;border:1px solid var(--line);border-radius:16px;padding:18px}.price-card h3{margin-top:0}.price-card>b{display:block;font-size:22px;color:#93c5fd;margin:12px 0}.price-card p{color:#e8eef7;line-height:1.7}.subscribeBtn{width:100%;background:#0b63ce}.institution-card .primary{width:100%;margin:6px 0}.tab .panel{margin-bottom:14px}@media(max-width:800px){.pricing-grid{grid-template-columns:1fr}}

.news-item{padding:14px;border:1px solid rgba(255,255,255,.12);border-radius:14px;margin-bottom:10px;background:rgba(0,0,0,.14)}.news-item h3{margin:.35rem 0}.news-item p{margin:.3rem 0;line-height:1.65}.news-item a{font-weight:700}.chat-box{height:420px;overflow:auto;padding:12px;border-radius:16px;background:rgba(0,0,0,.18);margin-bottom:12px}.chat-msg{white-space:pre-wrap;padding:10px 13px;border-radius:14px;margin:8px 0;max-width:88%;line-height:1.6}.chat-msg.user{margin-right:auto;background:rgba(0,120,255,.18)}.chat-msg.bot{margin-left:auto;background:rgba(0,170,120,.16)}

/* YAKADHA DZ — fixed professional operational identity */
:root{--accent:#0B3D91;--accent-2:#06285f;--surface:#ffffff;--text:#132238;--muted:#607089;--topbar:#ffffff;--border:rgba(19,34,56,.12)}
body{color:var(--text)}
button.primary,.primary{background:var(--accent)!important;border-color:var(--accent)!important}
.app-topbar{position:sticky;top:0;z-index:1200;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 16px;background:var(--topbar);border-bottom:1px solid var(--border);box-shadow:0 3px 14px rgba(0,0,0,.06)}
.brand-mini{display:flex;align-items:center;gap:10px;min-width:0}.brand-mini strong{display:block;font-size:1rem}.brand-mini small{display:block;color:var(--muted);font-size:.75rem;margin-top:2px}.role-logo{width:44px;height:44px;border-radius:50%;display:grid;place-items:center;overflow:hidden;border:2px solid var(--accent);background:linear-gradient(135deg,#fff,#e8eef8);font-size:24px;flex:0 0 auto}.role-logo.image-logo img{width:100%;height:100%;object-fit:contain;background:#fff}.platform-logo img{padding:3px}.top-controls{display:flex;align-items:center;gap:8px}
.install-btn{width:38px;height:38px;padding:0;display:grid;place-items:center;font-size:17px;border:1px solid var(--border);border-radius:12px;background:var(--surface);color:var(--text);cursor:pointer}.install-btn:hover{border-color:var(--accent);transform:translateY(-1px)}
.institution-detail-page{max-width:1100px;margin:auto}.institution-detail-head{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:22px;border-radius:20px;margin-bottom:16px;background:linear-gradient(135deg,var(--accent-2),var(--accent));color:#fff}.institution-detail-head h2,.institution-detail-head p{color:#fff}.institution-logo-large{width:125px;height:125px;object-fit:contain;border-radius:50%;background:#fff;padding:8px;box-shadow:0 8px 30px rgba(0,0,0,.2)}.unit-detail-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:14px;margin-top:16px}.unit-detail-card{background:var(--surface);border:1px solid var(--border);border-radius:16px;padding:14px;text-align:center}.unit-detail-card img{width:68px;height:68px;object-fit:contain}.institution-scope-note{margin-top:14px;padding:12px;border-radius:12px;background:rgba(31,111,235,.08);border-right:4px solid var(--accent)}
@media(max-width:650px){.app-topbar{padding:8px 10px}.theme-btn span{display:none}.language-picker{padding:0 7px}.institution-detail-head{padding:16px}.institution-logo-large{width:92px;height:92px}.theme-options{grid-template-columns:1fr}.brand-mini small{max-width:130px}}
.institution-entry{border-color:var(--accent);background:rgba(31,111,235,.08)}
.admin-entry{max-width:1200px;margin:10px auto 0;padding:0 16px}.admin-entry-btn{width:100%;background:linear-gradient(135deg,var(--accent-2),var(--accent));color:#fff;border:0;font-weight:800;padding:12px;border-radius:14px}.institution-register-dialog{max-height:90vh;overflow:auto}.institution-register-dialog label{display:block;margin:10px 0}.institution-register-dialog input,.institution-register-dialog select{box-sizing:border-box}.scope-hidden{display:none!important}.role-scope-banner{margin:12px 0;padding:12px 15px;border-radius:14px;background:linear-gradient(90deg,rgba(31,111,235,.12),rgba(16,185,129,.08));border:1px solid var(--border);font-weight:700}.request-card{display:grid;gap:7px}.request-actions{display:flex;gap:8px;flex-wrap:wrap}.request-actions button{flex:1;min-width:130px}.approved{color:#16a34a;font-weight:800}.pending{color:#d97706;font-weight:800}.rejected{color:#dc2626;font-weight:800}

.login-secondary-actions{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-top:10px;font-size:.85rem}.link-button{background:transparent!important;border:0!important;color:var(--accent,#4da3ff);padding:4px 0;cursor:pointer}.login-hint{opacity:.65}.login-panel .msg{min-height:2.4em;white-space:normal;overflow-wrap:anywhere}

/* Operational resource placement + incoming SOS */
.resource-add-panel{margin-bottom:12px;border:1px solid var(--accent);box-shadow:0 8px 28px rgba(11,61,145,.10)}
.sos-operational-card{border-right:4px solid #dc2626;background:rgba(220,38,38,.05)}
#incomingSosAlert{position:fixed;top:76px;right:18px;z-index:5000;width:min(390px,calc(100vw - 36px))}
.incoming-sos-card{background:#fff;color:#132238;border:2px solid #dc2626;border-radius:16px;padding:16px;box-shadow:0 16px 50px rgba(0,0,0,.28)}
.incoming-title{font-weight:900;font-size:18px;margin-bottom:8px}.sos-alert-flash .incoming-sos-card{animation:sosPulse .65s infinite alternate}
@keyframes sosPulse{from{box-shadow:0 0 0 0 rgba(220,38,38,.15),0 16px 50px rgba(0,0,0,.28)}to{box-shadow:0 0 0 9px rgba(220,38,38,.35),0 16px 50px rgba(0,0,0,.28)}}
#opsActionMsg{margin:8px 0}.map-toolbar button{white-space:nowrap}

.toast{position:fixed;left:50%;bottom:24px;transform:translateX(-50%) translateY(15px);opacity:0;pointer-events:none;z-index:6000;background:#0B3D91;color:#fff;border:1px solid rgba(255,255,255,.25);padding:11px 16px;border-radius:12px;box-shadow:0 12px 35px rgba(0,0,0,.3);transition:.2s ease;font-weight:700}.toast.show{opacity:1;transform:translateX(-50%) translateY(0)}

/* =========================================================
   YAKADHA DZ — accessibility / contrast / active-control hardening
   ========================================================= */
button,select,input,textarea{font:inherit}
button{min-height:42px;font-weight:700;transition:transform .15s ease,filter .15s ease,box-shadow .15s ease,border-color .15s ease}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:3px solid #38bdf8;outline-offset:2px}
button:disabled{opacity:.55;cursor:not-allowed;filter:none}
.tabs button{background:#13233a;color:#f8fafc;border-color:#38506f;box-shadow:0 2px 8px rgba(0,0,0,.12)}
.tabs button.active{background:var(--accent);color:#fff;border-color:#4d8de8;box-shadow:0 5px 16px rgba(11,61,145,.3)}
.feature-card,.guide-grid article,.hazard-grid article,.item,.price-card,.news-item,.chat-box{color:#f8fafc}
.feature-card b,.feature-card small,.guide-grid article b,.guide-grid article p,.hazard-grid article b,.hazard-grid article p,.item strong,.item div,.price-card h3,.price-card p,.news-item h3,.news-item p{color:#f8fafc}
.feature-card small,.guide-grid article p,.hazard-grid article p,.price-card p,.meta,.map-toolbar>span{color:#e8eef7}
.panel>h1,.panel>h2,.panel>h3,.section-title h2,.section-head h2,.section-head h3{color:var(--text)}
.panel p{color:#334155}
.institution-card .inst-body p{color:#334155;line-height:1.7}
.institution-card .inst-body h3{color:#132238}
.institution-card .official{color:#0b4f9c;font-weight:800}
.phone-row a{color:#eaf2ff!important}
.notice{color:#132238;background:#f1f6fc;border:1px solid #c9d8ea;border-radius:12px;padding:12px}
.msg{color:#8a4b00;background:#fff7df;border-radius:10px;padding:8px 10px}
.role-scope-banner{color:#16314f;background:#eef5ff}
.map-toolbar.panel{background:#fff;color:#132238}
.map-toolbar.panel button{color:#f8fafc;background:#172033;border-color:#38506f}
.map-toolbar.panel button.primary{background:var(--accent)!important;color:#fff}
.map-toolbar.panel button.active{background:#0e7490;color:#fff;border-color:#22d3ee}
.map-toolbar.panel>span{color:#425466}
.ai-output{color:#f8fafc}
.chat-msg.user{color:#eaf4ff}.chat-msg.bot{color:#eafff7}
.official-map .panel p,.institution-scope-note{color:#334155}
.institution-detail-head .eyebrow{color:#dbeafe}
.critical,.high,.medium,.low{color:#fff!important;font-weight:800}
.pill{border:1px solid rgba(255,255,255,.2)}
.install-btn{background:#fff;color:#132238}
#backendStatus{font-weight:700}
.unit-pin{line-height:30px}
.area-label{font-size:12px;box-shadow:0 4px 12px rgba(0,0,0,.22)}
@media(max-width:650px){button{min-height:44px}.hero-actions button{width:100%}.tabs{padding-bottom:10px}.map-toolbar.panel{align-items:stretch}.map-toolbar.panel button{flex:1 1 auto}.panel{padding:14px}}
.coordination-panel{margin-bottom:14px}.coord-note{margin:0 0 10px;color:#425466!important}.coord-feed{max-height:280px;overflow:auto;display:grid;gap:8px;padding:8px;background:#0a1424;border:1px solid #263247;border-radius:12px}.coord-msg{padding:10px 12px;border-radius:10px;background:#13233a;border:1px solid #38506f;color:#f8fafc;line-height:1.6}.coord-msg b{color:#fff}.coord-inst{font-size:11px;color:#93c5fd;margin-inline-start:6px}.coord-compose{display:flex;gap:8px;align-items:stretch;margin-top:10px}.coord-compose textarea{flex:1;margin:0}.coord-compose button{white-space:nowrap}@media(max-width:650px){.coord-compose{flex-direction:column}.coord-compose button{width:100%}}

/* YAKADHA DZ — final citizen/health/institution UX */
.citizen-grid{display:grid;grid-template-columns:1fr 1.15fr;gap:16px}.citizen-hero{background:linear-gradient(135deg,#06285f,#0B3D91);color:#fff}.citizen-hero h3,.citizen-hero p{color:#fff}.compact-guides{margin-top:12px}.firstaid-rich article{min-height:145px}.firstaid-rich article b{font-size:1.05rem}.medical-note{margin-top:16px;padding:14px;border-radius:14px;background:#fff7df;border:1px solid #e9d39a;color:#5b4300!important;font-weight:600}.institution-info-grid{display:grid;grid-template-columns:1.3fr .7fr;gap:16px;margin-bottom:16px}.info-list{margin:0;padding-right:20px;line-height:2}.emergency-links{display:grid;gap:9px;margin:12px 0}.emergency-links a{display:block;padding:11px;border-radius:11px;background:#eef5ff;color:#0b4f9c;font-weight:800}.big-official{display:block;margin-top:12px}.health-map{height:430px;border-radius:14px;overflow:hidden}.health-list{display:grid;gap:10px}.health-card{border:1px solid var(--border);border-radius:14px;padding:13px;background:#fff}.health-card-head{display:flex;gap:10px;align-items:center}.health-symbol{font-size:30px}.health-card h4{margin:0;color:#132238}.health-card p{color:#475569!important;line-height:1.65}.phone-btn,.health-focus{display:inline-flex;align-items:center;justify-content:center;padding:9px 12px;border-radius:10px;background:#eef5ff;color:#0b4f9c;font-weight:800;text-decoration:none;border:1px solid #cbdcf1}.health-pin{font-size:29px;text-align:center;filter:drop-shadow(0 3px 5px rgba(0,0,0,.28))}.civil-unit-marker{border-radius:50%;box-shadow:0 3px 10px rgba(0,0,0,.3);background:#fff}.resource-select-pin{font-size:28px;text-align:center}.sos-target-pin{font-size:30px;text-align:center;filter:drop-shadow(0 4px 7px rgba(0,0,0,.35))}.sos-dispatch-meta{margin:8px 0;padding:9px;border-radius:10px;background:#eef5ff;color:#183b61}.unit-detail-card button{margin-top:8px}.unit-detail-card img{border-radius:50%;background:#fff}.map-toolbar.panel>span{display:block;width:100%}@media(max-width:800px){.citizen-grid,.institution-info-grid{grid-template-columns:1fr}.health-map{height:360px}.firstaid-rich article{min-height:0}}

/* ===== FINAL OPERATIONS UX ===== */
.device-mode-btn{white-space:nowrap;font-weight:800}.resource-board{margin:12px 0}.resource-palette{display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));gap:9px;margin-top:10px}.resource-drag-card{display:flex;align-items:center;gap:10px;padding:10px;border:1px solid var(--line);border-radius:13px;background:#0a1424;cursor:grab;user-select:none}.resource-drag-card:active{cursor:grabbing}.resource-drag-icon{font-size:30px;line-height:1}.resource-drag-card b{display:block}.resource-drag-card small{display:block;color:#e8eef7;margin-top:3px}.drag-hint{margin-inline-start:auto;color:#93c5fd;font-size:12px}.map-drop-ready{outline:4px dashed #22d3ee;outline-offset:-6px}.resource-type-pin{display:flex;align-items:center;justify-content:center;font-size:32px;filter:drop-shadow(0 4px 5px rgba(0,0,0,.4));background:rgba(255,255,255,.9);border-radius:50%;border:2px solid #fff}.resource-type-pin span{line-height:1}.sos-command-summary{background:#eef7ff;color:#102a43;border:1px solid #b7d5ef}.route-summary-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:9px;margin-top:10px}.route-summary-grid>div{padding:10px;border-radius:11px;background:#fff;border:1px solid #d6e4f2}.coord-channel-row{display:flex;gap:8px;flex-wrap:wrap;margin:8px 0}.coord-channel{background:#172033}.coord-channel.active{background:#0e7490;border-color:#22d3ee}.coord-medical{display:inline-block;margin-inline-start:7px;padding:2px 7px;border-radius:20px;background:#dff7ea;color:#166534;font-size:10px}.role-compare-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.role-compare-grid article{padding:14px;border:1px solid var(--line);border-radius:14px;background:#0a1424}.role-compare-grid h4{margin-top:0}@media(max-width:800px){.route-summary-grid,.role-compare-grid{grid-template-columns:1fr}}
body[data-device-mode="computer"] main{max-width:1500px}body[data-device-mode="computer"] #map{height:650px}body[data-device-mode="computer"] .map-panel{min-height:710px}body[data-device-mode="computer"] .resource-palette{grid-template-columns:repeat(3,1fr)}body[data-device-mode="phone"] .resource-palette{grid-template-columns:1fr 1fr}body[data-device-mode="phone"] .resource-drag-card{padding:8px}body[data-device-mode="phone"] .drag-hint{display:none}

.resource-drag-card{touch-action:none}

.modal-backdrop{position:fixed;inset:0;z-index:10000;background:rgba(2,8,23,.72);display:flex;align-items:center;justify-content:center;padding:18px}.modal-card{width:min(720px,96vw);max-height:92vh;overflow:auto;background:#fff;color:#172033;border-radius:18px;padding:18px;box-shadow:0 25px 80px rgba(0,0,0,.35)}.modal-card label{color:#172033}.health-add-map-modal .section-head{position:sticky;top:0;background:#fff;z-index:2}.health-add-map-modal .grid{margin:10px 0}.health-add-map-modal .row{margin-top:14px}

.full-span{grid-column:1/-1}.pluscode-preview{border-color:rgba(34,197,94,.4)!important}
/* YAKADHA DZ — true device editions */
.app-logo img{width:100%;height:100%;object-fit:cover;border-radius:50%}
.admin-entry{display:flex;gap:10px;flex-wrap:wrap}
.admin-entry .admin-entry-btn{font-weight:900}
body[data-device-mode="phone"] .app-topbar{position:sticky;top:0;z-index:1100}
body[data-device-mode="phone"] .tabs{display:flex;overflow-x:auto;white-space:nowrap;scrollbar-width:none}
body[data-device-mode="phone"] .tabs::-webkit-scrollbar{display:none}
body[data-device-mode="phone"] main{padding:10px}
body[data-device-mode="computer"]{background:#e8eef7}
body[data-device-mode="computer"] .app-topbar{position:sticky;top:0;z-index:1200;min-height:66px;padding-inline:24px}
body[data-device-mode="computer"] .ticker{position:sticky;top:66px;z-index:1190}
body[data-device-mode="computer"] .topbar{position:sticky;top:96px;z-index:1180}
body[data-device-mode="computer"] #appView{min-height:calc(100vh - 120px)}
body[data-device-mode="computer"] #appView>.tabs{position:fixed;right:0;top:96px;bottom:0;width:245px;z-index:1050;display:flex;flex-direction:column;align-items:stretch;overflow-y:auto;overflow-x:hidden;padding:14px 10px 30px;background:linear-gradient(180deg,#06285f,#07111f);border-left:1px solid #29456c;box-shadow:-12px 0 35px rgba(0,0,0,.18)}
body[data-device-mode="computer"] #appView>.tabs button{width:100%;min-height:46px;text-align:right;border-radius:10px;margin:3px 0;font-size:14px}
body[data-device-mode="computer"] #appView>section.tab,
body[data-device-mode="computer"] #appView>.hero,
body[data-device-mode="computer"] #appView>.admin-entry,
body[data-device-mode="computer"] #appView>.role-scope-banner{margin-right:265px;margin-left:18px}
body[data-device-mode="computer"] #appView>.hero{border-radius:0 0 22px 22px;min-height:470px}
body[data-device-mode="computer"] #appView>section.tab{max-width:none}
body[data-device-mode="computer"] .grid{grid-template-columns:minmax(0,1.7fr) minmax(320px,.8fr)}
body[data-device-mode="computer"] #map{height:650px}
body[data-device-mode="computer"] .map-panel{min-height:710px}
body[data-device-mode="computer"] .feature-grid{grid-template-columns:repeat(4,minmax(0,1fr))}
body[data-device-mode="computer"] .institution-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
body[data-device-mode="computer"] .stats{grid-template-columns:repeat(4,minmax(0,1fr))}
body[data-device-mode="computer"] .device-mode-btn{min-width:150px}
body[data-device-mode="computer"] .resource-add-panel{max-width:1100px;margin-inline:auto}
@media(max-width:900px){body[data-device-mode="computer"] #appView>.tabs{width:210px}body[data-device-mode="computer"] #appView>section.tab,body[data-device-mode="computer"] #appView>.hero,body[data-device-mode="computer"] #appView>.admin-entry,body[data-device-mode="computer"] #appView>.role-scope-banner{margin-right:225px;margin-left:10px}}
@media(max-width:650px){body[data-device-mode="computer"] #appView>.tabs{position:static;width:auto;display:flex;flex-direction:row;overflow-x:auto;border:0;box-shadow:none}body[data-device-mode="computer"] #appView>section.tab,body[data-device-mode="computer"] #appView>.hero,body[data-device-mode="computer"] #appView>.admin-entry,body[data-device-mode="computer"] #appView>.role-scope-banner{margin-right:0;margin-left:0}}
/* YAKADHA DZ — smart 100 km operational scope + caller SOS card */
.sos-caller-marker{background:transparent!important;border:0!important;display:flex;align-items:center;justify-content:center;overflow:visible}
.sos-caller-marker>span{display:flex;align-items:center;justify-content:center;width:44px;height:44px;border-radius:50%;background:#dc2626;color:#fff;border:3px solid #fff;box-shadow:0 5px 18px rgba(127,29,29,.55);font-size:25px;line-height:1}
@keyframes yakadhaCallerPulse{0%,100%{transform:scale(1);filter:drop-shadow(0 0 0 rgba(220,38,38,0))}50%{transform:scale(1.18);filter:drop-shadow(0 0 13px rgba(220,38,38,.9))}}
.sos-caller-marker.caller-pulse>span{animation:yakadhaCallerPulse 1s ease-in-out infinite}
.sos-caller-card{direction:rtl;min-width:270px;color:#132238;background:#fff;border-radius:14px;padding:10px;box-shadow:0 8px 28px rgba(0,0,0,.2)}
.sos-caller-head{display:flex;align-items:center;gap:9px;padding-bottom:9px;margin-bottom:9px;border-bottom:1px solid #dbe4ef}
.sos-caller-head b{display:block;font-size:16px}.sos-caller-head small{display:block;color:#b91c1c;margin-top:2px;font-weight:800}
.sos-caller-badge{width:38px;height:38px;border-radius:50%;display:grid;place-items:center;background:#fee2e2;font-size:22px}
.sos-caller-grid{display:grid;grid-template-columns:1fr 1fr;gap:7px}.sos-caller-grid>div{padding:7px;border-radius:9px;background:#f5f8fc;border:1px solid #e1e8f0}.sos-caller-grid>div.full{grid-column:1/-1}.sos-caller-grid span{display:block;color:#b6c2d2;font-size:11px}.sos-caller-grid b{display:block;margin-top:2px;font-size:12px;word-break:break-word}
.sos-caller-focus{width:100%;margin-top:9px;background:#0b3d91;color:#fff;border-color:#0b3d91;font-weight:800}
@media(max-width:650px){.sos-caller-card{min-width:235px}.sos-caller-grid{grid-template-columns:1fr}.sos-caller-grid>div.full{grid-column:auto}}

/* YAKADHA DZ — automatic Civil Protection wilaya identity banner */
.civil-directorate-banner{position:relative;display:flex;align-items:center;gap:12px;margin:0 0 12px;padding:8px 12px;min-height:54px;overflow:hidden;border:1px solid rgba(255,255,255,.18);border-radius:16px;background:linear-gradient(90deg,#06285f,#0b3d91 55%,#071b36);box-shadow:0 8px 24px rgba(0,0,0,.16);color:#fff}
.civil-directorate-logo-wrap{flex:0 0 42px;width:42px;height:42px;border-radius:50%;padding:2px;background:#fff;box-shadow:0 0 0 2px rgba(255,255,255,.2)}
.civil-directorate-logo-wrap img{width:100%;height:100%;display:block;object-fit:contain;border-radius:50%}
.civil-directorate-marquee{min-width:0;flex:1;overflow:hidden;direction:rtl;mask-image:linear-gradient(90deg,transparent,#000 8%,#000 92%,transparent)}
.civil-directorate-track{display:inline-block;white-space:nowrap;padding-inline:40px;font-weight:900;font-size:clamp(14px,2vw,18px);letter-spacing:.1px;animation:yakadha-directorate-marquee 32s linear infinite}
.civil-directorate-banner:hover .civil-directorate-track{animation-play-state:paused}
.civil-directorate-status{flex:0 0 auto;font-size:11px;font-weight:800;opacity:.9;padding:5px 8px;border-radius:999px;background:rgba(255,255,255,.1);white-space:nowrap}
@keyframes yakadha-directorate-marquee{from{transform:translateX(105%)}to{transform:translateX(-115%)}}
@media(prefers-reduced-motion:reduce){.civil-directorate-track{animation:none;transform:none}}
@media(max-width:650px){.civil-directorate-banner{gap:8px;border-radius:12px;padding:7px 9px}.civil-directorate-logo-wrap{flex-basis:36px;width:36px;height:36px}.civil-directorate-track{font-size:13px;animation-duration:38s}.civil-directorate-status{font-size:9px;padding:4px 6px}}

/* ===== YAKADHA DZ — FINAL FIELD RELEASE UX 15/09/2026 ===== */
.yakadha-splash{position:fixed;inset:0;z-index:50000;background:#061326 url('./assets/yakadha-splash-20260915.png') center/cover no-repeat;display:flex;align-items:flex-end;justify-content:center;padding:clamp(20px,5vw,70px);transition:opacity .55s ease,visibility .55s ease}.yakadha-splash.hidden{opacity:0;visibility:hidden;pointer-events:none}.yakadha-splash-overlay{width:min(760px,92vw);text-align:center;color:#fff;background:linear-gradient(180deg,rgba(3,15,30,.1),rgba(3,15,30,.88));border-radius:24px;padding:24px 24px 20px;backdrop-filter:blur(6px);box-shadow:0 20px 70px rgba(0,0,0,.45)}.yakadha-splash-badge{font-size:clamp(20px,3vw,32px);font-weight:900;text-shadow:0 3px 14px #000}.yakadha-splash-overlay p{font-size:clamp(15px,2vw,22px);margin:7px 0;color:#fff}.yakadha-enter-btn{background:#c91f26!important;border:2px solid #fff!important;border-radius:14px!important;padding:13px 30px!important;font-size:18px!important;font-weight:900!important;box-shadow:0 8px 25px rgba(0,0,0,.3)}.yakadha-splash-overlay small{display:block;margin-top:10px;color:#e2e8f0}.sos-popup-actions{display:grid;grid-template-columns:1fr 1fr;gap:7px;margin-top:10px}.sos-history-panel{margin-top:18px;padding-top:14px;border-top:1px solid #dbe4ef}.sos-history-row{display:grid;grid-template-columns:42px 1fr auto;gap:10px;align-items:center;background:#fff!important;color:#132238!important;border-color:#dbe4ef!important}.sos-history-row strong,.sos-history-row div{color:#132238!important}.sos-history-rank{width:34px;height:34px;border-radius:50%;display:grid;place-items:center;background:#0b63ce;color:#fff!important;font-weight:900}.sos-history-main{min-width:0}.sos-history-main .meta{color:#b6c2d2!important}.sos-caller-grid{display:grid;grid-template-columns:1fr 1fr;gap:7px}.sos-caller-grid>div{padding:8px;border:1px solid #dbe4ef;border-radius:9px;background:#f7fafc}.sos-caller-grid span{display:block;font-size:11px;color:#b6c2d2;margin-bottom:2px}.sos-caller-grid b{display:block;color:#132238;overflow-wrap:anywhere}.sos-caller-grid .full{grid-column:1/-1}.sos-caller-marker.caller-pulse>span{will-change:transform,filter}.operational-radius-label{font-weight:900;color:#0b4f9c;background:#fff;border:1px solid #b7d5ef;padding:4px 8px;border-radius:999px}

/* Desktop edition: operational workstation inspired by the reference interface. */
body[data-device-mode="computer"]{background:#e7edf5;color:#132238}body[data-device-mode="computer"] .app-topbar{background:#071b33;color:#fff;border-bottom:0;height:64px}body[data-device-mode="computer"] .topbar{background:#fff;color:#132238;top:100px;border-bottom:1px solid #d7e1ed}body[data-device-mode="computer"] .ticker{background:#062b55}body[data-device-mode="computer"] #appView>.tabs{left:0;right:auto;border-left:0;border-right:1px solid #29456c;background:linear-gradient(180deg,#06285f,#071b33);box-shadow:12px 0 35px rgba(0,0,0,.14)}body[data-device-mode="computer"] #appView>section.tab,body[data-device-mode="computer"] #appView>.hero,body[data-device-mode="computer"] #appView>.admin-entry,body[data-device-mode="computer"] #appView>.role-scope-banner{margin-left:265px;margin-right:18px}body[data-device-mode="computer"] .hero{background:linear-gradient(90deg,rgba(4,17,32,.78),rgba(4,17,32,.16)),url('./assets/maqam-echahid.jpg') center/cover}body[data-device-mode="computer"] .hero h1{font-size:58px}body[data-device-mode="computer"] .feature-card{background:#fff;color:#132238;box-shadow:0 7px 22px rgba(13,35,60,.09);border-color:#d6e1ec;text-align:center;align-items:center}body[data-device-mode="computer"] .feature-card b,body[data-device-mode="computer"] .feature-card small{color:#132238}body[data-device-mode="computer"] .panel{background:#fff;color:#132238;border-color:#d6e1ec;box-shadow:0 7px 22px rgba(13,35,60,.08)}body[data-device-mode="computer"] .section-title h2,body[data-device-mode="computer"] .section-head h2,body[data-device-mode="computer"] .section-head h3,body[data-device-mode="computer"] .panel>h2,body[data-device-mode="computer"] .panel>h3{color:#132238}body[data-device-mode="computer"] .stats div{background:#fff;border-color:#d6e1ec}body[data-device-mode="computer"] .stats b{color:#0b3d91}body[data-device-mode="computer"] #map{height:650px}body[data-device-mode="computer"] .map-panel{min-height:710px}body[data-device-mode="computer"] .map-toolbar.panel{background:#fff}body[data-device-mode="computer"] .tabs button{font-size:14px}body[data-device-mode="computer"] .civil-directorate-banner{margin-left:265px;margin-right:18px}
@media(max-width:650px){.yakadha-splash{padding:14px}.yakadha-splash-overlay{padding:16px 14px}.sos-popup-actions{grid-template-columns:1fr}.sos-history-row{grid-template-columns:34px 1fr}.sos-history-row>.sos-map-btn{grid-column:2;justify-self:start}}

/* ===== MERGE 2026-09-16 — لوغو بحجم هاتف + مكتبة ===== */
.app-topbar{
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  padding:10px 14px;position:sticky;top:0;z-index:2000;
  background:linear-gradient(180deg,#0a1f4d,#07111f);border-bottom:1px solid #1e3a5f;
}
.brand-mini{display:flex;align-items:center;gap:12px;min-width:0}
.role-logo, #roleLogo.role-logo{
  width:64px!important;height:64px!important;min-width:64px;min-height:64px;
  font-size:36px!important;display:flex!important;align-items:center;justify-content:center;
  border-radius:18px;background:rgba(255,255,255,.12);border:2px solid #38bdf8;
  box-shadow:0 6px 18px rgba(14,116,144,.35);overflow:hidden;line-height:1;
}
.role-logo img, #roleLogo img{
  width:100%!important;height:100%!important;object-fit:contain;display:block;border-radius:14px;
}
.brand-mini strong{font-size:18px;display:block}
.brand-mini small{font-size:12px;opacity:.85}
.device-mode-btn{
  background:linear-gradient(135deg,#0B3D91,#0e7490)!important;color:#fff!important;
  border:1px solid #38bdf8!important;border-radius:999px!important;
  padding:10px 16px!important;font-size:13px!important;font-weight:800!important;
  box-shadow:0 4px 14px rgba(14,116,144,.4);white-space:nowrap;min-width:150px;
}
.device-mode-badge{
  display:inline-flex;align-items:center;padding:5px 10px;border-radius:999px;
  font-size:11px;font-weight:700;background:#0a1f3d;color:#7dd3fc;border:1px solid #164e63;
}
.login-mark{font-size:72px!important;line-height:1;margin-bottom:8px}
.login-panel .login-logo-img{
  width:120px;height:120px;object-fit:contain;display:block;margin:0 auto 12px;
  border-radius:28px;box-shadow:0 10px 30px rgba(0,0,0,.35);
}
/* مكتبة المعرفة */
.library-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:12px;margin-top:12px}
.library-card{
  background:#0a1424;border:1px solid #263247;border-radius:16px;padding:14px;cursor:pointer;
  transition:transform .15s,border-color .15s;
}
.library-card:hover{transform:translateY(-2px);border-color:#38bdf8}
.library-card .lib-icon{font-size:32px;margin-bottom:6px}
.library-card b{display:block;margin-bottom:4px}
.library-card small{color:#c5d0de;display:block}
.library-card .lib-free{display:inline-block;margin-top:8px;padding:3px 8px;border-radius:999px;background:#065f46;color:#a7f3d0;font-size:11px;font-weight:700}
.library-reader{
  background:#0a1424;border:1px solid #29456c;border-radius:16px;padding:16px;margin-top:12px;line-height:1.75;
}
.library-reader h3{margin-top:0}
.library-reader .lib-body{white-space:pre-wrap;color:#e2e8f0;font-size:15px}
@media(max-width:650px){
  .role-logo, #roleLogo.role-logo{width:56px!important;height:56px!important;min-width:56px;font-size:30px!important}
  .device-mode-btn{min-width:120px;padding:8px 12px!important;font-size:12px!important}
}

/* ===== ROLE SKINS — مواطن / مؤسسة / منصة ===== */
:root{ --role-accent:#0B3D91; }
body[data-role="citizen"]{
  --role-accent:#0B3D91;
  --accent:#0B3D91;
}
body[data-role="institution"]{
  --role-accent:#0f766e;
  --accent:#0f766e;
}
body[data-role="admin"]{
  --role-accent:#7c3aed;
  --accent:#7c3aed;
}

body[data-role="citizen"] .app-topbar{
  background:linear-gradient(180deg,#0a1f4d,#07111f);
  border-bottom-color:#1e3a5f;
}
body[data-role="institution"] .app-topbar{
  background:linear-gradient(180deg,#0a3d38,#042f2e);
  border-bottom-color:#115e59;
}
body[data-role="admin"] .app-topbar{
  background:linear-gradient(180deg,#3b0764,#1e1b4b);
  border-bottom-color:#6d28d9;
}

body[data-role="citizen"] .role-logo{ border-color:#38bdf8; box-shadow:0 6px 18px rgba(11,61,145,.4); }
body[data-role="institution"] .role-logo{ border-color:#2dd4bf; box-shadow:0 6px 18px rgba(15,118,110,.45); }
body[data-role="admin"] .role-logo{ border-color:#c4b5fd; box-shadow:0 6px 18px rgba(124,58,237,.45); }

.role-scope-banner{
  display:flex;align-items:center;flex-wrap:wrap;gap:8px;
  margin:10px 12px;padding:12px 14px;border-radius:14px;
  font-size:13px;line-height:1.5;border:1px solid transparent;
}
body[data-role="citizen"] .role-scope-banner,
.role-scope-banner[data-role="citizen"]{
  background:rgba(11,61,145,.15);border-color:#1d4ed8;color:#dbeafe;
}
body[data-role="institution"] .role-scope-banner,
.role-scope-banner[data-role="institution"]{
  background:rgba(15,118,110,.18);border-color:#0d9488;color:#ccfbf1;
}
body[data-role="admin"] .role-scope-banner,
.role-scope-banner[data-role="admin"]{
  background:rgba(124,58,237,.18);border-color:#7c3aed;color:#ede9fe;
}
.role-chip{
  display:inline-flex;align-items:center;gap:4px;
  padding:3px 10px;border-radius:999px;font-weight:800;font-size:12px;
  background:rgba(255,255,255,.12);
}

body[data-role="citizen"] .tabs button.active{
  background:#0B3D91;border-color:#3b82f6;
}
body[data-role="institution"] .tabs button.active{
  background:#0f766e;border-color:#2dd4bf;
}
body[data-role="admin"] .tabs button.active{
  background:#7c3aed;border-color:#c4b5fd;
}

body[data-role="citizen"] .primary,
body[data-role="citizen"] button.primary{ background:#0B3D91; }
body[data-role="institution"] .primary,
body[data-role="institution"] button.primary{ background:#0f766e; }
body[data-role="admin"] .primary,
body[data-role="admin"] button.primary{ background:#7c3aed; }

body[data-role="admin"] .admin-entry-btn{
  background:linear-gradient(135deg,#6d28d9,#4c1d95)!important;
  border:1px solid #c4b5fd;
}
body[data-role="citizen"] .hero,
body[data-role="citizen"] #home .section-title h2{ color:#93c5fd; }
body[data-role="institution"] #home .section-title h2{ color:#5eead4; }
body[data-role="admin"] #home .section-title h2{ color:#c4b5fd; }

/* نوافذ/بطاقات مميزة */
body[data-role="admin"] #platformAdmin,
body[data-role="admin"] [data-admin="true"]{
  border:1px solid rgba(167,139,250,.35);
  box-shadow:0 0 0 1px rgba(124,58,237,.15);
}
body[data-role="institution"] #ops,
body[data-role="institution"] #sos{
  border-radius:16px;
}
body[data-role="citizen"] #citizen,
body[data-role="citizen"] #library{
  border-radius:16px;
}

#roleHeroHint{
  margin:8px 0 12px;padding:10px 12px;border-radius:12px;
  background:rgba(255,255,255,.04);border:1px dashed rgba(148,163,184,.35);
  color:#e8eef7;font-size:13px;
}

/* تنبيهات محلية */
.local-alert-banner{
  position:sticky;top:0;z-index:3000;
  background:linear-gradient(90deg,#7f1d1d,#b91c1c);
  color:#fff;padding:10px 14px;font-size:13px;font-weight:700;
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  box-shadow:0 6px 20px rgba(127,29,29,.35);
}
.local-alerts-panel{margin:12px;border:1px solid #7f1d1d33}
.local-alert-card{border-right:4px solid #64748b}
.local-alert-card.level-HIGH{border-right-color:#dc2626;background:rgba(220,38,38,.06)}
.local-alert-card.level-MEDIUM{border-right-color:#f59e0b;background:rgba(245,158,11,.06)}
.local-alert-card.relevance-local{box-shadow:inset 0 0 0 1px rgba(14,165,233,.25)}


/* شريط مديرية الحماية — متحرك واضح */
.civil-directorate-banner{
  display:flex;align-items:center;gap:10px;
  background:linear-gradient(90deg,#7f1d1d,#b91c1c 40%,#991b1b);
  color:#fff;padding:8px 12px;overflow:hidden;
  border-bottom:2px solid #fca5a5;
  min-height:48px;
}
.civil-directorate-logo-wrap{
  flex:0 0 40px;width:40px;height:40px;border-radius:50%;
  background:#fff;display:flex;align-items:center;justify-content:center;
  overflow:hidden;border:2px solid #fecaca;
}
.civil-directorate-logo-wrap img{width:100%;height:100%;object-fit:contain}
.civil-directorate-marquee{
  flex:1;overflow:hidden;white-space:nowrap;mask-image:linear-gradient(90deg,transparent,#000 6%,#000 94%,transparent);
}
.civil-directorate-track{
  display:inline-block;padding-right:100%;
  animation:civilMarquee 28s linear infinite;
  font-weight:800;font-size:14px;letter-spacing:.2px;
}
@keyframes civilMarquee{
  0%{transform:translateX(0)}
  100%{transform:translateX(-50%)}
}
.civil-directorate-status{
  flex:0 0 auto;font-size:11px;font-weight:800;
  background:rgba(0,0,0,.25);padding:4px 8px;border-radius:999px;
}
.civil-directorate-status[data-state="live"]{background:#14532d}
.civil-directorate-status[data-state="error"]{background:#450a0a}
.civil-directorate-status[data-state="loading"]{background:#713f12}

.health-nearby-panel{margin-top:10px}
.pin-user{font-size:22px;filter:drop-shadow(0 2px 2px rgba(0,0,0,.4))}
.health-map, #healthMap{min-height:360px;border-radius:14px}

/* ===== بوابة الدخول التجريبية — مواطن / مؤسسات ===== */
.portal-gate{
  max-width:960px;margin:18px auto;padding:12px 14px 28px;
}
.portal-hero{text-align:center;margin-bottom:18px}
.portal-logo{width:96px;height:96px;border-radius:24px;object-fit:contain;
  box-shadow:0 12px 30px rgba(0,0,0,.35);margin-bottom:8px}
.portal-hero h1{margin:6px 0;font-size:28px}
.portal-sub{color:#e8eef7;margin:0 auto;max-width:520px;line-height:1.6}
.portal-domain{display:inline-block;margin-top:8px;font-size:12px;color:#7dd3fc;
  background:rgba(14,116,144,.2);padding:4px 10px;border-radius:999px}
.portal-choose{text-align:center;margin:12px 0 14px;font-size:18px}
.portal-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:14px}
.portal-card{
  border:0;padding:0;border-radius:18px;overflow:hidden;cursor:pointer;text-align:right;
  background:#0a1424;color:#f8fafc;box-shadow:0 10px 28px rgba(0,0,0,.28);
  border:1px solid #1e3a5f;transition:transform .15s,border-color .15s;
}
.portal-card:hover{transform:translateY(-3px);border-color:#38bdf8}
.portal-card img{width:100%;height:140px;object-fit:cover;display:block}
.portal-card-body{padding:12px 14px 16px}
.portal-card-body b{display:block;font-size:18px;margin:4px 0}
.portal-card-body small{color:#c5d0de;line-height:1.5;display:block}
.portal-badge{display:inline-block;font-size:11px;font-weight:800;padding:3px 8px;border-radius:999px;
  background:#065f46;color:#a7f3d0}
.portal-badge-inst{background:#1e3a8a;color:#bfdbfe}
.inst-type-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:12px;margin-top:12px}
.inst-type-card{
  background:#0a1424;border:1px solid #29456c;border-radius:16px;padding:14px;cursor:pointer;
  color:#f8fafc;text-align:center;
}
.inst-type-card img{width:64px;height:64px;object-fit:contain;margin:0 auto 8px;display:block}
.inst-type-card b{display:block;margin-bottom:4px}
.inst-type-card small{color:#c5d0de;font-size:12px}
.civil-portal-head{display:flex;gap:12px;align-items:center;margin-bottom:12px}
.civil-portal-head img{width:56px;height:56px;object-fit:contain;background:#fff;border-radius:12px;padding:4px}
.civil-portal-tabs{display:flex;gap:8px;margin-bottom:12px;flex-wrap:wrap}
.civil-tab{background:#13233a;color:#e2e8f0;border:1px solid #38506f;border-radius:999px;padding:8px 14px}
.civil-tab.active{background:#0B3D91;border-color:#60a5fa;color:#fff}
.portal-back-row{margin-bottom:8px}
.sup-pending-card{border-right:4px solid #f59e0b;background:rgba(245,158,11,.08)}

.sos-phone-label,.phone-gate-panel label{display:block;margin:10px 0}
.phone-gate-panel{max-width:420px;margin:12vh auto;z-index:8000;position:relative}
.modal-backdrop{position:fixed;inset:0;background:rgba(2,8,20,.72);z-index:7500;display:flex;align-items:flex-start;justify-content:center;padding:16px}
.modal-backdrop[hidden]{display:none!important}

.adsense-wrap{margin:12px 0;padding:8px;border-radius:12px;background:rgba(255,255,255,.03);border:1px dashed rgba(148,163,184,.35);min-height:90px;overflow:hidden}
.adsense-wrap ins{max-width:100%}


/* SOS supervisor dock + badges + smart update */
.supervisor-sos-dock{position:fixed;top:72px;left:12px;z-index:12000;display:flex;flex-direction:column;gap:8px;width:min(300px,calc(100vw - 24px));pointer-events:auto}
.sos-dock-head{background:#7f1d1d;color:#fff;font-weight:800;padding:8px 12px;border-radius:12px;box-shadow:0 8px 24px rgba(0,0,0,.25)}
.sos-dock-card{display:flex;flex-direction:column;align-items:flex-start;gap:2px;text-align:right;background:#fff;color:#111;border:2px solid #dc2626;border-radius:14px;padding:10px 12px;cursor:pointer;font:inherit}
.sos-dock-card strong{font-size:15px}
.sos-dock-card span{font-size:12px;opacity:.9}
.sos-dock-more{border:none;background:#0B3D91;color:#fff;border-radius:12px;padding:10px;cursor:pointer;font:inherit;font-weight:700}
.sos-live-badge{display:inline-flex;min-width:18px;height:18px;padding:0 5px;margin-inline-start:6px;border-radius:999px;background:#dc2626;color:#fff;font-size:11px;font-weight:800;align-items:center;justify-content:center;animation:sosBadgePulse 1s infinite alternate}
.tabs button.has-sos-pulse{box-shadow:0 0 0 2px rgba(220,38,38,.55)}
@keyframes sosBadgePulse{from{transform:scale(1)}to{transform:scale(1.12)}}
.app-update-banner{position:fixed;inset:auto 12px 18px 12px;z-index:13000;display:flex;justify-content:center}
.app-update-card{background:#0b1b33;color:#fff;border:1px solid #2d4d7a;border-radius:16px;padding:14px 16px;max-width:420px;width:100%;box-shadow:0 16px 40px rgba(0,0,0,.35)}
.app-update-card .row{display:flex;gap:8px;margin-top:10px;flex-wrap:wrap}
.app-update-card button{cursor:pointer}
#incomingSosAlert{position:fixed;top:16px;right:16px;z-index:12500}


/* Install + news final */
.install-btn{display:inline-flex!important;align-items:center;gap:4px;padding:6px 10px;border-radius:999px;background:#0B3D91;color:#fff;border:none;font-weight:700;cursor:pointer}
.install-btn.install-ready{animation:sosBadgePulse 1.2s infinite alternate;background:#065f46}
.install-app-btn{width:100%;max-width:420px;margin:8px auto;display:block;font-size:16px;padding:12px 16px}
.install-help-panel{max-width:440px;margin:12vh auto}
.install-steps{line-height:1.8;padding-right:18px}
.official-channels{margin-bottom:14px;padding:12px;border-radius:14px;background:rgba(11,61,145,.08);border:1px solid rgba(11,61,145,.2)}
.channel-row{display:flex;flex-wrap:wrap;gap:8px;margin-top:8px}
.channel-chip{display:inline-block;padding:8px 12px;border-radius:999px;background:#0B3D91;color:#fff!important;text-decoration:none;font-size:13px;font-weight:700}
.news-official{border-right:4px solid #0B3D91}
.news-item{display:block;padding:12px;margin:8px 0;border-radius:12px;background:rgba(255,255,255,.04);border:1px solid rgba(255,255,255,.08)}

.fb-official-card{display:flex;flex-direction:column;gap:4px;padding:14px 16px;margin:10px 0;border-radius:16px;background:linear-gradient(135deg,#1877F2,#0b5fcc);color:#fff!important;text-decoration:none;box-shadow:0 8px 24px rgba(24,119,242,.35)}
.fb-official-card strong{font-size:16px}
.fb-official-card span{font-size:13px;opacity:.95}
.fb-open{font-weight:800;margin-top:4px}
.channel-chip.chip-fb{background:#1877F2}

.install-first-banner{position:fixed;left:12px;right:12px;bottom:18px;z-index:14000;display:flex;justify-content:center;pointer-events:none}
.install-first-card{pointer-events:auto;display:flex;flex-wrap:wrap;gap:12px;align-items:center;justify-content:space-between;width:min(520px,100%);padding:14px 16px;border-radius:16px;background:#0b1b33;color:#fff;border:1px solid #2d4d7a;box-shadow:0 16px 40px rgba(0,0,0,.35)}
.install-first-text{display:flex;flex-direction:column;gap:4px;text-align:right}
.install-first-text strong{font-size:16px}
.install-first-text span{font-size:13px;opacity:.92}
.install-first-actions{display:flex;gap:8px;flex-wrap:wrap}
.install-cta-wrap{text-align:center;margin:12px 0 8px}
.install-app-btn{width:100%;max-width:420px;font-size:16px;padding:12px 16px}
.install-hint{margin:8px 0 0;font-size:13px;opacity:.85}
.install-btn{display:inline-flex!important;align-items:center;gap:4px;padding:6px 12px;border-radius:999px;background:#0B3D91;color:#fff;border:none;font-weight:700;cursor:pointer}
.install-help-panel{max-width:440px;margin:12vh auto}
.install-steps{line-height:1.85;padding-right:18px;text-align:right}
button.ghost{background:transparent;color:#fff;border:1px solid rgba(255,255,255,.35);border-radius:10px;padding:8px 12px;cursor:pointer}

.weather-risk-banner{position:sticky;top:0;z-index:9000;padding:8px 12px}
.weather-risk-banner .wx-card{display:flex;flex-direction:column;gap:4px;padding:12px 14px;border-radius:14px;background:#1e3a5f;color:#fff;border:1px solid #3d6ea8}
.weather-risk-banner.wx-high .wx-card{background:#7a1f1f;border-color:#c44}
.weather-risk-banner.wx-med .wx-card{background:#7a5a12;border-color:#d4a017}
.wx-reasons{font-size:13px;opacity:.95}
.weather-ops-box{margin:10px;padding:10px;border-radius:12px;background:rgba(11,61,145,.08);border:1px solid rgba(11,61,145,.2)}

/* Weather app-like UI */
.weather-btn{display:inline-flex;align-items:center;justify-content:center;min-width:52px;min-height:52px;width:52px;height:52px;border-radius:16px;border:2px solid #7dd3fc;background:linear-gradient(145deg,#2563eb,#0b3d91);color:#fff;font-size:30px;cursor:pointer;box-shadow:0 6px 18px rgba(37,99,235,.45)}
.weather-btn:hover{filter:brightness(1.08)}
.weather-btn.has-alert{animation:wxPulse 1.6s ease-in-out infinite;border-color:#ffd166}
@keyframes wxPulse{0%,100%{box-shadow:0 0 0 0 rgba(255,209,102,.45)}70%{box-shadow:0 0 0 10px rgba(255,209,102,0)}}
.weather-panel-backdrop{position:fixed;inset:0;z-index:15000;background:rgba(2,8,18,.72);display:flex;align-items:flex-end;justify-content:center;padding:12px;backdrop-filter:blur(4px)}
.weather-panel-backdrop[hidden]{display:none!important}
.weather-panel{width:min(520px,100%);max-height:88vh;overflow:auto;border-radius:22px 22px 16px 16px;background:linear-gradient(180deg,#14325f 0%,#0c1b33 55%,#091422 100%);color:#fff;border:1px solid #3d6ea8;box-shadow:0 24px 60px rgba(0,0,0,.5)}
.weather-panel-head{display:flex;justify-content:space-between;align-items:flex-start;padding:16px 16px 8px;gap:12px}
.weather-panel-head h2{margin:0;font-size:22px}
.weather-sub{margin:4px 0 0;color:#d5deea;font-size:13px}
.weather-close{border:none;background:rgba(255,255,255,.12);color:#fff;width:36px;height:36px;border-radius:10px;font-size:18px;cursor:pointer}
.weather-panel-body{padding:8px 16px 16px}
.weather-foot{padding:0 16px 16px;margin:0;font-size:11px;color:#b6c2d2;line-height:1.5}
.wx-hero{display:flex;flex-direction:column;align-items:center;text-align:center;padding:18px 12px;border-radius:18px;background:rgba(255,255,255,.06);margin-bottom:12px}
.wx-hero .wx-emoji{font-size:56px;line-height:1}
.wx-hero .wx-temp{font-size:42px;font-weight:800;margin-top:6px}
.wx-hero .wx-level{margin-top:6px;padding:4px 12px;border-radius:999px;font-size:13px;font-weight:700}
.wx-level.HIGH{background:#b91c1c}
.wx-level.MEDIUM{background:#b45309}
.wx-level.LOW{background:#0f766e}
.wx-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:12px 0}
.wx-tile{background:rgba(255,255,255,.07);border:1px solid rgba(255,255,255,.12);border-radius:14px;padding:12px}
.wx-tile b{display:block;font-size:12px;color:#d5deea;margin-bottom:4px}
.wx-tile span{font-size:18px;font-weight:700}
.wx-list{margin:0;padding:0;list-style:none}
.wx-list li{padding:10px 0;border-bottom:1px solid rgba(255,255,255,.1);font-size:14px;line-height:1.5}
.wx-refresh{width:100%;margin-top:10px;padding:12px;border:none;border-radius:12px;background:#2b7fff;color:#fff;font-weight:800;cursor:pointer}
.weather-loading{text-align:center;padding:28px;color:#e8eef7}
/* readability fixes */
.portal-sub,.meta,.hint,small{color:#dce6f2!important}
.item,.panel,.card{color:var(--text)}
.panel h2,.panel h3,.section-head h3{color:#ffffff}
a{color:#7dd3fc}
.primary{color:#fff!important}
.top-controls button,.device-mode-btn{color:#fff}
.device-mode-badge{color:#e8eef7;background:rgba(255,255,255,.1)}

/* ===== Readability fix pass ===== */
body, .panel, .item, .card, .modal-backdrop .panel, .notice, .coord-msg, .news-item {
  color: #ffffff !important;
}
.meta, .hint, small, .portal-sub, .section-head p, .ticker span {
  color: #e2eaf5 !important;
}
h1,h2,h3,h4, .section-head h3, .portal-hero h1, .brand-mini strong {
  color: #ffffff !important;
}
.msg { color: #fff7ed !important; font-weight: 600; }
.msg.error, .error { color: #fecaca !important; }
label { color: #f8fafc !important; }
input, select, textarea {
  color: #0f172a !important;
  background: #f8fafc !important;
  border: 1px solid #94a3b8 !important;
}
input::placeholder, textarea::placeholder { color: #64748b !important; }
.pill, .badge { color: #fff !important; }
a:not(.primary):not(.channel-chip):not(.channel-link-row):not(.fb-official-card) { color: #7dd3fc !important; }
.ghost, button.ghost { color: #f8fafc !important; }
.topbar, .app-topbar, .brand-mini, .top-controls { color: #fff !important; }
.device-mode-badge { color: #f1f5f9 !important; background: rgba(255,255,255,.14) !important; }
.device-mode-btn, .install-btn { color: #fff !important; }
/* panels that were too transparent */
.panel, .item, .news-item, .card {
  background: rgba(15, 30, 52, 0.92) !important;
  border-color: #3d5270 !important;
}
/* portal cards text */
.portal-cards button, .portal-cards h2, .portal-cards p { color: #fff !important; }
.portal-cards p.meta { color: #dbe7f5 !important; }

/* Official channels vertical list */
.channel-row { display: none !important; } /* legacy horizontal */
.channel-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0 6px;
  width: 100%;
}
.channel-link-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  background: #0b3d91;
  color: #fff !important;
  text-decoration: none !important;
  border: 1px solid #3d6ea8;
  box-sizing: border-box;
}
.channel-link-row.chip-fb { background: #1877F2; }
.channel-link-icon { font-size: 18px; width: 28px; text-align: center; }
.channel-link-text { flex: 1; text-align: right; font-weight: 700; font-size: 14px; line-height: 1.35; color: #fff !important; }
.channel-link-go { opacity: .9; font-weight: 800; }
.fb-official-card { width: 100%; box-sizing: border-box; }
.official-channels { overflow: hidden; }

/* bigger weather on narrow screens too */
@media (max-width: 640px) {
  .weather-btn { min-width: 56px !important; min-height: 56px !important; width: 56px !important; height: 56px !important; font-size: 32px !important; }
  .top-controls { gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
}


/* ===== Semantic UI system (visibility first) ===== */
body{color:var(--text);background:var(--bg)}
.panel,.item,.card,.news-item,.official-channels,.coord-msg,.notice{
  background:var(--surface)!important;
  color:var(--text)!important;
  border:1px solid var(--line)!important;
}
h1,h2,h3,h4,strong,label,.brand-mini strong{color:#fff!important}
.meta,.hint,small,.portal-sub,.channel-note{color:var(--muted)!important}
.primary,button.primary{background:var(--primary)!important;color:#fff!important;border:none}
.pill{color:#fff!important;background:var(--primary)}
.pill.critical,.pill-danger{background:var(--danger)!important}
.pill-ok{background:var(--ok)!important}
.pill-info{background:var(--info)!important}
input,select,textarea{background:var(--input-bg)!important;color:var(--input-text)!important;border:1px solid #94a3b8!important}
input::placeholder{color:#64748b!important}

/* Channel list: vertical, always readable */
.channel-stack{display:flex!important;flex-direction:column!important;gap:10px!important;width:100%!important;margin:12px 0!important}
.channel-link-row{
  display:flex!important;
  flex-direction:row!important;
  align-items:center!important;
  gap:12px!important;
  width:100%!important;
  min-height:52px!important;
  padding:12px 14px!important;
  border-radius:14px!important;
  background:var(--primary)!important;
  color:#ffffff!important;
  text-decoration:none!important;
  border:1px solid #60a5fa!important;
  box-sizing:border-box!important;
  direction:rtl!important;
}
.channel-link-row.is-fb{background:var(--fb)!important;border-color:#8bb7ff!important}
.channel-link-icon{font-size:20px!important;width:28px!important;text-align:center!important;flex:0 0 auto!important}
.channel-link-text{
  display:block!important;
  flex:1 1 auto!important;
  color:#ffffff!important;
  font-weight:800!important;
  font-size:15px!important;
  line-height:1.4!important;
  text-align:right!important;
  white-space:normal!important;
  opacity:1!important;
  visibility:visible!important;
}
.channel-link-go{color:#fff!important;font-weight:900!important;flex:0 0 auto!important}
.fb-official-card{display:flex!important;flex-direction:column!important;gap:6px!important;width:100%!important;padding:14px 16px!important;border-radius:16px!important;background:var(--fb)!important;color:#fff!important;text-decoration:none!important;margin-bottom:8px!important}
.fb-official-card strong,.fb-official-card span{color:#fff!important}

/* News cards clean */
.news-item{padding:14px!important;border-radius:16px!important;margin:10px 0!important}
.news-item h3{color:#fff!important;font-size:16px!important;line-height:1.45!important;margin:8px 0!important}
.news-summary{color:var(--muted)!important;font-size:14px!important;line-height:1.55!important;margin:0 0 10px!important}
.news-item-top{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.news-scope{color:var(--muted)!important;font-size:12px}
.news-read-btn{
  display:inline-flex!important;align-items:center;justify-content:center;
  margin-top:6px;padding:10px 14px;border-radius:12px;
  background:var(--ok)!important;color:#fff!important;text-decoration:none!important;font-weight:800!important;
}
.news-item a:not(.news-read-btn){display:none!important}

/* Status footer chips */
.footer-status,.status-bar{color:var(--muted)!important}


/* ===== Channel bars: same width as news panel ===== */
.official-channels{
  width:100%!important;
  max-width:100%!important;
  box-sizing:border-box!important;
  overflow:hidden!important;
  padding:12px!important;
  margin:10px 0!important;
}
.channel-stack{
  display:flex!important;
  flex-direction:column!important;
  gap:8px!important;
  width:100%!important;
  max-width:100%!important;
  margin:10px 0 6px!important;
  box-sizing:border-box!important;
}
.channel-link-row{
  display:flex!important;
  flex-direction:row!important;
  align-items:center!important;
  gap:10px!important;
  width:100%!important;
  max-width:100%!important;
  min-height:44px!important;
  height:auto!important;
  padding:10px 12px!important;
  border-radius:12px!important;
  background:var(--primary,#1d6feb)!important;
  color:#fff!important;
  text-decoration:none!important;
  border:1px solid #60a5fa!important;
  box-sizing:border-box!important;
  direction:rtl!important;
  overflow:hidden!important;
}
.channel-link-row.is-fb{background:#1877F2!important}
.channel-link-icon{
  font-size:18px!important;
  width:24px!important;
  flex:0 0 24px!important;
  text-align:center!important;
}
.channel-link-text{
  flex:1 1 auto!important;
  min-width:0!important;
  color:#fff!important;
  font-weight:700!important;
  font-size:13px!important;
  line-height:1.35!important;
  text-align:right!important;
  white-space:nowrap!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
}
.channel-link-go{
  flex:0 0 auto!important;
  color:#fff!important;
  font-weight:800!important;
}
.fb-official-card{
  width:100%!important;
  max-width:100%!important;
  box-sizing:border-box!important;
  padding:12px!important;
  border-radius:14px!important;
  overflow:hidden!important;
}
.newsFeed, #newsFeed, .news-item{
  width:100%!important;
  max-width:100%!important;
  box-sizing:border-box!important;
}


/* News marquee + compact official footer */
.news-marquee{
  display:flex;align-items:stretch;gap:0;width:100%;max-width:100%;
  border-radius:12px;overflow:hidden;margin:0 0 12px;
  border:1px solid var(--line,#3d5a80);background:#0b1b33;
  box-sizing:border-box;
}
.news-marquee-label{
  flex:0 0 auto;background:#dc2626;color:#fff;font-weight:800;font-size:12px;
  padding:10px 12px;display:flex;align-items:center;
}
.news-marquee-viewport{flex:1;overflow:hidden;direction:ltr}
.news-marquee-track{
  display:flex;align-items:center;gap:18px;width:max-content;
  padding:10px 0;animation:newsMarquee 40s linear infinite;
}
.news-marquee-item{color:#f8fafc!important;text-decoration:none!important;font-size:13px;white-space:nowrap}
a.news-marquee-item:hover{color:#7dd3fc!important}
.news-marquee-sep{color:#64748b}
@keyframes newsMarquee{from{transform:translateX(0)}to{transform:translateX(-50%)}}
.news-marquee:hover .news-marquee-track{animation-play-state:paused}

.official-links-footer{
  margin-top:16px;padding:12px;border-radius:14px;
  background:var(--surface,#13233a);border:1px solid var(--line,#3d5a80);
  width:100%;max-width:100%;box-sizing:border-box;
}
.official-links-title{font-weight:800;margin-bottom:8px;color:#fff;font-size:14px}
.official-links-row{
  display:flex;flex-wrap:wrap;gap:8px;width:100%;
}
.official-chip{
  display:inline-flex;align-items:center;gap:6px;
  padding:8px 12px;border-radius:999px;
  background:#1d6feb;color:#fff!important;text-decoration:none!important;
  font-size:12px;font-weight:700;line-height:1.2;
  max-width:100%;
}
.official-chip.is-fb{background:#1877F2}
/* إخفاء الأشرطة القديمة إن وُجدت في كاش قديم */
.channel-stack,.channel-link-row,.official-channels .fb-official-card{display:none!important}
.official-channels{display:none!important}


/* ===== HARD LOCK: no horizontal overflow anywhere ===== */
html, body {
  max-width: 100% !important;
  overflow-x: hidden !important;
  width: 100% !important;
}
*, *::before, *::after { box-sizing: border-box !important; }
#appView, main, .panel, .feed, #newsFeed, .section-head, .app-topbar, .topbar, .top-controls {
  max-width: 100% !important;
  overflow-x: hidden !important;
  box-sizing: border-box !important;
}
/* التبويبات يجب أن تمرر أفقيًا */
nav.tabs, #appView > .tabs, .tabs {
  overflow-x: auto !important;
  overflow-y: hidden !important;
  touch-action: pan-x !important;
  -webkit-overflow-scrolling: touch !important;
}
.panel { width: 100% !important; }
#newsFeed, .feed { width: 100% !important; overflow-x: hidden !important; }

/* Marquee confined */
.news-marquee {
  width: 100% !important;
  max-width: 100% !important;
  overflow: hidden !important;
  display: flex !important;
  box-sizing: border-box !important;
}
.news-marquee-viewport {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  overflow: hidden !important;
}
.news-marquee-track {
  width: max-content !important;
}

/* Official links: compact chips, wrap inside panel only */
.official-links-footer {
  width: 100% !important;
  max-width: 100% !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
  padding: 10px !important;
  margin: 12px 0 0 !important;
}
.official-links-row {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 6px !important;
  width: 100% !important;
  max-width: 100% !important;
}
.official-chip {
  flex: 0 1 auto !important;
  max-width: 100% !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  font-size: 12px !important;
  padding: 7px 10px !important;
}

/* Kill any leftover full-width blue bars */
.channel-stack, .channel-link-row, .official-channels, .fb-official-card {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Top bar: prevent install/weather buttons clipping off-screen */
.app-topbar, .topbar {
  width: 100% !important;
  max-width: 100vw !important;
  overflow: hidden !important;
}
.top-controls {
  display: flex !important;
  flex-wrap: wrap !important;
  justify-content: flex-end !important;
  gap: 6px !important;
  max-width: 100% !important;
  min-width: 0 !important;
}


/* =========================================================
   MOBILE RESPONSIVE LAYER — phone first polish
   ========================================================= */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  overscroll-behavior-y: contain;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

@media (max-width: 900px) {
  html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }

  .app-topbar, .topbar {
    position: sticky;
    top: 0;
    z-index: 1200;
    padding: 8px 10px !important;
    padding-top: calc(8px + env(safe-area-inset-top)) !important;
    gap: 8px !important;
    flex-wrap: nowrap !important;
    min-height: 56px;
  }
  .brand-mini {
    min-width: 0 !important;
    flex: 1 1 auto !important;
    gap: 8px !important;
  }
  .brand-mini strong {
    font-size: 0.95rem !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 42vw;
  }
  .brand-mini small {
    font-size: 0.7rem !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 42vw;
  }
  .role-logo, #roleLogo {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    font-size: 18px !important;
  }
  .top-controls {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 6px !important;
    flex: 0 0 auto !important;
    max-width: 58vw !important;
    overflow: hidden !important;
  }
  .language-picker select {
    max-width: 88px !important;
    font-size: 12px !important;
    padding: 6px 8px !important;
  }
  .device-mode-badge { display: none !important; }
  .device-mode-btn {
    font-size: 11px !important;
    padding: 6px 8px !important;
    white-space: nowrap;
  }
  .weather-btn {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    font-size: 22px !important;
    border-radius: 12px !important;
    flex: 0 0 auto !important;
  }
  .install-btn {
    font-size: 11px !important;
    padding: 6px 8px !important;
    max-width: 72px !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Tabs: horizontal scroll chip bar */
  #appView > .tabs, .tabs {
    position: sticky !important;
    top: 56px;
    z-index: 1100;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    gap: 6px !important;
    padding: 8px 10px !important;
    background: rgba(7, 17, 31, 0.96) !important;
    border-bottom: 1px solid var(--line, #3d5a80);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  #appView > .tabs::-webkit-scrollbar, .tabs::-webkit-scrollbar { display: none; }
  .tabs button, .tabs .tab, #appView > .tabs button {
    flex: 0 0 auto !important;
    white-space: nowrap !important;
    font-size: 12px !important;
    padding: 8px 12px !important;
    border-radius: 999px !important;
    min-height: 40px;
  }

  /* Content panels */
  main, #appView {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
    padding-bottom: calc(18px + env(safe-area-inset-bottom)) !important;
  }
  .panel, .item, .card, .feed {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  .panel {
    padding: 12px !important;
    border-radius: 14px !important;
  }
  .section-head {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    align-items: center !important;
    justify-content: space-between !important;
  }
  .section-head h2, .section-head h3 {
    font-size: 1rem !important;
    margin: 0 !important;
  }
  .grid.two, .grid.three, .grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  /* Portal / login */
  .portal-gate {
    max-width: 100% !important;
    margin: 8px auto !important;
    padding: 8px 12px 24px !important;
  }
  .portal-hero h1 { font-size: 1.45rem !important; }
  .portal-sub { font-size: 0.9rem !important; padding: 0 6px; }
  .portal-cards {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
  }
  .portal-cards button {
    width: 100% !important;
    min-height: 56px !important;
    text-align: right !important;
  }
  .install-cta-wrap { padding: 0 4px; }
  .install-app-btn {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 48px !important;
    font-size: 15px !important;
  }

  /* Forms: 16px prevents iOS zoom */
  input, select, textarea, button {
    font-size: 16px !important;
    max-width: 100% !important;
  }
  button.primary, .primary {
    min-height: 46px !important;
    width: auto;
  }
  label {
    display: block;
    margin-bottom: 8px;
  }

  /* Map */
  .leaflet-container, #map, .map-box {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 220px !important;
    height: 42vh !important;
    border-radius: 12px !important;
  }

  /* News */
  .news-marquee { border-radius: 10px !important; }
  .news-marquee-label { font-size: 11px !important; padding: 8px !important; }
  .news-item h3 { font-size: 0.95rem !important; }
  .news-read-btn { width: 100% !important; justify-content: center !important; }
  .official-links-row { gap: 6px !important; }
  .official-chip { font-size: 11px !important; padding: 6px 10px !important; }

  /* Weather panel full-sheet on phone */
  .weather-panel-backdrop {
    align-items: flex-end !important;
    padding: 0 !important;
  }
  .weather-panel {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 92vh !important;
    border-radius: 18px 18px 0 0 !important;
  }
  .wx-grid { grid-template-columns: 1fr 1fr !important; gap: 8px !important; }

  /* Install banner */
  .install-first-banner {
    left: 8px !important;
    right: 8px !important;
    bottom: calc(10px + env(safe-area-inset-bottom)) !important;
  }
  .install-first-card {
    width: 100% !important;
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .install-first-actions { width: 100%; justify-content: stretch; }
  .install-first-actions button { flex: 1; }

  /* Hero action buttons row */
  .hero-actions, .quick-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
  .hero-actions button, .quick-actions button {
    flex: 1 1 calc(50% - 8px) !important;
    min-width: 140px !important;
    font-size: 13px !important;
  }

  /* Coordination / ops */
  .row {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
  .row > * { min-width: 0; }

  /* Footer status */
  footer, .app-footer, .status-bar {
    font-size: 11px !important;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom)) !important;
    line-height: 1.45 !important;
    word-break: break-word !important;
  }
}

@media (max-width: 400px) {
  .brand-mini strong { max-width: 34vw !important; font-size: 0.85rem !important; }
  .device-mode-btn { display: none !important; }
  .install-btn { max-width: 56px !important; }
  .language-picker select { max-width: 72px !important; }
}

@media (prefers-reduced-motion: reduce) {
  .news-marquee-track, .ticker-track { animation: none !important; }
}


/* Weather panel LARGE + reliable */
.weather-btn{
  display:inline-flex!important;align-items:center;justify-content:center;
  width:52px!important;height:52px!important;min-width:52px!important;min-height:52px!important;
  border-radius:16px!important;border:2px solid #7dd3fc!important;
  background:linear-gradient(145deg,#2563eb,#0b3d91)!important;
  color:#fff!important;font-size:28px!important;cursor:pointer!important;
  box-shadow:0 6px 18px rgba(37,99,235,.45)!important;z-index:1300;
}
.weather-btn.has-alert{animation:wxPulse 1.6s ease-in-out infinite;border-color:#ffd166!important}
@keyframes wxPulse{0%,100%{box-shadow:0 0 0 0 rgba(255,209,102,.45)}70%{box-shadow:0 0 0 10px rgba(255,209,102,0)}}
.weather-panel-backdrop{
  position:fixed!important;inset:0!important;z-index:20000!important;
  background:rgba(2,8,18,.8)!important;display:flex!important;
  align-items:center!important;justify-content:center!important;
  padding:12px!important;backdrop-filter:blur(5px);
}
.weather-panel-backdrop[hidden]{display:none!important}
.weather-panel{
  width:min(640px,100%)!important;
  max-height:94vh!important;
  min-height:min(70vh,620px)!important;
  overflow:auto!important;
  border-radius:22px!important;
  background:linear-gradient(180deg,#14325f 0%,#0c1b33 55%,#091422 100%)!important;
  color:#fff!important;border:1px solid #3d6ea8!important;
  box-shadow:0 28px 70px rgba(0,0,0,.55)!important;
}
.weather-panel-head{display:flex;justify-content:space-between;align-items:flex-start;padding:18px 18px 8px;gap:12px}
.weather-panel-head h2{margin:0;font-size:24px!important}
.weather-sub{margin:6px 0 0;color:#d5deea;font-size:14px}
.weather-close{border:none;background:rgba(255,255,255,.14);color:#fff;width:42px;height:42px;border-radius:12px;font-size:20px;cursor:pointer}
.weather-panel-body{padding:8px 18px 18px}
.weather-foot{padding:0 18px 16px;margin:0;font-size:12px;color:#b6c2d2}
.wx-hero-lg{display:flex;flex-direction:column;align-items:center;text-align:center;padding:22px 14px;border-radius:20px;background:rgba(255,255,255,.07);margin-bottom:14px}
.wx-hero-lg .wx-emoji{font-size:72px!important;line-height:1}
.wx-hero-lg .wx-temp{font-size:52px!important;font-weight:800;margin-top:8px}
.wx-level{margin-top:10px;padding:6px 14px;border-radius:999px;font-size:14px;font-weight:800}
.wx-level.HIGH{background:#b91c1c}
.wx-level.MEDIUM{background:#b45309}
.wx-level.LOW{background:#0f766e}
.wx-summary{margin:12px 0 4px;color:#f1f5f9;font-size:15px;line-height:1.5}
.wx-loc{margin:0;color:#94a3b8;font-size:12px}
.wx-grid-lg{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin:14px 0}
.wx-tile{background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.12);border-radius:16px;padding:14px}
.wx-tile b{display:block;font-size:12px;color:#d5deea;margin-bottom:6px}
.wx-tile span{font-size:20px;font-weight:800}
.wx-h3{margin:10px 0 8px;font-size:16px}
.wx-list{margin:0;padding:0;list-style:none}
.wx-list li{padding:10px 0;border-bottom:1px solid rgba(255,255,255,.1);font-size:14px;line-height:1.5}
.wx-refresh{width:100%;margin-top:12px;padding:14px;border:none;border-radius:14px;background:#2b7fff;color:#fff;font-weight:800;font-size:16px;cursor:pointer}
.wx-advisory{margin-top:12px;font-size:12px;color:#b6c2d2;line-height:1.5}
.weather-loading{text-align:center;padding:36px 16px;color:#e8eef7;font-size:16px;line-height:1.7}
@media (max-width:900px){
  .weather-panel-backdrop{align-items:flex-end!important;padding:0!important}
  .weather-panel{
    width:100%!important;max-width:100%!important;
    min-height:85vh!important;max-height:96vh!important;
    border-radius:22px 22px 0 0!important;
  }
  .wx-hero-lg .wx-emoji{font-size:64px!important}
  .wx-hero-lg .wx-temp{font-size:44px!important}
}


/* ===== NAV + TOUCH REPAIR ===== */
nav.tabs, .tabs {
  pointer-events: auto !important;
  z-index: 1250 !important;
  position: relative;
}
.tabs button, nav.tabs button {
  pointer-events: auto !important;
  touch-action: manipulation !important;
  cursor: pointer !important;
  position: relative !important;
  z-index: 2 !important;
}

/* أي لوحة مخفية لا تبتلع اللمس */
[hidden],
.weather-panel-backdrop[hidden],
#weatherPanel[hidden],
#themePanel[hidden],
.modal-backdrop[hidden] {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

/* عندما تكون لوحة الطقس مغلقة */
#weatherPanel[hidden] {
  inset: auto !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
}

/* على الجوال: شريط تبويب لمس واضح */
@media (max-width: 900px) {
  nav.tabs, #appView > .tabs, .tabs {
    position: sticky !important;
    top: 56px !important;
    z-index: 1250 !important;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    pointer-events: auto !important;
    background: rgba(7, 17, 31, 0.98) !important;
  }
  .tabs button {
    flex: 0 0 auto !important;
    min-height: 44px !important;
    min-width: 64px !important;
    pointer-events: auto !important;
  }
  /* لا تُثبّت طبقات شفافة فوق المحتوى */
  .install-first-banner { pointer-events: none !important; }
  .install-first-banner .install-first-card { pointer-events: auto !important; }
}

/* STABLE LAYER */
html, body { max-width: 100%; overflow-x: hidden; }
nav.tabs, .tabs, .tabs button { pointer-events: auto !important; touch-action: manipulation !important; }
#weatherPanel[hidden], .weather-panel-backdrop[hidden] {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
}


/* ===== HORIZONTAL TOUCH NAV (tabs) ===== */
nav.tabs,
#appView > .tabs,
.tabs {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 6px !important;
  width: 100% !important;
  max-width: 100vw !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  overscroll-behavior-x: contain !important;
  touch-action: pan-x !important;
  -webkit-overflow-scrolling: touch !important;
  scroll-snap-type: x proximity;
  pointer-events: auto !important;
  z-index: 1250 !important;
}
nav.tabs button,
.tabs button {
  flex: 0 0 auto !important;
  white-space: nowrap !important;
  touch-action: manipulation !important;
  scroll-snap-align: start;
  min-height: 44px !important;
  pointer-events: auto !important;
}

/* على الهاتف: شريط أفقي وليس عمودًا جانبيًا */
@media (max-width: 900px), (pointer: coarse) {
  body[data-device-mode="computer"] #appView > .tabs,
  body[data-device-mode="phone"] #appView > .tabs,
  #appView > .tabs,
  nav.tabs {
    position: sticky !important;
    top: 56px !important;
    right: auto !important;
    left: auto !important;
    bottom: auto !important;
    width: 100% !important;
    max-width: 100vw !important;
    height: auto !important;
    flex-direction: row !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    border: none !important;
    box-shadow: 0 4px 12px rgba(0,0,0,.2) !important;
    padding: 8px 10px !important;
  }
  #appView { padding-right: 0 !important; margin-right: 0 !important; }
}


/* ===== SCROLL FIX: vertical page + horizontal tabs only ===== */
html, body {
  overflow-x: hidden !important;
  overflow-y: auto !important;
  height: auto !important;
  min-height: 100% !important;
  touch-action: pan-y pinch-zoom !important;
  overscroll-behavior-y: auto !important;
}
#appView, main, section.tab, .tab {
  touch-action: pan-y pinch-zoom !important;
  overflow-x: hidden !important;
  overflow-y: visible !important;
  max-height: none !important;
}
/* شريط التبويب فقط: سحب أفقي */
nav.tabs,
#appView > nav.tabs,
#appView > .tabs {
  touch-action: pan-x !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  overscroll-behavior-x: contain !important;
  overscroll-behavior-y: none !important;
}
nav.tabs button,
.tabs button {
  touch-action: manipulation !important;
}

/* Easy Connect — low literacy / emergency voice-video assist */
.easy-connect-panel{
  margin:12px 0 16px;padding:16px;border-radius:18px;
  background:linear-gradient(180deg,#1a2332,#0f172a);
  border:2px solid #3b82f6;box-sizing:border-box;
}
.easy-connect-head h2{margin:0 0 6px;font-size:1.25rem;color:#fff}
.easy-connect-sub{margin:0 0 14px;color:#dbeafe;font-size:14px;line-height:1.5}
.easy-connect-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}
@media(max-width:600px){.easy-connect-grid{grid-template-columns:1fr}}
.easy-btn{
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  min-height:100px;padding:16px 12px;border:none;border-radius:16px;
  font-size:1.15rem;font-weight:800;color:#fff;cursor:pointer;
  line-height:1.35;touch-action:manipulation;
  box-shadow:0 8px 20px rgba(0,0,0,.25);
}
.easy-btn span{font-size:.85rem;font-weight:600;opacity:.95;margin-top:6px}
.easy-btn-call{background:linear-gradient(145deg,#2563eb,#1d4ed8)}
.easy-btn-unit{background:linear-gradient(145deg,#0f766e,#0d9488)}
.easy-btn-video{background:linear-gradient(145deg,#7c3aed,#6d28d9)}
.easy-btn-sos{background:linear-gradient(145deg,#dc2626,#b91c1c)}
.easy-btn:active{transform:scale(.98)}
.easy-phone-label{display:block;margin:14px 0 8px;color:#e2e8f0;font-size:14px}
.easy-phone-label input{
  width:100%;margin-top:6px;padding:14px;font-size:18px;border-radius:12px;
  border:2px solid #64748b;box-sizing:border-box;
}
.easy-connect-status{
  margin-top:12px;padding:12px;border-radius:12px;background:rgba(255,255,255,.08);
  color:#f8fafc;font-size:15px;font-weight:700;text-align:center;min-height:24px;
}
.easy-video-box{margin-top:12px;display:grid;grid-template-columns:1fr 1fr;gap:8px}
.easy-video-box video{width:100%;min-height:140px;background:#000;border-radius:12px;object-fit:cover}
.easy-video-actions{grid-column:1/-1}
.easy-connect-fab{
  position:fixed;bottom:calc(18px + env(safe-area-inset-bottom));left:16px;z-index:9000;
  width:64px;height:64px;border-radius:50%;border:3px solid #93c5fd;
  background:linear-gradient(145deg,#2563eb,#1e40af);color:#fff;font-size:28px;
  box-shadow:0 10px 28px rgba(37,99,235,.45);cursor:pointer;
}
.ops-call-requests{margin:12px 0}
.ops-call-card{padding:12px;border-radius:12px;background:rgba(37,99,235,.15);border:1px solid #3b82f6;margin:8px 0}
.ops-call-card a.primary{display:inline-block;margin-top:8px;padding:10px 14px;border-radius:10px;background:#16a34a;color:#fff;text-decoration:none;font-weight:800}

.easy-video-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:8px}
.easy-video-actions button,.easy-video-actions .primary{flex:1;min-width:120px;padding:12px;border-radius:12px;font-weight:800}
.ops-call-card .row a,.ops-call-card .row button{margin:0}

.smart-ops-panel{margin:12px 0;border:2px solid #6366f1}
.smart-ops-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
@media(max-width:700px){.smart-ops-grid{grid-template-columns:1fr}}
.smart-ops-card{background:rgba(255,255,255,.06);border-radius:12px;padding:12px}
.smart-ops-card h4{margin:0 0 8px;font-size:14px;color:#e2e8f0}
.smart-ops-risk{font-size:22px;font-weight:900;padding:10px;border-radius:10px;text-align:center}
.smart-ops-risk.LOW{background:#0f766e;color:#fff}
.smart-ops-risk.MEDIUM{background:#b45309;color:#fff}
.smart-ops-risk.HIGH{background:#dc2626;color:#fff}
.smart-ops-risk.CRITICAL{background:#7f1d1d;color:#fff;animation:wxPulse 1.2s infinite}
.smart-ops-transcript{max-height:160px;overflow:auto;font-size:13px;line-height:1.5;color:#f1f5f9;white-space:pre-wrap;background:rgba(0,0,0,.25);padding:8px;border-radius:8px;min-height:80px}
