html, body {
    min-height: 100%;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; /* Modern font stack */
}

body {
    padding-top: 60px; /* Keep existing padding-top */
    margin: 0;
    overflow-y: hidden; /* Prevent body scroll; panes will scroll ON WIDE SCREENS */
    background-color: #f4f7f9; /* Light gray background */
}

/* Adjust userInfo positioning in the top right */
.navbar-text.navbar-right {
    margin-right: 15px;
    padding-left: 10px;
}

#userInfo .user-info {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px 4px 4px;
    border-radius: 999px;
    border: 1px solid #d6dde6;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    font-size: 13px;
    color: #4b5563;
}

#userInfo .user-info__avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid #d6dde6;
    background: #e9eef5;
    object-fit: cover;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
    color: #6b7280;
    line-height: 1;
}

#userInfo .user-info__avatar--placeholder {
    text-transform: uppercase;
}

#userInfo .user-info__name {
    white-space: nowrap;
}

.user-menu {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.user-menu__trigger {
    cursor: pointer;
}

.user-menu__panel {
    position: absolute;
    right: 0;
    top: 100%;
    min-width: 160px;
    background: #ffffff;
    border: 1px solid #d6dde6;
    border-radius: 8px;
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.12);
    padding: 6px 0;
    margin-top: 8px;
    display: none;
    z-index: 1000;
}

.user-menu__panel::before {
    content: "";
    position: absolute;
    top: -8px;
    left: 0;
    right: 0;
    height: 8px;
}

.user-menu:hover .user-menu__panel,
.user-menu:focus-within .user-menu__panel {
    display: block;
}

.user-menu__item {
    display: block;
    width: 100%;
    padding: 8px 16px;
    background: none;
    border: none;
    text-align: left;
    font-size: 13px;
    color: #1f2937;
    text-decoration: none;
    cursor: pointer;
}

.user-menu__item:hover,
.user-menu__item:focus {
    background: #f3f4f6;
    text-decoration: none;
    color: #111827;
}

.fill {
    height: calc(100vh - 60px); /* CORRECTED: Match the navbar height for full viewport usage */
}


/* === REDESIGNED VIEWER LAYOUT STYLES (FIXED) === */
.viewer-layout-container {
    display: flex;
    flex-direction: column; /* CHANGED: Main layout is now vertical */
    height: 100%;
    width: 100%;
    position: relative; /* Needed for absolute positioning of the toggle button */
}

#viewer-main-area {
    flex-grow: 1;
    display: flex;
    min-height: 0; /* Important for flex-shrink to work in a column layout */
    min-width: 0; /* Important for flex-shrink to work */
}

.viewer-pane-wrapper {
    display: flex; /* Make wrapper a flex container */
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    transition: max-width 0.35s ease, flex-grow 0.35s ease;
    min-width: 45px;
    flex-grow: 1; /* ADDED: Allows visible panes to expand */
}
.viewer-pane-wrapper.pane-is-collapsed {
    max-width: 45px;
    flex-grow: 0 !important;
    background-color: #f8f9fa; /* Set the gray background on the wrapper */
    border-right: 1px solid #dee2e6; /* A border to separate collapsed panes */
}
.viewer-pane-wrapper.pane-is-collapsed .viewer-pane-content,
.viewer-pane-wrapper.pane-is-collapsed .viewer-pane-header h5 > span {
    display: none;
}

/* New styles for the collapsed pane look */
.viewer-pane-wrapper.pane-is-collapsed .viewer-pane {
    background-color: transparent; /* Make the pane transparent to show wrapper background */
    border: none;
    box-shadow: none;
}

.viewer-pane-wrapper.pane-is-collapsed .viewer-pane-header {
    height: 100%;
    flex-direction: column; /* Stack icon and button vertically */
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: none;
}

