.container { max-width: 1440px; }
.stock-screener {
    --screen-border: rgba(148, 163, 184, .18);
    --screen-muted: #94a3b8;
    background: #101722;
    border: 1px solid var(--screen-border);
    border-radius: 16px;
    padding: 24px;
    color: #e2e8f0;
}
.stock-screener *, .screen-update * { box-sizing: border-box; }
.screen-heading, .screen-results, .screen-utilities, .screen-result-info, .screen-sort, .screen-update { display: flex; align-items: center; gap: 16px; }
.screen-heading { justify-content: space-between; margin-bottom: 24px; }
.screen-tabs, .screen-metric { display: inline-flex; padding: 4px; gap: 4px; background: #080f19; border: 1px solid var(--screen-border); border-radius: 10px; }
.stock-screener button, .screen-update button { font: inherit; cursor: pointer; }
.screen-tabs button, .screen-metric button { border: 0; border-radius: 6px; background: transparent; color: var(--screen-muted); padding: 10px 18px; font-size: .88rem; font-weight: 700; white-space: nowrap; }
.screen-tabs button.active, .screen-metric button.active { background: #223247; color: #e6f5ff; box-shadow: 0 1px 3px #0004; }
.screen-utilities { flex-shrink: 0; gap: 20px; font-size: .82rem; }
.screen-utilities a, .screen-utilities button { color: #a6bdd3; text-decoration: none; background: transparent; border: 0; padding: 4px 0; }
.screen-utilities span { color: #e2e8f0; background: #233044; border-radius: 4px; padding: 2px 6px; margin-left: 4px; }
.screen-main { display: grid; grid-template-columns: minmax(240px, 2fr) repeat(2, minmax(180px, 1fr)); gap: 16px; }
.screen-field { display: flex; flex-direction: column; gap: 9px; min-width: 0; font-size: .8rem; font-weight: 600; color: #a6b3c5; }
.stock-screener select, .stock-screener #searchInput {
    display: block; width: 100%; height: 44px; min-width: 0; padding: 0 12px;
    border: 1px solid #344154; border-radius: 8px; background: #0b121e;
    color: #e2e8f0; font: inherit; font-size: .88rem; color-scheme: dark;
}
.stock-screener #searchInput { padding-left: 14px; }
.stock-screener #searchInput::placeholder { color: #718096; }
.stock-screener :is(button, input, select, summary, a):focus-visible, .screen-update button:focus-visible { outline: 2px solid #54bcf7; outline-offset: 3px; }
.stock-screener :is(button, a):hover { color: #63c9ff; }
.screen-advanced { border-top: 1px solid var(--screen-border); margin-top: 22px; }
.screen-advanced summary { display: flex; align-items: center; gap: 10px; padding: 17px 0; list-style: none; cursor: pointer; font-weight: 600; font-size: .85rem; }
.screen-advanced summary::-webkit-details-marker { display: none; }
.screen-advanced summary > span:first-of-type { color: var(--screen-muted); font-size: .75rem; font-weight: 400; }
.screen-disclosure { margin-left: auto; font-size: 1.1rem; color: var(--screen-muted); transition: transform .15s; }
.screen-advanced[open] .screen-disclosure { transform: rotate(180deg); }
.screen-score-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; padding: 4px 0 0; }
.screen-hint { margin: 12px 0 18px; color: var(--screen-muted); font-size: .75rem; line-height: 1.6; }
.screen-results { border-top: 1px solid var(--screen-border); padding-top: 16px; justify-content: space-between; }
.screen-result-info { flex: 1; flex-wrap: wrap; column-gap: 12px; row-gap: 6px; min-width: 0; font-size: .8rem; }
.stock-screener #visibleRowCount { color: #dfeafa; font-size: .88rem; white-space: nowrap; }
#activeFilterSummary { color: var(--screen-muted); overflow-wrap: anywhere; }
.screen-result-info button { color: #70c5fa; padding: 0; border: 0; background: transparent; white-space: nowrap; font-size: .78rem; }
.screen-result-info button:disabled { display: none; }
.screen-sort { gap: 9px; flex-shrink: 0; font-size: .78rem; color: var(--screen-muted); }
.screen-sort select { width: 180px; height: 36px; font-size: .8rem; }
.screen-sort label { white-space: nowrap; }
.screen-metric[hidden] { display: none; }
.screen-metric button { padding: 6px 10px; font-size: .78rem; }
.screen-update { display:grid; grid-template-columns:minmax(0,1fr) auto; min-height:56px; margin: 12px 0 16px; gap: 12px; color: #8795aa; font-size: .76rem; }
#dashQuotesUpdateTime { height:2.6rem; line-height:1.7; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; text-align:left; font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
.screen-update button { min-width:90px; white-space:nowrap; }
.screen-update button[aria-busy="true"] { opacity:.55; cursor:wait; }
.screen-update button { border: 1px solid #344154; background: transparent; border-radius: 6px; color: #a7b6cc; padding: 5px 10px; font-size: .76rem; }
.screen-intro { color:#9fb0c6; font-size:.9rem; margin:-8px 0 24px; }
#cyber-banner { display:none; }
.screen-search-row { margin-bottom:12px; }
.position-controls { display:flex; gap:24px; align-items:center; margin:20px 0; flex-wrap:wrap; }
.position-controls .screen-field { min-width:200px; }
.short-history { display:flex; align-items:center; gap:8px; font-size:.82rem; color:#b4c2d6; }
.position-group { border:0; padding:0; margin:20px 0; min-width:0; }
.position-group legend { font-size:.86rem; font-weight:700; margin-bottom:12px; color:#dbeafe; }
.position-group legend small { font-size:12px; }
.position-group small { font-size:.72rem; font-weight:400; color:#8da3bb; margin-left:10px; }
.position-choices { display:flex; flex-wrap:wrap; gap:8px; }
.position-choices label { cursor:pointer; }
.position-choices input { position:absolute; opacity:0; width:1px; height:1px; }
.position-choices span { display:block; border:1px solid #35465d; border-radius:8px; padding:9px 13px; font-size:.83rem; white-space:nowrap; color:#b5c4d9; background:#111a29; }
.position-choices input:checked + span { border-color:#29caff; background:#083449; color:#8be5ff; }
.position-choices input:focus-visible + span { outline:2px solid #a78bfa; outline-offset:3px; }
.reentry-field { max-width:320px; }
.filter-actions { display:flex; gap:12px; margin:20px 0; }
.filter-actions button { border:1px solid #40516a; border-radius:8px; padding:10px 18px; color:#bed1e8; background:#141f30; font-size:.85rem; }
.filter-actions button:first-child { color:#07111d; background:#22c9f2; border-color:#22c9f2; font-weight:700; }
.screen-data-info { color:#95a7bf; font-size:.75rem; line-height:1.7; margin:12px 0 20px; }
.screen-data-info summary { cursor:pointer; color:#a8bdd5; }
.screen-data-info p { margin:10px 0; }
.screen-update { flex-wrap:wrap; }
#applyNewSnapshot { background:#13394b; border:1px solid #22c9f2; color:#8ee5ff; border-radius:8px; padding:10px 14px; margin:0 0 16px; cursor:pointer; }
.screener-table { border:1px solid #283348; border-radius:12px; }
#stockDashboard { font-size:.84rem; }
#stockDashboard thead th { white-space:nowrap; position:sticky; top:0; z-index:1; }
.table-sort-button { border:0; padding:6px 0; width:100%; color:inherit; background:transparent; font:inherit; font-weight:700; cursor:pointer; display:flex; align-items:center; justify-content:space-between; gap:6px; white-space:nowrap; }
.table-sort-button span { color:#869ab7; font-size:.8rem; width:1em; flex-shrink:0; text-align:center; }
.table-sort-button:hover,.table-sort-button.active,.table-sort-button.active span { color:#6de1ff; }
.table-sort-button:focus-visible { outline:2px solid #54bcf7; outline-offset:4px; border-radius:4px; }
.quote-source { height:3.2em; overflow:hidden; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; }
.snapshot-notice { height:64px; display:flex; align-items:center; }
.snapshot-notice #applyNewSnapshot { margin:0; max-width:100%; }
#stockDashboard td { padding:16px 12px; }
#stockDashboard td:nth-child(4) { min-width:145px; }
#stockDashboard td:nth-child(5) { white-space:nowrap; }
#stockDashboard td:nth-child(8) { min-width:175px; }
#stockDashboard td:last-child .report-link { display:inline-block; white-space:nowrap; margin:3px; }
.quote-meta { display:block; color:#8398b2; font-size:12px; font-weight:400; line-height:1.6; margin-top:5px; white-space:normal; }
.tech-badges { display:flex; flex-direction:column; align-items:flex-start; gap:6px; }
.position-badge { --badge-color:#a78bfa; color:var(--badge-color); border:1px solid color-mix(in srgb,var(--badge-color) 35%,transparent); background:color-mix(in srgb,var(--badge-color) 9%,transparent); padding:3px 7px; border-radius:5px; font-size:.72rem; white-space:nowrap; }
.position-badge.lohas { --badge-color:#67d6e7; }
.position-badge.missing { --badge-color:#8798ad; }
.muted { color:#8798ad; }
.selected-extra { background:#101722; border:1px solid #283348; border-radius:12px; margin:24px 0; padding:20px; }
.selected-extra>summary { font-size:1rem; font-weight:700; cursor:pointer; }
.selected-extra>summary span { color:#8597ae; font-size:.75rem; margin-left:10px; font-weight:400; }
.selected-extra section { margin-top:24px; }
[hidden] { display:none !important; }
.dashboard-cards,.mobile-table-toggle { display:none; }
.empty-results { text-align:center; padding:30px 10px; color:#9eb0c8; line-height:1.8; }
@media (max-width: 1050px) {
    .screen-main { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .screen-search { grid-column: 1 / -1; }
    .screen-score-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .screen-results { flex-wrap: wrap; }
    .screen-result-info { flex-basis: 100%; }
}
@media (max-width: 767.98px) { /* 手機版卡片式（< 768px），≥ 768px 維持表格 */
    header h1.dashboard-title { font-size:clamp(1.4rem,7.5vw,2rem); white-space:nowrap; }
    .dashboard-brand-prefix { display:none; }
    .stock-screener { padding: 16px; border-radius: 12px; }
    .screen-heading { flex-wrap: wrap; gap: 14px; margin-bottom: 20px; }
    .screen-tabs { width: 100%; }
    .screen-tabs button { flex: 1; padding: 10px 8px; }
    .screen-utilities { width: 100%; justify-content: flex-end; gap: 18px; }
    .screen-main { gap: 16px 10px; }
    .screen-score-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .screen-score-grid > :first-child { grid-column: 1 / -1; }
    .screen-sort { width: 100%; justify-content: space-between; }
    .screen-sort select { flex: 1; max-width: 230px; }
    .screen-update { flex-wrap: wrap; }
    .screen-main { grid-template-columns:1fr 1fr; }
    .screen-intro { line-height:1.6; }
    .position-controls { gap:14px; margin:16px 0; }
    .position-controls .screen-field { width:100%; }
    .short-history { line-height:1.6; }
    .position-choices { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
    .position-choices span { text-align:center; padding:10px 4px; font-size:.78rem; }
    .filter-actions button { flex:1; padding:12px 6px; font-size:.81rem; }
    .screener-table { display:none; }
    .dashboard-cards { display:grid; gap:12px; }
    .mobile-table-toggle { display:block; margin:0 0 16px; padding:8px 12px; border:1px solid #344154; border-radius:7px; background:#121c2a; color:#a8bdd5; cursor:pointer; }
    .show-full-table .screener-table { display:block; }
    .show-full-table .dashboard-cards { display:none; }
    .stock-state-card { padding:16px; border:1px solid #2d3a52; border-radius:12px; background:#101626; min-width:0; }
    .stock-state-card header { display:flex; justify-content:space-between; align-items:center; gap:12px; }
    .stock-state-card header a { color:#66dbfa; font-size:1.06rem; font-weight:700; text-decoration:none; }
    .stock-state-card header a span { color:#9eb3ce; font-size:.87rem; margin-right:6px; }
    .card-price { display:flex; justify-content:space-between; gap:10px; align-items:center; margin:12px 0 16px; }
    .card-price strong { color:#ecf4ff; font-size:1.6rem; font-variant-numeric:tabular-nums; }
    .card-price span { font-size:.8rem; font-weight:700; white-space:nowrap; }
    .stock-state-card dl { display:grid; grid-template-columns:1fr 1fr; margin:12px 0; gap:10px; }
    .stock-state-card dl div { background:#0b111c; padding:10px; border-radius:7px; }
    .stock-state-card dt { color:#8da2be; font-size:.7rem; }
    .stock-state-card dd { margin:5px 0 0; font-size:.94rem; font-weight:700; font-variant-numeric:tabular-nums; }
    .stock-state-card .tech-badges { flex-direction:row; flex-wrap:wrap; }
    .card-source { color:#92a6c0; font-size:.68rem; line-height:1.7; margin:12px 0; }
    .stock-state-card footer { display:flex; gap:10px; }
    .stock-state-card footer a { flex:1; text-align:center; padding:9px 5px; font-size:.78rem; white-space:nowrap; }
    .historical-note { color:#afa0d2; font-size:.75rem; line-height:1.6; }
    .selected-extra { padding:16px; }
    .selected-extra>summary { line-height:1.6; }
    .selected-extra>summary span { display:block; margin:4px 0 0; }
    .screen-update { min-height:72px; align-items:center; }
    #dashQuotesUpdateTime { height:3.9rem; -webkit-line-clamp:3; text-align:left; min-width:0; }
    .snapshot-notice { height:80px; }
    .stock-state-card p.card-source { height:3.4em; overflow:hidden; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; }
}
/* Shared valuation results stay legible beside dated quote columns. */
.valuation-filter-grid {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px;margin:18px 0;}
.valuation-filter-grid input {box-sizing:border-box;width:100%;min-width:0;background:#0b1421;color:#dceaff;border:1px solid #344154;border-radius:8px;padding:12px;font:inherit;}
.valuation-cell {min-width:170px;max-width:240px;white-space:normal;}
.valuation-cell strong {font-size:.86rem;font-variant-numeric:tabular-nums;}
.valuation-cell .quote-meta {white-space:normal;line-height:1.6;}
.valuation-cheap,.valuation-fair-low {color:#69dfb8;}
.valuation-fair-high {color:#efc977;}
.valuation-expensive {color:#ff939b;}
.valuation-missing {color:#94a3b8;}
#valuationFilterError {color:#ff939b;}
.card-valuation {display:grid;gap:6px;margin:14px 0;padding:12px;background:#0b1421;border-radius:8px;}
.card-valuation>span {color:#94a3b8;font-size:.75rem;}
@media(max-width:600px){.valuation-filter-grid{grid-template-columns:1fr}.card-valuation strong{overflow-wrap:anywhere;font-variant-numeric:tabular-nums;}}

/* EOD radar shares the screener's dated universe and compact mobile cards. */
.radar-controls { margin:0 0 22px; padding:18px; border:1px solid #345267; border-radius:12px; background:linear-gradient(120deg,#0c2330,#16172d); }
.radar-controls[hidden] { display:none; }
.radar-heading { display:flex; flex-wrap:wrap; justify-content:space-between; gap:8px; margin-bottom:16px; color:#80e2ef; }
.radar-heading span { font-size:.75rem; color:#b2a7ce; }
.radar-filter-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; }
.radar-method,.radar-evidence { font-size:.78rem; line-height:1.8; color:#a7bcd5; }
.radar-method summary,.radar-evidence summary { cursor:pointer; color:#79d8f0; padding:8px 0; }
.radar-method p { margin:8px 0; }
.radar-badge { display:inline-block; border:1px solid #496079; border-radius:6px; padding:4px 8px; font-size:.78rem; white-space:nowrap; }
.radar-setup { background:#112e39; color:#80deea; border-color:#357084; }
.radar-confirmed { background:#192e29; color:#82e4bc; border-color:#367761; }
.radar-watch,.radar-unavailable { color:#aab7c9; background:#1b2331; }
#stockDashboard .radar-detail-cell { min-width:260px; max-width:360px; white-space:normal; vertical-align:top; }
.radar-evidence { margin-top:10px; min-width:0; overflow-wrap:anywhere; }
.radar-evidence[open] { padding:10px; border:1px solid #35485e; border-radius:8px; background:#0b1422; }
.radar-evidence p { margin:8px 0; }
.radar-evidence-scroll { overflow-x:auto; max-width:100%; margin:10px 0; }
.radar-evidence table { width:100%; min-width:280px; border-collapse:collapse; font-size:.72rem; }
#stockDashboard .radar-evidence th,.radar-evidence th { position:static; white-space:normal; background:#1d293d; }
#stockDashboard .radar-evidence td,.radar-evidence td,.radar-evidence th { padding:8px 6px; border-bottom:1px solid #29354a; text-align:left; font-variant-numeric:tabular-nums; }
.radar-evidence td { white-space:normal; }
.radar-evidence td:nth-child(3),.radar-evidence td:nth-child(4) { white-space:nowrap; }
.radar-warnings { padding-left:18px; color:#e5c180; }
.radar-card dd { overflow-wrap:anywhere; }
@media(max-width:600px) {
  .screen-tabs button { font-size:.78rem; white-space:nowrap; padding:10px 4px; }
  .radar-controls { padding:12px; }
  .radar-filter-grid { grid-template-columns:1fr 1fr; gap:10px; }
  .radar-filter-grid>:last-child { grid-column:1/-1; }
  .radar-card .card-price { margin-bottom:6px; }
  .radar-card .quote-meta { white-space:normal; }
  .radar-evidence-scroll { width:100%; }
  .radar-card dl div { min-width:0; }
}

/* Compact market selector remains visible when mobile advanced filters collapse. */
.screen-search-row { display:grid; grid-template-columns:minmax(150px,200px) minmax(0,1fr); gap:12px; align-items:end; }
.esb-quote-detail { margin-top:6px; font-size:.76rem; color:#a6bdd3; overflow-wrap:anywhere; }
.esb-market-hint { border-left:3px solid #22c6df; padding:8px 12px; }

@media(max-width:600px){.screen-search-row { grid-template-columns:minmax(105px, .8fr) minmax(0,1.6fr); gap:8px; }.screen-search-row .screen-search { grid-column:auto; }.esb-quote-detail .quote-meta { white-space:normal; }}

#stockDashboard .telegram-reminder{color:#8fe7f7}
@media(max-width:767px){.stock-state-card footer{flex-wrap:wrap}.stock-state-card footer .telegram-reminder{flex-basis:100%;color:#8fe7f7}}

/* Explicit current-day status and dated snapshot browsing. */
.radar-freshness { margin:16px 0 8px; padding:14px; border:1px solid #47627a; border-radius:10px; background:#0b1725; min-width:0; }
.radar-freshness strong { display:block; color:#f0d497; font-size:.9rem; line-height:1.6; overflow-wrap:anywhere; }
.radar-freshness[data-state="ready"] strong { color:#82e4bc; }
.radar-freshness[data-state="failed"] strong,.radar-freshness[data-state="read-error"] strong { color:#ffb3ac; }
.radar-freshness p { margin:6px 0 12px; color:#b8c8dc; font-size:.78rem; line-height:1.7; }
.radar-snapshot-actions { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.radar-snapshot-actions button,.radar-snapshot-actions a { max-width:100%; min-height:42px; box-sizing:border-box; padding:9px 12px; border:1px solid #476782; border-radius:8px; background:#172b3d; color:#9ae5f2; font:inherit; font-size:.78rem; line-height:1.4; cursor:pointer; text-decoration:none; }
.radar-snapshot-actions [hidden] { display:none; }
.radar-snapshot-actions button:focus-visible,.radar-snapshot-actions a:focus-visible { outline:2px solid #21cae8; outline-offset:2px; }
@media(max-width:600px){ .radar-freshness{padding:12px;} .radar-snapshot-actions button{flex:1 1 130px;} .radar-snapshot-actions a{width:100%;text-align:center;} }

/* 突破雷達：逐層篩選漏斗與「差一點」標示 */
.radar-funnel { max-width:520px; margin:14px auto 0; text-align:left; color:#c8d6ea; }
.radar-funnel ol { margin:8px 0 12px; padding-left:22px; }
.radar-funnel li { display:flex; justify-content:space-between; gap:12px; padding:3px 0; border-bottom:1px dashed #2d3a52; }
.radar-funnel b { font-variant-numeric:tabular-nums; color:#e6eefb; }
.radar-near-link { padding:8px 12px; border:1px solid #3c6e8f; border-radius:8px; background:#10243a; color:#8fe7f7; cursor:pointer; }
.radar-badge.radar-near { background:#2a2440; color:#d8c8ff; border:1px solid #6b5aa8; }
.radar-market[data-weak="1"] { border-left:3px solid #f0b75a; padding-left:10px; color:#f3dcb0; }
