body,
html {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    margin: 0;
    padding: 0;
    height: 100%;
}

/* ── Full-width 2D viewer layout ── */
#viewer2dWrapper {
    position: absolute;
    top: 100px; /* header height */
    left: 0;
    right: 0;
    bottom: 0;
}

#mapContainer {
    position: absolute;
    inset: 0;
}

/* ── Floating sidebar ── */
#sidebarPanel {
    position: absolute;
    top: 10px;
    left: 10px;
    bottom: 30px;
    width: 310px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 10;
    overflow-y: auto;
    pointer-events: none;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#sidebarPanel::-webkit-scrollbar {
    display: none;
}

#sidebarPanel > * {
    pointer-events: auto;
}

/* ── Toggle sidebar button ── */
.btn-toggle-sidebar {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 20;
    display: none;
    background: rgba(255,255,255,0.95);
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* ── Glass cards ── */
.card-2d {
    background: rgba(255,255,255,0.96);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
    padding: 12px 14px;
    font-size: 12px;
    color: #334155;
}

.card-2d-title {
    font-size: 14px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.card-2d-section {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 10px 0 4px;
}

.card-2d-section:first-of-type {
    margin-top: 0;
}

.card-2d-row {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    margin-bottom: 6px;
}

.card-2d-check {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-weight: 500;
}

.color-controls select {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 12px;
    margin-bottom: 6px;
}

.color-range-row {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    font-size: 11px;
}

/* ── Table in card ── */
.table-holder {
    max-height: 45vh;
    overflow-y: auto;
    overflow-x: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    scrollbar-width: thin;
}

#lineList {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

#lineList th {
    position: sticky;
    top: 0;
    background: #0b4a53;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 6px 8px;
    text-align: left;
    white-space: nowrap;
    border: none;
}

#lineList td {
    padding: 5px 8px;
    border-bottom: 1px solid #f1f5f9;
    white-space: nowrap;
    font-size: 11px;
    color: #334155;
    border-left: none;
    border-right: none;
}

#lineList tbody tr:hover {
    background: #f0f9fa;
}

#lineList tbody tr:nth-child(even) {
    background: #f8fafc;
}

#lineList tbody tr:nth-child(even):hover {
    background: #f0f9fa;
}

/* ── Fault count badge ── */
.fault-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #0b4a53;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 22px;
    height: 18px;
    padding: 0 6px;
    border-radius: 9px;
    vertical-align: middle;
    margin-left: 4px;
}

/* ── Map loading overlay ── */
.map-loading-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.6);
    z-index: 5;
    gap: 12px;
    pointer-events: none;
}

.map-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e2e8f0;
    border-top-color: #0b4a53;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.map-loading-text {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
}

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

/* ── Responsive ── */
@media (max-width: 800px) {
    #sidebarPanel {
        width: 260px;
    }
}

#buttonRow {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}

#buttonRow button {
    background-color: #0b4a53;
    color: white;
    padding: 6px 14px;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

#buttonRow button:hover {
    background-color: #0d5e69;
}

/* ── Accordion sections ── */
.accordion-section {
    border: 1px solid #e8ecf0;
    border-radius: 10px;
    margin-bottom: 6px;
    overflow: hidden;
    background: #f8fafc;
}

.accordion-header {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    color: #334155;
    text-align: left;
}

.accordion-header:hover {
    background: #f1f5f9;
}

.accordion-arrow {
    font-size: 10px;
    color: #64748b;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.accordion-section:not(.open) .accordion-arrow {
    transform: rotate(-90deg);
}

.accordion-label {
    flex: 1;
    white-space: nowrap;
}

.accordion-range {
    font-size: 10px;
    font-weight: 700;
    color: #0b4a53;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.accordion-body {
    padding: 4px 12px 10px;
}

.accordion-section:not(.open) .accordion-body {
    display: none;
}

.accordion-slider {
    margin: 4px 0;
}

.accordion-footer {
    margin-top: 6px;
    text-align: center;
}

.btn-reset {
    background: none;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 6px 16px;
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-reset:hover {
    background: #f1f5f9;
    color: #334155;
}

/* ── noUiSlider theme ── */
.noUi-target {
    height: 5px !important;
    border: none !important;
    background: #e2e8f0 !important;
    border-radius: 4px !important;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.08) !important;
}

