@font-face {
    font-family: 'Ericsson Hilda';
    src: url('font/hilda/ericsson-hilda-regular.woff2') format('woff2'),
         url('font/hilda/ericsson-hilda-regular.woff') format('woff'),
         url('font/hilda/ericsson-hilda-regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'Ericsson Hilda';
    src: url('font/hilda/ericsson-hilda-light.woff2') format('woff2'),
         url('font/hilda/ericsson-hilda-light.woff') format('woff'),
         url('font/hilda/ericsson-hilda-light.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
}

@font-face {
    font-family: 'Ericsson Hilda';
    src: url('font/hilda/ericsson-hilda-medium.woff2') format('woff2'),
         url('font/hilda/ericsson-hilda-medium.woff') format('woff'),
         url('font/hilda/ericsson-hilda-medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
}

@font-face {
    font-family: 'Ericsson Hilda';
    src: url('font/hilda/ericsson-hilda-bold.woff2') format('woff2'),
         url('font/hilda/ericsson-hilda-bold.woff') format('woff'),
         url('font/hilda/ericsson-hilda-bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
}

body,
html {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    background: #333;
    font-family: 'Ericsson Hilda', Helvetica, Arial, sans-serif;
    display: flex;
    flex-direction: column;
}

a {
  color: #888;
}
a:hover,
a:focus {
  color: #555; /* slightly darker grey */
}

#logo {
    position: fixed;
    display: inline;
    right: 32px;
    top: 70px;
    opacity: 0.45;
    z-index: 1000;
    pointer-events: none;
}

#c2-map-2d-wrap,
#c2-map-3d-wrap,
#c2-map-video-wrap {
    position: relative;
}

#logo.logo--c2 {
    position: absolute;
    right: 16px;
    top: 16px;
}

#logo.logo--map {
    position: absolute;
    right: 33px;
    top: 30px;
}

#logo.logo--c2eds {
    position: absolute;
    right: 16px;
    top: 16px;
}

/* Tab Navigation */
nav {
    height: 40px;
    background: #000;
    display: flex;
    align-items: center;
    padding: 0 10px;
    flex-shrink: 0;
    overflow: hidden;
}

nav button {
    background: none;
    border: none;
    color: #aaa;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    text-transform: uppercase;
    transition: color 0.2s, background 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

nav button:hover {
    color: #fff;
    background: #444;
}

nav button.active {
    color: #fff;
    background: #555;
    border-bottom: 3px solid #1a6dff;
}

/* C2 app-state navigation items */
.c2-nav-item {
    text-transform: none;
    font-weight: normal;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    border-bottom: none !important; /* fighting EDS <a> bottom border */
}

/* Removed these, just looks horrible */
.c2-nav-item.c2-active {
    /*color: #fff;
    background: #3a3a3a;*/
}

.c2-nav-item:hover {
    /*    border-radius: 20px;*/
}

.c2-nav-sep {
    width: 1px;
    height: 18px;
    padding: 0;
    margin: 0 4px;
    background: #555;
    cursor: default;
    pointer-events: none;
    flex-shrink: 0;
    align-self: center;
}

.c2-nav-sep:hover {
    background: #555 !important; /* fighting EDS :hover background change on interactive elements */
    color: inherit;
}

.c2-nav-values {
    border: 1px solid #777;
    border-radius: 4px;
    padding: 4px 14px;
}

.c2-nav-values:hover {
    border-color: #aaa;
    border-radius: 4px;
}

/* Gradually shrink tabs between 950px and 1500px */
@media (max-width: 1500px) {
    nav button {
        font-size: clamp(9px, 0.6vw + 5px, 14px);
        padding: clamp(6px, 0.3vw + 4px, 10px) clamp(6px, 0.7vw + 4px, 20px);
    }

    .c2-nav-item {
        padding: clamp(4px, 0.3vw + 2px, 5px) clamp(6px, 0.7vw + 4px, 12px);
    }
}

/* Hamburger overflow button */
#tab-overflow-btn {
    display: none;
    background: none;
    border: none;
    color: #aaa;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.2s, background 0.2s;
}

#tab-overflow-btn:hover {
    color: #fff;
    background: #444;
}

#tab-overflow-btn.has-overflow {
    display: flex;
    align-items: center;
}

/* Overflow dropdown menu */
#tab-overflow-menu {
    display: none;
    position: fixed;
    top: 40px;
    right: 0;
    background: #2a2a2a;
    border: 1px solid #555;
    border-top: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.6);
    z-index: 99999;
    flex-direction: column;
    min-width: 160px;
}

#tab-overflow-menu.open {
    display: flex;
}

#tab-overflow-menu button {
    background: none;
    border: none;
    color: #aaa;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    text-transform: uppercase;
    text-align: left;
    width: 100%;
    transition: color 0.2s, background 0.2s;
    white-space: nowrap;
}

#tab-overflow-menu button:hover {
    color: #fff;
    background: #444;
}

#tab-overflow-menu button.active {
    color: #fff;
    background: #555;
    border-left: 3px solid #1a6dff;
}

#mute-btn {
    background: none;
    border: none;
    color: #aaa;
    padding: 10px 4px 10px 4px;
    cursor: pointer;
    font-size: 18px;
    transition: color 0.2s;
    flex-shrink: 0;
    margin-left: auto;
}

#mute-btn:hover {
    color: #fff;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

#fullscreen-btn {
    background: none;
    border: none;
    color: #aaa;
    padding: 10px 4px 10px 4px;
    cursor: pointer;
    font-size: 18px;
    transition: color 0.2s;
    flex-shrink: 0;
}

#fullscreen-btn:hover {
    color: #fff;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

#user-menu-btn {
    background: none;
    border: none;
    color: #aaa;
    padding: 10px 7px 10px 4px;
    cursor: pointer;
    font-size: 18px;
    transition: color 0.2s;
    flex-shrink: 0;
}

#user-menu-btn:hover {
    color: #fff;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

#user-display-name {
    font-size: 13px;
    margin-left: 5px;
    vertical-align: middle;
}

.user-menu-popup {
    display: none;
    position: absolute;
    top: 44px;
    right: 4px;
    background: #2a2a2a;
    border: 1px solid #555;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    z-index: 10000;
    min-width: 120px;
}

.user-menu-popup button {
    display: block;
    width: 100%;
    background: none;
    border: none;
    color: #ccc;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 14px;
    text-align: left;
    white-space: nowrap;
}

.user-menu-popup button:hover {
    background: #3a3a3a;
    color: #fff;
}

.user-menu-checkbox-item {
    display: block;
    padding: 10px 16px;
    color: #ccc;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
}

.user-menu-checkbox-item:hover {
    background: #3a3a3a;
    color: #fff;
}

/* Make label block so clicking anywhere in the row (not just the text) toggles the checkbox */
.user-menu-checkbox-item label {
    display: block;
    cursor: pointer;
}

/* Tab Content Containers */
.tab-content {
    flex: 1;
    display: none;
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 100%;
}

.tab-content.active {
    display: flex;
    /* Flex for the maps tab layout */
    flex-direction: column;
}

/* Maps Tab Specifics */
/* Maps Tab Specifics */
/* #tab-maps inherits display:flex from .active */

#content {
    display: grid;
    flex: 0 0 92%;
    /* 92% of the tab content area */
    width: 100%;
    gap: 0px;
    /* Gap handled by dividers */
    background: #000;
    position: relative;
}

#content-3dmap {
    flex: 0 0 92%;
    width: 100%;
    position: relative;
    background: radial-gradient(circle, #404050 0%, #303238 100%);
}

