#stock-screener  {
    display: grid;
    -webkit-box-pack: justify;
    justify-content: space-between;
    align-items: flex-start;
    scrollbar-width: none;
    position: relative;
    grid-template-columns: clamp(320px, 20%, 400px) minmax(0, 1fr);
    color: var(--text-main);
}
#stock-screener p {
    margin-bottom: 0;
}
#stock-screener h2 {
    font-size: 22px;
    line-height: 26px;
    margin-bottom: 15px;
}
#stock-screener h3.default-screener {
    display: none;
    background-color: var(--bg-topstock);
    font-size: 18px;
    margin-top: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    cursor: pointer;
}
.list-screener, .result-screener {
    padding: 15px;
}
.list-screener .close-list {
    display: none;
    position: absolute;
    top: 15px;
    right: 10px;
    cursor: pointer;
}
.list-screener .list p {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 500;
    background-color: var(--bg-thead);
    padding: 6px 10px;
    margin-bottom: 10px !important;
    border-radius: 6px;
    cursor: pointer;
    transition: color 0.3s ease-in-out;
    position: relative;
}
.list-screener .list p.smoney-locked {
    cursor: not-allowed;
}
.list-screener .list p.smoney-locked .smoney-locked-label {
    opacity: 0.6;
    display: flex;
    align-items: center;
    gap: 4px;
}
.list-screener .list p.smoney-locked:hover .criterion-locked-tooltip {
    display: block;
    pointer-events: auto;
}
.list-screener .list p.active {
    background-color: #f5a504;
    color: #ffffff;
}
.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.result-screener p.qty-stock span.qty {
    font-size: 28px;
    color: var(--text-main);
}
.result-screener p.qty-stock span.name {
    font-weight: 500;
    font-style: italic;
}
.result-screener p.qty-stock span {
    font-size: 18px;
    color: var(--text-muted);
}
.result-screener .box-title .exchange-name {
    margin-left: 0;
}
.result-screener .filter-screener {
    background-color: #f5a504;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    padding: 5px 8px;
    border-radius: 8px;
    cursor: pointer;
}
.market-table #result-screener table tr td {
    padding-top: 12px;
    padding-bottom: 12px;
}
.market-table #result-screener table tr td.tang-nhat {
    color: rgb(113 44 248);
}
.market-table #result-screener table tr td.tang-manh {
    color: rgb(113 44 248 / 80%);
}
.market-table #result-screener table tr td.tang-vua {
    color: rgb(38 168 78);
}
.market-table #result-screener table tr td.tang-nhe {
    color: rgb(38 168 78 / 80%);
}
.market-table #result-screener table tr td.khong-doi {
    color: #f1b63f;
}
.market-table #result-screener table tr td.giam-nhe {
    color: rgb(248 40 48 / 60%);
}
.market-table #result-screener table tr td.giam-vua {
    color: rgb(248 40 48 / 80%);
}
.market-table #result-screener table tr td.giam-manh {
    color: rgb(248 40 48);
}
#result-screener {
    position: relative;
}
#result-screener .box-result {
    overflow-x: auto;
    max-height: 100vh;
    min-height: 550px;
}
#result-screener .box-result::-webkit-scrollbar {
    width: 3px;
}
#result-screener table thead {
    top: 0px;
    z-index: 100;
}
#result-screener table thead td.sort-col {
    cursor: pointer;
}
#result-screener table thead td.sort-col > div {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}
#result-screener table td.market-symbol {
    position: sticky;
    left: 0px;
}
#result-screener table td:first-child, #result-screener table td.wl-add-col {
    min-width: 30px;
    max-width: 30px;
}
#result-screener table td {
    min-width: 95px;
}
#result-screener table td.market-symbol{
    min-width: 100px;
}
#result-screener table td.market-floor {
    min-width: 80px;
}
#result-screener table td svg {
    flex-shrink: 0;
}
#result-screener table tbody td.market-period {
    font-size: 15px;
}
#result-screener table td.market-symbol p.exchange {
    font-size: 10px;
    color: var(--text-normal);
}
svg.monitoring-badge {
    color: #f59e0b;
    cursor: default;
    flex-shrink: 0;
}
#result-screener tbody td.market-symbol .tooltip-custom {
    display: none;
    background-color: var(--bg-tooltip-ticker);
    color: var(--text-main);
    width: 360px;
    text-align: left;
    border-radius: 10px;
    padding: 5px;
    position: absolute;
    z-index: 1000;
    bottom: 80%;
    left: 0px;
    box-shadow: 0px 0px 8px var(--border-soft);
}
#result-screener tbody td.market-symbol:hover .tooltip-custom {
    display: block;
}
#result-screener .tooltip-custom.hide {
    display: none !important;
}
#result-screener .caption {
    position: relative;
    z-index: 1;
}
#result-screener .caption p {
    font-size: 14px;
}
.tooltip-custom .info {
    margin: 6px;
}
.tooltip-custom .info .logo-symbol, .tooltip-custom .link-symbol {
    display: flex;
    align-items: baseline;
    gap: 10px;
}
.tooltip-custom .logo-symbol .symbol {
    font-size: 22px;
    line-height: 22px;
    font-weight: bold;
}
.tooltip-custom .logo-symbol svg.tooltip-close {
    margin-left: auto;
    cursor: pointer;
}
.tooltip-custom .financial {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}
.tooltip-custom .financial .item {
    flex: 1 1 25%;
    background-color: var(--bg-box-white);
    padding: 3px 6px;
    border-radius: 8px;
    text-align: center;
}
.tooltip-custom .info .name, .tooltip-custom .logo-symbol span:last-child, .tooltip-custom .financial .item p:first-child {
    font-size: 14px;
}
.tooltip-custom .financial .item p:last-child, .tooltip-custom .link-symbol a {
    font-size: 15px;
    font-weight: 500;
}
.tooltip-custom .link-symbol {
    margin-top: 10px;
}
.tooltip-custom .link-symbol a {
    background-color: var(--scrollbar);
    color: var(--bg-link-menu) !important;
    padding: 3px 6px;
    border-radius: 6px;
    transition: all ease-in-out 0.3s;
}
.tooltip-custom .link-symbol a:hover {
    background-color: #f5a504;
    color: #fff;
}
.box-screener {
    background-color: var(--bg-overlay);
    position: fixed;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 10000001;
    transition: all 0.3s ease-in-out;
}
.box-screener.show {
    opacity: 1;
    visibility: visible;
}
.box-screener.hide {
    opacity: 0;
    visibility: hidden;
}
.box-screener .criterion {
    position: relative;
    width: 860px;
    max-height: 95vh;
    margin: 15px auto;
    z-index: 9;
    /* max-height: 696px; */
    padding: 16px;
    background-color: var(--box-search);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    /* overflow-y: scroll; */
}
.box-screener .criterion h3 {
    color: var(--text-main);
    font-size: 22px;
    margin-bottom: 0px;
    line-height: 26px;
    font-weight: 500;
}
.box-screener .criterion .title {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.box-screener .screener-close {
    cursor: pointer;
}
.box-screener .screener-close svg {
    width: 28px;
    height: 28px;
}
#form-criterion > div {
    max-height: 70vh;
    overflow-x: hidden;
    margin-bottom: 10px;
}
#form-criterion > div::-webkit-scrollbar {
    width: 2px;
}
.box-screener .content {
    margin-top: 20px;
}
.box-screener .criterion-info {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    margin-bottom: 15px;
}
.box-screener .criterion-info .criterion-name {
    color: var(--text-main);
    min-width: 155px;
}
.box-screener .criterion-list {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    row-gap: 12px;
    column-gap: 6px;
}
.box-screener .criterion-list .criterion-item {
    position: relative;
    font-size: 15px;
    background-color: #d8e3ff;
    min-height: 36px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 0px 10px;
    margin-right: 6px;
    border-radius: 6px;
    transition: all 0.6s ease;
    cursor: pointer;
}
.criterion-item.value-added {
    background-color: #f5a504 !important;
}
.criterion-item.value-added .name {
    font-weight: 500;
}
.criterion-item.value-added .value-added-close svg {
    width: 14px;
    height: 14px;
    margin-left: 6px;
}
.criterion-item .hide {
    display: none;
}
.criterion-item .show {
    position: absolute;
    bottom: 50px;
    right: 0px;
    z-index: 10000002;
    width: max-content;
    max-width: 450px;
    color: #fff;
    background-color: #888;
    padding: 10px;
    border-radius: 6px;
}
.criterion-item #industry.show {
    max-height: 380px;
    overflow-y: auto;
}
.criterion-item fieldset {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.criterion-item fieldset label {
    background-color: #fff;
    color: #222;
    padding: 3px 5px;
    border-radius: 6px;
    cursor: pointer;
}
.criterion-item fieldset label.gd-tf-locked {
    display: flex;
    align-items: center;
}
.criterion-item .input-value {
    position: relative
}
.criterion-item .input-value .value {
    width: 120px;
    display: block;
    padding: 6px 10px;
    border: 1px solid #fff;
    border-radius: 8px;
}
.criterion-item .input-value .unit {
    position: absolute;
    top: 8px;
    right: 12px;
    z-index: 1000000;
    background-color: #888888;
    color: #fff;
    min-width: 16px;
    min-height: 22px;
}
.criterion-item input[type="checkbox"], .criterion-item input[type="radio"] {
    display: none;
}
.criterion-item input[type="checkbox"]:checked + label, .criterion-item input[type="radio"]:checked + label {
    background-color: #d8e3ff;
    color: #f5a504;
    font-weight: 500;
}
.criterion-item input[type="number"] {
    width: 100%;
    background-color: #888888;
    color: #fff;
    border: none;
    outline: none;
}
.criterion-item input[type="number"]::placeholder {
    color: #fff;
    appearance: none;
}
.criterion-item input[type="number"]:focus {
    box-shadow: none !important;
    border: none;
}
.criterion-item input[type="number"]:focus + span.value {
    border: 1px solid #f5a504;
}
.criterion-item button {
    background-color: #f5a504;
    border: none;
    font-size: 15px;
}
.list-screener .new-item,
.box-screener .new-item {
    position: absolute;
    top: -10px;
    right: -6px;
    background-color: #f5294c;
    color: #ffffff;
    font-size: 11px;
    padding: 2px 5px;
    border-radius: 6px;
}
/* Criterion bị khoá */
.criterion-item.criterion-locked {
    cursor: not-allowed;
}
.criterion-item.criterion-locked .name {
    opacity: 0.6;
    cursor: not-allowed;
}
.criterion-lock-icon {
    vertical-align: middle;
    opacity: 0.8;
}
.criterion-locked-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    min-width: 220px;
    background-color: var(--bg-topstock);
    border: 1px solid var(--bg-thead);
    color: var(--text-normal);
    font-size: 13px;
    font-weight: 400;
    padding: 8px 12px;
    border-radius: 6px;
    text-align: center;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    pointer-events: none;
}
.criterion-locked-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--bg-thead);
}
.criterion-item.criterion-locked:hover .criterion-locked-tooltip {
    display: block;
    pointer-events: auto;
}
.criterion-locked-tooltip a {
    display: block;
    color: #f5a504;
    text-decoration: none;
}
.criterion-locked-tooltip strong {
    color: #f5a504;
}
.industry-list .industry-child {
    margin: 5px 5px 5px 0px;
}
.industry-list .industry-child label {
    padding: 5px 8px;
}
#form-criterion .float-end {
    margin-top: 15px;
}
#form-criterion #submitBtnScreener {
    border: none;
    background-color: #f5a504;
    font-weight: 500;
    padding: 8px 10px;
    border-radius: 6px;
    transition: all 0.3s;
}
#form-criterion #submitBtnScreener:hover {
    background-color: #bdbdbf;
}
#form-criterion .btn-reset-all {
    background-color: #bdbdbf;
    color: #001f3f;
    font-weight: 500;
    padding: 8px 10px;
    border: none;
    border-radius: 6px;
    transition: all 0.3s;
}
#form-criterion .btn-reset-all:hover {
    background-color: #f5a504;;
}
.loader {
    width: 1.3em;
    height: 1.3em;
    margin-left: 10px;
    display: none;
}
.loader.show {
    display: block;
}
.loader circle {
    fill: none;
    stroke-width: 4;
    stroke-linecap: round;
}
.loader circle:nth-child(2) {
    stroke: #001f3f;
    animation: rotate 0.6s linear infinite;
    transform-origin: 50% 50%;
    stroke-dasharray: 150;
    stroke-dashoffset: 60;
}
@keyframes rotate {
    100% {
        transform: rotate(360deg);
    }
}
@media (min-width: 768.1px) {
    #stock-screener .list-screener {
        height: 100vh;
        grid-row: 1 / 999;
        z-index: 1;
        scrollbar-width: none;
        overflow: scroll;
        position: sticky;
        top: 60px;
        border-right: 1px solid var(--border-main);
    }
}
@media (max-width: 1279.98px) {
    #stock-screener .post-content, #stock-screener .related-post {
        padding-bottom: 0 !important;
    }
}
@media (max-width: 992px) {
    #stock-screener {
        grid-template-columns: clamp(280px, 20%, 360px) minmax(0, 1fr);
    }
    .box-screener .criterion {
        width: 96%;
    }
}
@media (max-width: 768px) {
    #stock-screener {
        grid-template-columns: minmax(0, 1fr);
    }
    .box-screener .criterion-info {
        flex-wrap: wrap;
        row-gap: 10px;
    }
    .box-screener .criterion-list {
        justify-content: flex-start;
    }
    .box-screener .criterion-info .criterion-name {
        width: 100%;
    }
    .criterion-item .input-value .value {
        width: 96px;
    }
    .criterion-item .show {
        max-width: 280px;
        padding: 8px;
    }
    #result-screener table tbody td.market-period {
        font-size: 14px;
    }
}
@media (max-width: 576px) {
    .result-screener {
        padding-left: 10px;
        padding-right: 10px;
    }
}
@media (max-width: 480px) {
    #stock-screener h3.default-screener {
        display: block;
    }
    .list-screener {
        position: absolute;
        left: 0;
        top: 0px;
        transform: translateX(-100%);
        z-index: 100002;
        background-color: var(--scrollbar);
        height: 100%;
        transition: all ease-in-out 0.6s;
    }
    .list-screener .close-list {
        display: block;
    }
    .result-header {
        flex-wrap: wrap;
    }
    #result-screener tbody td.market-symbol .tooltip-custom {
        width: calc(100vw - 60px);
    }
    .result-screener p.qty-stock span.qty {
        font-size: 22px;
    }
    .result-screener p.qty-stock span, #stock-screener h3.default-screener {
        font-size: 15px;
    }
    #result-screener .caption p {
        font-size: 13px;
    }
}

