/* ── REIT 스크리너 셸 (프로토타입 CapIQ 레이아웃, 토큰 재테마) ──
   단일 페이지(listing.html, /reit-screener/)가 partials/reit_screener.html과
   함께 사용한다 — 통합/한국/미국은 별도 페이지가 아니라 이 화면의
   ?country= 필터 상태일 뿐이므로(2026-08), CSS도 단일 소스로 둔다. */
/* 풀 앱-셸: base.html의 중앙정렬 .container 제약 해제 + 고정 navbar(82px) 바로 아래부터.
   프로토타입처럼 상하좌우 여백/페이지 배경이 안 보이게 화면을 채운다. */
main.container:has(.listing-screener){
    max-width:100%;
    margin-top:0 !important;
    padding-top:82px !important;   /* fixed-top navbar 높이만큼만 (그 이상 여백 없음) */
    padding-bottom:0 !important;
    padding-left:0;
    padding-right:0;
}
.listing-screener.container-fluid{
    max-width:100%;
    margin:0 !important;
    padding-left:0;
    padding-right:0;
    background:var(--surface-strong);   /* 바탕(--surface) 대신 흰 배경 */
}
.listing-screener .screener-shell{
    display:flex;
    align-items:stretch;             /* 사이드바 full-height */
    gap:0;                           /* 붙임 (우측 경계선이 구분선) */
    min-height:calc(100vh - 82px);   /* 화면을 채워 아래 바탕이 안 보이게 */
    background:var(--surface-strong);
}
.listing-screener .screener-main{
    flex:1 1 auto;
    min-width:0;                     /* 테이블 가로 스크롤 허용 */
    padding-left:1.5rem;
    padding-right:1.5rem;
    background:var(--surface-strong);
}
/* 프로토타입처럼 필터/테이블을 플랫 섹션으로 — 카드 프레임·라운드·그림자 제거 */
.listing-screener .listing-filter-card,
.listing-screener .listing-table-card{
    border:0 !important;
    border-radius:0 !important;
    box-shadow:none !important;
    background:transparent !important;
    margin:0 !important;
}

/* 섹션 간 세로 여백 제거 — 하이라인으로만 구분해 플랫하게 붙임 */
.listing-screener .listing-command-surface{
    margin:0 !important;
    padding:0.55rem 1.5rem !important;
    background:transparent !important;
    border:0 !important;
    border-bottom:1px solid var(--border-soft) !important;
    border-radius:0 !important;
}
/* main 자체 좌우 패딩은 0으로 — 각 섹션이 자기 패딩을 가져 사이드바 구분선에 밀착 */
.listing-screener .screener-main{ padding-left:0; padding-right:0; }
.listing-screener .listing-filter-body,
.listing-screener .listing-toolbar-header{ padding-left:1.5rem; padding-right:1.5rem; }
/* 필터 토글을 flat 셰브론 헤더로 (테두리·라운드·배경 제거) */
.listing-screener .listing-filter-toggle{
    border:0 !important;
    border-radius:0 !important;
    background:transparent !important;
    box-shadow:none !important;
    padding-left:0 !important;
}
/* 셰브론 회전(펼침=아래, 접힘=우향) — aria-expanded 기준으로 부모 span 회전.
   SVG 레벨의 전역 180° 회전은 무력화한다. */
.listing-screener .listing-filter-toggle .chevron-icon svg{ transform:none !important; transition:none !important; }
.listing-screener .listing-filter-toggle .chevron-icon{ display:inline-flex; transition:none !important; }
.listing-screener .listing-filter-toggle[aria-expanded="true"] .chevron-icon{ transform:rotate(0deg); }
.listing-screener .listing-filter-toggle[aria-expanded="false"] .chevron-icon{ transform:rotate(-90deg); }
.listing-screener .listing-filter-toggle-txt{ margin-left:0.9rem; color:var(--text-tertiary); font-size:0.82rem; }
.listing-screener .listing-filter-toggle[aria-expanded="true"] .lft-closed{ display:none; }
.listing-screener .listing-filter-toggle[aria-expanded="false"] .lft-open{ display:none; }

/* 테이블 컨테이너 각지게 (24px 라운드 제거) */
.listing-screener #tableContainer{ border-radius:0 !important; }

/* 박스·컨트롤만 각지게 (필터 패널·카드·버튼·인풋·드롭다운·체크박스).
   칩/배지(알약형)와 로고 아이콘(둥근 프레임)은 건드리지 않는다. */