.viewer-pane-wrapper.pane-is-collapsed .viewer-pane-header h5 {
    margin: 0;
    font-size: 18px; /* Adjust icon size */
}
.pane-toggle-btn {
    background: none;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 2px 6px;
    line-height: 1.5;
    font-size: 12px;
    color: #555;
    cursor: pointer;
}
.pane-toggle-btn .fa-angle-double-right { display: none; }
.viewer-pane-wrapper.pane-is-collapsed .pane-toggle-btn .fa-angle-double-right { display: inline-block; }
.viewer-pane-wrapper.pane-is-collapsed .pane-toggle-btn .fa-angle-double-left { display: none; }
.gutter.is-hidden { display: none !important; }

.viewer-layout-container.no-split-transition .viewer-pane-wrapper {
    transition: none !important;
}

.viewer-pane {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
    display: flex;
    flex-direction: column;
    height: 100%;
    flex: 1;
}

.viewer-pane-header {
    padding: 8px 15px;
    border-bottom: 1px solid #dee2e6;
    background-color: #f8f9fa;
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.viewer-pane-header h5 {
    margin: 0;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.viewer-pane-content {
    flex-grow: 1;
    position: relative; /* Crucial for APS viewer */
    overflow: hidden; /* Default overflow, overridden for specific panes */
}

#xlsxTreeView,
#xlsxTableView {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

.xlsx-tree-content {
    flex: 1 1 auto;
    overflow: auto;
    padding: 10px;
    box-sizing: border-box;
    background-color: #ffffff;
}

#xlsxTableView {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

.xlsx-table-content {
    flex: 1 1 auto;
    overflow: auto;
    padding: 10px;
    box-sizing: border-box;
}

.xlsx-status-bar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 12px;
    border-top: 1px solid #e3e7ed;
    background-color: #f6f8fb;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
    position: relative;
    z-index: 1;
}

.xlsx-status-bar.is-filtered {
    background-color: #eef4ff;
    border-top-color: #cbd6f0;
}

.xlsx-status-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #5f6b7a;
}

.xlsx-status-label {
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
    font-size: 11px;
    color: #8a93a2;
}

.xlsx-status-value {
    font-weight: 700;
    color: #243447;
}

.xlsx-status-note {
    font-size: 11px;
    color: #6c7a89;
}

.xlsx-tree-path-bar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-top: 1px solid #e3e7ed;
    background-color: #f6f8fb;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
    font-size: 12px;
    color: #5f6b7a;
}

#xlsxTreeView .jstree-default {
    color: #1f2933;
}

#xlsxTreeView .jstree-default .jstree-anchor {
    color: #1f2933;
    font-weight: 450;
    font-size: 12px;
    line-height: 1.4;
    padding: 2px 4px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

#xlsxTreeView .jstree-default .jstree-clicked {
    color: #1f2933;
}

#xlsxTreeView .jstree-default .jstree-node {
    position: relative;
    margin-left: 18px;
    padding-left: 14px;
}

#xlsxTreeView .jstree-default .jstree-container-ul > .jstree-node {
    margin-left: 0;
    padding-left: 0;
}

#xlsxTreeView .jstree-default .jstree-node::before {
    content: "";
    position: absolute;
    left: -12px;
    top: -12px;
    bottom: 0px;
    width: 1px;
    background-color: #cfd6de;
}

#xlsxTreeView .jstree-default .jstree-node::after {
    content: "";
    position: absolute;
    left: -12px;
    top: 12px;
    width: 26px;
    height: 1px;
    background-color: #cfd6de;
}

#xlsxTreeView .jstree-default .jstree-last::before {
    bottom: 12px;
}

#xlsxTreeView .jstree-default .jstree-container-ul > .jstree-node::before,
#xlsxTreeView .jstree-default .jstree-container-ul > .jstree-node::after {
    content: none;
}

#xlsxTreeView .jstree-default .jstree-ocl {
    position: relative;
    width: 12px;
    height: 12px;
    margin-right: 3px;
    background: #84989b;
    background-image: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    clip-path: polygon(0% 0%, 100% 0%, 100% 0%, 100% 100%, 100% 100%, 0% 100%, 0% 100%, 0% 0%);
    top: 6px;
    z-index: 1;
}

#xlsxTreeView .jstree-default .jstree-ocl::before {
    content: "+";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    transform: translateY(-7px);
}