.noUi-connect {
    background: linear-gradient(to right, #0b4a53, #0d6e7a) !important;
    border-radius: 4px !important;
}

.noUi-handle {
    border-radius: 50% !important;
    width: 14px !important;
    height: 14px !important;
    right: -7px !important;
    top: -5px !important;
    background: #fff !important;
    border: 3px solid #0b4a53 !important;
    box-shadow: 0 1px 6px rgba(0,0,0,0.2) !important;
    cursor: grab !important;
    transition: box-shadow 0.15s, transform 0.15s !important;
}

.noUi-handle:hover {
    box-shadow: 0 2px 8px rgba(11,74,83,0.35) !important;
    transform: scale(1.1) !important;
}

.noUi-handle:active {
    cursor: grabbing !important;
    transform: scale(1.15) !important;
}

.noUi-handle::before,
.noUi-handle::after {
    display: none !important;
}

/* ── Color legend ── */
#colorLegend {
    margin-top: 8px;
    padding: 8px 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    max-height: 180px;
    overflow-y: auto;
}

.color-legend-title {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.color-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #334155;
    padding: 2px 0;
}

.color-legend-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.1);
}


.scrollable-div {
    flex: 1;
    /* Each div takes equal space */
    overflow-y: auto;
    /* Enables vertical scrolling */
    overflow-x: auto;
    /* Optional: Enables horizontal scrolling */
    margin: 5px;
    /* Adds space between the divs */
    height: 100%;
    /* Full height of the container */
    border: 1px solid #ccc;
    /* Adds a border for visibility */
}

table {
    font-size: 10px;
    width: 100%;
    /* Use the full width of the container */
    border-collapse: collapse;
    /* Collapses borders to reduce space between them */
    border: 1px solid #ccc;
    /* Light gray border for definition */
}

th,
td {
    border: 1px solid #ccc;
    /* Consistent border styling */
    padding: 4px 10px;
    /* Reduced padding for compactness */
    text-align: left;
    /* Align text to the left */
    vertical-align: top;
    /* Align content to the top of the cell */
    white-space: nowrap;
    /* Prevent text from wrapping */
}

/* CSS rule to hide elements of the ID column */
.hidden-id-column {
    display: none;
}

th {
    background-color: rgba(0, 31, 35, 0.5);
    color: white;
    font-weight: bold;
    /* Bold text for headers */
    height: 20px;
    /* Fixed height for the header cells */
}

tbody tr:nth-child(odd) {
    background-color: #eee;
    /* Very light gray for odd rows, for better readability */
}

tbody tr:hover {
    background-color: #e0e0e0;
    /* Slightly darker gray for hover, improving interaction */
}

.table-container {
    width: 100%;
    height: 700px;
    overflow-y: auto;
    border: 1px solid #ccc;
}

.table-holder {
    width: 100%;
    height: 700px;
    overflow-y: auto;
    border: 1px solid #ccc;
}

.color-bar {
    width: 15px;
    /* Width of the color bar */
    height: 10px;
    /* Height of the color bar */
    display: inline-block;
    /* To display it inline with inputs */
    border: 1px solid #ccc;
    /* Optional: adds border around the color bar */
    align-self: center;
}

.notes {
    width: 100%;
    font-size: 12px;
    color: darkred;
    margin-top: 10px;

}

#exitInstructions {
    display: none;
    position: absolute;
    bottom: 10px;
    left: 10px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px;
    border-radius: 3px;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    display: inline-block;
    /* <-- add this */
    width: 16px;
    height: 16px;
    border-radius: 50%;
}

.eq-dot {
    background: rgba(255, 255, 0, 0.5);
    border: 1px solid #c9a800;
}

.overlay-toggle {
    font-size: 11px;
    line-height: 1.4;
    color: #334155;
    margin-top: 4px;
}

.overlay-toggle label {
    cursor: pointer;
}

.overlay-toggle input[type="checkbox"] {
    vertical-align: middle;
    margin-right: 4px;
}

.overlay-toggle .legend-dot {
    vertical-align: middle;
    margin-right: 2px;
}

.overlay-toggle sup {
    font-size: 9px;
    color: #64748b;
}