#mobile-search-icon,
.main-menu .header-search-wrapper {
    display: none !important;
}

/* Base styles */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Lato', sans-serif !important;
    font-weight: 300;
    background-color: #f2f2f2;
    overflow-x: hidden;
}

h2 {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
}

.text-left {
    text-align: left !important;
}

.text-right {
    text-align: right !important;
}


.screener-plugin-wrapper {
    margin-inline: auto;
    max-width: none !important;
    margin-left: initial !important;
    margin-right: initial !important;
}

.screener-plugin-container {
    max-width: 1600px;
    background-color: #f2f2f2;
    margin-inline: auto;
    display: flex;
    flex-direction: column;
    padding: 10px;
    margin-top: 100px;
    margin-bottom: 70px;
}

.screener_table_pane,
.extrafilters {
    background: white;
    margin: 10px;
    padding: 20px;
    border-radius: 8px;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
}

.data-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.header-controls-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

#mobile-industry-filter {
    display: none;
}

#data-table-title {
    margin: 0;
}


#historic-data-wrapper {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    background-color: #fff;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.styled-table {
    border-collapse: collapse;
    margin: 0;
    font-size: 14px;
    width: 100%;
}

.styled-table thead tr {
    background-color: #f8f9fa;
    color: #333;
    font-weight: bold;
    border-bottom: 2px solid #dee2e6;
}

.styled-table th {
    text-align: left;
}

.styled-table th.text-right {
    text-align: right;
}

.styled-table th,
.styled-table td {
    padding: 6px 15px;
    border-bottom: none;
    white-space: nowrap;
    vertical-align: middle;
}

.styled-table tbody tr:nth-of-type(even) {
    background-color: #f9f9f9;
}

.styled-table tbody tr:hover {
    background-color: #f1f8ff;
    color: #004085;
}

.styled-table tbody tr:last-of-type {
    border-bottom: none;
}

.styled-table th.sortable {
    cursor: pointer;
}

.styled-table th.sortable span {
    vertical-align: middle;
}

.sort-indicator {
    display: inline-flex;
    flex-direction: column;
    vertical-align: middle;
}

.styled-table th:not(.text-right) .sort-indicator {
    margin-left: 8px;
}

.styled-table th.text-right .sort-indicator {
    margin-right: 8px;
}

.sort-arrow {
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    opacity: 0.25;
}

.sort-arrow.up {
    border-bottom: 5px solid #333;
    margin-bottom: 2px;
}

.sort-arrow.down {
    border-top: 5px solid #333;
}

.styled-table th.sorted-asc .sort-indicator .sort-arrow.up,
.styled-table th.sorted-desc .sort-indicator .sort-arrow.down {
    opacity: 1;
}

#pagination-controls {
    padding: 15px 20px;
    text-align: center;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #dee2e6;
    font-size: 14px;
    color: #6c757d;
    flex-wrap: wrap;
}

.btn-pagination {
    background-color: #217ab4;
    color: white;
    border: none;
    padding: 8px 16px;
    margin: 0 5px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.btn-pagination:hover:not(:disabled) {
    background-color: #001f33;
}

.btn-pagination:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

#pageInfo {
    font-size: 14px;
    color: #333;
    margin: 0 15px;
}

.pagination-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
}

.rows-per-page-container {
    display: flex;
    align-items: center;
}

/* 4.25: Tom Select wraps the rows select (script.js setupRowsPerPageSelector); the rule
   below styles the bare <select> only until that runs. */
.rows-per-page-container .ts-wrapper {
    min-width: 116px;
}
.rows-per-page-container .ts-control {
    text-align: left;
    cursor: pointer;
}
/* The site's padlock (KPI's, as in bq-ownership's locked cells), grey after a guest's locked
   row counts. In the menu, which sits in <body>, and in the box. */
.bq-scr-rows-lock {
    width: 11px;
    height: 11px;
    margin-left: 6px;
    vertical-align: -1px;
    color: #98a1ab;
    flex: none;
}
.ts-dropdown .option.active .bq-scr-rows-lock {
    color: currentColor;
}

#rows-per-page-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: white;
    border: 1px solid #c8c6c6;
    border-radius: 3px !important;
    color: #333;
    font-weight: normal;
    border-radius: 6px;
    padding: 6px 30px 6px 12px;
    font-size: 14px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23333333' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 16px 12px;
}


.valueInput,
#metrics-modal-search,
#rows-per-page-select {
    outline: none !important;
}

.valueInput:focus,
#metrics-modal-search:focus,
#rows-per-page-select:focus {
    border-color: #86b7fe !important;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
}