.listing-screener .listing-toolbar-header,
.listing-screener .listing-filter-card,
.listing-screener .listing-filter-body,
.listing-screener .listing-command-surface,
.listing-screener .listing-table-card,
.listing-screener .listing-search-wrap,
.listing-screener .form-control,
.listing-screener .sf-num,
.listing-screener #listingSearchInput,
.listing-screener .form-check-input,
.listing-screener .btn,
.listing-screener .btn-group,
.listing-screener .btn-group > .btn,
.listing-screener .listing-column-toggle-btn,
.listing-screener .dropdown-menu,
.listing-screener .dropdown-item,
.listing-screener select,
.listing-screener .input-group,
.listing-screener .input-group > *{ border-radius:0 !important; }

/* 칩·배지는 알약형 유지 */
.listing-screener .listing-chip,
.listing-screener .listing-applied-filters .filter-tag,
.listing-screener .sector-badge,
.listing-screener .metric-badge,
.listing-screener .listing-filter-count{ border-radius:999px !important; }

/* 펼친 필터 패널 배경 — 인접 흰 면(검색바·테이블)과 구분되도록 #f8f9f6 */
.listing-screener .listing-filter-body{ background:var(--screener-filter-bg) !important; }

/* 필터패널 ↔ 테이블을 경계선으로 구분 + thead 배경/보더 (프로토타입) */
.listing-screener .listing-table-card{ border-top:1px solid var(--border-soft) !important; }
.listing-screener #listingTable thead th{
    background:var(--table-header-bg) !important;
    border-bottom:2px solid var(--border-soft) !important;
}

/* ── 액센트 색상: 프로토타입 네이비(디자인 제안) ── */
/* 사이드바 active */
.listing-screener .screener-nav-item.active{
    background:var(--screener-accent-soft);
    color:var(--screener-accent);
    border-left-color:var(--screener-accent);
    font-weight:700;
}
.listing-screener .screener-nav-item.active .screener-nav-count{ color:var(--screener-accent); }
/* 기본(적용) 버튼 */
.listing-screener .btn-primary{
    background:var(--screener-accent) !important;
    border-color:var(--screener-accent) !important;
    color:#fff !important;
}
.listing-screener .btn-primary:hover{
    background:var(--screener-accent-hover) !important;
    border-color:var(--screener-accent-hover) !important;
}
/* 활성 필터 카운트 배지 */
.listing-screener .listing-filter-count{ background:var(--screener-accent) !important; color:#fff !important; }
/* 정렬 활성 컬럼 헤더 */
.listing-screener #listingTable thead th.sorted-column{
    background:var(--screener-accent-soft) !important;
    color:var(--screener-accent) !important;
}
/* 인풋 포커스 */
.listing-screener .form-control:focus,
.listing-screener .sf-num:focus,
.listing-screener #listingSearchInput:focus{
    border-color:var(--screener-accent) !important;
    box-shadow:0 0 0 2px rgba(26,60,110,0.12) !important;
}
/* 활성 빠른필터/유형 칩 (사이드바 외) */
.listing-screener .listing-chip.active{
    background:var(--screener-accent-soft);
    border-color:var(--screener-accent);
    color:var(--screener-accent);
}

/* 사이드바 — CapIQ식 full-bleed 네비 레일: 왼쪽에 붙는 사각 패널, 우측 경계선만.
   (플레이북의 12px 컨트롤-레일 라디우스 예외 — Corner radius 섹션에 기록됨) */
.listing-screener .screener-sidebar{
    flex:0 0 200px;
    width:200px;
    align-self:stretch;
    padding:0.75rem 0.5rem;
    background:var(--surface-muted);
    border:0;
    border-right:1px solid var(--border-soft);
    border-radius:0;
}
.listing-screener .screener-nav-group{
    margin-top:0.35rem;
    border-top:1px solid var(--border-soft);
    padding-top:0.35rem;
}
.listing-screener .screener-nav-group-head{
    display:flex;
    align-items:center;
    gap:0.35rem;
    width:100%;
    padding:0.4rem 0.5rem;
    background:transparent;
    border:0;
    font-size:0.72rem;
    font-weight:700;
    letter-spacing:0.04em;
    text-transform:uppercase;
    color:var(--text-secondary);
    cursor:pointer;
}
.listing-screener .screener-nav-chevron{
    width:13px;height:13px;
    color:var(--text-tertiary);
    transition:transform 0.15s ease;
}
.listing-screener .screener-nav-group.collapsed .screener-nav-chevron{ transform:rotate(-90deg); }
.listing-screener .screener-nav-group.collapsed .screener-nav-group-body{ display:none; }