/* ===================== Toast notification ===================== */
.screener-toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.screener-toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    max-width: 340px;
    box-shadow: 0 4px 16px rgba(0,0,0,.25);
    pointer-events: auto;
    animation: toastSlideIn .25s ease forwards;
    color: #fff;
    background: linear-gradient(135deg, #fdb301, #d89103);
}
.screener-toast.toast-success {
    background: linear-gradient(135deg, #fdb301, #d89103);
}
.screener-toast.toast-error {
    background: #c0392b;
}
.screener-toast.toast-hide {
    animation: toastSlideOut .3s ease forwards;
}
@keyframes toastSlideIn {
    from { opacity: 0; transform: translateX(60px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes toastSlideOut {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(60px); }
}

/* ===================== Share filter ===================== */
.filter-share-btn,
.btn-share-filter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 2px 4px;
    cursor: pointer;
    color: inherit;
    opacity: 0;
    transition: opacity 0.15s;
    flex-shrink: 0;
}
#stock-screener .list-screener .list p:hover .filter-share-btn {
    opacity: 0.6;
}
#stock-screener .list-screener .list p.active .filter-share-btn,
#stock-screener .list-screener .list p:hover .filter-share-btn:hover,
#stock-screener .list-screener .list p.active .filter-share-btn:hover {
    opacity: 1;
}
.saved-filter-item:hover .btn-share-filter,
.saved-filter-item.active .btn-share-filter {
    opacity: 0.6;
}
.saved-filter-item:hover .btn-share-filter:hover,
.saved-filter-item.active .btn-share-filter:hover {
    opacity: 1;
}
.filter-share-popover {
    position: fixed;
    background: var(--bs-body-bg, #fff);
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,.15);
    padding: 6px;
    z-index: 99999;
    display: none;
    flex-direction: column;
    gap: 2px;
    min-width: 158px;
}
.filter-share-popover.show {
    display: flex;
}
.filter-share-popover a,
.filter-share-popover button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 13px;
    text-decoration: none;
    color: inherit;
    background: none;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}