.button button,
.btn-download-table {
    color: #4a4a4a;
    background: white;
    border: 1px solid #dbdbdb;
    margin-inline: 0;
    cursor: pointer;
    border-radius: 4px;
    min-height: 38px;
    font-size: 14px;
    padding: 7px 15px;
    transition: all ease-in-out 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.button button:hover,
.btn-download-table:hover {
    color: #363636;
    border-color: #b5b5b5;
    background: #f5f5f5;
}

.template,
.industryFiltercontainer {
    display: flex;
    align-items: center;
    gap: 0; /* Changed from 15px to 0 for desktop */
}

.valueInput {
    height: 38px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 0 10px;
    font-size: 14px;
}

.valueInput[type=number] {
    -moz-appearance: textfield !important;
}

.valueInput[type=number]::-webkit-inner-spin-button,
.valueInput[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: auto !important;
    opacity: 1 !important;
    cursor: pointer;
}

.valueInput[type=number] {
    padding-right: 15px !important;
}

#addFilterButton {
    background: #217ab4;
    border: none;
    color: white;
    font-size: 20px;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    height: 29px;
    width: 29px;
    line-height: 29px;
    padding: 0;
    text-align: center;
    transition: background-color 0.2s;
}

#addFilterButton:hover {
    background: #001f33;
}

.removeFilterButton {
    background: none;
    border: none;
    color: #999;
    font-size: 24px;
    cursor: pointer;
    margin-left: 10px; /* Add some space */
}

.removeFilterButton:hover {
    color: #333;
}

.extrafilter_buttonContainer {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
}

.styled-table th.freeze,
.styled-table td.freeze {
    position: sticky !important;
    left: 0 !important;
    z-index: 5 !important;
    box-shadow: 2px 0 5px -2px rgba(0, 0, 0, 0.1) !important;
    border-right: 1px solid #dee2e6 !important;
}

.styled-table thead th.freeze {
    z-index: 15 !important;
    background-color: #f8f9fa !important;
}

.styled-table tbody td.freeze {
    background-color: #ffffff !important;
}

.styled-table tbody tr:nth-of-type(even) td.freeze {
    background-color: #f9f9f9 !important;
}

.styled-table tbody tr:hover td.freeze {
    background-color: #f1f8ff !important;
}

.styled-table thead th {
    position: sticky;
    background-color: #f8f9fa;
    z-index: 10;
}

.mobile-metrics-container {
    display: none;
    background: white;
    margin: 10px;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
    flex-direction: column;
    gap: 15px;
}

#mobile-select-metrics-btn {
    width: 100%;
    padding: 10px;
    font-size: 16px;
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
    margin-bottom: 0;
    background-color: #217ab4;
    color: white;
    border: none;
    font-weight: 500;
}

.pills-display-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0;
    min-height: auto;
}

.pills-display-container:empty {
    display: none;
}

#metrics-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

#metrics-modal-overlay.modal-visible {
    display: flex !important;
}

/* 4.25: while the filter modal is open on a phone only the modal scrolls (script.js
   lockPageScroll). Fixed, not overflow:hidden: iOS Safari scrolls an overflow:hidden
   body anyway. The modal's own list keeps its scroll to itself at either end. */
body.bq-scr-scroll-lock {
    position: fixed;
    left: 0;
    right: 0;
    width: 100%;
    overflow: hidden;
}
/* Tom Select places a menu in <body> at page coordinates; the fixed body has moved
   up by the scroll position, so the menu moves back down by the same amount. */
body.bq-scr-scroll-lock > .ts-dropdown {
    margin-top: var(--bq-scr-lock-y, 0px);
}
#metrics-modal-overlay,
#metrics-modal-list {
    overscroll-behavior: contain;
}

#metrics-modal {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 450px;
    display: flex;
    flex-direction: column;
    height: 85vh;
    max-height: 700px;
}

#metrics-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e9ecef;
    flex-shrink: 0;
}

#metrics-modal .modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

#metrics-modal-close {
    font-size: 28px;
    font-weight: 300;
    color: #888;
    cursor: pointer;
    line-height: 1;
}

#metrics-modal .modal-search-container {
    padding: 15px 20px;
    border-bottom: 1px solid #e9ecef;
    flex-shrink: 0;
}

#metrics-modal-search {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
}

#metrics-modal-list {
    overflow-y: auto;
    padding: 10px 0;
    flex-grow: 1;
}

.metric-item {
    padding: 12px 20px;
    cursor: pointer;
    font-size: 14px;
    border-bottom: 1px solid #f1f1f1;
    transition: background-color 0.2s;
}

.metric-item.selected {
    background-color: #e2efff !important;
    font-weight: 600 !important;
    color: #004085 !important;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #e9ecef;
    text-align: right;
    flex-shrink: 0;
}