/* 네비 항목 — 레일 항목이므로 사각(반경 0), 활성 시 직선 좌측 액센트 */
.listing-screener .screener-nav-item{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:0.5rem;
    width:100%;
    padding:0.4rem 0.55rem;
    background:transparent;
    border:0;
    border-left:3px solid transparent;
    border-radius:0;
    font-size:0.85rem;
    color:var(--ink-muted);
    cursor:pointer;
    text-align:left;
    text-decoration:none;
    line-height:1.3;
}
.listing-screener .screener-nav-item:hover{
    background:var(--surface-strong);
    color:var(--ink-strong);
}
.listing-screener .screener-nav-item.active{
    border-left-color:var(--screener-accent);
    background:var(--screener-accent-soft);
    color:var(--screener-accent);
    font-weight:700;
}
.listing-screener .screener-nav-all{ margin-bottom:0.15rem; }
.listing-screener .screener-nav-count{
    font-size:0.72rem;
    color:var(--text-tertiary);
    font-variant-numeric:tabular-nums;
}
.listing-screener .screener-nav-item.active .screener-nav-count{ color:var(--screener-accent); }
.listing-screener .screener-nav-empty{
    padding:0.35rem 0.55rem;
    font-size:0.75rem;
    font-style:italic;
    color:var(--text-tertiary);
}
.listing-screener .screener-recent-item{ font-size:0.8rem; }

/* 배당 캘린더 — 필터가 아닌 별도 페이지로 이동하는 도구 링크. 위 그룹들과
   동일한 border-top 구분선을 쓰되, count 배지가 없으므로 좌측 정렬로 오버라이드.
   K리츠 페이지에서만 렌더링됨 (partials/reit_screener.html의
   show_dividend_calendar_link 플래그). */
.listing-screener .screener-nav-tool-link{
    justify-content:flex-start;
}
.listing-screener .screener-nav-tool-icon{
    display:inline-flex;
    flex:0 0 auto;
    width:15px;height:15px;
    color:var(--text-tertiary);
}
.listing-screener .screener-nav-tool-link:hover .screener-nav-tool-icon{
    color:var(--screener-accent);
}

/* 헤더를 살짝 컴팩트하게 (스크리너 톤) */
.listing-screener .listing-header{ margin-bottom:1rem; }

