/* Dashboard composition: compact controls, a stable list, and one reading surface. */
body { background: #0b1019; }
.app-shell { width: min(1440px, calc(100% - 40px)); gap: 20px; padding-top: 16px; }
.command-section { padding: 0; gap: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.command-header { min-height: 66px; padding: 0 0 16px; margin: 0; border-bottom: 1px solid var(--line); }
.brand-lockup { gap: 10px; }
.brand-lockup img { width: 34px; height: 34px; }
.brand-lockup strong { font-size: 13px; letter-spacing: .1em; }
.command-workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); gap: 12px; padding-top: 14px; }
.command-secondary-stack { display: contents; }
.command-card { border-radius: 8px; background: #111925; box-shadow: none; }
.command-card-header { min-height: 42px; padding: 8px 12px; }
.command-card-title { color: #bbc6db; font-size: 11px; font-weight: 600; letter-spacing: .02em; text-transform: none; }
.command-card:has(.command-panel-content:not([hidden])) { grid-column: 1 / -1; }
.command-card-body { max-height: 380px; overflow-y: auto; }
.research-layout { grid-template-columns: 218px minmax(0, 1fr); gap: 20px; }
.rank-section { padding: 12px; gap: 10px; border-radius: 10px; background: #101722; box-shadow: none; top: 16px; }
.ranking-label { padding: 2px 2px 0; }
.ranking-label-copy > span { font-size: 12px; letter-spacing: .03em; color: #c6d0e3; }
.ranking-label small { font-size: 10px; line-height: 1.5; }
.setup-filter-label { padding: 4px 0; color: var(--muted); }
.setup-filter-label select { min-height: 36px; padding: 7px 10px; font-size: 12px; }
.rank-grid { gap: 4px; padding: 0; scrollbar-width: thin; }
.rank-card { padding: 7px 8px; grid-template-columns: 30px minmax(0, 1fr); grid-template-rows: 30px auto; min-height: 64px; border-color: transparent; border-radius: 6px; }
.rank-card.is-rebound, .rank-card.is-pullback, .rank-card.is-weak-thesis { background: transparent; border-color: transparent; box-shadow: none; }
.rank-card:hover { background: #1a2535; }
.rank-card.is-selected { background: #202d43; border-color: #526b96; box-shadow: inset 2px 0 0 #a6bcf1; }
.rank-card > strong { font-size: 14px; }
.rank-score { width: 30px; background: transparent; border-radius: 0; }
.rank-score::before { display: none; }
.rank-score strong { font-size: 12px; color: #bdcbe4; font-variant-numeric: tabular-nums; }
.rank-card .rank-forecast-caption { color: #9faec5; opacity: 1; font-size: 10px; }
.detail-panel { padding: 0; gap: 16px; background: transparent; border: 0; box-shadow: none; }
.sticky-detail-heading { position: sticky; top: 10px; margin: 0; padding: 18px 20px; border: 1px solid var(--line); border-radius: 10px; background: #111925; box-shadow: 0 8px 18px rgba(4, 7, 14, .25); backdrop-filter: none; }
.sticky-detail-top { gap: 20px; align-items: center; }
.detail-heading-copy { order: -1; }
.detail-heading-copy .kicker { padding-right: 0; font-size: 10px; letter-spacing: .06em; }
.detail-heading-copy h2 { font-size: 24px; font-weight: 650; letter-spacing: -.03em; line-height: 1.25; }
.forecast-header-score { min-width: 112px; padding: 0 0 0 18px; border: 0; border-left: 1px solid var(--line); border-radius: 0; }
.forecast-header-score > strong { font-size: 26px; line-height: 1.1; }
.forecast-header-score > small { max-width: 150px; font-size: 10px; line-height: 1.5; }
.detail-freshness { position: static; align-self: start; font-size: 10px; }
.sticky-detail-heading > .detail-company-context { font-size: 11px; color: #98a9c4; margin-top: 10px; }
.sticky-detail-heading > .external-ticker-links { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); gap: 14px; }
.external-ticker-link, .external-ticker-prefix { font-size: 10px; font-weight: 500; }
.embedded-price-history { padding: 18px 20px; border-radius: 10px; background: #111925; }
.price-history-head { gap: 12px; flex-wrap: wrap; }
.price-history-head .kicker { display: none; }
.price-history-head h2 { font-size: 14px; font-weight: 600; margin: 0; }
.price-history-controls { gap: 10px; flex-wrap: wrap; }
.chart-control-group { gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 7px; }
.chart-control-group button { min-height: 30px; padding: 5px 9px; border: 0; background: transparent; font-size: 10px; border-radius: 4px; }
.chart-control-group button.is-active { background: #2b3a54; color: #e7efff; box-shadow: none; }
.price-chart { padding: 12px 0 0; border: 0; border-radius: 0; background: transparent; margin: 0; }
.price-chart svg { height: clamp(240px, 25vw, 360px); aspect-ratio: auto; }
.price-chart-meta > div > span { font-size: 11px; }
.price-chart-meta strong { font-size: 20px; }
.price-chart-meta em { font-size: 14px; }
.price-chart-context, .price-chart-meta small { font-size: 10px; color: #91a1bd; }
.price-chart-facts span { white-space: normal; overflow: visible; font-size: 11px; line-height: 1.5; }
.price-chart-facts b { display: block; }
.price-chart-facts { border-top: 1px solid var(--line); padding-top: 12px; }
.thesis-banner { border-width: 1px; border-left-width: 3px; padding: 12px 16px; }
.directional-forecast { margin: 0; border-radius: 10px; background: #111925; }
.directional-forecast h3 { font-size: 15px; }
.detail-grid { gap: 10px; }
.app-footer { min-height: 100px; margin-top: 8px; background: transparent; }
:where(button, a, select, input):focus-visible { outline: 2px solid #b4caff; outline-offset: 3px; }
@media (max-width: 1000px) {
  .research-layout { grid-template-columns: 180px minmax(0, 1fr); gap: 14px; }
  .sticky-detail-top { flex-wrap: wrap; }
  .detail-freshness { order: 3; width: 100%; }
  .detail-heading-copy h2 { font-size: 21px; }
  .sticky-detail-heading, .embedded-price-history { padding: 16px; }
}
@media (max-width: 760px) {
  .app-shell { width: calc(100% - 24px); padding-top: 8px; gap: 14px; }
  .command-header { min-height: 58px; padding-bottom: 10px; }
  .command-workspace { gap: 6px; padding-top: 10px; }
  .command-card-header { min-height: 42px; padding: 8px; }
  .command-card-title { font-size: 10px; }
  .command-card-tools { gap: 2px; }
  .command-panel-caret { width: 10px; }
  .notification-help, #notification-state-pill { display: none; }
  .command-card:has(.command-panel-content:not([hidden])) { grid-column: 1 / -1; }
  .research-layout { grid-template-columns: 1fr; gap: 14px; }
  .rank-section { padding: 10px; max-height: none; position: static; }
  .ranking-label-copy { flex-direction: row; align-items: center; justify-content: space-between; }
  .ranking-label small { width: auto; text-align: right; }
  .setup-filter-label { flex-direction: row; align-items: center; gap: 10px; }
  .setup-filter-label select { width: auto; flex: 1; }
  .rank-grid { display: grid; grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: 138px; grid-template-rows: 72px; overflow-x: auto; overflow-y: hidden; gap: 6px; padding-bottom: 4px; }
  .rank-grid > :nth-child(n) { transform: none; }
  .rank-card { width: auto; min-width: 0; min-height: 68px; }
  .rank-section.is-stuck .rank-sticky-logo { display: none; }
  .rank-section.rank-footer { display: none; }
  .sticky-detail-heading, .embedded-price-history { padding: 14px; }
  .sticky-detail-heading { top: 0; }
  .sticky-detail-top { gap: 12px; }
  .detail-heading-copy h2 { font-size: 20px; }
  .forecast-header-score { min-width: 90px; padding-left: 12px; }
  .forecast-header-score > strong { font-size: 23px; }
  .forecast-header-score > small { max-width: 100px; }
  .external-ticker-links { overflow-x: auto; }
  .price-history-controls { gap: 6px; }
  .chart-control-group button { min-height: 34px; padding: 5px 8px; }
  .price-chart-meta { display: flex; flex-wrap: wrap; gap: 10px; }
  .price-chart svg { height: 235px; }
  .price-chart-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Source health and scan timing are distinct from market direction. */
.source-list > span { display: grid; grid-template-columns: auto auto; align-items: center; gap: 5px 10px; padding: 10px 12px; }
.source-list > span > strong { margin: 0; }
.source-list b { font-size: 11px; font-weight: 600; }
.source-list small { grid-column: 1 / -1; color: var(--muted); font-size: 10px; }
.source-pending { color: var(--muted); }
.forecast-header-score > small { max-width: 175px; }
@media (max-width: 560px) { .price-chart-context { display: block; line-height: 1.5; } }

/* Ranking ledger: ordering metric and forecast retain distinct labels. */
.ranking-sort-help { margin: 0 0 6px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.rank-ledger { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto auto auto; gap: 3px 8px; padding: 8px; min-height: 88px; border: 1px solid #253247; background: #141e2d; align-content: start; }
.rank-ledger.is-rebound, .rank-ledger.is-pullback, .rank-ledger.is-weak-thesis { border-color: #253247; background: #141e2d; }
.rank-identity { grid-column: 1; display: flex; align-items: baseline; gap: 5px; min-width: 0; }
.rank-identity strong { color: #e7edf8; font-size: 13px; letter-spacing: .01em; min-width: 0; overflow-wrap: anywhere; }
.rank-identity small { flex-shrink: 0; font-size: 10px; color: #9faec5; }
.rank-main-metric { grid-column: 2; grid-row: 1 / 4; text-align: right; display: grid; align-content: start; gap: 2px; }
.rank-main-metric > small { font-size: 10px; color: #acbad0; }
.rank-main-metric > span { display: flex; align-items: baseline; justify-content: flex-end; gap: 3px; }
.rank-main-metric strong { font-size: 21px; line-height: 1.1; color: #e7edf8; font-variant-numeric: tabular-nums; }
.rank-main-metric span small { font-size: 10px; color: #acbad0; }
.rank-pattern { grid-column: 1; grid-row: 2; color: #c5d1e4; font-size: 11px; line-height: 1.3; }
.rank-secondary-metric { grid-column: 1; grid-row: 3; font-size: 11px; line-height: 1.3; color: #acbad0; font-variant-numeric: tabular-nums; }
.rank-data-state { grid-column: 1 / -1; grid-row: 4; display: flex; flex-wrap: wrap; gap: 2px 6px; color: #9faec5; font-size: 10px; line-height: 1.3; }
.rank-conflict { display: block; color: #efc38b; font-size: 10px; }
.ranking-validation-link { color: #b4ccf5; font-size: 12px; text-underline-offset: 3px; }
.review-notes > p { margin: 10px 0; font-size: 13px; line-height: 1.5; }
.rank-ledger.is-selected { border-color: #94b2ed; background: #202f47; box-shadow: inset 0 2px 0 #aac5ff; }
.rank-ledger:focus-visible { outline: none; box-shadow: inset 0 0 0 2px #e0eaff; }
.ranking-legend { margin: 0; color: #acbad0; font-size: 11px; line-height: 1.4; }
.ranking-swipe-hint { display: none; }
@media (max-width: 760px) {
  .rank-grid:not(.is-empty) { grid-auto-columns: calc((100% - 12px) / 3); grid-template-rows: auto; align-items: stretch; scroll-snap-type: x proximity; }
  .rank-ledger { display: flex; flex-direction: column; align-items: stretch; gap: 3px; padding: 8px 6px; min-height: 116px; scroll-snap-align: start; }
  .rank-identity { justify-content: space-between; flex-wrap: wrap; gap: 1px; }
  .rank-identity strong { font-size: 12px; flex-shrink: 0; white-space: nowrap; }
  .rank-identity small { font-size: 9px; }
  .rank-main-metric { text-align: left; gap: 1px; }
  .rank-main-metric > span { justify-content: flex-start; }
  .is-priority-sort .rank-main-metric > small { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .ranking-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 6px 10px; }
  .ranking-controls .setup-filter-label { min-width: 0; gap: 6px; }
  .ranking-controls select { min-width: 0; }
  .ranking-controls .setup-filters { margin: 0; }
  .ranking-controls .setup-filters summary { padding: 11px 0; }
  .ranking-controls .setup-filters[open] { grid-column: 1 / -1; }
  .rank-pattern { min-height: 28px; font-size: 10px; line-height: 14px; }
  .rank-secondary-metric { font-size: 10px; }
  .rank-data-state { margin-top: auto; font-size: 10px; gap: 2px 4px; }
  .ranking-swipe-hint { display: inline; float: right; }
}

@media (max-width: 760px) {
  .sticky-detail-top { display: grid; grid-template-columns: minmax(0, 1fr) 110px; align-items: start; }
  .detail-heading-copy { grid-column: 1; grid-row: 1; }
  .detail-heading-copy h2 { overflow-wrap: anywhere; }
  .forecast-header-score { grid-column: 2; grid-row: 1; min-width: 0; }
  .sticky-detail-top .forecast-header-score > small { max-width: 100%; }
  .detail-freshness { grid-column: 1 / -1; grid-row: 2; justify-self: end; width: auto; max-width: 100%; }
}

.setup-filters { margin-top: 4px; font-size: 11px; }
.setup-filters summary { cursor: pointer; color: #c6d0e3; padding: 7px 0; }
.setup-filter-option { display: flex; align-items: center; gap: 8px; padding: 8px; margin-top: 5px; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.setup-filter-option:has(input:checked) { border-color: #6884ae; background: #202d43; color: #e7efff; }
.setup-filter-option:has(input:focus-visible) { outline: 2px solid #b4caff; outline-offset: 2px; }
.setup-filter-option input { appearance: none; flex: 0 0 14px; width: 14px; height: 14px; min-height: 0; margin: 0; padding: 0; border: 1px solid #7384a0; border-radius: 3px; background: #101722; display: grid; place-content: center; }
.setup-filter-option input:checked { border-color: #b4caff; background: #b4caff; }
.setup-filter-option input:checked::after { content: ""; width: 7px; height: 4px; border-left: 2px solid #101722; border-bottom: 2px solid #101722; transform: translateY(-1px) rotate(-45deg); }
.setup-filter-note { color: var(--muted); font-size: 10px; line-height: 1.4; margin: 8px 0; }
[data-clear-setup-filters] { padding: 5px 8px; font-size: 11px; }

/* Reserve a complete card below expanded controls, even in shorter windows. */
.ranking-controls { min-width: 0; min-height: 0; }
.ranking-controls .setup-filter-label { padding: 0; }
.ranking-controls .setup-filter-label select { margin-top: 2px; }
#rank-grid { border-top: 1px solid var(--line); padding-top: 8px; }
@media (min-width: 761px) {
  .research-layout > .rank-section { grid-template-rows: auto minmax(0, auto) auto minmax(156px, 1fr) auto; }
  .ranking-controls { max-height: max(100px, calc(100dvh - 300px)); overflow-y: auto; scrollbar-width: thin; padding: 3px; }
}
@media (min-width: 761px) and (max-height: 600px) {
  .research-layout > .rank-section { position: static; max-height: none; }
  .ranking-controls { max-height: none; overflow: visible; }
  #rank-grid { max-height: 50vh; min-height: 156px; }
}
.forecast-details { min-width: 0; border: 1px solid var(--line); border-radius: 10px; background: #111925; }
.forecast-details > summary { padding: 14px 16px; cursor: pointer; color: #c6d0e3; font-size: 13px; }
.forecast-details .directional-forecast { border: 0; }
@media (max-width: 760px) {
  .forecast-header-score > small { font-size: 10px; }
}

/* One shared tab header, one active controls panel. */
.command-workspace { display: block; padding-top: 14px; }
.command-tabs { display: flex; gap: 4px; border-bottom: 1px solid #33435c; }
.command-tabs [role="tab"] { min-height: 44px; padding: 10px 18px; border: 0; border-radius: 6px 6px 0 0; background: transparent; color: #9faec5; font-size: 13px; font-weight: 600; }
.command-tabs [role="tab"]:hover { background: #162133; color: #e7edf8; }
.command-tabs [aria-selected="true"] { background: #172337; color: #e7edf8; box-shadow: inset 0 -2px 0 #aac5ff; }
.command-tabs [role="tab"]:focus-visible { outline-offset: -3px; }
.command-workspace > [role="tabpanel"] { margin: 0; padding: 14px; border: 1px solid #253247; border-top: 0; border-radius: 0 0 8px 8px; background: #111925; min-width: 0; max-height: 380px; overflow-y: auto; }
.command-workspace > [role="tabpanel"][hidden] { display: none; }
.command-workspace > #status-line { display: block; padding: 8px 2px 0; }
.command-workspace > #status-line:empty { display: none; }
.notification-panel-heading { display: flex; align-items: center; gap: 8px; }
.notification-panel-heading #notification-state-pill { display: inline-block; }
.notification-panel-heading .notification-help { display: inline-grid; }
@media (max-width: 760px) {
  .command-workspace { padding-top: 10px; }
  .command-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; }
  .command-tabs [role="tab"] { min-width: 0; padding: 10px 4px; font-size: 12px; }
  .command-workspace > [role="tabpanel"] { padding: 12px 10px; }
}

#ranking-selection-validation p { margin: 10px 0; color: #9aaac4; font-size: 12px; line-height: 1.5; }
#ranking-selection-validation summary { font-size: 12px; color: #c5d1e4; }

.option-repricing { margin-top: 6px; }
.option-repricing summary { list-style: none; cursor: pointer; }
.option-repricing summary::-webkit-details-marker { display: none; }
.option-repricing summary::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid #91a1bd; border-bottom: 1.5px solid #91a1bd; transform: rotate(-45deg); flex-shrink: 0; }
.option-repricing details[open] > summary::before,
.option-repricing[open] > summary::before { transform: rotate(45deg); }
.option-repricing summary:focus-visible { outline: 2px solid #b4caff; outline-offset: -2px; border-radius: 6px; }
.option-repricing > summary { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; }
.repricing-title { display: grid; gap: 4px; font-size: 14px; font-weight: 600; }
.repricing-title small { color: #91a1bd; font-size: 11px; font-weight: 400; }
.repricing-badge { padding: 4px 8px; border-radius: 5px; background: #243147; color: #b9c8df; font-size: 10px; line-height: 1.4; font-weight: 500; }
.repricing-body { display: grid; gap: 16px; padding: 16px; border-top: 1px solid var(--line); }
.repricing-body p { margin: 0; overflow-wrap: anywhere; }
.repricing-note, .repricing-method p { font-size: 12px; line-height: 1.6; color: #9aaac4; }
.repricing-overview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0; }
.repricing-overview > div { display: grid; gap: 7px; align-content: start; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #151f2e; }
.repricing-overview dt { color: #9aaac4; font-size: 10px; line-height: 1.5; font-weight: 600; }
.repricing-overview dd { margin: 0; color: #e7efff; font-size: 20px; line-height: 1.2; font-weight: 650; font-variant-numeric: tabular-nums; }
.repricing-overview small { color: #91a1bd; font-size: 10px; line-height: 1.5; overflow-wrap: anywhere; }
.repricing-empty { padding: 14px; border-left: 2px solid #617da8; border-radius: 0 6px 6px 0; background: #172235; }
.repricing-empty strong { display: block; margin-bottom: 5px; color: #cbd7ea; font-size: 12px; font-weight: 600; }
.repricing-empty p { color: #9aaac4; font-size: 12px; line-height: 1.6; }
.repricing-contracts { display: grid; gap: 6px; min-width: 0; }
.repricing-contract { min-width: 0; border: 1px solid var(--line); border-radius: 7px; }
.repricing-contract > summary { display: flex; align-items: center; gap: 12px; padding: 11px 12px; }
.repricing-contract-name { min-width: 0; color: #a9b9d1; font-size: 11px; }
.repricing-contract-name strong { margin-left: 4px; color: #dce6f5; font-size: 13px; font-weight: 600; }
.repricing-expiry { color: #91a1bd; font-size: 11px; margin-left: auto; }
.repricing-contract-body { display: grid; gap: 12px; padding: 12px; border-top: 1px solid var(--line); }
.repricing-contract-id { color: #91a1bd; font: 10px/1.5 ui-monospace, monospace; }
.repricing-observation { color: #cbd7ea; font-size: 12px; }
.repricing-pending > summary, .repricing-method > summary { display: flex; align-items: center; gap: 10px; color: #9aaac4; font-size: 12px; line-height: 1.5; padding: 6px 0; }
.repricing-pending[open] > summary { margin-bottom: 8px; }
.repricing-method { border-top: 1px solid var(--line); padding-top: 10px; }
.repricing-method p { margin-top: 10px; }
.repricing-relative { display: grid; gap: 10px; }
.repricing-relative h4 { margin: 0; font-size: 12px; color: #cbd7ea; }
@media (max-width: 600px) {
  .option-repricing > summary { grid-template-columns: auto minmax(0, 1fr); gap: 8px 12px; padding: 12px; }
  .option-repricing > summary > .repricing-badge { grid-column: 2; justify-self: start; }
  .repricing-body { padding: 12px; gap: 12px; }
  .repricing-overview { grid-template-columns: 1fr; gap: 6px; }
  .repricing-overview > div { grid-template-columns: minmax(0, 1fr) auto; gap: 3px 10px; padding: 10px 12px; align-items: center; }
  .repricing-overview small { grid-column: 1 / -1; }
  .repricing-overview dd { font-size: 18px; }
  .repricing-contract > summary { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 10px; }
  .repricing-expiry, .repricing-contract > summary > .repricing-badge { grid-column: 2; margin-left: 0; justify-self: start; }
}