#metrics-modal-apply {
    background-color: #217ab4 !important;
    color: white !important;
    border: none !important;
    padding: 8px 16px !important;
    border-radius: 4px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    cursor: pointer;
}

#metrics-modal-selected-container {
    padding: 5px 20px 10px;
    border-bottom: 1px solid #e9ecef;
    max-height: 140px;
    overflow-y: auto;
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

#metrics-modal-selected-container:empty {
    padding: 0;
    border-bottom: none;
}

.metric-filter-controls {
    padding: 10px 15px 15px 15px;
    background-color: #f7f7f7;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
    align-items: center;
}

.metric-filter-controls .ts-wrapper {
    flex: 1 1 35%;
    min-width: 0;
}

.metric-filter-controls .valueInput {
    flex: 1 1 30%;
    min-width: 0;
}

.condition-pill {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    background-color: #e2efff;
    color: #004085;
    border: 1px solid #b8daff;
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    gap: 8px;
    transition: background-color 0.2s, border-color 0.2s;
}

.condition-pill.active,
.condition-pill:hover {
    background-color: #cce5ff;
    border-color: #007bff;
}

.condition-pill .edit-icon {
    font-size: 14px;
    color: #004085;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.condition-pill:hover .edit-icon {
    opacity: 1;
}

.condition-pill .remove-condition {
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    font-weight: bold;
    color: #004085;
    opacity: 0.7;
}

.mobile-edit-controls-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.mobile-edit-controls-header {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    padding-bottom: 10px;
    border-bottom: 1px solid #e9ecef;
}

.mobile-edit-controls-header strong {
    color: #217ab4;
}

.mobile-edit-controls-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.mobile-edit-controls-row .ts-wrapper {
    flex: 1 1 30%;
    min-width: 0;
}

.mobile-edit-controls-row .valueInput {
    flex: 1 1 40%;
    min-width: 0;
}

.toggle-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-label {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
}

input:checked+.slider {
    background-color: #217ab4;
}

input:checked+.slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}


@media screen and (max-width: 768px) {
    .screener-plugin-container {
        margin-top: 20px;
        margin-bottom: 20px;
    }

    .screener_table_pane,
    .extrafilters,
    .mobile-metrics-container {
        padding: 15px;
    }

    .data-table-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .toggle-container {
        display: flex;
        order: -1;
        width: 100%;
        justify-content: center;
        padding-bottom: 10px;
        border-bottom: 1px solid #f1f1f1;
        margin-bottom: 10px;
    }

    .screener_table_pane {
        display: flex;
        flex-direction: column;
        margin-bottom: 60px;
    }

    #mobile-industry-filter {
        display: block;
        order: 1;
        margin-bottom: 15px;
    }

    #data-table-container {
        order: 2;
    }

    #data-table-title {
        order: 1;
        text-align: center;
    }

    .header-controls-right {
        order: 2;
        display: flex;
        gap: 10px;
        width: 100%;
        flex-wrap: wrap;
    }

    .header-controls-right .button {
        flex: 1;
    }

    .header-controls-right .button button,
    .header-controls-right .button a {
        width: 100%;
        justify-content: center;
    }

    #desktop-industry-filter {
        display: none;
    }

    .mobile-metrics-container {
        display: flex;
        margin-top: 60px;
    }

    .template {
        display: none;
    }

    #addFilterButton {
        display: none !important;
    }

    #metrics-modal-list {
        padding: 0;
    }

    .metric-item {
        border-bottom: none;
    }

    .metric-item-container {
        border-bottom: 1px solid #f1f1f1;
    }

    .filter-controls-row {
        display: flex;
        width: 100%;
        gap: 5px;
        align-items: center;
    }

    .filter-controls-row .ts-wrapper {
        flex: 1 1 30%;
        width: auto !important;
        min-width: 0;
        margin: 0 !important;
    }

    .filter-controls-row .valueInput {
        flex: 1 1 40%;
        width: auto !important;
        min-width: 0;
        margin: 0 !important;
        height: 38px;
    }

    .pagination-controls {
        flex-direction: column;
        gap: 15px;
    }

    .pagination-buttons {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 100%;
    }

    #mobile-industry-filter .ts-wrapper {
        width: 100% !important;
        max-width: 100%;
    }

    .metric-filter-controls .valueInput[type=number],
    .mobile-edit-controls-row .valueInput[type=number] {
        -webkit-appearance: textfield !important;
        -moz-appearance: textfield !important;
    }
}

