/* =========================================================
   NCIS SPATIAL INTELLIGENCE
   Brand-Aligned Premium UI
   Version: 1.2.1
   ========================================================= */

:root {
    --ncis-green-1000: #021d17;
    --ncis-green-950: #03271f;
    --ncis-green-900: #06372c;
    --ncis-green-850: #084438;
    --ncis-green-800: #0a5041;
    --ncis-green-700: #126a54;
    --ncis-green-600: #237d61;
    --ncis-green-500: #3d9472;

    --ncis-gold-800: #886521;
    --ncis-gold-700: #9d762e;
    --ncis-gold-600: #b78b3e;
    --ncis-gold-500: #c9a45c;
    --ncis-gold-400: #ddbb73;
    --ncis-gold-300: #efd699;
    --ncis-gold-200: #f7e8be;

    --ncis-white: #ffffff;
    --ncis-ivory: #fbf8ef;
    --ncis-ivory-soft: #f7f3e8;

    --ncis-surface: #ffffff;
    --ncis-surface-soft: #f5f8f5;
    --ncis-map-background: #dce9e3;

    --ncis-text: #15372e;
    --ncis-text-soft: #61736c;
    --ncis-text-muted: #87968f;

    --ncis-border: #dce6e1;
    --ncis-border-strong: #c8d7d0;

    --ncis-success: #5bd19b;

    --ncis-header-height: 78px;
    --ncis-sidebar-width: 354px;

    --ncis-shadow-sm: 0 4px 14px rgba(6, 51, 41, 0.08);
    --ncis-shadow-md: 0 14px 36px rgba(6, 51, 41, 0.14);
    --ncis-shadow-lg: 0 26px 68px rgba(2, 35, 28, 0.23);

    --ncis-transition: 180ms ease;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
}

html {
    background: var(--ncis-green-1000);
    -webkit-text-size-adjust: 100%;
}

body {
    overflow: hidden;
    color: var(--ncis-text);
    background: var(--ncis-map-background);
    font-family:
        "Inter",
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
select {
    cursor: pointer;
}

button,
input,
select {
    outline: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
    outline: 3px solid rgba(201, 164, 92, 0.34);
    outline-offset: 2px;
}

img,
svg {
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

[hidden] {
    display: none !important;
}

.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

#ncis-app {
    position: fixed;
    inset: 0;
    display: grid;
    grid-template-rows:
        var(--ncis-header-height)
        minmax(0, 1fr);
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--ncis-map-background);
}

.app-header {
    position: relative;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 0;
    height: var(--ncis-header-height);
    padding: 0 22px;
    color: var(--ncis-white);
    background:
        radial-gradient(
            circle at 14% -70%,
            rgba(201, 164, 92, 0.18),
            transparent 45%
        ),
        radial-gradient(
            circle at 80% 10%,
            rgba(39, 131, 96, 0.13),
            transparent 40%
        ),
        linear-gradient(
            135deg,
            var(--ncis-green-1000),
            var(--ncis-green-900) 52%,
            var(--ncis-green-850)
        );
    border-bottom: 1px solid rgba(239, 214, 153, 0.13);
    box-shadow: 0 8px 28px rgba(1, 26, 20, 0.22);
}

.app-header::after {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 1px;
    content: "";
    background:
        linear-gradient(
            90deg,
            transparent,
            rgba(201, 164, 92, 0.64),
            transparent
        );
}

.header-left,
.header-actions,
.module-title-row,
.corporate-home-link {
    display: flex;
    align-items: center;
}

.header-left {
    min-width: 0;
    gap: 16px;
}

.header-actions {
    flex-shrink: 0;
    gap: 10px;
}

.header-menu-button {
    display: none;
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    padding: 0 13px;
    background: rgba(255, 255, 255, 0.045);
    border: 1px solid rgba(239, 214, 153, 0.18);
    border-radius: 15px;
}

.header-menu-button span {
    display: block;
    width: 100%;
    height: 2px;
    margin: 5px 0;
    background: var(--ncis-gold-300);
    border-radius: 999px;
}

.corporate-home-link {
    min-width: 0;
    gap: 12px;
    padding: 5px 7px 5px 0;
    border-radius: 14px;
    transition:
        background var(--ncis-transition),
        transform var(--ncis-transition);
}

.corporate-home-link:hover {
    background: rgba(255, 255, 255, 0.035);
    transform: translateY(-1px);
}

.corporate-logo-mark {
    flex: 0 0 auto;
    width: 52px;
    height: 52px;
    object-fit: contain;
    object-position: center;
    filter: drop-shadow(0 5px 14px rgba(201, 164, 92, 0.2));
}