.grid-divider-v {
    background: #444;
    cursor: col-resize;
    z-index: 10;
    touch-action: none;
}

.grid-divider-v:hover,
.grid-divider-v:active {
    background: #666;
}

.grid-divider-h {
    background: #444;
    cursor: row-resize;
    z-index: 10;
    touch-action: none;
}

.grid-divider-h:hover,
.grid-divider-h:active {
    background: #666;
}

.map-container {
    width: 100%;
    height: 100%;
    background: #eee;
    position: relative;
    /* Ensure children like absolute icons are positioned relative to this */
}

/* Eye icon for map settings (now inside a Leaflet Control) */
.map-settings-control {
    margin-top: 10px !important; /* fighting Leaflet .leaflet-control margin reset */
    margin-right: 10px !important; /* fighting Leaflet .leaflet-control margin reset */
    position: relative;
    pointer-events: auto;
}

.map-settings-icon {
    cursor: pointer;
    font-size: 20px;
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
    background: white;
    padding: 6px 10px;
    border-radius: 4px;
    user-select: none;
    transition: background 0.2s;
    border: 2px solid rgba(0, 0, 0, 0.2);
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.4);
    display: inline-block;
    color: black;
}

.map-settings-icon:hover {
    background: #f4f4f4;
}

/* Map settings popup menu */
.map-settings-popup {
    position: fixed;
    background: #2c2c2c;
    color: white;
    padding: 10px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    display: none;
    /* Hidden by default */
    min-width: 180px;
    font-family: 'Ericsson Hilda', Arial, Helvetica, sans-serif;
    font-size: 13px;
    border: 1px solid #333;
    z-index: 10000;
    /* Ensure popup appears above POI canvas layers */
    max-height: calc(100vh - 20px);
    overflow-y: auto;
}

.map-settings-popup.visible {
    display: block;
}


.map-settings-popup label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin-bottom: 8px;
}

.map-settings-popup input[type="radio"],
.map-settings-popup input[type="checkbox"] {
    margin: 0;
}

/* Track legend overlay (shared by 2D and 3D tabs) */
.map-legend {
    position: absolute;
    bottom: 12px;
    right: 12px;
    z-index: 10000;
    background: rgba(30, 30, 30, 0.30);
    color: #eee;
    padding: 8px 12px;
    border-radius: 9px;
    font-family: 'Ericsson Hilda', Arial, Helvetica, sans-serif;
    font-size: 12px;
    pointer-events: auto;
    border: 0px solid #444;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.map-legend > span,
.map-legend > label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    white-space: nowrap;
}

.map-legend > span:last-child,
.map-legend > label:last-child {
    margin-bottom: 0;
}

.map-legend label {
    cursor: pointer;
}

.map-legend input[type="checkbox"] {
    margin: 0;
}

.map-legend .legend-swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

/* Per-map grayscale filter */
.map-grayscale .leaflet-tile-pane {
    filter: grayscale(100%);
}

/* C2 view: dark blue tint matching EDS primary button (#0077db, hue ~207°) */
#c2-content .leaflet-tile-pane {
    filter: grayscale(100%) invert(100%) brightness(80%) sepia(100%) hue-rotate(172deg) saturate(180%);
}

/* C2 view: black background while tiles load */
#c2-content.leaflet-container {
    background: #000;
}

/* Disable all tile filters when Google Maps (or another colour-accurate provider) is active */
#c2-content.c2-maps-no-filter .leaflet-tile-pane,
#c2eds-map-container.c2-maps-no-filter .leaflet-tile-pane {
    filter: none !important; /* fighting .leaflet-tile-pane filter applied for dark map tiles */
}

#timeline {
    flex: 0 0 8%;
    /* 8% of the tab content area */
    width: 100%;
    min-height: 0;
    /* Allow shrinking below content size */
    background: #222;
    position: relative;
    /* overflow: hidden; Removed to allow handle to overlap */
    border-top: none;
    display: flex;
    overflow-y: auto;
}

#timeline::-webkit-scrollbar {
    width: 8px;
}

#timeline::-webkit-scrollbar-track {
    background: #1a1a1a;
}

#timeline::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}

#timeline::-webkit-scrollbar-thumb:hover {
    background: #555;
}

#timeline-labels {
    width: 150px;
    flex-shrink: 0;
    background: #1a1a1a;
    border-right: 1px solid #333;
    z-index: 5;
    pointer-events: auto;
}

#timeline-canvas-wrapper {
    flex-grow: 1;
    position: relative;
    overflow: hidden;
    /* X overflow handled by timeline scale */
}

#timeline-static-canvas,
#timeline-ui-canvas {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    will-change: transform;
}

.timeline-row {
    height: 12px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    padding: 0 5px;
    border-bottom: 1px solid #2a2a2a;
    color: #b0b0b0;
    font-family: monospace;
    font-size: 11px;
    white-space: nowrap;
    cursor: default;
    user-select: none;
}

.timeline-label-text {
    pointer-events: none;
}

.timeline-row:hover {
    background: rgba(255, 255, 255, 0.25);
}

.timeline-row.selected {
    background: rgba(26, 109, 255, 0.35);
    color: #fff;
}

/*.timeline-row.alternate {
    background: rgba(255, 255, 255, 0.05);
}
*/

.timeline-row .expand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    cursor: pointer;
    font-size: 12px;
    color: #888;
    transition: transform 0.2s;
    align-self: stretch;
    padding: 0 6px;
}

.timeline-row .expand-icon.expanded {
    transform: rotate(90deg);
}

.timeline-row.child-id {
    padding-left: 20px;
    background: rgba(0, 0, 0, 0.2);
    font-size: 10px;
    color: #888;
}

.timeline-row.child-id.selected {
    background: rgba(26, 109, 255, 0.35);
    color: #fff;
}

.timeline-row.child-id:hover {
    background: rgba(255, 255, 255, 0.25);
}

.timeline-row.selected-object {
    padding-left: 20px;
    background: rgba(255, 165, 0, 0.20);
    font-size: 10px;
    color: #ffaa00;
    font-weight: bold;
    border-left: 2px solid #ff8800;
}

.timeline-row.selected-object.selected {
    background: rgba(255, 165, 0, 0.35);
    color: #ffcc00;
}

.timeline-row.selected-object:hover {
    background: rgba(255, 165, 0, 0.30);
}


.timeline-row .fit-icon {
    color: cyan;
    cursor: default;
    margin-right: 2px;
    font-size: 10px;
    padding: 0 2px;
}

.timeline-row .save-icon {
    margin-left: auto;
    cursor: default;
    font-size: 14px;
    padding: 0 2px;
}


#drag-divider {
    height: 9px;
    background: #444;
    cursor: ns-resize;
    width: 100%;
    flex: 0 0 auto;
    z-index: 100;
    touch-action: none;
}

#drag-divider:hover,
#drag-divider:active {
    background: #1a6dff;
}

#c2-left #drag-divider {
    background: #000;
}

#c2-left #drag-divider:hover,
#c2-left #drag-divider:active {
    background: #1a6dff;
}

/* C2 View */
#c2-layout {
    display: flex;
    flex-direction: row;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.c2-panel {
    overflow: auto;
    position: relative;
}

#c2-left {
    flex: 4 1 0; /* 80% */
    min-width: 100px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#c2-left-top {
    flex: 7 1 0; /* 70% */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #242424;
}

.c2-pane-heading-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    padding-right: 0;
}

.c2-map-tab-menu {
    display: flex;
    gap: 4px;
}