#xlsxTreeView .jstree-default .jstree-open > .jstree-ocl::before {
    content: "−";
    transform: translateY(-1px);
}

#xlsxTreeView .jstree-default .jstree-closed > .jstree-ocl::before,
#xlsxTreeView .jstree-default .jstree-last::before {
    bottom: auto; /* Stop the line from looking at the bottom of the container */
    height: 24px; /* Set fixed height: starts at -10px, ends at 13px (connector position) + 1px overlap */
}

#xlsxTreeView .jstree-default .jstree-leaf > .jstree-ocl {
    background: transparent;
    border-color: transparent;
}

#xlsxTreeView .jstree-default .jstree-leaf > .jstree-ocl::before {
    content: "";
}

#xlsxTreeView .jstree-default .jstree-themeicon {
    display: none;
}

.xlsx-tree-path-value {
    flex: 1;
    font-weight: 600;
    color: #243447;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.xlsx-tree-path-copy-btn {
    border: 1px solid #cbd6f0;
    background-color: #ffffff;
    color: #2f3a49;
    border-radius: 4px;
    padding: 4px 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.xlsx-tree-path-copy-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.xlsx-tree-path-copy-btn.is-clicked {
    animation: treeCopyPulse 0.25s ease-out;
}

@keyframes treeCopyPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.08);
    }
    100% {
        transform: scale(1);
    }
}


.viewer-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    text-align: center;
}
.viewer-placeholder i {
    font-size: 48px;
    margin-bottom: 15px;
    color: #ccc;
}


#inspector-panel {
    flex-shrink: 0;
    background: linear-gradient(180deg, #f7f9fc 0%, #f1f4f9 100%);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-left: 1px solid #e3e7ed;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.04);
}

.inspector-panel-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.inspector-body {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    box-sizing: border-box;
    padding: 10px 12px;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    flex-grow: 1;
    flex-wrap: nowrap;
    background: radial-gradient(circle at 20% 20%, rgba(76,110,245,0.05), transparent 35%),
                radial-gradient(circle at 80% 0%, rgba(0,204,150,0.06), transparent 30%),
                #f7f9fc;
}

.control-group {
    padding: 10px;
    min-width: 0;
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 14px;
    border: 1px solid #e7ecf3;
    box-shadow: 0 10px 20px rgba(40, 54, 85, 0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.control-group:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 26px rgba(40, 54, 85, 0.1);
}
.control-group:last-child {
    padding-right: 16px;
}

.control-group h6 {
    font-weight: 700;
    margin: 0;
    color: #1f2a44;
    flex-shrink: 0;
}

.control-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.control-title--info {
    color: #1f6feb;
}

.control-title--warning {
    color: #d98100;
}

.control-title--success {
    color: #0f8b6e;
}
.control-group .form-group {
    margin-bottom: 10px;
}
.control-group label,
.control-label {
    font-size: 13px;
    font-weight: 600;
    color: #4a5162;
    margin-bottom: 6px;
    display: inline-block;
}
#sheet-selector-container {
    padding: 12px;
    border: 1px dashed #d8e3f2;
    background: #f8fbff;
    border-radius: 12px;
    margin-bottom: 10px;
}
#sheet-select-dropdown-wrapper p {
    margin: 0;
}
.control-group .file-info {
    font-size: 13px;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #212633;
}
.control-group .file-info i {
    margin-right: 8px;
}
.control-group:not(:last-child) {
    border-right: none;
}
.inspector-body hr {
    display: none;
}