.corporate-wordmark {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.corporate-wordmark strong {
    overflow: hidden;
    color: var(--ncis-gold-300);
    font-family: "Cinzel", Georgia, serif;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.075em;
    line-height: 1.08;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.corporate-wordmark span {
    overflow: hidden;
    margin-top: 5px;
    color: rgba(255, 255, 255, 0.64);
    font-size: 6.5px;
    font-weight: 700;
    letter-spacing: 0.27em;
    line-height: 1;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.header-separator {
    flex: 0 0 auto;
    width: 1px;
    height: 42px;
    background:
        linear-gradient(
            to bottom,
            transparent,
            rgba(239, 214, 153, 0.36),
            transparent
        );
}

.module-identity {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 6px;
}

.module-ecosystem {
    overflow: hidden;
    color: rgba(255, 255, 255, 0.48);
    font-size: 7px;
    font-weight: 700;
    letter-spacing: 0.13em;
    line-height: 1;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.module-title-row {
    min-width: 0;
    gap: 10px;
}

.module-title-row strong {
    flex: 0 0 auto;
    color: var(--ncis-white);
    font-size: 20px;
    font-weight: 850;
    letter-spacing: 0.09em;
    line-height: 1;
}

.module-title-row > span:last-child {
    overflow: hidden;
    color: rgba(255, 255, 255, 0.73);
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.module-title-divider {
    flex: 0 0 auto;
    width: 1px;
    height: 19px;
    background: rgba(201, 164, 92, 0.48);
}

.version-badge,
.engine-status {
    display: inline-flex;
    align-items: center;
    min-height: 31px;
    color: rgba(255, 255, 255, 0.86);
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid rgba(239, 214, 153, 0.14);
    border-radius: 999px;
    white-space: nowrap;
}

.version-badge {
    padding: 0 12px;
    color: var(--ncis-gold-300);
    font-size: 10px;
    font-weight: 820;
}

.engine-status {
    gap: 7px;
    padding: 0 12px;
    font-size: 9px;
}

.engine-status i {
    width: 7px;
    height: 7px;
    background: var(--ncis-success);
    border-radius: 50%;
    box-shadow:
        0 0 0 4px rgba(91, 209, 155, 0.12),
        0 0 12px rgba(91, 209, 155, 0.48);
}

.app-workspace {
    position: relative;
    display: grid;
    grid-template-columns:
        var(--ncis-sidebar-width)
        minmax(0, 1fr);
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.app-sidebar {
    position: relative;
    z-index: 800;
    display: flex;
    min-width: 0;
    min-height: 0;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    background: var(--ncis-surface);
    border-right: 1px solid var(--ncis-border);
    box-shadow: 9px 0 34px rgba(8, 52, 42, 0.08);
    scrollbar-color: var(--ncis-border-strong) transparent;
    scrollbar-width: thin;
}

.app-sidebar::-webkit-scrollbar {
    width: 6px;
}

.app-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.app-sidebar::-webkit-scrollbar-thumb {
    background: var(--ncis-border-strong);
    border-radius: 999px;
}

.sidebar-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 150px;
    padding: 22px 22px;
    gap: 14px;
    color: var(--ncis-white);
    background:
        radial-gradient(
            circle at 93% 17%,
            rgba(201, 164, 92, 0.2),
            transparent 34%
        ),
        linear-gradient(
            140deg,
            var(--ncis-green-950),
            var(--ncis-green-700)
        );
    border-bottom: 1px solid rgba(201, 164, 92, 0.19);
}

.sidebar-programme-brand {
    display: flex;
    align-items: center;
    min-width: 0;
    flex: 1 1 auto;
    gap: 15px;
}

.bicp-logo {
    flex: 0 0 auto;
    width: 82px;
    height: 82px;
    object-fit: contain;
    object-position: center;
    filter:
        drop-shadow(0 7px 18px rgba(0, 0, 0, 0.25))
        drop-shadow(0 0 10px rgba(221, 187, 115, 0.10));
}

.sidebar-programme-copy {
    min-width: 0;
}

.sidebar-hero h1 {
    margin: 7px 0 0;
    color: var(--ncis-white);
    font-size: 18px;
    font-weight: 780;
    letter-spacing: -0.025em;
    line-height: 1.22;
}

.sidebar-hero p {
    margin: 7px 0 0;
    color: rgba(255, 255, 255, 0.64);
    font-size: 9px;
    line-height: 1.4;
}

.section-eyebrow {
    display: block;
    color: var(--ncis-gold-600);
    font-size: 8px;
    font-weight: 860;
    letter-spacing: 0.17em;
    line-height: 1.4;
    text-transform: uppercase;
}

.sidebar-hero .section-eyebrow {
    color: var(--ncis-gold-300);
}

.sidebar-close {
    display: none;
    flex: 0 0 auto;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    color: var(--ncis-gold-300);
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid rgba(239, 214, 153, 0.17);
    border-radius: 11px;
    font-size: 22px;
}

.sidebar-section {
    padding: 21px 22px;
    border-bottom: 1px solid #edf2ef;
}

.section-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 15px;
}

.section-title-row h2 {
    margin: 5px 0 0;
    color: var(--ncis-text);
    font-size: 15px;
    font-weight: 780;
    letter-spacing: -0.015em;
    line-height: 1.25;
}

.live-badge {
    display: inline-flex;
    align-items: center;
    min-height: 23px;
    padding: 0 8px;
    color: var(--ncis-green-700);
    background: rgba(61, 148, 114, 0.09);
    border: 1px solid rgba(61, 148, 114, 0.16);
    border-radius: 999px;
    font-size: 8px;
    font-weight: 800;
    text-transform: uppercase;
}

.search-control {
    position: relative;
}

.search-icon {
    position: absolute;
    top: 50%;
    left: 13px;
    z-index: 2;
    color: var(--ncis-text-muted);
    font-size: 16px;
    transform: translateY(-50%);
    pointer-events: none;
}

.search-control input {
    width: 100%;
    min-height: 46px;
    padding: 0 43px 0 38px;
    color: var(--ncis-text);
    background: var(--ncis-white);
    border: 1px solid var(--ncis-border);
    border-radius: 13px;
    box-shadow: inset 0 1px 2px rgba(11, 60, 48, 0.025);
    font-size: 12px;
    transition:
        border-color var(--ncis-transition),
        box-shadow var(--ncis-transition);
}

.search-control input::placeholder {
    color: #a0aba6;
}

.search-control input:focus {
    border-color: rgba(201, 164, 92, 0.58);
    box-shadow: 0 0 0 4px rgba(201, 164, 92, 0.1);
}

.search-control button {
    position: absolute;
    top: 50%;
    right: 7px;
    display: grid;
    place-items: center;
    width: 31px;
    height: 31px;
    padding: 0;
    color: var(--ncis-text-muted);
    background: transparent;
    border: 0;
    border-radius: 8px;
    transform: translateY(-50%);
}

.search-control button:hover {
    color: var(--ncis-gold-800);
    background: var(--ncis-ivory);
}

.search-results {
    position: relative;
    max-height: 340px;
    margin-top: 9px;
    overflow-x: hidden;
    overflow-y: auto;
    background: var(--ncis-white);
    border: 1px solid var(--ncis-border);
    border-radius: 13px;
    box-shadow: var(--ncis-shadow-md);
}

.search-result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 66px;
    padding: 12px 13px;
    gap: 13px;
    color: var(--ncis-text);
    background: var(--ncis-white);
    border: 0;
    border-bottom: 1px solid var(--ncis-border);
    text-align: left;
}

.search-result-item:hover,
.search-result-item.is-active {
    background: var(--ncis-ivory);
}

.search-result-main,
.search-result-meta {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.search-result-main {
    flex: 1 1 auto;
}

.search-result-main strong {
    overflow: hidden;
    color: var(--ncis-green-900);
    font-size: 11px;
    font-weight: 820;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result-main small {
    overflow: hidden;
    margin-top: 4px;
    color: var(--ncis-text-muted);
    font-size: 8px;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result-meta {
    flex: 0 0 auto;
    max-width: 98px;
    align-items: flex-end;
    text-align: right;
}

.search-result-meta b {
    color: var(--ncis-green-700);
    font-size: 10px;
    white-space: nowrap;
}

.search-result-meta small {
    overflow: hidden;
    max-width: 98px;
    margin-top: 4px;
    color: var(--ncis-gold-700);
    font-size: 7px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-results-footer {
    padding: 9px 12px;
    color: var(--ncis-text-muted);
    background: var(--ncis-ivory);
    font-size: 8px;
    text-align: center;
}

.search-empty-state {
    display: flex;
    padding: 17px 14px;
    flex-direction: column;
    text-align: center;
}

.search-empty-state strong {
    color: var(--ncis-green-900);
    font-size: 11px;
}

.search-empty-state span {
    margin-top: 5px;
    color: var(--ncis-text-muted);
    font-size: 9px;
    line-height: 1.45;
}

.statistics-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 11px;
}

.stat-card {
    position: relative;
    min-width: 0;
    min-height: 104px;
    overflow: hidden;
    padding: 15px 14px;
    background:
        linear-gradient(
            145deg,
            var(--ncis-white),
            var(--ncis-ivory)
        );
    border: 1px solid var(--ncis-border);
    border-radius: 15px;
    box-shadow: var(--ncis-shadow-sm);
}

.stat-card::before {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 2px;
    content: "";
    background:
        linear-gradient(
            90deg,
            transparent,
            rgba(201, 164, 92, 0.72),
            transparent
        );
}

.stat-card::after {
    position: absolute;
    right: -18px;
    bottom: -22px;
    width: 76px;
    height: 76px;
    content: "";
    background:
        radial-gradient(
            circle,
            rgba(201, 164, 92, 0.15),
            rgba(201, 164, 92, 0)
        );
    border-radius: 50%;
}

.stat-label,
.stat-card small,
.stat-card strong {
    position: relative;
    z-index: 1;
    display: block;
}

.stat-label {
    color: var(--ncis-text-soft);
    font-size: 8px;
    font-weight: 780;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.stat-card strong {
    margin-top: 8px;
    color: var(--ncis-green-900);
    font-size: 23px;
    font-weight: 850;
    letter-spacing: -0.04em;
    line-height: 1;
}

.stat-card small {
    margin-top: 6px;
    color: var(--ncis-text-muted);
    font-size: 8px;
    line-height: 1.3;
}

.reset-button {
    padding: 3px 0;
    color: var(--ncis-gold-800);
    background: transparent;
    border: 0;
    font-size: 10px;
    font-weight: 820;
}

.filter-stack {
    display: grid;
    gap: 13px;
}

.form-group {
    display: grid;
    gap: 6px;
}

.form-group label {
    color: var(--ncis-text-soft);
    font-size: 10px;
    font-weight: 720;
}

.form-group select {
    width: 100%;
    min-height: 43px;
    padding: 0 36px 0 12px;
    color: var(--ncis-text);
    background-color: var(--ncis-white);
    border: 1px solid var(--ncis-border);
    border-radius: 11px;
    font-size: 12px;
}

.form-group select:focus {
    border-color: rgba(201, 164, 92, 0.58);
    box-shadow: 0 0 0 4px rgba(201, 164, 92, 0.1);
}

.summary-list {
    margin: 0;
}

.summary-list > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px dashed var(--ncis-border);
}

.summary-list > div:last-child {
    border-bottom: 0;
}

.summary-list dt,
.summary-list dd {
    margin: 0;
}

.summary-list dt {
    color: var(--ncis-text-muted);
    font-size: 10px;
}

.summary-list dd {
    color: var(--ncis-green-900);
    font-size: 11px;
    font-weight: 820;
    text-align: right;
}

.sidebar-footer {
    display: flex;
    min-height: 84px;
    margin-top: auto;
    padding: 18px 22px;
    flex-direction: column;
    justify-content: center;
    color: var(--ncis-white);
    background:
        radial-gradient(
            circle at 80% 20%,
            rgba(201, 164, 92, 0.12),
            transparent 35%
        ),
        linear-gradient(
            135deg,
            var(--ncis-green-1000),
            var(--ncis-green-900)
        );
    border-top: 1px solid rgba(201, 164, 92, 0.13);
}

.sidebar-footer span {
    color: rgba(255, 255, 255, 0.58);
    font-size: 8px;
}

.sidebar-footer strong {
    margin-top: 4px;
    color: var(--ncis-gold-300);
    font-family: "Cinzel", Georgia, serif;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.map-workspace {
    position: relative;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background: var(--ncis-map-background);
}

#map {
    position: absolute;
    z-index: 1;
    inset: 0;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    background: var(--ncis-map-background);
}

.leaflet-container {
    width: 100%;
    height: 100%;
    background: var(--ncis-map-background);
    font-family: "Inter", sans-serif;
}

.leaflet-container img {
    max-width: none !important;
    max-height: none !important;
}

.leaflet-control-zoom {
    overflow: hidden;
    border: 0 !important;
    border-radius: 13px !important;
    box-shadow: var(--ncis-shadow-md) !important;
}

.leaflet-control-zoom a {
    display: grid !important;
    place-items: center;
    width: 39px !important;
    height: 39px !important;
    color: var(--ncis-green-900) !important;
    background: rgba(255, 255, 255, 0.96) !important;
    border-bottom-color: var(--ncis-border) !important;
    font-size: 19px !important;
    line-height: 39px !important;
}

.leaflet-control-zoom a:hover {
    color: var(--ncis-gold-800) !important;
    background: var(--ncis-ivory) !important;
}

.leaflet-control-attribution {
    padding: 3px 7px !important;
    color: var(--ncis-text-soft) !important;
    background: rgba(255, 255, 255, 0.84) !important;
    border-radius: 7px 0 0 0;
    font-size: 8px !important;
    backdrop-filter: blur(6px);
}

.leaflet-control-attribution a {
    color: var(--ncis-green-700) !important;
}

.map-toolbar {
    position: absolute;
    z-index: 600;
    top: 15px;
    right: 15px;
    display: flex;
    gap: 8px;
    pointer-events: none;
}

.map-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0 13px;
    gap: 8px;
    color: var(--ncis-green-900);
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(201, 164, 92, 0.21);
    border-radius: 13px;
    box-shadow: var(--ncis-shadow-md);
    font-weight: 760;
    pointer-events: auto;
    backdrop-filter: blur(10px);
}

.map-action-icon {
    color: var(--ncis-gold-800);
    font-size: 16px;
}

.map-action-label {
    font-size: 10px;
}

.map-action:hover {
    background: var(--ncis-ivory);
    box-shadow: var(--ncis-shadow-lg);
    transform: translateY(-1px);
}

.map-status {
    position: absolute;
    z-index: 600;
    bottom: 17px;
    left: 17px;
    display: inline-flex;
    align-items: center;
    max-width: calc(100% - 34px);
    min-height: 36px;
    padding: 0 15px;
    gap: 9px;
    color: var(--ncis-text);
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(201, 164, 92, 0.2);
    border-radius: 999px;
    box-shadow: var(--ncis-shadow-md);
    font-size: 10px;
    font-weight: 720;
    pointer-events: none;
    backdrop-filter: blur(10px);
}

.map-status-indicator {
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    background: var(--ncis-gold-500);
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(201, 164, 92, 0.15);
}

#map-status-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.map-legend {
    position: absolute;
    z-index: 650;
    top: 76px;
    right: 15px;
    width: min(285px, calc(100% - 30px));
    overflow: hidden;
    background: rgba(255, 255, 255, 0.97);
    border: 1px solid rgba(201, 164, 92, 0.2);
    border-radius: 16px;
    box-shadow: var(--ncis-shadow-lg);
    backdrop-filter: blur(10px);
}

.legend-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 15px;
    border-bottom: 1px solid var(--ncis-border);
}

.legend-header strong {
    display: block;
    margin-top: 4px;
    color: var(--ncis-green-900);
    font-size: 12px;
}

.legend-header button {
    display: grid;
    place-items: center;
    width: 29px;
    height: 29px;
    padding: 0;
    color: var(--ncis-text-muted);
    background: transparent;
    border: 0;
    border-radius: 8px;
    font-size: 18px;
}

#legend-content {
    padding: 14px 15px;
}

.sidebar-overlay {
    position: fixed;
    z-index: 850;
    inset: var(--ncis-header-height) 0 0;
    display: none;
    padding: 0;
    background: rgba(2, 30, 24, 0.5);
    border: 0;
    opacity: 0;
    pointer-events: none;
    backdrop-filter: blur(3px);
    transition: opacity var(--ncis-transition);
}

.sidebar-overlay.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.app-loader {
    position: fixed;
    z-index: 9999;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    color: var(--ncis-white);
    background:
        radial-gradient(
            circle at 50% 42%,
            rgba(43, 130, 95, 0.27),
            transparent 41%
        ),
        radial-gradient(
            circle at 25% 10%,
            rgba(201, 164, 92, 0.12),
            transparent 30%
        ),
        linear-gradient(
            145deg,
            var(--ncis-green-1000),
            var(--ncis-green-900)
        );
    opacity: 1;
    visibility: visible;
    transition:
        opacity 380ms ease,
        visibility 380ms ease;
}

.app-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-panel {
    display: grid;
    grid-template-columns:
        minmax(0, 1fr)
        minmax(260px, 1fr);
    align-items: center;
    width: min(760px, 100%);
    padding: 32px 36px;
    gap: 34px;
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid rgba(239, 214, 153, 0.18);
    border-radius: 29px;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(14px);
}

.loader-corporate-brand {
    display: flex;
    align-items: center;
    gap: 15px;
}

.loader-brand-logo {
    flex: 0 0 auto;
    width: 88px;
    height: 88px;
    object-fit: contain;
    filter: drop-shadow(0 8px 22px rgba(201, 164, 92, 0.2));
}

.loader-wordmark {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.loader-wordmark strong {
    color: var(--ncis-gold-300);
    font-family: "Cinzel", Georgia, serif;
    font-size: clamp(18px, 2.3vw, 27px);
    font-weight: 600;
    letter-spacing: 0.07em;
    line-height: 1.15;
    text-transform: uppercase;
}

.loader-wordmark span {
    margin-top: 7px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 7px;
    font-weight: 700;
    letter-spacing: 0.27em;
    line-height: 1.5;
    text-transform: uppercase;
}

.loader-system {
    min-width: 0;
    padding-left: 30px;
    border-left: 1px solid rgba(201, 164, 92, 0.28);
}

.loader-system-label {
    display: block;
    color: rgba(255, 255, 255, 0.48);
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.loader-system-title {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-top: 9px;
}

.loader-system-title strong {
    color: var(--ncis-white);
    font-size: clamp(21px, 3vw, 31px);
    font-weight: 850;
    letter-spacing: 0.09em;
}

.loader-system-title > span:last-child {
    color: rgba(255, 255, 255, 0.7);
    font-size: clamp(12px, 1.8vw, 16px);
}

.loader-system-divider {
    width: 1px;
    height: 23px;
    background: rgba(201, 164, 92, 0.47);
}

.loader-message {
    display: block;
    margin-top: 9px;
    color: rgba(255, 255, 255, 0.58);
    font-size: 12px;
}

.loader-progress {
    position: relative;
    width: 100%;
    height: 4px;
    margin-top: 18px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.11);
    border-radius: 999px;
}

.loader-progress span {
    position: absolute;
    top: 0;
    bottom: 0;
    left: -35%;
    width: 35%;
    background:
        linear-gradient(
            90deg,
            transparent,
            var(--ncis-gold-300),
            transparent
        );
    border-radius: 999px;
    animation: ncis-loader-progress 1.4s infinite ease-in-out;
}

@keyframes ncis-loader-progress {
    0% { left: -35%; }
    100% { left: 100%; }
}

.leaflet-popup-content-wrapper {
    overflow: hidden;
    padding: 0;
    color: var(--ncis-text);
    background: var(--ncis-white);
    border: 1px solid rgba(201, 164, 92, 0.17);
    border-radius: 17px;
    box-shadow: var(--ncis-shadow-lg);
}

.leaflet-popup-content {
    width: auto !important;
    margin: 0 !important;
}

.leaflet-popup-tip {
    background: var(--ncis-white);
    box-shadow: none;
}

.leaflet-popup-close-button {
    z-index: 5;
    top: 10px !important;
    right: 10px !important;
    display: grid !important;
    place-items: center;
    width: 29px !important;
    height: 29px !important;
    padding: 0 !important;
    color: rgba(255, 255, 255, 0.82) !important;
    font-size: 20px !important;
}

.ncis-popup-card {
    width: 330px;
    max-width: calc(100vw - 48px);
    background: var(--ncis-white);
}

.ncis-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 58px;
    padding: 13px 44px 13px 17px;
    gap: 12px;
    color: var(--ncis-white);
    background:
        radial-gradient(
            circle at 90% 20%,
            rgba(201, 164, 92, 0.15),
            transparent 35%
        ),
        linear-gradient(
            135deg,
            var(--ncis-green-1000),
            var(--ncis-green-700)
        );
    border-bottom: 1px solid rgba(201, 164, 92, 0.18);
}

.ncis-popup-brand {
    display: flex;
    flex-direction: column;
}

.ncis-popup-brand span {
    color: var(--ncis-gold-300);
    font-size: 11px;
    font-weight: 860;
    letter-spacing: 0.12em;
}

.ncis-popup-brand small {
    margin-top: 2px;
    color: rgba(255, 255, 255, 0.63);
    font-size: 8px;
}

.ncis-popup-status {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 9px;
    gap: 5px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(239, 214, 153, 0.14);
    border-radius: 999px;
    font-size: 8px;
    white-space: nowrap;
}

.ncis-popup-status i {
    width: 6px;
    height: 6px;
    background: var(--ncis-success);
    border-radius: 50%;
}

.ncis-popup-title {
    padding: 17px 17px 14px;
    border-bottom: 1px solid var(--ncis-border);
}

.ncis-popup-eyebrow {
    color: var(--ncis-gold-700);
    font-size: 8px;
    font-weight: 860;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.ncis-popup-title h3 {
    margin: 6px 0 0;
    color: var(--ncis-green-900);
    font-size: 18px;
    line-height: 1.25;
}

.ncis-popup-title p {
    margin: 6px 0 0;
    color: var(--ncis-text-soft);
    font-size: 10px;
}

.ncis-popup-data {
    padding: 8px 17px;
}

.ncis-popup-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 15px;
    padding: 8px 0;
    border-bottom: 1px dashed var(--ncis-border);
}

.ncis-popup-row:last-child {
    border-bottom: 0;
}

.ncis-popup-row.is-highlight {
    margin: 3px 0;
    padding: 11px;
    background: var(--ncis-ivory);
    border: 1px solid rgba(201, 164, 92, 0.17);
    border-radius: 11px;
}

.ncis-popup-label {
    color: var(--ncis-text-muted);
    font-size: 9px;
}

.ncis-popup-value {
    color: var(--ncis-green-900);
    font-size: 10px;
    text-align: right;
}

.ncis-popup-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 17px;
    gap: 12px;
    background: var(--ncis-ivory);
    border-top: 1px solid var(--ncis-border);
}

.ncis-popup-footer > div {
    display: flex;
    flex-direction: column;
}

.ncis-popup-footer span {
    color: var(--ncis-text-muted);
    font-size: 8px;
}

.ncis-popup-footer strong {
    color: var(--ncis-green-900);
    font-size: 10px;
}

.ncis-popup-detail-button {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 12px;
    gap: 6px;
    color: var(--ncis-white);
    background:
        linear-gradient(
            135deg,
            var(--ncis-green-800),
            var(--ncis-green-600)
        );
    border: 1px solid rgba(201, 164, 92, 0.2);
    border-radius: 9px;
    font-size: 9px;
    font-weight: 770;
}

@media (max-width: 1180px) {
    :root {
        --ncis-sidebar-width: 320px;
    }

    .corporate-wordmark strong {
        font-size: 15px;
    }

    .corporate-wordmark span {
        font-size: 5.8px;
    }

    .module-ecosystem {
        display: none;
    }

    .sidebar-section,
    .sidebar-hero {
        padding-right: 18px;
        padding-left: 18px;
    }

    .bicp-logo {
        width: 72px;
        height: 72px;
    }

    .sidebar-hero h1 {
        font-size: 16px;
    }
}

@media (max-width: 980px) {
    .corporate-wordmark {
        display: none;
    }

    .header-separator {
        height: 36px;
    }

    .map-action-label {
        display: none;
    }

    .map-action {
        width: 44px;
        padding: 0;
    }
}

@media (max-width: 768px) {
    :root {
        --ncis-header-height: 76px;
    }

    #ncis-app {
        grid-template-rows:
            calc(
                var(--ncis-header-height) +
                env(safe-area-inset-top, 0px)
            )
            minmax(0, 1fr);
    }

    .app-header {
        height:
            calc(
                var(--ncis-header-height) +
                env(safe-area-inset-top, 0px)
            );
        padding:
            env(safe-area-inset-top, 0px)
            16px
            0;
    }

    .mobile-only {
        display: grid;
    }

    .header-menu-button {
        display: block;
    }

    .header-left {
        gap: 10px;
    }

    .corporate-home-link {
        padding: 0;
    }

    .corporate-logo-mark {
        width: 48px;
        height: 48px;
    }

    .corporate-wordmark,
    .header-separator,
    .module-ecosystem {
        display: none;
    }

    .module-title-row {
        gap: 8px;
    }

    .module-title-row strong {
        font-size: 21px;
    }

    .module-title-row > span:last-child {
        max-width: 160px;
        font-size: 13px;
    }

    .module-title-divider {
        height: 23px;
    }

    .version-badge {
        min-height: 40px;
        padding: 0 14px;
        font-size: 12px;
    }

    .engine-status {
        display: none;
    }

    .app-workspace {
        display: block;
    }

    .app-sidebar {
        position: fixed;
        z-index: 900;
        top:
            calc(
                var(--ncis-header-height) +
                env(safe-area-inset-top, 0px)
            );
        bottom: 0;
        left: 0;
        width: min(88vw, 390px);
        max-width: 100%;
        border-right: 0;
        box-shadow: var(--ncis-shadow-lg);
        transform: translateX(-105%);
        visibility: hidden;
        transition:
            transform 240ms ease,
            visibility 240ms ease;
    }

    .app-sidebar.is-open {
        transform: translateX(0);
        visibility: visible;
    }

    .sidebar-close {
        display: grid;
    }

    .sidebar-overlay {
        display: block;
        top:
            calc(
                var(--ncis-header-height) +
                env(safe-area-inset-top, 0px)
            );
    }

    .sidebar-hero {
        min-height: 172px;
        padding: 22px 18px;
    }

    .sidebar-programme-brand {
        align-items: center;
        gap: 14px;
    }

    .bicp-logo {
        width: 96px;
        height: 96px;
    }

    .sidebar-programme-copy .section-eyebrow {
        font-size: 7px;
        letter-spacing: 0.13em;
    }

    .sidebar-programme-copy h1 {
        font-size: 17px;
        line-height: 1.2;
    }

    .sidebar-programme-copy p {
        max-width: 190px;
        font-size: 9px;
        line-height: 1.4;
    }

    .map-workspace {
        position: absolute;
        inset: 0;
    }

    .map-toolbar {
        top: 19px;
        right: 17px;
        gap: 11px;
    }

    .map-action {
        width: 56px;
        min-width: 56px;
        height: 56px;
        border-radius: 17px;
    }

    .map-action-icon {
        font-size: 19px;
    }

    .map-status {
        right: 17px;
        bottom:
            calc(
                20px +
                env(safe-area-inset-bottom, 0px)
            );
        left: 17px;
        justify-content: center;
        min-height: 53px;
        max-width: none;
        padding: 0 18px;
        font-size: 13px;
    }

    .leaflet-control-zoom {
        display: none;
    }

    .leaflet-control-attribution {
        font-size: 7px !important;
    }

    .loader-panel {
        grid-template-columns: 1fr;
        width: min(520px, 100%);
        padding: 25px;
        gap: 24px;
        border-radius: 25px;
    }

    .loader-corporate-brand {
        justify-content: center;
    }

    .loader-brand-logo {
        width: 76px;
        height: 76px;
    }

    .loader-wordmark strong {
        font-size: 20px;
    }

    .loader-system {
        padding-top: 22px;
        padding-left: 0;
        border-top: 1px solid rgba(201, 164, 92, 0.28);
        border-left: 0;
        text-align: center;
    }

    .loader-system-title {
        justify-content: center;
    }

    .ncis-popup-card {
        width: min(320px, calc(100vw - 42px));
    }
}