.filter-share-popover a:hover,
.filter-share-popover button:hover {
    background: var(--bs-tertiary-bg, #f1f3f5);
    color: inherit;
}

/* ===================== Bộ lọc của tôi ===================== */
.list-my-filters {
    margin-top: 16px;
    border-top: 1px solid var(--border-main);
    padding-top: 12px;
}
.list-my-filters h2 {
    font-size: 15px;
    margin-bottom: 8px;
    color: var(--text-main);
}
.filter-count-badge {
    font-size: 12px;
    font-weight: 600;
    background: var(--bg-thead);
    color: var(--text-muted);
    padding: 2px 8px;
    border-radius: 10px;
}
.saved-filter-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-main);
    transition: background .15s;
    margin-bottom: 4px;
}
.saved-filter-item:hover {
    background: var(--bg-thead);
}
.saved-filter-item.active {
    background-color: #f5a504;
    color: #ffffff;
}
.saved-filter-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.saved-filter-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}
.saved-filter-actions button {
    background: none;
    border: none;
    padding: 3px;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: 4px;
    line-height: 1;
    transition: color .15s;
}
.saved-filter-actions button:hover {
    color: var(--text-main);
}
.no-saved-filter {
    font-size: 13px;
    color: var(--text-muted);
    margin: 4px 0;
}
.no-saved-filter a {
    color: var(--text-blue);
}
#btn-open-save-filter {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    font-size: 13px;
    background: var(--bg-thead);
    border: 1px solid var(--border-main);
    border-radius: 6px;
    padding: 5px 10px;
    cursor: pointer;
    color: var(--text-main);
    transition: border-color .15s;
    width: 100%;
    justify-content: center;
}
#btn-open-save-filter:hover {
    background: var(--border-soft);
    border-color: var(--border-soft);
}
.filter-limit-msg {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Modal lưu bộ lọc */
.modal-save-filter-backdrop {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    z-index: 10000001;
    display: none;
    align-items: center;
    justify-content: center;
}
.modal-save-filter-box {
    background: var(--box-search);
    color: var(--text-main);
    border-radius: 12px;
    padding: 24px;
    width: 100%;
    max-width: 360px;
    border: 1px solid var(--border-main);
    box-shadow: 0 8px 32px rgba(0,0,0,.2);
}
.modal-save-filter-box h4 {
    margin: 0 0 14px;
    font-size: 16px;
    color: var(--text-main);
}
.modal-save-filter-box input[type="text"] {
    width: 100%;
    padding: 9px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-main);
    background: var(--bg-body);
    color: var(--text-main);
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
    transition: border-color .15s;
}
.modal-save-filter-box input[type="text"]:focus {
    border-color: var(--bg-link-active);
}
.save-filter-error {
    font-size: 12px;
    color: #e74c3c;
    margin: 6px 0 0;
}
.modal-save-filter-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    justify-content: flex-end;
}
.modal-save-filter-actions button {
    padding: 8px 18px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: opacity .15s;
}
#btn-confirm-save-filter {
    background: var(--bg-link-active);
    color: #fff;
}
#btn-confirm-save-filter:disabled {
    opacity: .6;
    cursor: not-allowed;
}
#btn-cancel-save-filter,
#btn-cancel-rename-filter,
#btn-cancel-delete-filter {
    background: var(--bg-thead);
    color: var(--text-main);
    border: 1px solid var(--border-main);
}
#btn-confirm-rename-filter {
    background: var(--bg-link-active);
    color: #fff;
}
#btn-confirm-rename-filter:disabled {
    opacity: .6;
    cursor: not-allowed;
}
.btn-danger-action {
    background: #c0392b;
    color: #fff;
}
.btn-danger-action:hover {
    background: #a93226;
}
.modal-delete-msg {
    font-size: 14px;
    color: var(--text-main);
    margin: 0 0 4px;
    line-height: 1.5;
}