@media screen and (min-width: 769px) {
    .template {
        display: flex;
        align-items: center;
        gap: 0;
    }

    .template .metric-select-button {
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23333333' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
        background-repeat: no-repeat;
        background-position: right 0.75rem center;
        background-size: 16px 12px;
        background-color: #f2f7fa;
        border: none;
        border-bottom: 1px solid #72c4f9;
        border-radius: 2px;
        height: auto;
        line-height: 28px;
        font-size: 15px;
        width: 486px;
        margin: 5px 0 5px 5px; /* Adjust margin */
        padding: 0 30px 0 10px;
        text-align: left;
        cursor: pointer;
    }
    
    /* CRITICAL FIX: Add flexbox styles for horizontal alignment */
    .template .filter-controls-row {
        display: flex;
        align-items: center;
        gap: 0;
    }

    .template .ts-wrapper {
        margin: 10px 0 5px 28px;
        width: 235px !important;

    }

    .template .ts-control {
        background-color: #f2f7fa !important;
        border: none !important;
        border-bottom: 1px solid #72c4f9 !important;
        border-radius: 2px !important;
        height: 29px !important;
        padding-top: 2px;
        font-size: 15px;
        min-height: auto;
    }
    
    .template .ts-control input::placeholder {
        color: #333 !important;
    }

    .template .valueInput {
        background-color: #f2f7fa;
        height: 29px !important;
        border: none;
        border-bottom: 1px solid #72c4f9;
        border-radius: 2px;
        width: 200px !important;
        margin: 5px 0 5px 28px; /* Adjust margin */
        font-size: 15px;
    }
}

.screener_table_pane.loading-overlay {
    position: relative;
    overflow: hidden;
}

.screener_table_pane.loading-overlay::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.7);
    z-index: 99;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='xMidYMid' width='50' height='50' style='shape-rendering: auto; display: block; background: transparent;' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg%3E%3Ccircle cx='50' cy='50' r='32' stroke-width='8' stroke='%23217ab4' stroke-dasharray='50.26548245743669 50.26548245743669' fill='none' stroke-linecap='round'%3E%3CanimateTransform attributeName='transform' type='rotate' repeatCount='indefinite' dur='1s' keyTimes='0;1' values='0 50 50;360 50 50'%3E%3C/animateTransform%3E%3C/circle%3E%3Cg%3E%3C/g%3E%3C/g%3E%3C!-- [ldio] generated by https://loading.io/ --%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    transition: opacity 0.2s ease-in-out;
}

.fixed-header-wrapper {
    position: fixed;
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
    overflow: hidden;
}

.fixed-header-wrapper th {
    font-size: 14px !important;
}

.fixed-header-wrapper.sticky-active {
    background-color: #f8f8f8;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transform: translateZ(0);
}

.fixed-header-wrapper .cloned-table {
    table-layout: fixed;
    transition: none;
}

.fixed-header-wrapper .frozen-column {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1001;
    background-color: #f8f8f8;
    box-shadow: 0 0 2px rgba(0,0,0,0.02);
    border-right: 1px solid rgba(0,0,0,0.01);
    opacity: 0;
    transform: translateX(0);
    transition: opacity 0.2s ease;
}

.fixed-header-wrapper .frozen-column.show {
    opacity: 1;
    transform: translateX(0);
}

.fixed-header-wrapper .frozen-column th {
    padding: 10px;
    text-align: left;
    font-weight: bold;
    box-sizing: border-box;
}

#runScreenerButton {
    min-height: 29px; 
    height: 29px;
    padding: 0 15px;
    margin-left: -5px; 
}

#runScreenerButton:disabled {
    background-color: #cccccc;
    border-color: #cccccc;
    color: #666;
    cursor: not-allowed;
}

#runScreenerButton:disabled:hover {
    background: #cccccc;
    border-color: #cccccc;
    color: #666;
}

/* Tom Select Customizations */
.ts-wrapper .ts-control {
    border: 1px solid #ced4da;
    border-radius: 4px;
    box-shadow: none;
    font-size: 14px;
    padding: 6px 12px;
}

.ts-wrapper.multi.has-items .ts-control {
    padding: 6px 12px 3px 12px;
}

.ts-wrapper.focus .ts-control {
    border-color: #86b7fe !important;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
}

.ts-wrapper.multi .ts-control > div {
    background: #007bff;
    color: white;
    border: 1px solid #006fe6;
    border-radius: 4px;
    padding: 4px 8px;
    font-weight: 500;
}

.ts-wrapper.multi .ts-control > div .remove {
    border-left: 1px solid #0062cc;
    margin-left: 6px;
    padding-left: 6px;
    font-size: 14px;
}

.ts-wrapper .ts-dropdown {
    z-index: 10050;
    border-color: #ced4da;
}

/* CRITICAL FIX: Add direct selector for dropdowns appended to body */
.ts-dropdown {
    z-index: 10050 !important;
}