.c2-map-tab-btn {
    padding: 2px 8px;
    font-size: 0.75em;
    font-weight: 600;
    background: #333;
    color: #888;
    border: 1px solid #555;
    border-radius: 3px;
    cursor: pointer;
    text-transform: uppercase;
    line-height: 1.6;
}

.c2-pane-heading-bar .c2-pane-heading {
    flex: 1;
}

.c2-map-tab-btn.active {
    background: #0077DB;
    color: #fff;
    border-color: #0077DB;
}

.c2-map-tab-btn:hover:not(.active) {
    background: #444;
    color: #ccc;
}

#c2-map-area {
    flex: 1 1 0;
    display: flex;
    flex-direction: row;
    overflow: hidden;
    min-height: 0;
}

#c2-map-2d-wrap,
#c2-map-3d-wrap {
    flex: 1 1 0;
    overflow: hidden;
    position: relative;
    min-width: 0;
    min-height: 0;
    display: flex;
}

#c2-map-right-panel {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    min-height: 0;
}

#c2-map-video-wrap {
    flex: 1 1 0;
    overflow: hidden;
    position: relative;
    min-width: 0;
    min-height: 0;
}

#c2-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.c2-map-hdivider {
    flex: 0 0 9px;
    background: #000;
    cursor: row-resize;
    z-index: 10;
    touch-action: none;
}

.c2-map-hdivider:hover,
.c2-map-hdivider:active {
    background: #1a6dff;
}

#c2-content {
    display: grid;
    flex: 1 1 0;
    min-width: 0;
    min-height: 0;
    position: relative;
    overflow: hidden;
}

.c2-map-vdivider {
    flex: 0 0 9px;
    background: #000;
    cursor: col-resize;
    z-index: 10;
    touch-action: none;
}

.c2-map-vdivider:hover,
.c2-map-vdivider:active {
    background: #1a6dff;
}

#c2-left-bottom {
    flex: 3 1 0; /* 30% */
    display: flex;
    flex-direction: row;
    overflow: hidden;
}

.c2-lb-pane {
    flex: 1 1 0;
    overflow: auto;
    min-width: 240px;
    background: #242424;
}

#c2-lb-pane1 {
    flex: 3 1 0; /* 30% total = 60% of the pane1+pane2 half */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#c2-lb-pane1 .timeline {
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
}

#c2-lb-pane2 {
    flex: 2 1 0; /* 20% total = 40% of the pane1+pane2 half */
}

#c2-lb-pane3 {
    flex: 5 1 0; /* 50% total */
}

#c2-right {
    flex: 1 1 0; /* 20% */
    min-width: 60px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.c2-right-pane {
    flex: 1 1 0;
    overflow: auto;
    min-height: 60px;
    background: #242424;
}

/* Alerts pane: flex-column so the list scrolls and the button stays pinned at the bottom */
#c2-right-top {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#c2-right-top .c2-detection-list {
    flex: 1 1 0;
    overflow-y: auto;
}

/* .dark h3 in eds.min.css has specificity (0,1,1) and sets margin-top:24px.
   Use .dark .c2-pane-heading (0,2,0) to override it. */
.dark .c2-pane-heading {
    font-family: Ericsson Hilda;
    margin: 8px 12px 8px 8px;
    font-size: 1.1em;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #ddd;
}

#c2-right .c2-pane-heading,
.c2-lb-pane .c2-pane-heading,
#c2-left-top .c2-pane-heading {
    margin-left: 12px;
}

.c2-pane-menu-btn {
    background: transparent;
    border: none;
    color: #888;
    cursor: pointer;
    padding: 4px 6px;
    margin-right: 4px;
    font-size: 1rem;
    line-height: 1;
    border-radius: 3px;
    flex-shrink: 0;
}

.c2-pane-menu-btn:hover {
    color: #ddd;
    background: #333;
}

/* Override EDS min-width so timeline fits narrow panes */
.c2-lb-pane .timeline .entry .target,
#c2-status-dialog .timeline .entry .target,
#c2-log-dialog .timeline .entry .target {
    min-width: 0;
}

/* The EDS vertical timeline positions the dot at left:0.5rem and the connecting line at
   left:1.25rem. The intended fix is padding-left:2.25rem on .target — but our log entries
   use .c2-log-entry-header instead of .target, so apply the same indent there. */
#c2-log-dialog .timeline .entry.c2-log-entry {
    padding-left: 2.25rem;
}

/* EDS places the dot at top:1rem and the line at top:1.5rem, assuming .target has 1rem
   top padding. Our entries use 6px top padding, so override both to match our layout.
   Dot: 8px wide + 2px border = 10px total height; center = 6px + 5px = 11px from entry top.
   Line starts at dot center: top = 11px. */
#c2-log-dialog .timeline .entry.c2-log-entry::before {
    top: -1px;
}
#c2-log-dialog .timeline .entry.c2-log-entry::after {
    top: 6px;
}

/* Latest actions list */
#c2-actions-list .entry {
    cursor: default;
}
#c2-actions-list .entry[style*="cursor: pointer"]:hover {
    background: #252525;
}
.c2-action-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}
.c2-action-user {
    color: #666;
    font-size: 0.78em;
}
.c2-action-id {
    background: #1a3a4e;
    color: #4af;
    font-size: 0.75em;
    padding: 1px 5px;
    border-radius: 3px;
    font-family: monospace;
}

.c2-detection-list {
    list-style: none;
    margin: 0;
    padding: 0 0 8px;
    border-top: 1px solid #333;
}

/* .dark ul li in eds.min.css has specificity (0,1,2) and zeroes padding-left.
   Use .dark .c2-detection-row (0,2,0) to override it. */
.dark .c2-detection-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px 10px 12px;
    border-bottom: 1px solid #333;
}

.c2-detection-dot {
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.c2-detection-name {
    flex: 1 1 0;
    color: #ddd;
    font-size: 0.9em;
    letter-spacing: -0.025em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.c2-detection-time {
    flex-shrink: 0;
    color: #888;
    font-size: 0.8em;
    white-space: nowrap;
}

.c2-detection-track {
    flex-shrink: 0;
    color: #ddd;
    font-size: 0.85em;
    text-decoration: underline;
    cursor: pointer;
}

.c2-detection-track:hover {
    color: #fff;
}

.c2-detection-delete {
    flex-shrink: 0;
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 2px 4px;
    font-size: 0.95em;
    line-height: 1;
    border-radius: 3px;
}

.c2-detection-delete:hover {
    color: #ddd;
    background: #333;
}

.c2-detection-row--dragging {
    opacity: 0.4;
}

.c2-detection-row--drag-over {
    border-top: 2px solid #888;
}

.c2-detection-row--selected {
    background: rgba(68, 170, 255, 0.08);
    outline: 1px solid #4af;
    outline-offset: -1px;
}

.c2-detection-user {
    flex-shrink: 0;
    color: #666;
    font-size: 0.8em;
    white-space: nowrap;
}

.c2-detection-btn-bar {
    flex-shrink: 0;
    padding: 8px 12px;
    background: #222;
    text-align: right;
}

.c2-create-detection-btn {
    width: 33%;
    margin: 0 0 10px 0;
}

#c2-perimeter-altmax-slider,
#c2-perimeter-altmin-slider {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: #181818;
    border-radius: 3px;
    width: calc(100% - 2px) !important; /* fighting EDS input[type=range] width: 100% overflowing parent by border width */
}

#c2-perimeter-altmax-slider::-webkit-slider-thumb,
#c2-perimeter-altmin-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #008cff;
    border-radius: 50%;
    cursor: pointer;
}

