/* Keep controls reachable without hiding clipped content. */
/* A mobile-view suggestion is lower priority than every working dialog. */
#mobile-switch-banner{z-index:1400!important}
[hidden]{display:none!important}button,a,input,select,textarea{touch-action:manipulation}button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:3px solid #38bdf8;outline-offset:3px}
.assign-modal .modal-content{max-height:calc(100dvh - 24px);overflow-y:auto;min-width:0}.assign-modal{padding:max(12px,env(safe-area-inset-top)) 12px max(12px,env(safe-area-inset-bottom));box-sizing:border-box}.modal-content input,.modal-content select,.modal-content textarea{max-width:100%;min-width:0;box-sizing:border-box}.nrs-exercise-record{padding:8px;border-bottom:1px solid #334155;overflow-wrap:anywhere}.nrs-exercise-record p{margin:3px 0}
@media(max-width:650px){input,textarea,select{font-size:16px!important}.assign-modal .modal-content{width:100%!important;max-width:100%!important}.modal-actions{flex-wrap:wrap}.modal-actions button{min-height:44px;flex:1}#nrs-toast-container{max-width:calc(100vw - 24px)!important;left:12px;right:12px!important;bottom:max(20px,env(safe-area-inset-bottom))!important}.assign-modal button,.assign-modal summary{min-height:44px}}
@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}

#nrs-portal-sync-state{position:fixed;right:max(8px,env(safe-area-inset-right));bottom:calc(100px + env(safe-area-inset-bottom));max-width:min(340px,calc(100vw - 16px));z-index:2400;background:#112c42;color:#f3f8ff;border:1px solid #82afc6;border-radius:10px;padding:8px;font:14px/1.5 Sarabun,sans-serif;box-shadow:0 3px 12px #0005}
#nrs-portal-sync-state[hidden]{display:none}#nrs-portal-sync-state summary{cursor:pointer;min-height:32px}#nrs-portal-sync-state p{overflow-wrap:anywhere;max-height:35dvh;overflow:auto;margin:8px 0}#nrs-portal-sync-state button{background:#d5e9f4;color:#082539;border-radius:6px;padding:8px;border:1px solid #82afc6;min-height:44px}#nrs-portal-sync-state button:disabled{opacity:.5}

@media(max-width:768px){
 body.nrs-dispatch-shell{display:flex;flex-direction:column;height:100dvh;min-height:0}
 .nrs-dispatch-shell>.main-container{height:0!important;flex:1;min-height:0}
}

.nrs-sos-receipt{display:block;flex-basis:100%;width:100%;max-width:100%;box-sizing:border-box;overflow-wrap:anywhere;margin:10px 0;padding:12px;border:1px solid #a7c4d5;border-radius:10px;background:#eef7ff;color:#102c42;font:14px/1.6 Sarabun,sans-serif}
.nrs-sos-receipt:empty{display:none}.nrs-sos-receipt button{min-height:44px;padding:8px 14px;margin:4px;border:1px solid #285276;border-radius:7px;background:white;color:#102c42;touch-action:manipulation}.nrs-sos-receipt summary{min-height:44px;cursor:pointer}.nrs-sos-receipt p{margin:8px 0}

.nrs-sos-submit-row{flex-wrap:wrap!important}

#nrs-portal-sync-state{position:relative;right:auto;bottom:auto;width:100%;max-width:100%;z-index:auto;box-sizing:border-box;margin:8px 0}
#modal-request,#modal-request-success{z-index:100010!important;padding-top:max(12px,env(safe-area-inset-top))!important;padding-bottom:max(12px,env(safe-area-inset-bottom))!important}

/* Confirmed service requests */
#modal-medical-request,#modal-repair-request,#booking-modal-backdrop{z-index:1000001!important;padding-top:max(12px,env(safe-area-inset-top));padding-bottom:max(12px,env(safe-area-inset-bottom));overflow-y:auto;overscroll-behavior:contain}
#modal-medical-request>div,#modal-repair-request>div,#booking-modal-backdrop>div{max-height:calc(100dvh - 24px);overflow-y:auto;min-width:0;max-width:100%}
.nrs-service-receipt,.nrs-service-receipts{flex-basis:100%;min-width:0;max-width:100%;overflow-wrap:anywhere;white-space:normal;line-height:1.65;color:#1e3a5f;font-size:15px;padding:10px 0;text-align:left}
.nrs-service-receipts{border-top:1px solid #b7c8d8;margin-top:10px}
.nrs-service-receipts button{min-height:44px;font-size:16px;padding:8px 12px;margin:4px 6px 4px 0;border:1px solid #547394;border-radius:8px;background:#edf4fa;color:#16314e;touch-action:manipulation}
#ncd-patient-phone,#ncd-patient-allergy,#ncd-patient-details{min-height:44px;font-size:16px;min-width:0;width:100%}

/* Official situation summary */
/* Exercise dialogs share the same touch and viewport rules as the consoles. */
#drill-modal .modal-content,#drill-aar-modal .modal-content,#ecomm-judge-modal .modal-content{box-sizing:border-box;min-width:0;overscroll-behavior:contain}
#drill-modal .modal-header{display:flex;flex-wrap:wrap;gap:12px;align-items:flex-start}
#drill-modal .modal-header>span:first-child{flex:1 1 100%;min-width:0}
#drill-modal .modal-header>div:last-child{width:100%;justify-content:space-between;flex-wrap:wrap}
#nrs-native-drill-panel{line-height:1.6;font-size:14px;color:#e2edf7;background:#0b2238}
#nrs-native-drill-panel p{margin:4px 0 10px;font-weight:400}
#nrs-native-drill-panel button{min-height:44px;margin:4px;padding:8px 12px;border:1px solid #5b8aad;border-radius:7px;background:#173c58;color:#fff;font:inherit;touch-action:manipulation}
#nrs-native-drill-panel button:focus-visible{outline:3px solid #ffd26b;outline-offset:2px}
.nrs-exercise-intro{padding:14px;background:#112d3f;color:#e4eff6;border-radius:9px;margin:12px 0;line-height:1.65}
.nrs-exercise-intro h3{font-size:18px;margin:0 0 8px}.nrs-exercise-intro p{font-size:14px;margin:8px 0}.nrs-exercise-intro button{min-height:44px;font-size:16px;white-space:normal;background:#24516e;color:white;padding:8px 12px}
#drill-modal input,#drill-modal select,#drill-modal textarea{min-height:44px;font-size:16px!important;max-width:100%;box-sizing:border-box}
@media(max-width:600px){
 #drill-modal,#drill-aar-modal,#ecomm-judge-modal{padding:8px!important;padding-top:max(8px,env(safe-area-inset-top))!important;padding-bottom:max(8px,env(safe-area-inset-bottom))!important}
 #drill-modal .modal-content,#drill-aar-modal .modal-content,#ecomm-judge-modal .modal-content{width:100%!important;max-height:calc(100dvh - 24px)!important;padding:12px!important}
 #drill-modal .modal-header>span:first-child>div>div:first-child{font-size:18px!important;line-height:1.45}
 #drill-modal [style*="grid-template-columns: 1fr 1fr"]{grid-template-columns:minmax(0,1fr)!important}
 #nrs-native-drill-panel{margin:8px 0!important;padding:10px!important}
 #nrs-native-drill-panel button{width:100%;margin:4px 0}
 #drill-modal #btn-save-pace{min-height:44px;white-space:normal}
}
.nrs-situation-dashboard{padding:clamp(16px,3vw,32px);background:#f3f7fa;color:#19334b;border-radius:16px;line-height:1.65;overflow-wrap:anywhere}
.nrs-situation-dashboard h2{font-size:clamp(24px,4vw,32px);font-weight:800}.nrs-situation-dashboard h3{font-size:19px;font-weight:700}
.nrs-situation-dashboard p{margin:6px 0 12px}.nrs-situation-filters,.nrs-situation-actions{display:flex;flex-wrap:wrap;gap:12px;margin:16px 0}
.nrs-situation-filters label{display:grid;gap:5px;flex:1;min-width:min(220px,100%)}
.nrs-situation-dashboard input,.nrs-situation-dashboard select,.nrs-situation-dashboard button{font:inherit;font-size:16px;min-height:44px;padding:9px 12px;border:1px solid #728da5;border-radius:8px;background:white;color:#183650;max-width:100%;box-sizing:border-box}
.nrs-situation-dashboard button{cursor:pointer;background:#1e4b6e;color:white}.nrs-situation-dashboard :focus-visible{outline:3px solid #b56e00;outline-offset:3px}
.nrs-situation-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(290px,100%),1fr));gap:16px}.nrs-situation-card{padding:16px;border-left:5px solid #18876a;background:white}.nrs-situation-card.level-2{border-color:#bc7900}.nrs-situation-card.level-3{border-color:#b82339}
#dash-data-status{background:#dceaf3;padding:12px;border-radius:8px}#dash-qa-answer-box{padding:16px;background:white;border:1px solid #bbccda;border-radius:8px}

.nrs-pharmacy-confirm{position:fixed;inset:0;z-index:1000010;background:#07172cbd;display:flex;align-items:center;justify-content:center;padding:12px;color:#19334b}.nrs-pharmacy-confirm form{background:white;width:min(600px,100%);max-height:calc(100dvh - 24px);overflow-y:auto;border-radius:16px;padding:24px;box-sizing:border-box}.nrs-pharmacy-confirm h2{font-size:23px;font-weight:800}.nrs-pharmacy-confirm label{display:block;margin:16px 0}.nrs-pharmacy-confirm input:not([type=checkbox]),.nrs-pharmacy-confirm select{display:block;box-sizing:border-box;width:100%;font:inherit;font-size:16px;border:1px solid #7a8fa5;min-height:44px;padding:8px;border-radius:8px}.nrs-pharmacy-confirm input[type=checkbox]{margin:0 10px 0 0;width:20px;height:20px}.nrs-pharmacy-confirm button{min-height:44px;padding:10px;margin:6px;border-radius:8px;background:#1e4b6e;color:white}.nrs-pharmacy-confirm p{overflow-wrap:anywhere;margin:8px 0}.nrs-pharmacy-confirm :focus-visible{outline:3px solid #bd7700;outline-offset:3px}

#disaster-report-form .nrs-service-receipt label{display:block;margin:10px 0}#disaster-report-form .nrs-service-receipt input,#disaster-report-form .nrs-service-receipt select{display:block;width:100%;max-width:100%;min-height:44px;margin-top:6px;padding:8px;box-sizing:border-box}#nrs-disaster-reports button{min-height:44px;margin:4px;white-space:normal}

/* Portal HQ preview: scoped styles do not change the operational consoles. */
.nrs-hq-preview{background:#fff;color:#19334b;border:1px solid #bacbd7;padding:clamp(16px,3vw,28px);border-radius:16px;line-height:1.65;overflow-wrap:anywhere}
.nrs-hq-preview h2{font-size:24px;font-weight:800}.nrs-hq-preview h3{font-size:19px;font-weight:700;margin:18px 0 10px}.nrs-hq-preview p{margin:6px 0 12px}
.nrs-inbox-preview-actions{display:flex;flex-wrap:wrap;align-items:end;gap:10px;margin:16px 0}.nrs-inbox-preview-actions label{display:grid;gap:4px}
.nrs-hq-preview button,.nrs-hq-preview input,.nrs-hq-preview a{min-height:44px;max-width:100%;box-sizing:border-box;font:inherit;font-size:16px;padding:9px 12px;border:1px solid #607e95;border-radius:8px;background:white;color:#17476c}.nrs-hq-preview a{display:inline-block;text-decoration:underline}.nrs-hq-preview button{background:#17476c;color:white;cursor:pointer}.nrs-hq-preview button:disabled{opacity:.55;cursor:default}.nrs-hq-preview :focus-visible{outline:3px solid #af6500;outline-offset:3px}
.nrs-inbox-preview-row{padding:12px 0;border-bottom:1px solid #d9e3ea}.nrs-inbox-preview-row small{display:block;overflow-wrap:anywhere}#nrs-report-read-status{padding:12px;background:#e5f0f6;border-radius:8px}
@media(max-width:767px){.nrs-inbox-preview-row:nth-of-type(n+3){display:none}.nrs-inbox-preview-actions>*{flex:1 1 100%}}

#admin-member-db-section{display:none!important}
.nrs-reference-row{display:grid;grid-template-columns:1fr auto;gap:8px;align-items:center;padding:12px 0;border-bottom:1px solid #69849a}.nrs-reference-row span{grid-column:1;overflow-wrap:anywhere}.nrs-reference-row button{grid-column:2;grid-row:1 / 3}
#nrs-reference-editor nav{display:flex;flex-wrap:wrap;gap:8px;margin:12px 0}#nrs-reference-editor input[type=checkbox]{width:24px;height:24px;margin-right:8px}#nrs-reference-editor button,#nrs-runtime-dialog button{min-height:44px;padding:8px 12px;margin:4px;border-radius:8px}
#nrs-runtime-dialog a{display:inline-block;min-height:44px;padding:10px;margin:4px;color:#74d9ef;text-decoration:underline}#nrs-runtime-dialog input{display:block;width:100%;min-height:44px;box-sizing:border-box;padding:8px;font:inherit}#nrs-runtime-dialog canvas{display:block;margin:12px auto;max-width:100%}
.nrs-runtime-note{position:relative;z-index:501;padding:14px;background:#edf4f8;border:1px solid #748d9e;border-radius:8px;color:#1b3449;margin:12px 0;font:16px/1.6 Sarabun,sans-serif;overflow-wrap:anywhere}.nrs-runtime-note a,.nrs-runtime-note button{display:inline-block;padding:10px;min-height:44px;box-sizing:border-box;border:1px solid #607e95;margin:4px;border-radius:8px}.nrs-runtime-note a{color:#174d79;text-decoration:underline}

/* R91: allocate the viewport from the actual header, not a fixed 62px guess. */
body.nrs-dispatch-shell{display:flex!important;flex-direction:column;height:100dvh!important;min-height:0;margin:0!important;position:relative!important;width:100%!important;overflow:hidden!important}
.nrs-dispatch-shell>.header{flex:0 0 auto!important;min-height:0!important;height:auto!important;align-content:start;align-items:center!important;gap:8px 18px!important;padding:10px 16px!important;box-sizing:border-box;width:100%;max-width:100%;overflow:visible!important}
.nrs-dispatch-shell .logo-section{flex:0 1 auto;min-width:0;max-width:100%;align-items:center!important}
.nrs-dispatch-shell .title-section{min-width:0;max-width:100%}.nrs-dispatch-shell .title-section h1{margin:0;line-height:1.5!important;white-space:normal!important;overflow-wrap:anywhere}
.nrs-dispatch-shell .frequencies{display:flex!important;flex-wrap:wrap;white-space:normal!important;gap:3px 8px!important;line-height:1.5!important}
.nrs-dispatch-shell .header .status-bar{flex:1 1 auto;display:flex;flex-wrap:wrap!important;min-width:0;max-width:100%;height:auto;justify-content:flex-end;gap:8px!important;overflow:visible!important}
.nrs-dispatch-shell .header .header-btn{height:auto!important;min-height:44px;box-sizing:border-box;white-space:normal!important;line-height:1.4!important;padding:8px 12px!important}
.nrs-dispatch-shell>.main-container{flex:1 1 0!important;min-height:0!important;height:auto!important;max-height:100%;overflow:hidden;min-width:0}
.nrs-dispatch-shell .map-area,.nrs-dispatch-shell .map-container{min-height:0;min-width:0}
.nrs-dispatch-shell .map-controls{top:74px!important;bottom:12px;max-height:none!important;max-width:calc(100% - 80px);overflow:auto;overscroll-behavior:contain}
.nrs-dispatch-shell .map-controls>button,.nrs-dispatch-shell .map-controls>a{flex-shrink:0;min-height:44px;white-space:normal;line-height:1.4}
@media(max-width:900px){.nrs-dispatch-shell .header .status-bar{justify-content:flex-start}.nrs-dispatch-shell>.header{padding:8px!important}}
@media(max-width:768px){.nrs-dispatch-shell .map-controls{max-height:min(50dvh,400px)!important;bottom:auto}}

/* R97: deterministic header rows. Keep every action and live status in view. */
.nrs-dispatch-shell>.header{display:grid!important;grid-template-columns:minmax(300px,1fr) auto minmax(140px,auto);gap:6px 12px!important;padding:6px 12px!important;justify-content:stretch!important;min-height:64px!important}
.nrs-dispatch-shell>.header>.logo-section{grid-column:1;grid-row:1;gap:9px!important;justify-content:flex-start!important}
.nrs-dispatch-shell>.header .radio-icon{width:38px!important;height:38px!important;font-size:21px!important;box-shadow:none}
.nrs-dispatch-shell>.header .title-section h1{font-size:17px!important;line-height:1.4!important}
.nrs-dispatch-shell>.header .frequencies{font-size:11px!important;gap:2px 5px!important;line-height:1.4!important}
.nrs-dispatch-shell>.header>.status-bar{grid-column:2;grid-row:1;display:flex!important;flex-wrap:nowrap!important;justify-content:flex-start!important;width:auto!important;gap:6px!important;padding:0!important}
.nrs-dispatch-shell>.header .header-btn{font-size:13px!important;padding:7px 9px!important;min-height:44px!important;gap:5px!important;justify-content:center;white-space:nowrap!important}
.nrs-dispatch-shell>.header .header-btn .btn-icon{font-size:16px!important}
.nrs-header-status{grid-column:3;grid-row:1;display:grid;grid-template-columns:auto auto;gap:3px 9px;align-items:center;justify-content:end;min-width:0;font-size:11px;line-height:1.4;color:#cbd5e1}
.nrs-header-status>.status-item{min-width:0;padding:0!important;font-size:11px!important;white-space:normal!important}
.nrs-header-status>.status-item:first-child{grid-column:1/-1;justify-content:flex-end;overflow-wrap:anywhere}
.nrs-header-status #current-time{font-variant-numeric:tabular-nums}
@media(max-width:1279px){
 .nrs-dispatch-shell>.header{grid-template-columns:minmax(0,1fr) auto;padding:6px 10px!important}
 .nrs-dispatch-shell>.header>.status-bar{grid-column:1/-1;grid-row:2;display:grid!important;grid-template-columns:repeat(5,minmax(0,1fr));width:100%!important}
 .nrs-header-status{grid-column:2;grid-row:1}
 .nrs-dispatch-shell>.header .header-btn{white-space:normal!important}
}

/* --- UNIFIED MOBILE WEBAPP HEADER SYSTEM (2026 Native WebApp Standard) --- */
.mobile-header-toggle,
.mobile-header-pull-tab {
    display: none !important;
}

@media (max-width: 768px) {
    /* 1. Main Header Container - Native App Top Bar */
    .nrs-dispatch-shell > .header {
        display: flex !important;
        flex-direction: column !important;
        gap: 5px !important;
        padding: 6px 10px 2px 10px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        background: rgba(9, 14, 26, 0.96) !important;
        backdrop-filter: blur(16px) !important;
        -webkit-backdrop-filter: blur(16px) !important;
        border-bottom: 1.5px solid rgba(56, 189, 248, 0.3) !important;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6) !important;
        z-index: 1500 !important;
        min-height: auto !important;
        max-height: none !important;
        position: relative !important;
        transition: max-height 0.28s cubic-bezier(0.4, 0, 0.2, 1), padding 0.28s ease, min-height 0.28s ease !important;
    }

    /* 2. Top Row: Brand, Frequencies & Sleek Toggle */
    .nrs-dispatch-shell > .header > .logo-section {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
        gap: 8px !important;
        min-width: 0 !important;
        padding: 0 !important;
    }
    .nrs-dispatch-shell > .header .radio-icon {
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
        font-size: 17px !important;
        border-radius: 8px !important;
        background: linear-gradient(135deg, #f97316 0%, #ea580c 100%) !important;
        box-shadow: 0 2px 8px rgba(249, 115, 22, 0.4) !important;
        flex-shrink: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    .nrs-dispatch-shell > .header .title-section {
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        min-width: 0 !important;
        flex: 1 1 auto !important;
        gap: 1px !important;
        overflow: hidden !important;
    }
    .nrs-dispatch-shell > .header .title-section h1 {
        font-size: 13.5px !important;
        font-weight: 800 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        line-height: 1.25 !important;
        margin: 0 !important;
        color: #f8fafc !important;
        letter-spacing: -0.01em !important;
    }
    .nrs-dispatch-shell > .header .frequencies {
        font-size: 9.5px !important;
        font-weight: 600 !important;
        color: #fbbf24 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        line-height: 1.2 !important;
        display: flex !important;
        align-items: center !important;
        gap: 5px !important;
    }
    .mobile-header-toggle {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 4px !important;
        padding: 0 9px !important;
        height: 28px !important;
        min-height: 28px !important;
        font-size: 11px !important;
        font-weight: 700 !important;
        border-radius: 14px !important;
        flex-shrink: 0 !important;
        background: rgba(30, 41, 59, 0.85) !important;
        border: 1px solid rgba(56, 189, 248, 0.45) !important;
        color: #38bdf8 !important;
        white-space: nowrap !important;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) !important;
        cursor: pointer !important;
        transition: all 0.2s ease !important;
        line-height: 1.2 !important;
    }
    .mobile-header-toggle:active {
        transform: scale(0.95) !important;
    }

    /* 3. Horizontal Touch-Swipeable Pill Action Bar (.status-bar) */
    .nrs-dispatch-shell > .header > .status-bar {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        gap: 7px !important;
        padding: 3px 2px 5px 2px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
        scroll-snap-type: x mandatory !important;
        touch-action: pan-x !important;
    }
    .nrs-dispatch-shell > .header > .status-bar::-webkit-scrollbar {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
    }
    .nrs-dispatch-shell > .header .header-btn {
        flex: 0 0 auto !important;
        min-width: max-content !important;
        white-space: nowrap !important;
        height: 36px !important;
        min-height: 36px !important;
        max-height: 36px !important;
        padding: 0 13px !important;
        font-size: 12px !important;
        font-weight: 700 !important;
        border-radius: 18px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 6px !important;
        line-height: 1 !important;
        scroll-snap-align: start !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
        border: 1px solid rgba(255, 255, 255, 0.12) !important;
        transition: transform 0.15s ease, background 0.15s ease !important;
    }
    .nrs-dispatch-shell > .header .header-btn:active {
        transform: scale(0.96) !important;
    }
    .nrs-dispatch-shell > .header .header-btn span {
        white-space: nowrap !important;
        line-height: 1 !important;
    }
    .nrs-dispatch-shell > .header .header-btn .btn-icon {
        font-size: 15px !important;
        line-height: 1 !important;
    }

    /* 4. Sub-Status Single Flex Row (.nrs-header-status) */
    .nrs-header-status {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
        padding: 3px 4px 1px 4px !important;
        font-size: 10.5px !important;
        border-top: 1px solid rgba(255, 255, 255, 0.07) !important;
        box-sizing: border-box !important;
        color: #94a3b8 !important;
    }
    .nrs-header-status > .status-item {
        display: inline-flex !important;
        align-items: center !important;
        gap: 5px !important;
        font-size: 10.5px !important;
        white-space: nowrap !important;
        padding: 0 !important;
        min-width: 0 !important;
        line-height: 1.2 !important;
    }
    .nrs-header-status #dispatch-link-status {
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 140px !important;
    }
    .nrs-header-status #current-time {
        font-size: 10.5px !important;
        font-family: monospace !important;
        color: #cbd5e1 !important;
    }

    /* 5. Mobile Pull Tab */
    .mobile-header-pull-tab {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        width: 100% !important;
        padding: 3px 0 2px 0 !important;
        cursor: pointer !important;
        background: transparent !important;
        touch-action: pan-y !important;
    }
    .mobile-header-pull-tab .pull-indicator {
        width: 38px !important;
        height: 3.5px !important;
        border-radius: 2px !important;
        background: rgba(255, 255, 255, 0.3) !important;
        transition: background 0.2s, transform 0.2s !important;
    }
    .mobile-header-pull-tab:active .pull-indicator {
        background: #38bdf8 !important;
        transform: scaleX(1.2) !important;
    }

    /* 6. COLLAPSED STATE (38px Compact Header) */
    .nrs-dispatch-shell > .header.header-collapsed {
        padding: 4px 10px !important;
        min-height: 38px !important;
        max-height: 38px !important;
        height: 38px !important;
        gap: 0 !important;
        overflow: hidden !important;
        background: rgba(9, 13, 22, 0.95) !important;
        border-bottom: 1.5px solid rgba(56, 189, 248, 0.45) !important;
        box-shadow: 0 4px 18px rgba(0, 0, 0, 0.6) !important;
    }
    .nrs-dispatch-shell > .header.header-collapsed > .status-bar,
    .nrs-dispatch-shell > .header.header-collapsed > .nrs-header-status,
    .nrs-dispatch-shell > .header.header-collapsed .frequencies {
        display: none !important;
    }
    .nrs-dispatch-shell > .header.header-collapsed > .logo-section {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
        height: 100% !important;
        gap: 8px !important;
    }
    .nrs-dispatch-shell > .header.header-collapsed .radio-icon {
        width: 24px !important;
        height: 24px !important;
        min-width: 24px !important;
        font-size: 13px !important;
        border-radius: 6px !important;
    }
    .nrs-dispatch-shell > .header.header-collapsed .title-section h1 {
        font-size: 12.5px !important;
        margin: 0 !important;
        line-height: 1.1 !important;
    }
    .nrs-dispatch-shell > .header.header-collapsed .mobile-header-toggle {
        background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
        border-color: #38bdf8 !important;
        color: #ffffff !important;
        box-shadow: 0 0 12px rgba(56, 189, 248, 0.6) !important;
    }
    .nrs-dispatch-shell > .header.header-collapsed .mobile-header-pull-tab {
        padding: 1px 0 !important;
    }
}

/* ADVANCED MOBILE RESPONSIVE SUITE (2026) */
/* Keep all modals strictly on top of banners, floating controls, and bottom sheets */
#mobile-switch-banner {
    z-index: 2500 !important;
}
.assign-modal {
    z-index: 100000 !important;
}
body:has(.assign-modal:not([style*="display: none"])) #mobile-switch-banner {
    display: none !important;
}

@media (max-width: 768px) {
    /* 1. Global Tactical Modal Architecture */
    .assign-modal {
        position: fixed !important;
        inset: 0 !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100dvh !important;
        background: #090e1a !important;
        padding: 0 !important;
        margin: 0 !important;
        align-items: stretch !important;
        justify-content: stretch !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    .assign-modal .modal-content,
    .assign-modal .tactical-dark-modal {
        position: fixed !important;
        inset: 0 !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        border: none !important;
        margin: 0 !important;
        padding: 0 !important;
        box-sizing: border-box !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        background: #090e1a !important;
        box-shadow: none !important;
    }

    /* Modal Headers: Compact, Sticky, High Contrast with Clean Close Button */
    .assign-modal .modal-header {
        height: 52px !important;
        min-height: 52px !important;
        max-height: 52px !important;
        padding: 0 14px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        background: #0b1329 !important;
        border-bottom: 1.5px solid rgba(255, 255, 255, 0.12) !important;
        flex-shrink: 0 !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }

    .assign-modal .modal-header > span:first-child,
    .assign-modal .modal-header .atak-modal-title,
    .assign-modal .modal-header .sos-modal-title {
        font-size: 15px !important;
        font-weight: 800 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        min-width: 0 !important;
    }

    /* Close Button Polish */
    .assign-modal .modal-header button,
    .sos-close-btn,
    .atak-close-btn {
        width: 36px !important;
        height: 36px !important;
        min-height: 36px !important;
        border-radius: 8px !important;
        font-size: 16px !important;
        font-weight: bold !important;
        cursor: pointer !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex-shrink: 0 !important;
        outline: none !important;
        touch-action: manipulation !important;
    }

    /* 2. SOS EMERGENCY COMMAND HUB (#sos-modal) */
    #sos-modal .modal-header {
        background: #15090f !important;
        border-bottom: 1.5px solid rgba(239, 68, 68, 0.4) !important;
    }

    #sos-modal .sos-dashboard {
        display: flex !important;
        flex-direction: column !important;
        gap: 16px !important;
        margin-top: 0 !important;
        flex: 1 1 auto !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding: 14px 14px 28px 14px !important;
        box-sizing: border-box !important;
        min-height: 0 !important;
    }

    #sos-modal .sos-dashboard-col {
        border-right: none !important;
        padding-right: 0 !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    #sos-modal select,
    #sos-modal input,
    #sos-modal textarea {
        font-size: 14px !important;
        line-height: 1.4 !important;
    }

    #sos-modal select {
        height: 44px !important;
        padding: 6px 10px !important;
        border-radius: 8px !important;
        background: #020617 !important;
        border: 1px solid rgba(255, 255, 255, 0.2) !important;
        color: #ffffff !important;
        box-sizing: border-box !important;
        width: 100% !important;
    }

    #sos-modal #sos-coordinates {
        height: 42px !important;
        border-radius: 8px !important;
        padding: 0 10px !important;
        font-size: 13px !important;
    }

    #sos-modal button[onclick*="startSOSLocationPicker"] {
        height: 42px !important;
        min-height: 42px !important;
        font-size: 13px !important;
        font-weight: 700 !important;
        padding: 0 14px !important;
        border-radius: 8px !important;
        white-space: nowrap !important;
    }

    #sos-modal #sos-details {
        height: 80px !important;
        border-radius: 8px !important;
        padding: 8px 10px !important;
    }

    /* Col 1 Action Buttons */
    #sos-modal .sos-action-row,
    #sos-modal .sos-dashboard-col:first-child > div:last-child {
        display: flex !important;
        gap: 10px !important;
        width: 100% !important;
        margin-top: 6px !important;
    }

    #sos-modal .sos-dashboard-col:first-child > div:last-child button:first-child {
        flex: 1 !important;
        min-height: 44px !important;
        border-radius: 8px !important;
        font-size: 14px !important;
    }

    #sos-modal .sos-dashboard-col:first-child > div:last-child button:last-child {
        flex: 2 !important;
        min-height: 44px !important;
        border-radius: 8px !important;
        font-size: 14px !important;
        font-weight: 800 !important;
        white-space: normal !important;
        line-height: 1.3 !important;
    }

    /* Col 2 (Active Incidents Header & Action Buttons) */
    #sos-modal .sos-incidents-header,
    #sos-modal .sos-dashboard-col:last-child > div:first-child {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
        margin-bottom: 8px !important;
    }

    #sos-modal .sos-dashboard-col:last-child > div:first-child > div {
        display: flex !important;
        gap: 6px !important;
    }

    #sos-modal .sos-dashboard-col:last-child > div:first-child button {
        font-size: 11.5px !important;
        padding: 6px 10px !important;
        min-height: 36px !important;
        border-radius: 6px !important;
        white-space: nowrap !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    #sos-modal #hub-content-list {
        max-height: 240px !important;
        min-height: 100px !important;
    }

    /* Sticky Mobile Footers for Modals */
    #sos-modal .modal-actions {
        display: flex !important;
        padding: 8px 14px max(8px, env(safe-area-inset-bottom)) 14px !important;
        background: #15090f !important;
        border-top: 1px solid rgba(239, 68, 68, 0.3) !important;
        flex-shrink: 0 !important;
        margin: 0 !important;
    }
    #sos-modal .modal-actions button {
        width: 100% !important;
        min-height: 44px !important;
        font-size: 14px !important;
        font-weight: 700 !important;
        border-radius: 8px !important;
        justify-content: center !important;
        display: flex !important;
        align-items: center !important;
    }

    #atak-modal .modal-actions {
        display: flex !important;
        padding: 8px 14px max(8px, env(safe-area-inset-bottom)) 14px !important;
        background: #08111e !important;
        border-top: 1px solid rgba(0, 255, 102, 0.25) !important;
        flex-shrink: 0 !important;
        margin: 0 !important;
    }
    #atak-modal .modal-actions button {
        width: 100% !important;
        min-height: 44px !important;
        font-size: 14px !important;
        font-weight: 700 !important;
        border-radius: 8px !important;
        justify-content: center !important;
        display: flex !important;
        align-items: center !important;
        background: #1e293b !important;
        color: #cbd5e1 !important;
        border: 1px solid rgba(255, 255, 255, 0.2) !important;
    }

    
    /* 3. ATAK CIVIL & APRS RADIO HUB (#atak-modal) */
    #atak-modal .modal-header {
        height: 48px !important;
        min-height: 48px !important;
        max-height: 48px !important;
        padding: 0 10px !important;
        background: #08111e !important;
        border-bottom: 1.5px solid rgba(0, 255, 102, 0.3) !important;
    }

    #atak-modal .modal-header .atak-modal-title {
        font-size: 13.5px !important;
        font-weight: 800 !important;
        gap: 6px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        min-width: 0 !important;
        flex: 1 1 auto !important;
    }

    #atak-modal .modal-header .atak-mode-badge {
        font-size: 10px !important;
        padding: 2px 6px !important;
        border-radius: 4px !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
    }

    #atak-modal .modal-header .atak-close-btn {
        width: 32px !important;
        height: 32px !important;
        min-height: 32px !important;
        font-size: 15px !important;
        flex-shrink: 0 !important;
    }


    /* Horizontal Pill Scroll Navigation */
    #atak-tab-nav {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        gap: 6px !important;
        padding: 8px 12px !important;
        margin: 0 !important;
        background: #090e1a !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
        flex-shrink: 0 !important;
    }

    #atak-tab-nav::-webkit-scrollbar {
        display: none !important;
    }

    #atak-tab-nav .atak-tab-btn {
        flex-shrink: 0 !important;
        white-space: nowrap !important;
        padding: 6px 14px !important;
        font-size: 13px !important;
        font-weight: 700 !important;
        border-radius: 18px !important;
        line-height: 1.3 !important;
    }

    /* Tab Content Full Height Scroll */
    .atak-tab-content {
        flex: 1 1 auto !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding: 12px 14px 28px 14px !important;
        margin: 0 !important;
        min-height: 0 !important;
        box-sizing: border-box !important;
    }

    /* APRS Tab Two-Column to Stacked Responsive Flow */
    #aprs-tab > div[style*="grid-template-columns"],
    #aprs-tab .aprs-tab-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 16px !important;
        width: 100% !important;
    }

    /* Transmitter 3-Column Header to Clean Vertical Stack */
    #aprs-tab div[style*="grid-template-columns: 1.2fr 1fr 1fr"],
    #aprs-tab .aprs-header-inputs {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
    }

    #aprs-mode,
    #aprs-callsign,
    #aprs-priority {
        height: 44px !important;
        font-size: 13.5px !important;
        border-radius: 8px !important;
        box-sizing: border-box !important;
        width: 100% !important;
    }

    /* Signal Parameters Grid */
    #aprs-signal-params-grid {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 6px !important;
    }

    #aprs-signal-params-grid input {
        height: 38px !important;
        font-size: 13px !important;
    }

    /* LatLng Pickers Row */
    #aprs-tab .aprs-latlng-row,
    #aprs-tab div:has(> #aprs-latlng) {
        display: flex !important;
        flex-direction: column !important;
        gap: 6px !important;
    }

    #aprs-latlng {
        width: 100% !important;
        height: 42px !important;
        font-size: 13px !important;
        border-radius: 8px !important;
        box-sizing: border-box !important;
    }

    #aprs-tab .aprs-latlng-btns,
    #aprs-tab div:has(> #aprs-latlng) > div:last-child {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 6px !important;
        width: 100% !important;
    }

    #aprs-tab div:has(> #aprs-latlng) button {
        min-height: 40px !important;
        font-size: 13px !important;
        font-weight: 700 !important;
        padding: 6px 10px !important;
        border-radius: 8px !important;
        justify-content: center !important;
        white-space: nowrap !important;
    }

    /* Quick Action Presets: 2 Columns of 3 rows for easy tapping */
    #aprs-tab .aprs-quick-actions-grid,
    #aprs-tab div:has(> button[onclick*="quickTacticalAction"]) {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 6px !important;
    }

    #aprs-tab button[onclick*="quickTacticalAction"] {
        min-height: 44px !important;
        font-size: 13px !important;
        padding: 8px 6px !important;
        border-radius: 8px !important;
        justify-content: center !important;
    }

    /* Transmitter Bottom Bar */
    #aprs-tab .aprs-tx-bar,
    #aprs-tab div:has(> #btn-aprs-tx) {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        margin-top: 8px !important;
    }

    #aprs-tab div:has(> #btn-aprs-tx) > div:first-child {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        width: 100% !important;
    }

    #btn-aprs-tx {
        width: 100% !important;
        min-height: 48px !important;
        font-size: 14.5px !important;
        font-weight: 800 !important;
        border-radius: 8px !important;
        margin-top: 4px !important;
    }

    /* Receiver Panel on Mobile */
    #aprs-tab div[style*="border: 1px solid rgba(59, 130, 246"] {
        width: 100% !important;
        box-sizing: border-box !important;
        margin-top: 6px !important;
    }

    /* Universal single-column flow for all tabs in ATAK modal on mobile */
    .atak-tab-content > div[style*="grid-template-columns"],
    .atak-tab-content div[style*="grid-template-columns: 1.15fr 0.85fr"] {
        display: flex !important;
        flex-direction: column !important;
        gap: 16px !important;
        width: 100% !important;
    }
    .atak-tab-content div[style*="grid-template-columns: 1fr 1fr"] {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
        width: 100% !important;
    }
    .atak-tab-content select,
    .atak-tab-content input,
    .atak-tab-content textarea {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    .atak-tab-content .latlng-row,
    .atak-tab-content div:has(> input[id*="latlng"]) {
        display: flex !important;
        flex-direction: column !important;
        gap: 6px !important;
    }


    /* Make offline plan receipt compact on mobile and hide disabled action buttons */
    .assign-modal .nrs-original-plan-receipt {
        margin: 4px 12px !important;
        padding: 6px 10px !important;
        font-size: 11px !important;
        background: rgba(16, 47, 64, 0.7) !important;
        border-radius: 8px !important;
        border: 1px solid rgba(82, 134, 151, 0.4) !important;
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        gap: 6px !important;
        order: 4 !important;
    }
    .assign-modal .nrs-original-plan-receipt p {
        margin: 0 !important;
        font-size: 11px !important;
        flex: 1 1 100% !important;
        color: #94a3b8 !important;
    }
    .assign-modal .nrs-original-plan-receipt button {
        min-height: 32px !important;
        font-size: 11px !important;
        padding: 4px 8px !important;
        margin: 0 !important;
        flex: 1 1 auto !important;
    }
    .assign-modal .nrs-original-plan-receipt button:disabled {
        display: none !important;
    }
    .assign-modal .modal-actions {
        order: 5 !important;
    }

}


/* ATAK & APRS Hub does not use route plan receipts; hide the operation_login_required draft box */
#atak-modal .nrs-original-plan-receipt {
    display: none !important;
}
