.screener-page {
    max-width: 1000px;
    margin: 48px auto;
    padding: 30px;
    color: white;
    background: transparent;
    box-shadow: none;
}
.screener-intro,
#screener-status {
    text-align: center;
}
.screener-page .page-heading {
    width: 560px;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    text-align: left;
}
.screener-controls {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: nowrap;
    width: 560px;
    max-width: 100%;
    margin: 0 auto;
    gap: 12px;
}
.screener-controls label {
    width: auto;
    flex: 0 1 auto;
}
.screener-controls input,
.screener-controls select {
    width: 150px;
    height: 38px;
    margin: 0;
    padding: 8px 10px;
    border: 1px solid #64748b;
    border-radius: 3px;
    background: #fff;
    box-shadow: none;
    color: #1f2937;
    font: inherit;
    font-size: 0.95rem;
}
#screener-operator,
#screener-percent {
    flex: 0 0 150px;
    width: 150px;
    box-sizing: border-box;
}
.screener-field {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
    white-space: nowrap;
}
.screener-field-label {
    display: block;
}
.screener-action-field {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    gap: 8px;
    margin-bottom: 0;
}
.screener-field select {
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, #64748b 50%),
        linear-gradient(135deg, #64748b 50%, transparent 50%);
    background-position: calc(100% - 14px) 16px, calc(100% - 9px) 16px;
    background-repeat: no-repeat;
    background-size: 5px 5px, 5px 5px;
    padding-right: 28px;
}
.screener-field input:focus,
.screener-field select:focus {
    border-color: #0284c7;
    outline: 2px solid rgba(14, 165, 233, .25);
    outline-offset: 1px;
}
.screener-controls > .action-button,
.screener-action-field > .action-button {
    align-self: center;
    flex-shrink: 0;
    height: 38px;
    margin: 0;
    padding: 8px 18px;
    box-sizing: border-box;
}
#screener-status {
    min-height: 1.5em;
}
.screener-results-panel {
    max-width: 900px;
    margin: 24px auto 0;
    text-align: left;
}
.screener-symbol {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 110px;
}
.screener-results-panel h2 {
    text-align: left;
}
.screener-results-list {
    list-style: none;
    max-height: 60vh;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    border-radius: 4px;
}
.screener-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 16px;
    background: #17181c;
    border-bottom: 1px solid #2a2c33;
    color: #dbeafe;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.screener-sort-header {
    cursor: pointer;
    user-select: none;
}
.screener-list-header > .screener-sort-header {
    flex: 0 0 110px;
    min-width: 110px;
}
.screener-sort-header:hover,
.screener-sort-header.is-sorted-ascending,
.screener-sort-header.is-sorted-descending {
    color: #fff;
}
.screener-sort-header.is-sorted-ascending::after {
    content: " \2191";
    color: #7dd3fc;
}
.screener-sort-header.is-sorted-descending::after {
    content: " \2193";
    color: #7dd3fc;
}
.screener-result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 12px 16px;
    background: #17181c;
    border-bottom: 1px solid #2a2c33;
    color: #fff;
    cursor: pointer;
}
.screener-result-item:hover,
.screener-result-item:focus-within {
    background: #202127;
}
.screener-result-item:last-child {
    border-bottom: none;
}
.screener-result-data {
    display: grid;
    grid-template-columns: repeat(5, minmax(80px, 1fr));
    flex: 1;
    gap: 10px;
    text-align: right;
}
.screener-result-item .item-clickable-area {
    display: flex;
    align-items: center;
    flex: 0 0 110px;
    width: 110px;
    min-width: 110px;
    gap: 10px;
}
.screener-action-header,
.screener-analyze-button,
.screener-watchlist-button {
    flex: 0 0 auto;
}
.screener-action-header {
    min-width: 76px;
    text-align: center;
}
.screener-row-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}
.screener-analyze-button,
.screener-watchlist-button {
    margin: 0;
    padding: 7px 10px;
    font-size: 0.85rem;
}
.screener-watchlist-button {
    background: #16a34a;
}
.screener-watchlist-button:disabled {
    background: #4b5563;
    cursor: default;
}
.screener-result-item .item-text {
    min-width: 0;
    font-size: 16px;
    white-space: normal;
    word-break: break-word;
}
.screener-result-data span {
    display: flex;
    flex-direction: column;
}
.screener-result-data small {
    margin-bottom: 2px;
    color: #94a3b8;
    font-size: 0.7rem;
    text-transform: uppercase;
}
.screener-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
    border-radius: 4px;
}