#c2-perimeter-altmax-slider::-moz-range-thumb,
#c2-perimeter-altmin-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #008cff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

#c2-perimeter-altmax-slider::-webkit-slider-thumb:hover,
#c2-perimeter-altmin-slider::-webkit-slider-thumb:hover {
    background: #0077db;
}

#c2-perimeter-altmax-slider::-moz-range-thumb:hover,
#c2-perimeter-altmin-slider::-moz-range-thumb:hover {
    background: #0077db;
}


/* EDS .dialog z-index is 100, below Leaflet panes (up to 1000).
   Override for C2 dialogs so they appear above the map. */
#c2-settings-dialog,
#c2-perimeter-dialog,
#c2-detection-dialog,
#c2-log-dialog,
#c2-status-dialog,
#c2-help-dialog,
#c2-syscon-dialog,
#c2-data-shared-dialog,
#c2-conn-status-dialog,
#c2-values-dialog,
#c2-microdoppler-dialog,
#c2-lobby-dialog {
    z-index: 1500;
}

/* Push C2 dialog close buttons slightly outside the content box */
#c2-settings-dialog .top .right,
#c2-perimeter-dialog .top .right,
#c2-detection-dialog .top .right,
#c2-log-dialog .top .right,
#c2-status-dialog .top .right,
#c2-help-dialog .top .right,
#c2-syscon-dialog .top .right,
#c2-data-shared-dialog .top .right,
#c2-conn-status-dialog .top .right,
#c2-values-dialog .top .right,
#c2-lobby-dialog .top .right {
    margin-top: -3px;
    margin-right: -3px;
}

/* Override EDS styles for map popup radio label*/
.c2-track-popup .form-element label {
    font-size: 12px !important; /* fighting EDS .form-element label font-size */
}

.c2-lobby-group-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.c2-lobby-group-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 4px;
    background: rgba(255,255,255,0.04);
}

.c2-lobby-group-title  { font-weight: 600; min-width: 60px; }
.c2-lobby-group-status { flex: 1; font-size: 0.85em; opacity: 0.65;
                         white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.c2-lobby-mqtt-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.c2-lobby-lamp {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #666;
    transition: background 0.3s;
}
.c2-lobby-lamp--idle       { background: #666; }
.c2-lobby-lamp--connecting { background: #f90; animation: c2-lobby-pulse 1s infinite; }
.c2-lobby-lamp--ok         { background: #4c8; }
.c2-lobby-lamp--error      { background: #e44; }

@keyframes c2-lobby-pulse {
    0%   { opacity: 1; }
    50%  { opacity: 0.4; }
    100% { opacity: 1; }
}

.c2-lobby-lamp-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.c2-lobby-lamp-label {
    font-size: 0.8em;
    opacity: 0.6;
    min-width: 32px;
}

.c2-lobby-lamp-text {
    font-size: 0.85em;
    opacity: 0.75;
}

.c2-lobby-notice {
    margin: 14px 0 0;
    font-size: 0.85em;
    opacity: 0.6;
    font-style: italic;
    border-left: 2px solid rgba(255,255,255,0.2);
    padding-left: 10px;
}

/* Perimeter dialog: widen slightly so all four preset links fit on one row */
#c2-perimeter-dialog > .content {
    min-width: 460px;
}
/* Prevent sliders and other full-width elements from creating a horizontal scrollbar */
#c2-perimeter-dialog > .content > .body {
    overflow-x: hidden;
}

/* Visible fieldset label (EDS hides <legend> visually) */
.c2-field-label {
    font-size: 0.8em;
    opacity: 0.6;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 2px;
}

/* Perimeter dialog preset links — inline so they wrap naturally */
.c2-preset-link {
    color: #5ba3ff;
    text-decoration: none;
    font-size: 0.9em;
    white-space: nowrap;
    margin-right: 14px;
}
.c2-preset-link:last-of-type {
    margin-right: 0;
}
.c2-preset-link:hover {
    color: #85c0ff;
    text-decoration: underline;
}


.c2-detection-level-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}

.c2-improved-tracking-row {
    display: flex;
    align-items: center;
    padding: 6px 12px 4px;
    border-bottom: 1px solid #333;
    color: #ccc;
    font-size: 13px;
    position: sticky;
    left: 0;
}

.c2-improved-tracking-row label {
    cursor: pointer;
    user-select: none;
}

.c2-improved-tracking-row label::before {
    margin-right: 8px !important;
}

.c2-tracked-filter-bar {
    display: flex;
    gap: 2px;
    padding: 4px 12px 2px;
    border-bottom: 1px solid #333;
}

.c2-tracked-filter-btn {
    padding: 2px 8px 4px;
    font-size: 0.75em;
    font-weight: 400;
    background: transparent;
    color: #888;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    cursor: pointer;
    line-height: 1.6;
}

.c2-tracked-filter-btn.active {
    background: transparent;
    color: #ccc;
    border-bottom: 2px solid #0077DB;
}

.c2-tracked-filter-btn:hover:not(.active) {
    background: transparent;
    color: #aaa;
}

.c2-tracked-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85em;
    color: #ddd;
}

.c2-tracked-table thead tr {
    border-bottom: 1px solid #444;
}

.c2-tracked-table th {
    padding: 6px 8px;
    text-align: left;
    color: #888;
    font-weight: 400;
    white-space: nowrap;
    background: transparent;
}

.c2-tracked-table th:first-child,
.c2-tracked-table td:first-child {
    padding-left: 12px;
}

.c2-tracked-table td {
    padding: 10px 8px;
    white-space: nowrap;
}

.c2-tracked-table tbody tr {
    border-bottom: 2px solid #222;
}

.c2-tracked-row--dragging {
    opacity: 0.4;
}

.c2-tracked-row--drag-over {
    border-top: 2px solid #888;
}

.c2-tracked-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.c2-syscon-grid {
    display: grid;
    max-width: 420px;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 4px 8px 8px;
}

.c2-syscon-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start; /*space-between; */
    gap: 8px;
    padding: 4px 8px;
    min-height: 32px;
}

.c2-syscon-label {
    margin-left: 4px;
    font-size: 0.75em;
    color: #ccc;
    letter-spacing: 0.04em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.c2-syscon-item .switch {
    flex-shrink: 0;
    margin-top: 3px;
    display: inline-flex;
    align-items: center;
    height: 20px;
}

#c2-right-bottom .c2-pane-heading-bar,
#c2-right-bottom .c2-tracked-filter-bar {
    position: sticky;
    left: 0;
}

.c2-selection-body {
    display: grid;
    /*grid-template-columns: minmax(50px, 1fr) minmax(55px, 1fr) minmax(80px, 1fr) auto auto;*/
    grid-template-columns: minmax(160px, 1fr) minmax(160px, 1fr) minmax(160px, 1fr) minmax(160px, 1fr) minmax(160px, 1fr);
    gap: 12px;
    padding: 8px 12px 12px;
    min-height: 0;
    max-width: 1200px;
    align-items: start;
}

.c2-sel-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 220px;
    min-width: 0;
}

.c2-selection-stats {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.c2-stat-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 8px;
}

.c2-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.c2-stat-label {
    font-size: 0.75em;
    color: #888;
}

.c2-stat-value {
    font-size: 0.9em;
    color: #ddd;
}

.c2-selection-image {
    flex: 0 0 auto;
    /*width set so it does not left align*/
    width: 220px;
    height: 130px;
    background: #242424;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden;
}