.ts-wrapper .ts-dropdown .active {
    background-color: #217ab4;
    color: white;
}

.metric-filter-controls .ts-control, .mobile-edit-controls-row .ts-control {
    text-align: left;
}




/* =====================================================================
   TOUCH — iOS ZOOM ON FOCUS
   ---------------------------------------------------------------------
   Mobile Safari zooms the viewport whenever a focused form control
   computes to UNDER 16px, and it does not zoom back out afterwards — the
   reader is left on a page they now have to pinch to fix. Sizing the
   focused control at 16px IS the fix; deferring the focus is the
   workaround for when the type size cannot be changed, and it still zooms
   the moment anyone actually types.

   Only the elements iOS measures are listed — the <input>, <select> and
   <textarea> that genuinely take focus. Resting text that merely looks
   like a field (a Tom Select .item, a fake-select trigger) is not
   focusable and is left alone, so the page looks exactly as it does now
   until someone taps into a control.

   `pointer: coarse` rather than a width query: this is about the input
   method, not the viewport. A narrow desktop window has no zoom problem
   and keeps its own type size; a tablet in landscape has the problem at
   1024px wide and gets the fix.

   The canonical version of this note, with the full reasoning and the
   rejected alternatives, is in company-KPI/css/styles.css.
   ===================================================================== */
@media (pointer: coarse) {
    .ts-wrapper .ts-control > input,
    .template .ts-control > input,
    #metrics-modal-search,
    #rows-per-page-select,
    .valueInput,
    /* .template .valueInput lives inside a min-width:769px query and is one
       class more specific, so the bare .valueInput above never reached it —
       a tablet in landscape matches both queries. Same specificity, later in
       the file, so this wins the tie. */
    .template .valueInput {
        font-size: 16px;
    }
    /* The originals Tom Select hides behind its own controls stay focusable
       unless told otherwise, and iOS measures whatever takes focus. */
    select.tomselected.ts-hidden-accessible {
        font-size: 16px;
        pointer-events: none;
    }
}

/* =====================================================================
   4.20 — THE STOCK-LIST CHROME
   ---------------------------------------------------------------------
   The screener and the stock-list pages are the same object at different
   scopes ("every bank" / "every company with ROE over 20%"), so they wear
   the same chrome: square corners, hairline borders, a tinted toolbar and
   an ink rule under the column headers. Everything is scoped to .bq-scr and
   sits after the older rules so it wins on order, not on !important.
   Tokens are restated with the homepage values because homepage.css does
   not load on this page.
   ===================================================================== */
.bq-scr {
    --blue-primary: #00529b;
    --blue-darkest: #003a6e;
    --bq-ink: #0b1f2e;
    --bq-line: #e7edf2;
    --bq-line-strong: #cdd7e0;
    --bq-panel-head: #f5f8fa;
    --bq-green: #15803d;
    --bq-red: #c5331f;
    --gray-500: #a0aec0;
    --gray-700: #4a5568;
    /* The homepage's own stacks. --bq-mono is Lato too, despite the name:
       these are tabular figures, not code. */
    --font-sans: 'Lato', 'Lato Fallback', 'Lato Fallback R', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --bq-mono: 'Lato', 'Lato Fallback', 'Lato Fallback R', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    font-family: var(--font-sans);
    font-weight: 400;
    color: var(--gray-700);
    -webkit-font-smoothing: antialiased;
}
/* The pre-4.20 body rule sets Lato 300 (thin); the homepage is 400. The
   page stays TINTED, not white: the screener is a working surface of
   separate white panes (head, filters, table), and a cool grey ground is
   what makes each pane read as its own object. A shade of the homepage's
   panel-head blue-grey rather than the old neutral #f2f2f2, so the hairline
   borders and the ground belong to one palette. This stylesheet loads on
   the screener only. */
body { font-weight: 400; background-color: #eef2f6; }
.bq-scr button, .bq-scr input, .bq-scr select { font-family: inherit; }
.bq-scr .styled-table td { color: var(--bq-ink); }
.bq-scr .styled-table td.text-right { font-family: var(--bq-mono); }
/* 1600px of content, as before 4.20 (box-sizing is border-box here, so the
   two 16px gutters are added on top). The stock-list pages stop at 1500px,
   but they have seven fixed columns; the screener's are the reader's own and
   need every pixel a wide screen offers. */
.bq-scr .screener-plugin-container { background: transparent; max-width: 1632px; width: 100%; padding: 0 16px; margin-top: 100px; }

/* ── head ── */
.bq-scr-head {
    background: #fff; border: 1px solid var(--bq-line-strong);
    padding: 20px 22px; margin: 0 0 16px;
}
.bq-scr-crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; font-size: 12px; color: var(--gray-500); margin-bottom: 8px; }
.bq-scr-crumbs a { color: var(--blue-primary); text-decoration: none; }
.bq-scr-crumbs a:hover { text-decoration: underline; }
.bq-scr-eyebrow { display: block; margin-bottom: 7px; font-size: 11px; font-weight: 700; letter-spacing: 1.1px; text-transform: uppercase; color: var(--blue-primary); }
.bq-scr-head h1 { margin: 0; font-size: 28px; font-weight: 900; line-height: 1.15; letter-spacing: -.5px; color: var(--bq-ink); }
.bq-scr-lede { margin: 9px 0 0; font-size: 14.5px; line-height: 1.6; color: var(--gray-700); }