@media (max-width: 700px) {
    .screener-page {
        width: calc(100% - 24px);
        margin: 24px auto;
        padding: 16px 12px;
    }

    .screener-controls {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        width: 100%;
        gap: 4px;
    }

    .screener-field,
    .screener-action-field {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        width: 100%;
        min-width: 0;
        font-size: 0.8rem;
        font-weight: 600;
    }

    .screener-field-label {
        width: 100%;
        min-height: 2.2em;
        line-height: 1.1;
        margin: 0;
        padding: 0;
        text-align: left;
    }

    .screener-field {
        align-items: flex-start;
    }

    .screener-controls input,
    .screener-controls select {
        flex: 1 1 auto;
        min-width: 0;
        width: 100%;
        height: 38px;
        box-sizing: border-box;
        font-size: 0.8rem;
    }
    #screener-operator,
    #screener-percent {
        display: block;
        flex: none;
        inline-size: 100% !important;
        width: 100% !important;
        max-width: none;
        min-width: 0;
        height: 38px !important;
        min-height: 38px;
        max-height: 38px;
        margin: 0;
        padding: 8px 10px;
        border: 1px solid #64748b;
        border-radius: 3px;
        box-sizing: border-box;
    }

    .screener-action-field .action-button {
        width: 100%;
        min-height: 32px;
        height: 32px;
        padding: 6px 4px;
        font-size: 0.72rem;
        transform: none;
    }

    .screener-result-item,
    .screener-list-header {
        box-sizing: border-box;
        width: 100%;
        align-items: flex-start;
        flex-direction: row;
        gap: 12px;
        padding: 7px 6px;
    }

    .screener-list-header > .screener-sort-header,
    .screener-result-item .item-clickable-area {
        flex: 0 0 62px;
        width: 62px;
        min-width: 62px;
    }

    .screener-result-data {
        grid-template-columns:
            minmax(0, 0.8fr)
            minmax(0, 0.8fr)
            minmax(0, 0.9fr)
            minmax(0, 1fr)
            minmax(0, 1.3fr);
        width: 100%;
        min-width: 0;
        gap: 2px;
        font-size: 0.66rem;
        text-align: left;
    }

    .screener-list-header .screener-result-data {
        min-width: 0;
        text-align: left;
    }

    .screener-result-data span {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .screener-result-data small {
        overflow: hidden;
        font-size: 0.5rem;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .screener-result-item .item-clickable-area {
        gap: 4px;
    }

    .screener-result-item .item-text {
        overflow: hidden;
        font-size: 0.72rem;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .screener-action-header {
        min-width: 44px;
    }

    /* Chained with the parent class (instead of relying on source order) so
       these always win over the shared `.action-button` mobile sizing in
       mobile.css (min-height: 36px, padding: 7px 12px, font-size: 14px),
       regardless of which stylesheet loads last. `flex-basis` is intentionally
       left unset here: `.screener-row-actions` is a column flex container on
       mobile, so `flex-basis` would size each button's *height*, not width. */
    .screener-row-actions .screener-analyze-button,
    .screener-row-actions .screener-watchlist-button {
        width: 44px;
        min-width: 44px;
        max-width: 44px;
        min-height: 0;
        height: 20px;
        margin: 0;
        padding: 0 2px;
        font-size: 0.55rem;
        line-height: 20px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .screener-row-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 3px;
    }

    .screener-logo {
        width: 20px;
        height: 20px;
    }
}