.c2-selection-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.c2-selection-actions {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 160px;
    max-width: 220px;
    margin-right: 8px;
}

.c2-selection-actions .btn {
    width: 100%;
    text-align: center;
    margin-left: 0 !important; /* fighting EDS .dark .btn ~ .btn { margin-left: 8px } */
}

/* Highlighted row when a track is selected in the Tracked Objects table */
.c2-tracked-table tbody tr.c2-tracked-selected {
    outline: 1px solid #4af;
    outline-offset: -1px;
}

.c2-tracked-table tbody tr:hover {
    background: #2a2a2a;
}

/* Classification text badge in table rows */
.c2-class-badge {
    flex: 1 1 0;
    font-size: 0.85em;
    color: #bbb;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Classification dropdown in the Selected Object pane */
.c2-classification-select {
    width: 100%;
    background: #222;
    color: #ddd;
    border: 1px solid #444;
    border-radius: 3px;
    padding: 4px 6px;
    font-size: 0.85em;
    cursor: pointer;
    margin-top: 2px;
}

.c2-classification-select:focus {
    outline: none;
    border-color: #4af;
}

/* Heading arrow canvas in the selection image area */
#c2-heading-canvas {
    display: block;
}

/* Note textarea in the Selected Object pane — constrained height to keep pane compact */
#c2-sel-note textarea {
    width: 100%;
    height: 54px;
    min-height: 32px;
    resize: vertical;
    box-sizing: border-box;
}

#c2-map-draw-controls {
    position: absolute;
    bottom: 1px;
    right: 0px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 6px;
    pointer-events: auto;
}

.c2-h-divider {
    flex: 0 0 4px;
    background: #000;
    cursor: row-resize;
    z-index: 1490;
    touch-action: none;
}

.c2-h-divider:hover,
.c2-h-divider:active {
    background: #000;
    /* Hiding the activation color, should not be seen during the demo */
    /* background: #1a6dff; */
}

@media (hover: none) {
    .c2-h-divider {
        background: #000;
    }
}

.c2-divider {
    flex: 0 0 4px;
    background: #000;
    cursor: col-resize;
    z-index: 1500;
    touch-action: none;
}

.c2-divider:hover,
.c2-divider:active {
    background: #000f;
    /* Hiding the activation color, should not be seen during the demo */
    /* background: #1a6dff; */
}

@media (hover: none) {
    .c2-divider {
        background: #000;
    }
}

/* Notch support — dividers become positioning contexts */
.c2-divider,
.c2-h-divider {
    position: relative;
}

/* Notch pill button — shared base */
.c2-panel-notch {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 8px;
    cursor: pointer;
    z-index: 1510;
    padding: 0;
    color: #bbb;
    transition: background 0.15s, color 0.15s;
    pointer-events: all;
}

.c2-panel-notch:hover {
    background: #1a6dff;
    color: #fff;
    border-color: #1a6dff;
}

.c2-panel-notch .icon {
    font-size: 16px;
}

/* Vertical divider notch: tall pill, centered on divider strip */
.c2-panel-notch--vert {
    width: 20px;
    height: 40px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Horizontal divider notch: wide pill, centered on divider strip */
.c2-panel-notch--horiz {
    width: 40px;
    height: 20px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

/* Internal lb dividers don't need high z-index — only outer panel-edge dividers do */
#c2-lb-div1,
#c2-lb-div2 {
    z-index: 10;
}

/* Collapsed: shift pill 5px inside the screen edge */
.c2-divider--collapsed .c2-panel-notch--vert {
    transform: translate(calc(-100% - 5px), -50%);
}

.c2-h-divider--collapsed .c2-panel-notch--horiz {
    transform: translate(-50%, calc(-100% - 5px));
}

/* Collapsed state: zero-width/height, notch floats outside via overflow: visible */
.c2-divider--collapsed {
    flex: 0 0 0px !important; /* fighting .c2-divider flex: 0 0 6px */
    background: transparent !important; /* fighting .c2-divider background */
    cursor: default !important; /* fighting .c2-divider cursor: col-resize */
    overflow: visible !important; /* fighting .c2-divider overflow: hidden */
}

.c2-divider--collapsed:hover,
.c2-divider--collapsed:active {
    background: transparent !important; /* fighting .c2-divider:hover background highlight */
}

.c2-h-divider--collapsed {
    flex: 0 0 0px !important; /* fighting .c2-h-divider flex: 0 0 6px */
    background: transparent !important; /* fighting .c2-h-divider background */
    cursor: default !important; /* fighting .c2-h-divider cursor: row-resize */
    overflow: visible !important; /* fighting .c2-h-divider overflow: hidden */
}

.c2-h-divider--collapsed:hover,
.c2-h-divider--collapsed:active {
    background: transparent !important; /* fighting .c2-h-divider:hover background highlight */
}

/* Override EDS close button icon for leaflet popup */
#c2-content .leaflet-popup-close-button::after {
    content: none !important; /* fighting EDS button::after icon injection that renders on top of Leaflet's × */
}

/* Place Search Bar */

.c2-place-search-wrapper {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    align-items: center;
    z-index: 800;
}

.c2-place-search-wrapper .c2-place-search {
    min-width: 200px;
    padding-right: 32px;
    text-overflow: ellipsis;
    overflow: hidden;
}

.c2-place-search-wrapper .icon-search {
    position: absolute;
    right: 20px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    pointer-events: none;
}


/* Google Places autocomplete dropdown */
.pac-container {
    background: #242424;
    z-index: 800;
    border: 1px solid #3c3c3c;
    font-family: inherit;
}
.pac-item {
    border-top: 1px solid #3c3c3c;
    color: #b0b0b0;
    padding: 8px 12px;
    cursor: pointer;
    line-height: 1.4;
}
.pac-item:first-child { border-top: none; }
.pac-item:hover,
.pac-item-selected { background: #333; }
.pac-item-query { color: #e0e0e0; font-weight: 500; }
.pac-matched { color: #4da6ff; }
.pac-icon,
.pac-logo::after { display: none; }

.placeholder-tab {
    padding: 0px;
    color: #888;
    background: radial-gradient(circle, #404050 0%, #303238 100%);
    display: none;
    overflow: auto;
}

.settings-tab {
    padding: 0px;
    color: #eee;
    background: radial-gradient(circle, #404050 0%, #303238 100%);
    display: none;
    overflow: auto;
}

.status-tab {
    padding: 0px;
    color: #eee;
    background: radial-gradient(circle, #404050 0%, #303238 100%);
    display: none;
}

/* In the Status tab the outer region scrolls, so the mqtt-explorer container
   and its tree-view must grow to content height rather than scroll internally. */
.status-tab #mqtt-explorer.mqtt-explorer-container {
    height: auto;
    overflow: visible;
    flex-shrink: 0;
}

.status-tab #mqtt-explorer .mqtt-tree-view {
    overflow-y: visible;
    flex: none;
}

.MQTT-tab {
    padding: 0px;
    color: #333;
    background: #f0f0f0;
    display: none;
}

.placeholder-tab.active {
    display: block;
}

h1 {
    margin-top: 0;
    font-size: 300%;
    font-weight: 400;
    font-family: 'Ericsson Hilda', sans-serif;
}

/* MQTT Explorer */
.mqtt-explorer-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #1a1a1a;
    color: #eee;
    font-family: monospace;
    overflow: hidden;
}

.mqtt-tree-view {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.mqtt-topic-item {
    cursor: pointer;
    padding: 2px 0;
    white-space: nowrap;
}

.mqtt-topic-item:hover {
    background-color: #2a2a2a;
}

.mqtt-topic-name {
    display: inline-block;
}

.mqtt-topic-message {
    color: #aaa;
    font-size: 0.9em;
    margin-left: 10px;
    display: inline-block;
    max-width: 500px;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
}

.mqtt-topic-children {
    margin-left: 20px;
    border-left: 1px solid #333;
}

.mqtt-expand-icon {
    display: inline-block;
    width: 12px;
    text-align: center;
    margin-right: 5px;
    font-weight: bold;
}

.mqtt-message-panel {
    height: 50px;

    padding: 10px;
    background: #141414;
    overflow-y: auto;
}

.mqtt-message-panel h3 {
    margin-top: 0;
    font-size: 14px;
    color: #fff;
}

.mqtt-raw-message {
    white-space: pre-wrap;
    word-break: break-all;
    color: #0f0;
}

/* Fade in animation */
.fade-in {
    animation: fadeEffect 0.35s forwards;
}

@keyframes fadeEffect {
    from {
        opacity: 0.3;
    }

    to {
        opacity: 1;
    }
}

.mqtt-explorer-divider {
    height: 5px;
    background: #444;
    cursor: ns-resize;
    flex: 0 0 auto;
    z-index: 100;
}

.mqtt-explorer-divider:hover {
    background: #1a6dff;
}

#mqtt-drop-zone {
    border: 2px dashed #aaa;
    border-radius: 10px;
    padding: 40px;
    text-align: center;
    color: #aaa;
    font-size: 1.2em;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.05);
}

#mqtt-drop-zone.dragover {
    border-color: #1a6dff;
    background: rgba(26, 109, 255, 0.1);
    color: #fff;
    box-shadow: 0 0 10px rgba(26, 109, 255, 0.3);
}

#import-data-btn {
    margin-bottom: 20px;
}

