/* tokens.css 위에 얹는 사이트 공통 보강: 탭 메뉴, 검색, 하위 탭, 도구 */
.header-inner { gap: 12px 24px; }
.nav { gap: 20px; overflow-x: auto; scrollbar-width: none; white-space: nowrap; flex: 1 1 auto; }
.nav::-webkit-scrollbar { display: none; }
.nav a { flex: none; }
.search { display: flex; gap: 6px; margin-left: auto; }
.search input { width: 168px; min-height: 40px; padding: 0 12px; border: 1px solid var(--line, #d7dde2); border-radius: 10px; background: var(--surface); color: inherit; font: inherit; font-size: 14px; }
.search button { min-height: 40px; padding: 0 14px; border: 0; border-radius: 10px; background: var(--brand); color: #fff; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.more { font-size: 14px; font-weight: 600; color: var(--brand); white-space: nowrap; }
.page-head { padding-block: 28px 12px; }
.page-head h1 { font-size: 32px; }
.page-head .lead { max-width: 35em; margin-top: 8px; }
.subtabs { display: flex; gap: 8px; overflow-x: auto; padding-block: 8px; scrollbar-width: none; white-space: nowrap; }
.subtabs::-webkit-scrollbar { display: none; }
.subtabs a { flex: none; padding: 8px 16px; min-height: 40px; display: inline-flex; align-items: center; border: 1px solid var(--line, #d7dde2); border-radius: 99px; font-size: 14px; font-weight: 600; background: var(--surface); }
.subtabs a[aria-current='page'] { background: var(--brand); border-color: var(--brand); color: #fff; }
.small-tabs a { padding: 4px 12px; min-height: 32px; font-size: 13px; }
.table-stock-link { display: block; }
.market-table td.num.change { font-weight: 700; }
.plain { margin: 8px 0 0; padding-left: 1.2em; max-width: 40em; }
.plain li { margin-block: 6px; }
.tool-list { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); margin-block: 16px 24px; }
.tool-list .form-row { margin-block: 12px; }
.ticker-item, .tag { white-space: nowrap; }
@media (max-width: 767px) {
  .header-inner { min-height: 0; padding-block: 10px; gap: 6px 12px; }
  .nav { order: 3; width: 100%; flex-basis: 100%; gap: 6px; }
  .nav a { padding-inline: 10px; }
  .search { margin-left: auto; }
  .search input { width: 132px; }
  .page-head h1 { font-size: 26px; }
}

/* 테마 상세 분포 막대(서버 SVG) */
.ratio-svg { display: block; width: 100%; height: 10px; border-radius: 20px; overflow: hidden; margin-block: 12px; background: var(--surface-soft); }
.ratio-svg .ratio-up { fill: var(--up); } .ratio-svg .ratio-down { fill: var(--down); } .ratio-svg .ratio-flat { fill: var(--flat); }

/* 정책·소개 글 */
.policy { max-width: 46em; line-height: 1.85; }
.policy h2 { font-size: 18px; margin: 28px 0 8px; }
.policy h2:first-child { margin-top: 0; }
.policy ul { padding-left: 1.2em; }
.policy li { margin-block: 6px; }
.policy a { color: var(--brand); text-decoration: underline; }

/* 상단 TODAY/TOTAL */
.top-strip { font-size: 11px; line-height: 1; color: var(--muted); background: var(--bg); }
.top-strip .wrap { display: flex; justify-content: flex-end; gap: 14px; padding-block: 6px; }
.top-strip b { color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; margin-left: 3px; }
/* 공식 링크 */
.link-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.link-card { display: grid; grid-template-columns: 72px minmax(0, 1fr); grid-template-areas: "img body" "btn btn"; gap: 12px 16px; padding: 20px; align-items: center; }
.link-avatar { grid-area: img; width: 72px; height: 72px; border-radius: 50%; object-fit: cover; background: var(--surface-soft); border: 1px solid var(--border); }
.link-body { grid-area: body; min-width: 0; }
.link-body h3 { font-size: 18px; margin: 0 0 4px; text-wrap: balance; }
.link-card .btn { grid-area: btn; justify-content: center; text-align: center; }

/* 칩·가이드·전문가 줄·키워드 링크·관심종목 */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip-list { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 14px; border: 1px solid var(--border); border-radius: 99px; background: var(--surface); font-size: 14px; font-weight: 600; }
.chip small { color: var(--muted); font-weight: 500; font-size: 11px; }
.chip:hover { border-color: var(--brand); }
.guide-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.guide-card { display: grid; gap: 6px; padding: 18px; }
.guide-card strong { font-size: 16px; }
.daily-card { display: grid; gap: 6px; padding: 18px 20px; margin-top: 16px; }
.daily-card strong { font-size: 17px; }
.expert-strip { list-style: none; display: flex; gap: 12px; padding: 0; margin: 0; overflow-x: auto; }
.expert-chip { display: grid; justify-items: center; gap: 8px; width: 108px; padding: 12px 8px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); font-size: 13px; font-weight: 600; text-align: center; }
.expert-chip img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); }
.keyword-links { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 18px 0 8px; font-size: 13px; }
.keyword-links a { color: var(--muted); }
.keyword-links a:hover { color: var(--brand); text-decoration: underline; }
.fav-btn { margin-left: auto; min-height: 36px; padding: 0 12px; border: 1px solid var(--border); border-radius: 99px; background: var(--surface); color: inherit; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.fav-btn[aria-pressed='true'] { border-color: var(--brand); color: var(--brand); }
.policy details { padding: 8px 0; border-top: 1px solid var(--border); }
.policy summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.daily-text p { max-width: 42em; }

/* 코덱스 검수 반영: 버튼 대비, 키워드 링크 대비, 칩 접기 */
.policy a.btn { color: var(--on-brand, #fff); text-decoration: none; }
.keyword-links a { color: var(--text); opacity: .82; }
.chip-more { width: 100%; }
.chip-more summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--brand); min-height: 40px; display: flex; align-items: center; }

/* 페이지 이동, 공시 본문 */
.pager { margin-block: 20px; justify-content: center; }
.pager a[aria-current='page'] { background: var(--brand); border-color: var(--brand); color: var(--on-brand, #fff); }
.disc-body { overflow-x: auto; line-height: 1.7; font-size: 15px; }
.disc-body table { border-collapse: collapse; margin-block: 12px; min-width: 100%; }
.disc-body td, .disc-body th { border: 1px solid var(--border); padding: 6px 8px; vertical-align: top; font-size: 14px; }
.disc-body p { margin-block: 8px; }

/* 긴 값(공모가 범위·경쟁률)은 줄바꿈 허용 */
.metrics dd.flex-text { white-space: normal; overflow-wrap: anywhere; word-break: keep-all; }

/* 히트맵 */
.treemap { position: relative; width: 100%; aspect-ratio: 16 / 10; border-radius: 12px; overflow: hidden; background: var(--surface-soft); }
.tm-tile { position: absolute; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 2px; overflow: hidden; border: 1px solid var(--bg); box-sizing: border-box; line-height: 1.25; }
.tm-tile strong { font-size: 12px; word-break: keep-all; }
.tm-tile span { font-size: 11px; font-variant-numeric: tabular-nums; }
.tm-tile:hover { outline: 2px solid var(--text); z-index: 2; }
.tm-xs strong, .tm-xs span { font-size: 0; }
.hm-legend { margin-top: 12px; }
@media (max-width: 767px) { .treemap { aspect-ratio: 3 / 4; } .tm-tile strong { font-size: 11px; } }
/* 달력 */
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.cal-head { background: var(--surface-soft); text-align: center; padding: 8px 0; font-size: 13px; font-weight: 700; }
.cal-cell { background: var(--surface); min-height: 96px; padding: 4px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-off { background: var(--surface-soft); }
.cal-day { font-size: 12px; font-weight: 700; color: var(--muted); }
.cal-today .cal-day { color: #fff; background: var(--brand); border-radius: 99px; width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; }
.cal-sun .cal-day, .cal-head.cal-sun { color: var(--up); } .cal-sat .cal-day, .cal-head.cal-sat { color: var(--down); }
.cal-ev { display: block; font-size: 11px; line-height: 1.3; padding: 2px 4px; border-radius: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.cal-sub { background: color-mix(in srgb, var(--brand) 16%, var(--surface)); color: var(--text); }
.cal-list { background: color-mix(in srgb, var(--up) 16%, var(--surface)); color: var(--text); }
.cal-more { font-size: 11px; color: var(--muted); }
@media (max-width: 767px) { .cal-cell { min-height: 72px; } .cal-ev { font-size: 10px; padding: 1px 2px; } }
/* 비교 폼, 광고 */
.compare-form { display: grid; gap: 12px; grid-template-columns: 1fr 1fr auto; align-items: end; margin-bottom: 20px; }
.compare-form label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }
.compare-form input { min-height: 44px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: inherit; font: inherit; }
@media (max-width: 767px) { .compare-form { grid-template-columns: 1fr; } }
.ad-slot { margin-block: 20px; min-height: 90px; text-align: center; }

/* 관리자 대시보드 */
.adm-chart { width: 100%; height: auto; display: block; }
.adm-bar { fill: var(--brand); }
.adm-num, .adm-day { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.adm-num { fill: var(--text); font-weight: 600; }
.adm-bar-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 8px; }
.adm-logout { margin-left: auto; }
.adm-logout .chip { cursor: pointer; font: inherit; }
.adm-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 8px; }
.adm-act { min-height: 44px; }
.adm-result { word-break: break-all; }
.adm-gauge { height: 10px; border-radius: 20px; background: var(--surface-soft); overflow: hidden; margin-block: 10px; }
.adm-gauge span { display: block; height: 100%; background: var(--brand); }
.summary-three small { display: block; margin-top: 4px; }