/* ── panes: square, hairline, no shadow ── */
.bq-scr .screener_table_pane,
.bq-scr .extrafilters,
.bq-scr .mobile-metrics-container {
    margin: 0 0 16px; border-radius: 0; box-shadow: none;
    border: 1px solid var(--bq-line-strong);
}
.bq-scr .screener_table_pane { padding: 0; }
.bq-scr .extrafilters { padding: 16px 18px; }

/* ── stats strip ── */
.bq-scr-stats { display: grid; grid-template-columns: repeat(4, 1fr); background: #fcfdfe; border-bottom: 1px solid var(--bq-line-strong); }
.bq-scr-stat { padding: 11px 16px 12px; border-left: 1px solid var(--bq-line); min-width: 0; }
.bq-scr-stat:first-child { border-left: none; }
.bq-scr-stat__label { display: block; margin-bottom: 3px; font-size: 9.5px; font-weight: 700; letter-spacing: .9px; text-transform: uppercase; color: var(--gray-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bq-scr-stat__val { display: block; font-family: var(--bq-mono); font-variant-numeric: tabular-nums; font-size: 16px; font-weight: 700; color: var(--bq-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── toolbar ── */
.bq-scr-bar { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; padding: 10px 14px; background: var(--bq-panel-head); border-bottom: 1px solid var(--bq-line); }
.bq-scr-bar__left { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; min-width: 0; }
.bq-scr-toggle { display: inline-flex; align-items: center; gap: 7px; height: 36px; font-size: 13px; color: var(--bq-ink); cursor: pointer; user-select: none; white-space: nowrap; }
.bq-scr-scope { display: flex; flex-direction: column; margin: 0; padding: 0; border: 0; min-width: 0; }
.bq-scr-scope__label { display: block; float: left; width: 100%; margin-bottom: 3px; padding: 0; font-size: 9.5px; font-weight: 700; letter-spacing: .9px; text-transform: uppercase; color: var(--gray-500); }
.bq-scr-scope__opts { clear: both; display: flex; align-items: center; gap: 4px; height: 36px; padding: 0 4px; background: #fff; border: 1px solid var(--bq-line-strong); }
.bq-scr-scope .bq-scr-toggle { height: 26px; padding: 0 8px; }
.bq-scr-scope .bq-scr-toggle + .bq-scr-toggle { border-left: 1px solid var(--bq-line); }
.bq-scr-scope .bq-scr-tag--key { margin-left: 0; cursor: inherit; }
.bq-scr-scope.is-off .bq-scr-toggle { cursor: not-allowed; color: var(--gray-500); }
.bq-scr-scope.is-off .bq-scr-tag--key { opacity: .55; }
.bq-scr-toggle input { margin: 0; accent-color: var(--blue-primary); }
.bq-scr-toggle__n { font-family: var(--bq-mono); font-size: 10.5px; font-weight: 700; color: var(--gray-500); background: #fff; border: 1px solid var(--bq-line-strong); padding: 1px 6px; }
.bq-scr-toggle__n:empty { display: none; }

.bq-scr .data-table-header { padding: 10px 14px; margin: 0; border-bottom: 1px solid var(--bq-line-strong); gap: 10px; }
.bq-scr #data-table-title { font-size: 14px; font-weight: 400; color: var(--gray-700); }
.bq-scr #data-table-title strong { color: var(--bq-ink); font-weight: 700; }
.bq-scr .header-controls-right { gap: 10px; flex-wrap: wrap; }
.bq-scr .toggle-label { font-size: 12.5px; font-weight: 400; color: var(--gray-700); }
.bq-scr .btn-download-table {
    height: 32px; padding: 0 12px; border-radius: 0;
    font-size: 12px; font-weight: 700; letter-spacing: .3px;
    color: var(--blue-primary); background: #fff; border: 1px solid var(--bq-line-strong);
}
.bq-scr .btn-download-table { white-space: nowrap; justify-content: center; }
.bq-scr .btn-download-table:hover { color: var(--blue-darkest); border-color: var(--blue-primary); background: #fff; }

/* ── picker ── */
.bq-scr-picker { position: relative; min-width: 0; }
.bq-scr-picker__label { display: block; margin-bottom: 3px; font-size: 9.5px; font-weight: 700; letter-spacing: .9px; text-transform: uppercase; color: var(--gray-500); }
.bq-scr-picker.has-value .bq-scr-picker__label { color: var(--blue-primary); }
.bq-scr-picker__control { display: inline-flex; align-items: stretch; height: 36px; max-width: 100%; background: #fff; border: 1px solid var(--bq-line-strong); transition: border-color .14s ease, box-shadow .14s ease; }
.bq-scr-picker__control:hover { border-color: #b6c1cc; }
.bq-scr-picker__control:focus-within { border-color: var(--blue-primary); box-shadow: 0 0 0 3px rgba(0, 82, 155, .10); }
.bq-scr-picker__input { border: 0; outline: 0; background: none; padding: 0 10px; font-family: inherit; font-size: 13.5px; font-weight: 400; color: var(--bq-ink); width: 280px; min-width: 0; text-overflow: ellipsis; cursor: pointer; }
.bq-scr-picker__input:focus { cursor: text; }
.bq-scr-picker__input::placeholder { color: var(--gray-700); }
.bq-scr-picker__clear { display: flex; align-items: center; justify-content: center; width: 28px; padding: 0; border: 0; background: none; color: var(--gray-500); cursor: pointer; }
.bq-scr-picker__clear[hidden] { display: none; }
.bq-scr-picker__clear:hover { color: var(--bq-red); }
.bq-scr-picker__clear svg { width: 14px; height: 14px; }
.bq-scr-picker__chev { display: flex; align-items: center; justify-content: center; width: 30px; flex-shrink: 0; border-left: 1px solid var(--bq-line); background: #fafbfc; color: var(--gray-500); pointer-events: none; }
.bq-scr-picker__chev svg { width: 16px; height: 16px; }
.bq-scr-picker__pop {
    position: absolute; z-index: 700; left: 0; top: calc(100% + 3px);
    min-width: 100%; width: max-content; max-width: min(520px, calc(100vw - 32px));
    max-height: 380px; overflow-y: auto; overscroll-behavior: contain;
    padding: 4px 0; background: #fff;
    border: 1px solid var(--bq-line-strong); box-shadow: 0 8px 24px rgba(11, 31, 46, .10);
}
.bq-scr-picker__pop[hidden] { display: none; }

/* Hierarchy by typography and indent, as on the stock-list picker: a sector
   is a caps label, a group a grey band in bold, an industry plain and
   indented. The current row is inverted. */
.bq-scr-opt { display: flex; align-items: baseline; gap: 10px; padding: 7px 12px; cursor: pointer; }
.bq-scr-opt.is-active, .bq-scr-opt:hover { background: #f4f5f6; }
.bq-scr-opt__name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bq-scr-opt__ctx { flex: 0 1 auto; min-width: 0; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; color: var(--gray-500); }
.bq-scr-opt__n { flex: 0 0 auto; min-width: 3.2em; text-align: right; font-family: var(--bq-mono); font-size: 11px; color: var(--gray-500); font-variant-numeric: tabular-nums; }
.bq-scr-opt--sector { padding-top: 10px; border-top: 1px solid var(--bq-line); }
.bq-scr-opt--sector:first-child { border-top: 0; }
.bq-scr-opt--sector .bq-scr-opt__name { font-size: 11px; font-weight: 700; letter-spacing: .9px; text-transform: uppercase; color: var(--blue-primary); }
.bq-scr-opt--group { background: #f1f2f4; }
.bq-scr-opt--group.is-active, .bq-scr-opt--group:hover { background: #e8e9ec; }
.bq-scr-opt--group .bq-scr-opt__name { font-size: 13.5px; font-weight: 700; color: var(--bq-ink); }
.bq-scr-opt--industry { padding-left: 32px; }
.bq-scr-opt--industry .bq-scr-opt__name { font-size: 13px; color: #55595f; }
.bq-scr-opt--empty { cursor: default; color: var(--gray-500); font-size: 13px; }
.bq-scr-opt--empty:hover { background: none; }
.bq-scr-opt.is-current { background: var(--blue-primary); box-shadow: inset 3px 0 0 var(--blue-darkest); }
.bq-scr-opt.is-current .bq-scr-opt__name { font-weight: 700; color: #fff; }
.bq-scr-opt.is-current .bq-scr-opt__ctx,
.bq-scr-opt.is-current .bq-scr-opt__n { color: rgba(255, 255, 255, .78); }
.bq-scr-opt.is-current:hover { background: var(--blue-darkest); }

/* ── table ── */
.bq-scr #historic-data-wrapper { border: 0; border-radius: 0; }
.bq-scr .styled-table { font-size: 13.5px; }
.bq-scr .styled-table thead tr { background: #fff; border-bottom: 2px solid var(--bq-ink); }
.bq-scr .styled-table thead th,
.bq-scr .styled-table thead th.freeze { background-color: #fff !important; font-size: 10px; font-weight: 700; letter-spacing: .7px; text-transform: uppercase; color: var(--gray-700); padding-top: 9px; padding-bottom: 9px; }
.bq-scr .styled-table td { border-bottom: 1px solid var(--bq-line); font-variant-numeric: tabular-nums; }
.bq-scr .styled-table tbody tr:nth-of-type(even),
.bq-scr .styled-table tbody tr:nth-of-type(even) td.freeze { background-color: #fff !important; }
.bq-scr .styled-table tbody tr:hover,
.bq-scr .styled-table tbody tr:hover td.freeze { background-color: #f6f9fc !important; color: inherit; }
.bq-scr .styled-table th.freeze,
.bq-scr .styled-table td.freeze { box-shadow: none !important; border-right: 1px solid var(--bq-line) !important; }
.bq-scr-ticker { font-weight: 700; color: var(--blue-primary); text-decoration: none; }
.bq-scr-ticker:hover { text-decoration: underline; }
.bq-scr-tag {
    display: inline-block; margin-left: 5px; vertical-align: 1px;
    font-size: 9px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase;
    color: #b45309; background: #fff7ed; border: 1px solid #fed7aa; padding: 0 4px; cursor: help;
}
.bq-scr .pagination-controls { padding: 10px 14px; margin: 0; border-top: 1px solid var(--bq-line); }

@media (max-width: 900px) {
    .bq-scr-stats { grid-template-columns: 1fr 1fr; }
    .bq-scr-stat:nth-child(3) { border-left: none; }
    .bq-scr-stat:nth-child(n+3) { border-top: 1px solid var(--bq-line); }
}
@media screen and (max-width: 768px) {
    .bq-scr .screener-plugin-container { margin-top: 70px; padding: 0 16px; }
    .bq-scr .mobile-metrics-container { margin-top: 0; }
    .bq-scr .screener_table_pane { padding: 0; margin-bottom: 40px; }
    .bq-scr .toggle-container { padding-bottom: 0; margin-bottom: 0; border-bottom: 0; }
}
@media (max-width: 680px) {
    .bq-scr-head { padding: 16px 14px 15px; margin-bottom: 12px; }
    .bq-scr-head h1 { font-size: 22px; }
    .bq-scr-lede { font-size: 13.5px; }
    /* nowrap: a WRAPPING column sizes its line to the widest child, not to
       the container, which pushed the picker off a 320px screen. */
    .bq-scr-bar, .bq-scr-bar__left { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 8px; }
    .bq-scr-scope .bq-scr-toggle { flex: 1 1 0; justify-content: center; min-width: 0; padding: 0 6px; }
    .bq-scr-picker__control { display: flex; width: 100%; }
    .bq-scr-picker__input { flex: 1 1 auto; width: auto; }
    .bq-scr-scope__opts { justify-content: space-between; }
}
@media (max-width: 400px) {
    /* The rows still carry the 2nd tag; the key beside the box is the first
       thing to go on a narrow phone. */
    .bq-scr-scope .bq-scr-tag--key { display: none; }
    .bq-scr-stat { padding: 9px 12px 10px; }
    .bq-scr-stat__val { font-size: 14px; }
}


/* =====================================================================
   TOUCH — iOS ZOOM ON FOCUS, THE LAST WORD (2026-10-26)
   ---------------------------------------------------------------------
   The TOUCH block above predates 4.20, and 4.20's metric picker
   (.bq-scr-picker__input, 13.5px) is declared after it at the same
   specificity, so on an iPhone tapping the picker zoomed the page again.
   This block sits at the end of the file and carries !important on the
   one property, so no later section and no more specific selector can
   undercut it: anything that takes focus is 16px on a touch device.
   The reasoning for 16px over deferring focus is in company-KPI's
   styles.css.
   ===================================================================== */
@media (pointer: coarse) {
    .bq-scr-picker__input,
    .ts-wrapper .ts-control > input,
    #metrics-modal-search,
    #rows-per-page-select,
    .valueInput,
    input[type="text"], input[type="search"], input[type="number"], input[type="email"],
    input[type="url"], input[type="tel"], input[type="date"], input:not([type]),
    select, textarea {
        font-size: 16px !important;
    }
}