#mqtt-file-list {
    margin-top: 10px;
}

.mqtt-file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 5px;
    color: #eee;
    font-family: monospace;
    cursor: pointer;
    transition: background 0.2s;
}

.mqtt-file-item:hover {
    background: rgba(255, 255, 255, 0.15);
}

.mqtt-file-remove {
    cursor: pointer;
    color: #aaa;
    margin-left: 10px;
    font-weight: bold;
    padding: 8px 12px;
}

.mqtt-file-remove:hover {
    color: #ff4444;
}

/* Splash Screen */
#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 70vh;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    background: transparent;
    pointer-events: none;
    /* Clicks pass through */
    animation: splashContainerFadeOut 1s forwards 6s;
}

#splash-screen img {
    width: 50%;
    max-height: 50%;
    object-fit: contain;
    transform: scale(1);
    animation:
        splashLogoGrow 6s linear forwards,
        splashLogoFadeOut 5s linear 1s forwards;
}

@keyframes splashLogoGrow {
    from {
        transform: scale(1);
    }

    to {
        transform: scale(1.214);
    }
}

@keyframes splashLogoFadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@keyframes splashContainerFadeOut {
    to {
        visibility: hidden;
        opacity: 0;
    }
}

.btn-disabled-visual {
    filter: grayscale(100%);
    opacity: 0.6;
}

/* Touch device support */
#map3d-canvas {
    touch-action: none;
}

/* On touch devices show dividers slightly brighter so they're more discoverable */
@media (hover: none) {
    .grid-divider-v,
    .grid-divider-h {
        background: #555;
    }
    #drag-divider {
        background: #555;
    }
}

/* ── Mobile / tablet fullscreen navigation ───────────────────────────────────
   Applied when body has the .mobile-fs class (touch device in fullscreen /
   standalone PWA mode).  The tab-bar is hidden; a floating hamburger button
   takes its place.
*/
body.mobile-fs #tab-bar {
    display: none;
}

/* The floating hamburger button shown in mobile fullscreen.
   For the Maps tab it is rendered as a Leaflet control (see maps.js), so the
   fixed-position version below is automatically hidden by the .in-map-control
   modifier that maps.js toggles.  For every other tab it stays fixed. */
#mobile-tab-btn {
    display: none; /* hidden until mobile-fs */
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 8px);
    right: 10px;
    z-index: 99998;
    background: rgba(40, 40, 40, 0.92);
    color: #fff;
    border: 1px solid #666;
    border-radius: 6px;
    font-size: 20px;
    line-height: 1;
    padding: 6px 10px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.6);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body.mobile-fs #mobile-tab-btn {
    display: block;
}

/* Hide the fixed button when the maps tab is active — the Leaflet control
   renders its own copy inside the map corner. */
body.mobile-fs.on-tab-maps #mobile-tab-btn {
    display: none;
}

/* Mobile tab selection popup */
#mobile-tab-menu {
    display: none;
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 50px);
    right: 10px;
    z-index: 99999;
    background: #2a2a2a;
    border: 1px solid #555;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.7);
    flex-direction: column;
    min-width: 170px;
    overflow: hidden;
}

#mobile-tab-menu.open {
    display: flex;
}

#mobile-tab-menu button {
    background: none;
    border: none;
    border-bottom: 1px solid #3a3a3a;
    color: #ccc;
    padding: 13px 18px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    text-transform: uppercase;
    text-align: left;
    width: 100%;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

#mobile-tab-menu button:last-child {
    border-bottom: none;
}

#mobile-tab-menu button:hover,
#mobile-tab-menu button:active {
    background: #444;
    color: #fff;
}

#mobile-tab-menu button.active {
    color: #fff;
    background: #555;
    border-left: 3px solid #1a6dff;
}

/* Leaflet-hosted mobile hamburger (inside map[0] topright control).
   Leaflet uses floats for controls (not flex). By default each control has
   clear:both, which stacks them vertically. Override clear so both controls
   float right on the SAME row: hamburger to the left, eye to the right. */
body.mobile-fs .leaflet-top.leaflet-right .leaflet-control {
    clear: none;
}

.mobile-map-nav-control {
    margin-top: 10px !important; /* fighting Leaflet .leaflet-control margin reset */
    margin-right: 4px !important; /* fighting Leaflet .leaflet-control margin reset; small gap between hamburger and eye */
    display: none; /* hidden until mobile-fs; avoids pushing the eye icon down */
}

body.mobile-fs .mobile-map-nav-control {
    display: block;
}

.mobile-map-nav-btn {
    background: rgba(40, 40, 40, 0.92);
    color: #fff;
    border: 1px solid #666;
    border-radius: 6px;
    font-size: 20px;
    line-height: 1;
    padding: 6px 10px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.6);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    display: none; /* hidden until mobile-fs */
}

body.mobile-fs .mobile-map-nav-btn {
    display: block;
}

/* ── 3D Map touch controls ───────────────────────────────────────────────────
   Shown on touch devices (pointer: coarse) regardless of fullscreen mode.
   Left-anchored so they don't overlap the bottom-right legend.             */
#map3d-touch-controls {
    display: none;
    position: absolute;
    bottom: 24px;
    left: 16px;
    z-index: 10001; /* above legend (10000) */
    pointer-events: none; /* children opt back in */
    flex-direction: row;
    align-items: flex-end;
    gap: 12px;
}

@media (pointer: coarse) {
    #map3d-touch-controls {
        display: flex;
    }
}

