﻿.page-header {
    background: white;
    border-bottom: 1px solid #e0e0e0;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-direction: column;
    flex-wrap: wrap;
    gap: 12px;
}

.page-title {
    font-size: 16px;
    font-weight: 600;
}

.page-sub {
    font-size: 11px;
    color: #888;
    margin-top: 2px;
}

.legend-container {
    display: flex;
    flex-direction: row;
    gap: 10px;
}

.legend {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    flex-direction: column;
    align-items: flex-start;
    border: 1px solid #888;
    padding: 5px;
    border-radius: 5px;
}

.legend-items {
    display: flex;
    flex-direction: row;
    gap: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #555;
}

.legend-swatch {
    width: 14px;
    height: 14px;
    border-radius: 2px;
    border: 1px solid rgba(0,0,0,0.1);
}

.controls {
    background: white;
    border-bottom: 1px solid #e0e0e0;
    padding: 8px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

    .controls label {
        font-size: 12px;
        color: #666;
        white-space: nowrap;
    }

select, input[type=text] {
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    padding: 5px 10px;
    font-size: 12px;
    background: white;
    color: #333;
    outline: none;
    font-family: inherit;
}

    select:focus, input:focus {
        border-color: #4a9e94;
    }

#categoryFilter {
    width: 10em;
}
/* ── Tree Multiselect ── */
.ms-wrap {
    position: relative;
    min-width: 220px;
    max-width: 420px;
    user-select: none;
}

.ms-control {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    padding: 3px 8px 3px 6px;
    background: white;
    cursor: pointer;
    min-height: 32px;
}

.ms-wrap.open .ms-control {
    border-color: #4a9e94;
}

.ms-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    flex: 1;
    align-items: center;
}

.ms-placeholder {
    font-size: 12px;
    color: #999;
}

.ms-tag {
    display: flex;
    align-items: center;
    gap: 3px;
    background: #e6f4f3;
    color: #2a7a74;
    border: 1px solid #b0dbd8;
    border-radius: 3px;
    font-size: 11px;
    padding: 1px 5px;
    white-space: nowrap;
}

    .ms-tag.ms-tag-group {
        background: #d4ecd9;
        color: #2a6a3a;
        border-color: #a0ccaa;
        font-weight: 600;
    }

.ms-tag-remove {
    cursor: pointer;
    font-size: 13px;
    color: inherit;
    opacity: 0.7;
}

    .ms-tag-remove:hover {
        opacity: 1;
        color: #d43a28;
    }

.ms-arrow {
    font-size: 10px;
    color: #999;
    margin-left: auto;
    flex-shrink: 0;
    transition: transform 0.15s;
}

.ms-wrap.open .ms-arrow {
    transform: rotate(180deg);
}

.ms-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 340px;
    background: white;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    z-index: 300;
    max-height: 320px;
    flex-direction: column;
}

.ms-wrap.open .ms-dropdown {
    display: flex;
}

.ms-search-wrap {
    padding: 6px 8px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
    width: calc(100% - 38px)
}

.ms-search {
    width: 100%;
    border: 1px solid #d0d0d0;
    border-radius: 3px;
    padding: 4px 8px;
    font-size: 12px;
    outline: none;
    font-family: inherit;
}

.ms-search-inner {
    width: calc(100% - 16px);
}

.ms-search:focus {
    border-color: #4a9e94;
}

.ms-tree {
    overflow-y: auto;
    flex: 1;
}

.ms-select-all-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    border-bottom: 2px solid #e8e8e8;
    cursor: pointer;
    color: #333;
}

    .ms-select-all-row:hover {
        background: #f5fafa;
    }

.ms-group-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px 6px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    color: #333;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    z-index: 1;
}

    .ms-group-row:hover {
        background: #eef5f5;
    }

.ms-group-toggle {
    font-size: 9px;
    color: #999;
    transition: transform 0.15s;
    flex-shrink: 0;
    width: 10px;
}

.ms-group-row.collapsed .ms-group-toggle {
    transform: rotate(-90deg);
}

.ms-group-items {
}

    .ms-group-items.collapsed {
        display: none;
    }

.ms-item-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 28px;
    font-size: 12px;
    cursor: pointer;
    color: #444;
}

    .ms-item-row:hover {
        background: #f5fafa;
    }

    .ms-item-row input[type=checkbox],
    .ms-group-row input[type=checkbox],
    .ms-select-all-row input[type=checkbox] {
        cursor: pointer;
        accent-color: #4a9e94;
        flex-shrink: 0;
    }

.ms-item-label {
    font-family: 'IBM Plex Mono', monospace;
}

.ms-item-row.hidden {
    display: none;
}