.control-group-header {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.control-title-btn {
    border: none;
    border-radius: 12px;
    padding: 7px 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 13px;
    color: #ffffff;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
}

.control-title-btn i {
    font-size: 13px;
}

.control-title-btn--info {
    background: linear-gradient(135deg, #4a8cff 0%, #3575e6 100%);
}

.control-title-btn--warning {
    background: linear-gradient(135deg, #f0a500 0%, #d88600 100%);
}

.control-title-btn--success {
    background: linear-gradient(135deg, #21b187 0%, #119a72 100%);
}

.filter-elements-body {
    display: flex;
    flex-direction: row;
    gap: 12px;
    align-items: flex-start;
}

.filter-rows-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1 1 auto;
}

.filter-elements-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    align-self: flex-start;
    margin-left: auto;
}

.filter-elements-actions .btn {
    border-radius: 10px;
    min-width: 110px;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.06);
}

.filter-row {
    background: #f9fbff;
    border: 1px solid #e1e8f4;
    border-radius: 10px;
    padding: 10px 12px;
    margin: 0;
}

.header-bubble {
    display: inline-flex;
    align-items: center;
    background-color: #e9ecef;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 3px 8px;
    font-size: 13px;
    cursor: default;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.header-bubble:hover {
    background-color: #dfe7ff;
    transform: translateY(-1px);
}

.header-bubble .remove-bubble {
    margin-left: 8px;
    cursor: pointer;
    font-weight: bold;
    color: #6c757d;
    line-height: 1;
}

.header-bubble .remove-bubble:hover {
    color: #343a40;
}

.full-width-btn {
    width: 100%;
    border-radius: 10px;
    margin-top: 2px;
}

.compact-checkbox {
    margin-top: 10px;
    margin-bottom: 4px;
    color: #556070;
}

#tree-view-group {
    flex: 1 1 250px;
}

.selected-headers-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

#file-info-group {
    flex: 0 0 20%;
    max-width: 20%;
    min-width: 160px;
}

#sorting-grouping-group {
    flex: 0 0 40%;
    max-width: 40%;
    min-width: 300px;
}

#filter-elements-group {
    flex: 0 0 40%;
    max-width: 40%;
    min-width: 320px;
}

.sorting-layout {
    display: flex;
    flex-direction: row;
    gap: 12px;
    align-items: flex-start;
    flex-wrap: nowrap;
}

.sorting-section {
    flex: 1 1 55%;
}

.aggregation-section {
    flex: 1 1 45%;
}

#sorting-grouping-group .sorting-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
#sorting-grouping-group .sorting-row select {
    flex-grow: 1;
}


#isolate-group {
    flex: 1 1 450px;
}
.isolate-group-content {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 15px;
    flex-grow: 1;
}
.isolate-forms {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.isolate-forms .form-group {
    margin-bottom: 0;
}
.isolate-actions {
    display: flex;
    flex-shrink: 0;
    gap: 5px;
}
.isolate-actions .btn {
    width: 38px;
    height: 38px;
    font-size: 16px;
    padding: 0;
    line-height: 38px;
    text-align: center;
}

#filter-path-group {
    flex: 1 1 300px;
    min-width: 250px;
}
#filterPathDisplay.current-filter-path {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 8px;
    font-size: 12px;
    font-family: monospace;
    flex-grow: 1;
    overflow: auto;
    word-break: break-all;
    margin-top: 0;
}


.gutter {
    background-color: #f4f7f9;
    background-repeat: no-repeat;
    background-position: 50%;
    z-index: 50; /* Ensure gutter is above viewer content but below toggle button */
}
.gutter.gutter-horizontal {
    cursor: col-resize;
}
.gutter.gutter-vertical {
    cursor: row-resize;
}


/* viewer containers */
#modelViewer {
    width: 100%;
    height: 100%;
    overflow: hidden; /* This is correct for the 3D viewer canvas */
    position: relative;
    background: #ffffff;
}

/* trees (only in key management now) */
#keyManagerHubs {
    width: 100%;
    height: 100%;
    overflow: auto;
}

/* layout for key manager */
#keyManagerContent {
    height: 100%;
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

#keyManagerContent > h2,
#keyManagerContent > .lead {
    flex-shrink: 0;
}

.KeyManagerCard {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
    border: 1px solid #e9ecef;
    transition: box-shadow 0.2s ease-in-out;
    margin-bottom: 0;
}
.KeyManagerCard:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.keyManagerCardsContainer {
    flex-grow: 1;
    min-height: 0;
    display: flex;
    gap: 20px;
}

.createKeyCard {
    flex: 1 1 380px;
    display: flex;
    flex-direction: column;
}