.map3d-touch-btn {
    pointer-events: auto;
    background: rgba(30, 30, 30, 0.75);
    color: #fff;
    border: 1px solid rgba(150, 150, 150, 0.5);
    border-radius: 8px;
    font-size: 18px;
    line-height: 1;
    min-width: 52px;
    min-height: 52px;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.map3d-touch-btn:active {
    background: rgba(80, 120, 200, 0.85);
}

/* D-pad grid */
#map3d-dpad {
    display: grid;
    grid-template-areas:
        ". up ."
        "left . right"
        ". down .";
    grid-template-columns: 52px 52px 52px;
    grid-template-rows: 52px 52px 52px;
    gap: 4px;
}

#map3d-btn-w { grid-area: up; }
#map3d-btn-a { grid-area: left; }
#map3d-btn-s { grid-area: down; }
#map3d-btn-d { grid-area: right; }

/* Fly up/down column */
#map3d-fly-btns {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#map3d-fly-btns .map3d-touch-btn {
    font-size: 13px;
    min-width: 56px;
}

/* Ground raise/lower column */
#map3d-ground-btns {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#map3d-ground-btns .map3d-touch-btn {
    font-size: 13px;
    min-width: 62px;
}

/* ── EDS integration overrides ──────────────────────────────────────────────
   Ensure EDS components render correctly against the app's dark backgrounds. */

/* Settings tab h2 headings: EDS dark base sets color:#fff which is correct.
   Remove any residual explicit color so EDS theme wins. */
#tab-settings h2 {
    color: #fff;
    font-size: 18px;
    font-weight: 500;
}

/* EDS .btn resets some margin; restore a sensible top margin for the Save button */
#tab-settings .btn {
    margin-top: 8px;
}

/* Ensure nav tab buttons keep their custom appearance when .dark is on body
   (EDS .dark base styles reset button colors — pin ours explicitly) */
nav#tab-bar button {
    font-family: 'Ericsson Hilda', Helvetica, Arial, sans-serif;
}

/* Brand logo + app name at the left edge of the tab bar */
#tab-bar-brand {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px 0 18px; /* 18px = nav's 10px left padding + original 8px brand indent */
    margin-left: -10px;     /* cancel nav's left padding so hit area reaches screen edge */
    align-self: stretch;    /* fill full nav height */
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    color: #fff;
}

#app-state-menu {
    left: 4px;
    right: auto;
}

#app-state-menu button {
    display: flex;
    align-items: center;
    text-align: left;
}

#app-state-menu button::before {
    content: '';
    display: inline-block;
    width: 18px;
    flex-shrink: 0;
}

#app-state-menu button.selected::before {
    content: '✓';
}

/* C2 scenario selector — same checkmark pattern as #app-state-menu */
#c2-scenario-menu button {
    display: flex;
    align-items: center;
    text-align: left;
}

#c2-scenario-menu button::before {
    content: '';
    display: inline-block;
    width: 18px;
    flex-shrink: 0;
}

#c2-scenario-menu button.selected::before {
    content: '✓';
}

@keyframes c2-spin { to { transform: rotate(360deg); } }

.c2-loading-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: c2-spin 0.75s linear infinite;
    vertical-align: middle;
    margin-right: 4px;
}

/* Restore native appearance for wrapped radio buttons (checkboxes have been migrated
   to the EDS sibling pattern; radio buttons in maps.js popup and Settings tab still
   use the wrapping pattern <label><input></label> and need this workaround). */
.dark label > input[type="radio"] {
    position: static;
    width: auto;
    height: auto;
    padding: revert;
    margin: revert;
    opacity: 1;
    pointer-events: auto;
    display: inline-block;
    appearance: auto;
    -webkit-appearance: auto;
    background: revert;
    border: revert;
    accent-color: #1a6dff;
}

/* ── Extracted inline-style classes ─────────────────────────────────────────
   CSS classes replacing repeated inline style="" attributes from index.html.
   Grouped by visual pattern. */

/* White text header overlaid on shader canvas backgrounds */
.shader-title {
    position: relative;
    z-index: 1;
    color: #ffffff;
    margin: 0px 0px 0px 40px;
    text-shadow: 2px 3px 5px rgba(0, 0, 0, 1.0);
    white-space: nowrap;
}

/* Full-size canvas positioned behind shader-title elements */
.shader-canvas-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Container holding a shader canvas + overlaid title */
.shader-container {
    width: 100%;
    height: 120px;
    flex-shrink: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: left;
    overflow: hidden;
}

/* Dev-only tab button color */
nav .dev-tab {
    color: #7090d0;
}

/* Standard inner padding for tab content areas */
.content-padding {
    padding: 40px;
}

/* ── Settings tab form classes ──────────────────────────────────────────── */

/* Spacing between form field groups */
.form-group {
    margin-bottom: 15px;
}

/* Section divider with top border */
.settings-section {
    margin-top: 30px;
    border-top: 1px solid #444;
    padding-top: 20px;
}

/* Block-level form labels */
.form-label-block {
    display: block;
    margin-bottom: 5px;
}

/* Inline flex label with pointer (for checkbox/radio rows) */
.form-label-flex {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

/* Wider input wrappers for MQTT settings — override EDS inline-block shrink */
.input-narrow {
    display: block;
    width: 60%;
    min-width: 400px;
}

/* Force MQTT broker URL inputs wider — EDS .input-wrapper is inline-block which shrinks to fit */
#mqtt-url,
#c2-lobby-url,
#c2-settings-url {
    width: 400px;
}


/* Muted hint text below form controls */
.form-hint {
    color: #888;
    font-size: 12px;
    margin-top: 4px;
}

/* Validation error message (hidden by default, shown by JS) */
.form-error {
    color: #e06060;
    font-size: 0.85em;
    margin-top: 4px;
    display: none;
}

/* ── Dialog classes ─────────────────────────────────────────────────────── */

/* Uppercase section header inside C2 dialogs */
.dialog-section-header {
    margin: 12px 0 4px;
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.7;
}

/* Small color indicator dot for perimeter alert levels */
.c2-alert-level-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: 4px;
    vertical-align: middle;
    border-radius: 2px;
}

/* ── Metrics tab styles (migrated from inline <style>) ──────────────────
   All selectors scoped to #tab-metrics to avoid leaking into global styles. */

#tab-metrics .container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

#tab-metrics h1 {
    color: #333;
    text-align: center;
    margin-bottom: 30px;
}

#tab-metrics .status {
    text-align: center;
    margin-bottom: 20px;
    padding: 10px;
    border-radius: 4px;
    font-weight: bold;
}

#tab-metrics .status.connected {
    background-color: #d4edda;
    color: #155724;
}

#tab-metrics .status.disconnected {
    background-color: #f8d7da;
    color: #721c24;
}

#tab-metrics table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

#tab-metrics th,
#tab-metrics td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

#tab-metrics th {
    background-color: #f8f9fa;
    font-weight: bold;
}

#tab-metrics .sensor-name {
    font-weight: bold;
    color: #495057;
}

#tab-metrics .error-value {
    font-family: monospace;
    color: #007b7f;
    font-size: 16px;
    font-weight: bold;
}

#tab-metrics .tracked-true {
    color: #28a745;
    font-weight: bold;
}

#tab-metrics .tracked-false {
    color: #dc3545;
    font-weight: bold;
}

#tab-metrics .last-update {
    font-size: 0.9em;
    color: #6c757d;
    text-align: center;
    margin-top: 20px;
}

#tab-metrics button {
    background-color: #1a6dff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    margin: 10px;
}

#tab-metrics button:hover {
    background-color: #0056b3;
}

#tab-metrics button:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}

/* ── Status/Archive JSON syntax highlighting (migrated from inline <style>) ──
   These generic class names (.string, .number, etc.) are set by JS formatJSON(). */