@media (max-width: 430px) {
    .app-header {
        padding-right: 12px;
        padding-left: 12px;
    }

    .header-menu-button {
        width: 50px;
        height: 50px;
    }

    .header-left {
        gap: 8px;
    }

    .corporate-logo-mark {
        width: 43px;
        height: 43px;
    }

    .module-title-row strong {
        font-size: 18px;
    }

    .module-title-row > span:last-child {
        max-width: 116px;
        font-size: 10px;
    }

    .module-title-divider {
        height: 19px;
    }

    .version-badge {
        min-height: 36px;
        padding: 0 11px;
        font-size: 10px;
    }

    .sidebar-hero {
        min-height: 158px;
        padding: 18px 15px;
        gap: 8px;
    }

    .sidebar-programme-brand {
        gap: 11px;
    }

    .bicp-logo {
        width: 84px;
        height: 84px;
    }

    .sidebar-programme-copy .section-eyebrow {
        font-size: 6.2px;
        letter-spacing: 0.10em;
    }

    .sidebar-programme-copy h1 {
        font-size: 15px;
        line-height: 1.18;
    }

    .sidebar-programme-copy p {
        max-width: 165px;
        font-size: 8px;
    }

    .sidebar-close {
        width: 36px;
        height: 36px;
    }

    .map-toolbar {
        top: 14px;
        right: 13px;
        gap: 9px;
    }

    .map-action {
        width: 50px;
        min-width: 50px;
        height: 50px;
        border-radius: 15px;
    }

    .map-status {
        right: 13px;
        left: 13px;
        min-height: 48px;
        font-size: 12px;
    }

    .loader-panel {
        padding: 21px;
    }

    .loader-corporate-brand {
        gap: 12px;
    }

    .loader-brand-logo {
        width: 65px;
        height: 65px;
    }

    .loader-wordmark strong {
        font-size: 16px;
    }

    .loader-wordmark span {
        font-size: 5.6px;
    }

    .loader-system-title strong {
        font-size: 23px;
    }

    .loader-system-title > span:last-child {
        font-size: 12px;
    }
}