.listKeysCard {
    flex: 2 1 500px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.keysTableWrapper {
    flex-grow: 1;
    overflow-y: auto;
    margin-top: 15px;
}

@media (max-width: 992px) {
    body {
        overflow-y: auto;
    }
    .keyManagerCardsContainer {
        flex-direction: column;
        min-height: initial;
    }
    .KeyManagerCard {
        margin-bottom: 20px;
    }
}

.createKeyCard h3 {
    margin-top: 0;
    margin-bottom: 20px;
}
.createKeyCard .form-group {
    margin-bottom: 15px;
}
.createKeyCard .form-control {
    width: 100%;
    box-sizing: border-box;
}
.file-selection-group {
    margin-bottom: 20px;
}
.file-selection-group > label {
    font-weight: bold;
    margin-bottom: 10px;
    display: block;
}
.file-selectors-layout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.file-selector-card {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 20px;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background-color: #f8f9fa;
    transition: background-color 0.2s ease-in-out, border-color 0.2s ease-in-out;
    flex: 1;
}
.file-selector-card:hover {
    background-color: #e9ecef;
    border-color: #999;
}
.file-selector-card.placeholder .file-name {
    color: #999;
}
.file-selector-card.selected {
    background-color: #eaf6ff;
    border-style: solid;
    border-color: #337ab7;
}
.file-selector-card.selected .glyphicon {
    color: #337ab7;
}
.file-selector-card .glyphicon {
    font-size: 40px;
    color: #555;
    margin-bottom: 10px;
}
.file-selector-card .file-description {
    font-weight: bold;
    color: #333;
    text-align: center;
    margin-bottom: 5px;
}
.file-selector-card .file-name {
    font-size: 14px;
    color: #222;
    text-align: center;
    word-break: break-word;
}
.pairing-key-icon {
    font-size: 48px;
    color: #337ab7;
    padding: 0 10px;
}
#createKeyButton {
    width: 100%;
    margin-top: 25px;
    padding: 12px 15px;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}
#createKeyButton .glyphicon {
    margin-right: 8px;
    font-size: 16px;
}
.sort-arrow {
    cursor: pointer;
}
#keysTableBody tr {
    transition: background-color 0.2s ease;
}
#keysTableBody tr:hover {
    background-color: #f5f5f5;
}

/* --- XLSX Viewer Styles --- */
.xlsx-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 13px;
    white-space: nowrap;
}
.xlsx-table th,
.xlsx-table td {
    border: 1px solid #e9ecef;
    padding: 8px;
    text-align: left;
    cursor: pointer;
}
.xlsx-table tbody tr:hover td,
.xlsx-table tbody tr:hover th {
    background-color: #f5f5f5;
}
.xlsx-table td.boq-identification-cell {
    position: relative;
    padding-left: calc(8px + var(--boq-indent));
    background-color: #f8fbff;
}
.xlsx-table td.boq-identification-cell::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--boq-indent);
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.18), rgba(59, 130, 246, 0.02));
}
.xlsx-table td.boq-identification-cell .boq-identification-value {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.xlsx-table td.boq-identification-cell .boq-identification-level {
    font-size: 11px;
    font-weight: 600;
    color: #1e3a8a;
    background: #e7f0ff;
    border-radius: 999px;
    padding: 2px 8px;
}
.xlsx-table td.boq-identification-cell .boq-identification-text {
    font-weight: 600;
    color: #1f2a44;
}
.xlsx-virtual-spacer td {
    padding: 0;
    border: none;
    height: 0;
}
.xlsx-virtual-sample {
    visibility: hidden;
}
.xlsx-table thead th {
    position: -webkit-sticky; /* For Safari */
    position: sticky;
    top: -10px; /* Adjust for container padding */
    z-index: 2;
    background-color: #f2f2f2;
    font-weight: bold;
}
.xlsx-header-cell {
    position: relative;
    padding-right: 150px;
    --header-underline: transparent;
}
.header-title {
    display: inline-block;
    vertical-align: middle;
}
.xlsx-header-cell::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: var(--header-underline);
    opacity: 0;
    transition: opacity 0.2s ease, background 0.2s ease;
    border-radius: 0 0 2px 2px;
}
.xlsx-header-cell.xlsx-header-cell--underlined::after {
    opacity: 1;
}
.sheet-header-ring {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 6px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 3;
}