pre {
    font-family: monospace;
}

.string {
    color: white;
}

.number {
    color: darkorange;
}

.boolean {
    color: blue;
}

.null {
    color: magenta;
}

.key {
    color: grey;
}

.spoiler-toggle {
    background: #d0d000;
    padding: 0 20px 0 20px;
}

/* C2 detection alert toast */
.c2-toast {
    padding: 8px 16px;
    border-radius: 4px;
    color: #fff;
    font-size: 0.8rem;
    pointer-events: auto;
    animation: c2-toast-in 0.3s ease, c2-toast-out 0.3s ease 4.7s forwards;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
@keyframes c2-toast-in {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes c2-toast-out {
    from { opacity: 1; }
    to   { opacity: 0; }
}
/* C2 detection pane flash */
@keyframes c2-pane-flash {
    0%, 100% { box-shadow: none; }
    50% { box-shadow: inset 0 0 12px 2px var(--flash-color, #ff4444); }
}
.c2-pane-flash {
    animation: c2-pane-flash 0.6s ease 2;
}
/* ── C2 Log Dialog — enhanced entries ───────────────────────── */
.c2-log-entry {
    padding: 6px 0;
    border-bottom: 1px solid #1a2438;
}
.c2-log-entry-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
}
.c2-log-time {
    font-size: 0.78em;
    color: #5a7090;
    font-family: monospace;
    flex-shrink: 0;
}
.c2-log-type-tag {
    font-size: 0.68em;
    font-family: monospace;
    border: 1px solid #4af;
    color: #4af;
    padding: 1px 5px;
    border-radius: 3px;
    flex-shrink: 0;
    letter-spacing: 0.04em;
}
.c2-log-expand-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #5a7090;
    padding: 0 4px;
    margin-left: auto;
    flex-shrink: 0;
    transition: color 0.15s, transform 0.15s;
}
.c2-log-expand-btn:hover { color: #8baac8; }
.c2-log-expand-btn--open { transform: rotate(90deg); color: #8baac8; }
.c2-log-expand-btn .icon { font-size: 0.9em; }

/* Detail panel */
.c2-log-detail-panel {
    background: rgba(10, 20, 40, 0.55);
    border-left: 2px solid #1a3a5e;
    margin: 4px 0 4px 12px;
    padding: 8px 10px;
    border-radius: 0 4px 4px 0;
}
.c2-log-detail-dl {
    display: grid;
    grid-template-columns: max-content 1fr;
    column-gap: 14px;
    row-gap: 3px;
    margin: 0;
    font-size: 0.82em;
}
.c2-log-detail-dl dt {
    color: #5a7090;
    white-space: nowrap;
}
.c2-log-detail-dl dd {
    margin: 0;
    color: #c8d8e8;
    word-break: break-all;
}
.c2-log-detail-section {
    grid-column: 1 / -1;
    color: #3a6090 !important; /* fighting EDS .dark inherited color */
    font-size: 0.88em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 6px;
    border-top: 1px solid #1a2a3a;
    padding-top: 4px;
}

/* Full snapshot section */
.c2-log-snapshot-section {
    padding: 10px 0 0;
    border-top: 1px solid #1a2438;
    list-style: none;
}
.c2-log-snapshot-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    list-style: none;
}
.c2-log-snapshot-summary::-webkit-details-marker { display: none; }
.c2-log-snapshot-summary::marker { content: none; }
.c2-log-snapshot-summary {
    cursor: pointer;
    color: #5a7090;
    font-size: 0.82em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    user-select: none;
    padding: 4px 0;
}
.c2-log-snapshot-summary:hover { color: #8baac8; }
.c2-log-snapshot-arrow {
    font-size: 0.9em;
    transition: transform 0.15s;
    flex-shrink: 0;
}
details[open] > .c2-log-snapshot-summary .c2-log-snapshot-arrow {
    transform: rotate(90deg);
}
.c2-log-snapshot-refresh {
    font-size: 0.78em !important; /* fighting EDS .btn font-size */
    padding: 1px 8px !important; /* fighting EDS .btn padding */
    height: auto !important; /* fighting EDS .btn fixed height */
    min-height: 0 !important; /* fighting EDS .btn min-height */
}

/* JSON tree */
.c2-log-json-tree {
    font-family: monospace;
    font-size: 0.78em;
    padding: 6px 0;
    color: #c8d8e8;
    overflow-x: auto;
}
.c2-log-json-tree details { margin-left: 14px; }
.c2-log-json-tree summary { cursor: pointer; color: #5a8ab8; list-style: disclosure-closed; }
.c2-log-json-tree details[open] > summary { list-style: disclosure-open; }
.c2-log-json-dl {
    display: grid;
    grid-template-columns: max-content 1fr;
    column-gap: 10px;
    row-gap: 1px;
    margin: 2px 0 2px 14px;
}
.c2-log-json-key { color: #7baad8; white-space: nowrap; }
.c2-log-json-val { margin: 0; }

/* --- Track Detail Side Pane (non-C2 views) --- */

#tab-maps.active,
#tab-3dmap.active {
    flex-direction: row;
}

.maps-main-col {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    min-width: 100px;
    overflow: hidden;
}

#track-detail-pane {
    flex: 0 0 0px;
    overflow: hidden;
    min-width: 0;
    background: #242424;
    display: flex;
    flex-direction: column;
}

.td-heading-bar {
    flex: 0 0 auto;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 600;
    color: #ccc;
    background: #1a1a1a;
    border-bottom: 1px solid #333;
    white-space: nowrap;
}

.td-body {
    flex: 1 1 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 12px;
}

.td-stat {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    font-size: 13px;
}

.td-label {
    color: #888;
    white-space: nowrap;
    margin-right: 8px;
}

.td-value {
    color: #ddd;
    text-align: right;
    font-family: monospace;
    font-size: 12px;
    word-break: break-all;
}

.td-hr {
    border: 0;
    border-top: 1px solid #444;
    margin: 6px 0;
}

.td-section-label {
    color: #888;
    font-size: 12px;
    margin: 8px 0 4px 0;
}

#td-heading-canvas,
#td-node-bearing-canvas {
    display: block;
    margin: 0 auto 8px auto;
    background: transparent;
}

.td-node-color-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 0;
    font-size: 13px;
    color: #ddd;
}

.td-node-color-row input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.td-node-color-row label {
    cursor: pointer;
    user-select: none;
}

#td-node-color-picker-wrap {
    margin: 6px auto 8px auto;
    width: 120px;
}

#td-node-color-picker {
    display: block;
    cursor: crosshair;
    border-radius: 50%;
}

.td-covariance-matrix {
    width: 100%;
    border-collapse: collapse;
    font-family: monospace;
    font-size: 11px;
    color: #ccc;
    margin-bottom: 4px;
}

.td-covariance-matrix td {
    text-align: right;
    padding: 1px 4px;
    border: 1px solid #383838;
    white-space: nowrap;
}

.td-chart-wrap {
    position: relative;
    width: 100%;
    margin: 0 0 8px 0;
}

.td-chart-wrap canvas {
    display: block;
    width: 100%;
    background: transparent;
}

.td-chart-wrap canvas:first-child {
    pointer-events: none;
}

.td-chart-wrap canvas:last-child {
    position: absolute;
    top: 0;
    left: 0;
    cursor: crosshair;
}

.td-body::-webkit-scrollbar {
    width: 6px;
}

.td-body::-webkit-scrollbar-track {
    background: transparent;
}

.td-body::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 3px;
}