@media (
    max-width: 900px
) and (
    max-height: 500px
) and (
    orientation: landscape
) {
    :root {
        --ncis-header-height: 58px;
    }

    .corporate-logo-mark {
        width: 38px;
        height: 38px;
    }

    .module-title-row strong {
        font-size: 16px;
    }

    .module-title-row > span:last-child {
        font-size: 10px;
    }

    .header-menu-button {
        width: 42px;
        height: 42px;
    }

    .sidebar-hero {
        min-height: 132px;
    }

    .bicp-logo {
        width: 72px;
        height: 72px;
    }

    .map-action {
        width: 43px;
        min-width: 43px;
        height: 43px;
    }

    .map-status {
        min-height: 39px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}


/* =========================================================
   NCDE Living Command Center Embed Mode
   Stable CSS-only integration — does not alter GIS bootstrap.
========================================================= */
body.is-command-embed {
    overflow: hidden;
    background: #032b22;
}

body.is-command-embed .app-header,
body.is-command-embed .app-sidebar,
body.is-command-embed .sidebar-overlay {
    display: none !important;
}

body.is-command-embed .app-workspace,
body.is-command-embed .map-workspace,
body.is-command-embed #map {
    width: 100% !important;
    height: 100vh !important;
    min-height: 100vh !important;
    margin: 0 !important;
    inset: 0 !important;
}

body.is-command-embed .map-workspace {
    position: fixed !important;
}

body.is-command-embed .map-toolbar {
    top: 14px;
    right: 14px;
}

body.is-command-embed .map-status {
    left: 14px;
    bottom: 14px;
}

body.is-command-embed .app-loader {
    z-index: 99999;
}