.xlsx-header-cell:hover .sheet-header-ring,
.sheet-header-ring:focus-within {
    opacity: 1;
    pointer-events: auto;
}

.sheet-ring-btn {
    width: 28px;
    height: 28px;
    position: relative;
    border-radius: 50%;
    border: none;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    opacity: 0.92;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.sheet-ring-btn:hover {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
    opacity: 1;
}

.sheet-ring-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.35);
}

.sheet-ring-btn--add {
    background-color: #28a745;
}

.sheet-ring-btn--remove {
    background-color: #e74c3c;
}

.sheet-ring-btn--sort-asc {
    background-color: #3498db;
}

.sheet-ring-btn--sort-desc {
    background-color: #8e44ad;
}

.sheet-ring-btn--aggregate {
    background-color: #f39c12;
}

.sheet-ring-btn.is-active {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(0, 0, 0, 0.15);
    opacity: 1;
}

.sheet-ring-btn--sort-asc:not(.is-active),
.sheet-ring-btn--sort-desc:not(.is-active) {
    filter: grayscale(0.65) saturate(0.6);
}

.sheet-ring-btn .sort-order-badge {
    position: absolute;
    bottom: -4px;
    right: -4px;
    min-width: 14px;
    height: 14px;
    padding: 0 3px;
    border-radius: 8px;
    background-color: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.sheet-ring-btn .sort-order-badge.is-visible {
    display: inline-flex;
}
.sheet-column-action {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    padding: 4px;
    border-radius: 50%;
    color: #6c757d;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.sheet-column-action:hover,
.sheet-header-menu__item:hover {
    background-color: #e9ecef;
    color: #343a40;
}
.add-column-btn {
    right: 6px;
}
.remove-column-btn {
    right: 32px;
    opacity: 0;
}
.removable-header:hover .remove-column-btn {
    opacity: 1;
}
.sheet-header-menu {
    position: absolute;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
    padding: 6px;
    min-width: 160px;
    width: max-content;
    max-width: 260px;
    z-index: 3000;
}
.sheet-header-menu__item,
.sheet-header-menu__empty {
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    padding: 6px 8px;
    border-radius: 4px;
    color: #212529;
}
.sheet-header-menu__empty {
    color: #6c757d;
    cursor: default;
}
.xlsx-primary-row td, .xlsx-primary-row th {
    background-color: #aad4ff !important;
}
.xlsx-secondary-row td, .xlsx-secondary-row th {
    background-color: #d4eaff !important;
}

/* Hides table rows that are not highlighted */
#xlsxTableView.hide-non-highlighted .xlsx-table > tbody > tr {
    display: none;
}

#xlsxTableView.hide-non-highlighted .xlsx-table > tbody > tr.xlsx-primary-row,
#xlsxTableView.hide-non-highlighted .xlsx-table > tbody > tr.xlsx-secondary-row {
    display: table-row;
}


/* Notification Styles */
#notification-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    pointer-events: none;
}

.notification {
    background-color: #333;
    color: #fff;
    padding: 10px 15px;
    border-radius: 4px;
    min-width: 200px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: auto;
}

.notification.show {
    opacity: 1;
    transform: translateY(0);
}

/* Tree view custom grid styles */
.tree-grid-header {
    display: flex;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 4px 8px;
    align-items: center;
    font-weight: bold;
}

.tree-col-header {
    flex: 0 0 100px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    text-align: right;
    margin-left: 8px;
    position: relative;
}

.tree-col-name {
    flex: 1 1 auto;
    text-align: left;
    margin-left: 0;
}

.jstree-anchor {
    display: inline-flex;
    align-items: center;
}

.tree-header-title {
    margin-right: 6px;
}

.tree-header-action {
    border: none;
    background: transparent;
    padding: 4px;
    border-radius: 50%;
    color: #6c757d;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.tree-header-action:hover {
    background-color: #e9ecef;
    color: #343a40;
}