/* 필터 패널 — 검색으로 조건을 추가/삭제하는 동적 스크리너 */
/* 조건 추가 검색줄 + 그 아래 카탈로그 드롭다운 */
.listing-screener .sf-add-bar{
    position:relative;
    display:flex;
    align-items:center;
    gap:0.5rem;
    max-width:420px;
    padding:0.35rem 0.6rem;
    background:var(--surface-strong);
    border:1px solid var(--border-soft);
}
.listing-screener .sf-add-bar:focus-within{ border-color:var(--screener-accent); }
.listing-screener .sf-add-icon{ display:inline-flex; color:var(--text-tertiary); }
.listing-screener .sf-add-input{
    flex:1 1 auto;
    height:30px;
    border:0 !important;
    padding:0 !important;
    font-size:0.85rem;
    background:transparent;
    box-shadow:none !important;
}
/* 카탈로그 드롭다운 — 검색줄 바로 아래 절대배치 */
.listing-screener .sf-catalog-menu{
    position:absolute;
    top:calc(100% + 4px);
    left:0;
    right:0;
    z-index:20;
    max-height:320px;
    overflow-y:auto;
    padding:0.35rem 0;
    background:var(--surface-strong);
    border:1px solid var(--border-soft);
    box-shadow:0 8px 24px rgba(15,23,42,0.12);
}
.listing-screener .sf-catalog-group{
    padding:0.4rem 0.75rem 0.15rem;
    font-size:0.68rem;
    font-weight:700;
    letter-spacing:0.05em;
    text-transform:uppercase;
    color:var(--text-tertiary);
}
.listing-screener .sf-catalog-item{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:0.5rem;
    width:100%;
    padding:0.4rem 0.75rem;
    background:transparent;
    border:0;
    text-align:left;
    font-size:0.85rem;
    color:var(--ink-strong);
    cursor:pointer;
}
.listing-screener .sf-catalog-item:hover:not(:disabled){
    background:var(--screener-accent-soft);
    color:var(--screener-accent);
}
.listing-screener .sf-catalog-item:disabled{ color:var(--text-tertiary); cursor:default; }
.listing-screener .sf-catalog-item .sf-catalog-added{ font-size:0.72rem; color:var(--text-tertiary); }
.listing-screener .sf-catalog-empty{
    padding:0.5rem 0.75rem;
    font-size:0.8rem;
    font-style:italic;
    color:var(--text-tertiary);
}
/* 활성 조건 블록 목록 — 반응형 그리드 */
.listing-screener .sf-filter-list{
    display:grid;
    grid-template-columns:repeat(auto-fill, minmax(240px, 1fr));
    gap:0.6rem;
    margin-top:0.85rem;
}
.listing-screener .sf-filter-list:empty{ margin-top:0; }
.listing-screener .sf-filter-block{
    display:flex;
    flex-direction:column;
    gap:0.5rem;
    padding:0.6rem 0.7rem;
    background:var(--surface-strong);
    border:1px solid var(--border-soft);
}
.listing-screener .sf-block-head{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:0.5rem;
}
.listing-screener .sf-block-label{
    font-size:0.82rem;
    font-weight:600;
    color:var(--ink-strong);
    line-height:1.25;
}
.listing-screener .sf-block-remove{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    flex:0 0 auto;
    width:24px;
    height:24px;
    padding:0;
    border:0;
    background:transparent;
    color:var(--text-tertiary);
    cursor:pointer;
}
.listing-screener .sf-block-remove:hover{ background:var(--negative-soft); color:var(--ink-strong); }
.listing-screener .sf-block-ctl{
    display:flex;
    align-items:center;
    gap:0.4rem;
}
.listing-screener .sf-empty-hint{
    margin:0.85rem 0 0;
    font-size:0.8rem;
    font-style:italic;
    color:var(--text-tertiary);
}
/* min/max 인풋 — 블록 안에서 균등 확장 */
.listing-screener .sf-num{
    flex:1 1 0;
    min-width:0;
    height:32px;
    padding:0.2rem 0.5rem;
    font-size:0.82rem;
    font-variant-numeric:tabular-nums;
}
/* select 인풋 (국가 등) — sf-num과 동일한 블록 높이/패딩, 숫자 전용 속성만 제외 */
.listing-screener .sf-select{
    flex:1 1 0;
    min-width:0;
    height:32px;
    padding:0.2rem 0.5rem;
    font-size:0.82rem;
    cursor:pointer;
}
.listing-screener .sf-sep{ color:var(--text-tertiary); font-size:0.8rem; }
.listing-screener .sf-unit{ color:var(--text-tertiary); font-size:0.78rem; white-space:nowrap; }
.listing-screener .sf-footer{
    display:flex;
    align-items:center;
    gap:0.5rem;
    margin-top:1rem;
    padding-top:0.85rem;
    border-top:1px solid var(--border-soft);
}
.listing-screener .sf-note{
    margin-right:auto;
    font-size:0.78rem;
    font-style:italic;
    color:var(--text-tertiary);
}
@media (max-width: 575.98px){
    .listing-screener .sf-add-bar{ max-width:none; }
    .listing-screener .sf-filter-list{ grid-template-columns:1fr; }
}

/* † 범례 — 선행 배당수익률에 Milleans 추정 행이 있을 때 표 바로 아래에 붙는 각주.
   화면 폭이 넓어도 줄이 너무 길어지지 않게 오른쪽 안쪽 여백으로 글줄 길이를 68rem에 맞춘다.
   표 스크롤 영역의 아래 경계도 이 hairline이 맡는다. 첫 문장만 ink-strong. */
.listing-screener .listing-est-legend{
    margin:0;
    padding:0.7rem max(1.5rem, calc(100% - 68rem)) 1.1rem 1.5rem;
    border-top:1px solid var(--border-soft);
    font-size:0.78rem;
    line-height:1.55;
    color:var(--ink-muted);
}
.listing-screener .listing-est-legend strong{ color:var(--ink-strong); font-weight:700; }
/* † 는 숫자 오른쪽 바깥에 걸린다(style.css .est-mark). 이 열이 마지막 열일 때 셀 밖으로 4px 넘쳐
   표 스크롤 영역에 가로 스크롤이 생기던 것(2026-10-06 확인)을 열 전체 오른쪽 여백으로 막는다.
   행마다 같은 여백이라 소수점 정렬은 그대로다. */
.listing-screener #listingTable th.dividend-yield-column,
.listing-screener #listingTable td.dividend-yield-column{ padding-right:1.1rem; }
/* 모바일 카드의 † 한 줄 (카드 뷰는 현재 숨김 상태 — style.css 767.98px 주석 참고) */
.listing-screener .mobile-card-est{
    margin:0.55rem 0 0;
    font-size:0.74rem;
    color:var(--ink-muted);
}

/* 모바일: 사이드바 숨김 (모바일은 카드 뷰 사용) */
@media (max-width: 991.98px){
    .listing-screener .screener-shell{ display:block; }
    .listing-screener .screener-sidebar{ display:none; }
}