/* ── Table container ── */
.table-wrap {
    overflow: auto;
    max-height: calc(100vh - 130px);
    margin: 16px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: white;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

table {
    border-collapse: collapse;
    width: max-content;
}

/* ── Top scrollbar mirror ── */
.scroll-mirror-wrap {
    overflow-x: auto;
    overflow-y: hidden;
    margin: 16px 16px -16px;
}

.scroll-mirror-inner {
    height: 1px; /* just enough to show scrollbar */
}

/* sticky column headers */
#htable thead th.ab {
    position: sticky;
    top: 0;
    z-index: 30;
    /*  background: #f8f9fa;*/
    /*  border-bottom: 2px solid #e0e0e0;*/
    /*  border-right: 1px solid #eee;*/
    border: 2px solid #888;
    padding: 8px 10px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    /*  color: #444;*/
    text-align: left;
    vertical-align: bottom;
    white-space: nowrap;
    min-width: 40px;
    height: 100px;
}

.rotated-table-header {
    transform: rotate(-45deg);
    transform-origin: center center;
    display: inline-block;
    white-space: wrap;
    margin-bottom: 40px;
    text-align: left;
}

#htable thead th.group {
    border: 2px solid #888;
}

thead tr {
    background: #f8f9fa;
}

/* top-left corner — sticky both axes */
thead th.corner {
    position: sticky;
    left: 0;
    z-index: 40;
    background: #f8f9fa;
    min-width: 240px;
    max-width: 240px;
    text-align: left;
    padding-left: 12px;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 11px;
    color: #888;
    font-weight: 400;
    border-right: 2px solid #e0e0e0;
}

/* sticky row label */
tbody td.row-label {
    position: sticky;
    left: 0;
    z-index: 20;
    background: white;
    min-width: 240px;
    max-width: 240px;
    padding: 0;
    border-right: 2px solid #e0e0e0;
    border-bottom: 1px solid #f0f0f0;
}

.row-label-inner {
    display: flex;
    align-items: stretch;
    height: 28px;
}

.row-stripe {
    width: 4px;
    min-width: 4px;
    flex-shrink: 0;
}

.row-name {
    font-size: 11px;
    padding: 0 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
    max-width: 224px;
    color: #333;
}

    .row-name.high {
        color: #be1622;
        font-weight: 500;
    }

/* category group header — sticky left so label never scrolls away */
tr.cat-header td {
    position: sticky;
    left: 0;
    z-index: 25;
    font-size: 11px;
    font-weight: 600;
    padding: 5px 10px 5px 14px;
    color: white;
    letter-spacing: 0.03em;
    white-space: nowrap;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

/* data cells */
tbody td.cell {
    padding: 2px;
    border-right: 1px solid #f5f5f5;
    border-bottom: 1px solid #f5f5f5;
}

.cell-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 24px;
    border-radius: 3px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    font-weight: 500;
    cursor: default;
    min-width: 48px;
    transition: filter 0.1s;
}

    .cell-inner:hover {
        filter: brightness(0.88);
    }

.c-nd {
    background: #CCC;
    color: #3A3A3A;
}

.c-0 {
    background: #7FBF7B;
    color: #1A4D18;
}

.c-10 {
    background: #F5E642;
    color: #5C4A00;
}

.c-50 {
    background: #C51B7D;
    color: #FFE8F3;
}

.c-intrinsic {
    background: #8E0152;
    color: #FFD6EC;
}

.c-access {
    background: #73E046;
    color: #1A4D18;
}

.c-watch {
    background: #F0FA73;
    color: #5C4A00;
}

.c-reserve {
    background: #E65149;
    color: #FFE8F3;
}

.c-reserve-35a {
    background: #C7241B;
    color: #FFE8F3;
}

.c-watch-reserve {
    background: linear-gradient(to bottom right, #F0FA73 50%, #E65149 50%);
    color: #111;
}

.c-not-listed {
    background: #CCC;
    color: #3A3A3A;
}

.text-left {
    text-align: left !important;
}



/* ── Tooltip ── */
#tooltip {
    position: fixed;
    z-index: 999;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    padding: 10px 14px;
    font-size: 12px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.1s;
    max-width: 260px;
    line-height: 1.6;
}

    #tooltip.visible {
        opacity: 1;
    }

    #tooltip .tt-pathogen {
        font-weight: 600;
        font-size: 13px;
        margin-bottom: 4px;
        color: #1a1a2e;
    }

    #tooltip .tt-cat {
        font-size: 11px;
        color: #888;
        margin-bottom: 6px;
    }

    #tooltip .tt-row {
        display: flex;
        justify-content: space-between;
        gap: 16px;
    }

    #tooltip .tt-label {
        color: #666;
    }

    #tooltip .tt-value {
        font-family: 'IBM Plex Mono', monospace;
        font-weight: 600;
    }

        #tooltip .tt-value.high {
            color: #7a1a50;
            ;
        }

        #tooltip .tt-value.low {
            color: #2a5a1a;
        }

        #tooltip .tt-value.middle {
            color: #5a5a00;
        }

    #tooltip .tt-divider {
        border: none;
        border-top: 1px solid #f0f0f0;
        margin: 6px 0;
    }

.no-results {
    padding: 40px;
    text-align: center;
    color: #aaa;
    font-size: 13px;
}

.footnote {
    padding: 6px 24px 14px;
    font-size: 11px;
    color: #aaa;
}