.remove-tree-column-btn {
    opacity: 0;
}

.removable-tree-header:hover .remove-tree-column-btn {
    opacity: 1;
}

.tree-col-value {
    flex: 0 0 100px;
    text-align: right;
    margin-left: 8px;
}
/* Login Gate states */
body.logged-out:not(.access-request-page) nav,
body.logged-out #main-app-container {
    display: none;
}

body.logged-in #login-gate-container {
    display: none;
}

#login-gate-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 16px;
    background: radial-gradient(circle at top, rgba(0, 0, 0, 0.08), transparent 60%),
        linear-gradient(135deg, rgba(30, 35, 40, 0.08), rgba(55, 62, 70, 0.12));
}

.login-gate {
    width: 100%;
    display: flex;
    justify-content: center;
}

.login-gate__card {
    max-width: 520px;
    width: 100%;
    background: #ffffff;
    border-radius: 16px;
    padding: 32px 32px 28px;
    text-align: center;
    box-shadow: 0 18px 40px rgba(15, 32, 39, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.login-gate__logo {
    height: 48px;
    margin-bottom: 16px;
}

.login-gate__message {
    font-size: 16px;
    line-height: 1.5;
    color: #52607a;
    margin: 0 0 24px;
}

.login-gate__button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 22px;
    border-radius: 999px;
    font-weight: 600;
    background: linear-gradient(135deg, #f2f2f2, #d8d8d8);
    border: 1px solid #6b6f75;
    color: #1b1f24;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
}

.login-gate__button:hover,
.login-gate__button:focus {
    background: linear-gradient(135deg, #e6e6e6, #c9c9c9);
    border-color: #4f545a;
    color: #111417;
}

.login-gate__button-logo {
    height: 20px;
}

.login-gate__hint {
    margin-top: 18px;
    font-size: 13px;
    color: #7b879c;
}

/* === ACCESS REQUEST PAGE === */
.access-request-page {
    overflow-y: auto;
    background: radial-gradient(circle at top, rgba(0, 0, 0, 0.08), transparent 60%),
        linear-gradient(135deg, rgba(30, 35, 40, 0.08), rgba(55, 62, 70, 0.12));
}

.access-request.page-content {
    min-height: calc(100vh - 60px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 15px 60px;
    background: transparent;
}

.access-request__card {
    width: min(720px, 100%);
    background: #ffffff;
    border-radius: 16px;
    padding: 36px 40px;
    box-shadow: 0 24px 50px rgba(20, 36, 56, 0.12);
    border: 1px solid #e6ebf2;
}

.access-request__icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: #f0f1f3;
    color: #4f545a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    margin-bottom: 16px;
}

.access-request__title {
    margin-top: 0;
    font-size: 26px;
    font-weight: 600;
    color: #1f2a44;
}

.access-request__subtitle {
    color: #5a6b84;
    margin-bottom: 24px;
}

.access-request__form .form-control {
    border-radius: 10px;
    border: 1px solid #d6dde6;
    box-shadow: none;
}

.access-request__form .form-control:focus {
    border-color: #8c9299;
    box-shadow: 0 0 0 3px rgba(140, 146, 153, 0.2);
}

.access-request__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    margin-top: 10px;
}

.access-request__actions .btn {
    border-radius: 999px;
    padding: 12px 26px;
    font-weight: 600;
    border: 1px solid #6b6f75;
    background: linear-gradient(135deg, #f2f2f2, #d8d8d8);
    color: #1b1f24;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
}

.access-request__actions .btn:hover,
.access-request__actions .btn:focus {
    background: linear-gradient(135deg, #e6e6e6, #c9c9c9);
    border-color: #4f545a;
    color: #111417;
}

.access-request__status {
    font-size: 14px;
    color: #5a6b84;
}

.access-request__status.is-success {
    color: #2b7a3d;
}

.access-request__status.is-error {
    color: #c93a3a;
}

@media (max-width: 640px) {
    .access-request__card {
        padding: 28px 24px;
    }
}
