/* 기본(메인) 테마 = 화이트. 설정(더보기 패널)에서 블랙 버전으로 전환 가능 — :root[data-theme="dark"]가 아래서 덮어씀 */
:root {
  --bg: #ffffff;
  --card-bg: #ffffff;
  --text: #14161c;
  --muted: #6b7280;
  --border: #d1d5db;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --good: #15803d;
  --bad: #dc2626;
  --warn: #b45309;
  --pos: #dc2626; /* 양수/상승 = 빨강(한국식) */
  --neg: #1d4ed8; /* 음수/하락 = 파랑(한국식) */
  --radius: 12px;
  --icon-accent: #f60303; /* 틀고정 아이콘 색 — 해외(기본) 모드는 로고 점(.) 색과 통일한 빨강 */
  --good-soft: #e3f5ea;
  --bad-soft: #fde8e8;
  --bad-soft-border: #f3b4b4;
  --warn-soft: #fef3e2;
  --gold: #8a6a00;
  --glass-bg: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(20, 22, 28, 0.1);
  --glass-icon: rgba(20, 22, 28, 0.45);
  --glass-icon-active: #14161c;
  --subtle-fill: rgba(20, 22, 28, 0.06);
  --subtle-fill-2: rgba(20, 22, 28, 0.08);
  --overlay-chip-bg: rgba(255, 255, 255, 0.75);
  --overlay-chip-border: rgba(20, 22, 28, 0.14);
  --overlay-chip-icon: #14161c;
  --track-fill: rgba(20, 22, 28, 0.08);
}
/* 블랙 버전(설정에서 선택) — 기존 다크 테마 배색을 그대로 유지 */
:root[data-theme="dark"] {
  --bg: #000000;
  --card-bg: #1c1f27;
  --text: #eceef2;
  --muted: #9aa2b1;
  --border: #2b2f3a;
  --accent: #6b9bff;
  --accent-soft: #22314f;
  --good: #1a9c5c;
  --bad: #d64545;
  --warn: #c98a1a;
  --pos: #d64545;
  --neg: #3b7dd8;
  --icon-accent: #f60303;
  --good-soft: #143327;
  --bad-soft: #3a1f20;
  --bad-soft-border: #5c2b2b;
  --warn-soft: #362a12;
  --gold: #b8860b;
  --glass-bg: rgba(255, 255, 255, 0.035);
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-icon: rgba(255, 255, 255, 0.45);
  --glass-icon-active: #ffffff;
  --subtle-fill: rgba(255, 255, 255, 0.06);
  --subtle-fill-2: rgba(255, 255, 255, 0.08);
  --overlay-chip-bg: rgba(20, 22, 28, 0.55);
  --overlay-chip-border: rgba(255, 255, 255, 0.18);
  --overlay-chip-icon: #ffffff;
  --track-fill: rgba(255, 255, 255, 0.08);
}
/* 좌측 상단 국내/해외 토글에서 국내를 선택하면 상단 툴바가 주황 배경으로 바뀌므로, 틀고정 아이콘도 흰색으로 맞춘다(섹터맵과 동일한 규칙) */
body[data-market-mode="kr"] { --icon-accent: #14161c; }
/* 상승/하락 색상 — 설정(더보기)에서 "초록·빨강"(해외식)으로 전환하면 --pos/--neg만 덮어써서 전체(차트·표·지도)에 반영 */
:root[data-colorscheme="global"] { --pos: #16a34a; --neg: #dc2626; }
:root[data-theme="dark"][data-colorscheme="global"] { --pos: #22c55e; --neg: #e15252; }

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

.container {
  max-width: 860px;
  margin: 0 auto;
  padding: calc(var(--fixed-header-h, 210px) + 16px) 20px 96px;
}

.fixed-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: none;
  padding: calc(6px + env(safe-area-inset-top, 0px)) 14px 0px; /* 지도(섹터맵) 상단 툴바(top-bar padding-top: safe-area + top-bar-row padding 6px)와 동일한 위치 */
  box-shadow: none;
  transition: background 0.2s ease;
}
/* 국내 선택 시 맨 위 툴바를 섹터맵(지도)과 동일하게 주황 배경으로 — 해외는 기존 그대로(테마에 따라 흰/검정) */
body[data-market-mode="kr"] .fixed-header {
  background: linear-gradient(180deg, #f95503 0%, #e04600 100%);
  /* 해외의 얇은 구분선과 동일하게, 주황 배경 위에서 잘 보이도록 반투명 흰 선으로(지도 top-bar-row와 동일한 방식) */
  border-bottom: 1px solid rgba(255, 255, 255, 0.25);
}
body[data-market-mode="kr"] .fh-banner { filter: brightness(0) invert(1); }
/* 해외 선택 시 지도(섹터맵)의 .top-bar.is-overseas와 동일한 얇은 구분선 */
body[data-market-mode="us"] .fixed-header { border-bottom: 1px solid var(--border); }

.fh-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 860px;
  margin: 0 auto 6px; /* 아래 탭바(관심종목~뉴스·공시)와 겹치지 않게 여백 확보 */
}

/* 지도(섹터맵) 상단 toggle-pill과 동일한 디자인 — 알약 컨테이너 배경 안에서 선택된 쪽만 흰/주황 알약으로 강조 */
.market-mode-toggle {
  display: flex;
  gap: 2px;
  background: var(--subtle-fill);
  border-radius: 999px;
  padding: 3px;
}
.market-mode-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  padding: 5.5px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.market-mode-btn-kr.active { background: #ffffff; color: #e04600; }
.market-mode-btn-us.active { background: #e04600; color: #ffffff; }
/* 국내 모드 상단 툴바 — 섹터맵과 동일하게 주황 배경 위 반투명 흰 알약 컨테이너, 선택된 국내는 흰 알약(주황 글씨) */
body[data-market-mode="kr"] .market-mode-toggle { background: rgba(255,255,255,0.22); }
body[data-market-mode="kr"] .market-mode-btn { color: rgba(255,255,255,0.9); }
body[data-market-mode="kr"] .market-mode-btn-kr.active { background: #ffffff; color: #e04600; }
/* 상단 툴바(주황 배경)의 아이콘만 흰색으로 — 종목 상세페이지(.detail-bar, 흰 배경)의 검색/알림/즐겨찾기 아이콘은 대상에서 제외해야 흰 배경 위에서 보임 */
body[data-market-mode="kr"] .fh-topline .header-icon-btn { color: #ffffff; }
body[data-market-mode="kr"] .user-avatar-btn { background: rgba(255,255,255,0.25); border-color: rgba(255,255,255,0.6); color: #ffffff; }
body[data-market-mode="kr"] .login-header-btn { color: #ffffff; }

.contact-btn {
  flex: none;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  background: none;
  border: none;
  color: var(--text);
}

.fh-banner { height: 20px; width: auto; display: block; flex: none; } /* 지도 상단 로고와 동일 크기 */

.fh-right-group { display: flex; align-items: center; gap: 14px; }

.fh-actions { display: flex; align-items: center; gap: 4px; }

.header-icon-btn {
  flex: none;
  width: 34px;
  height: 34px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: var(--text);
  line-height: 1;
}
.header-icon-btn svg { display: block; }
/* 맨 윗줄(로고-토글-검색) 아이콘 버튼만 지도 상단 아이콘과 동일한 크기로 — 다른 화면의 header-icon-btn(분석/알림 등)은 그대로 둠 */
.fh-topline .header-icon-btn { width: 30px; height: 30px; border-radius: 50%; }
.fh-topline .header-icon-btn svg { width: 19px; height: 19px; }
.fh-topline .header-icon-btn:active { background: var(--subtle-fill); }
/* 로그인(유저메뉴)은 더보기 패널로 이동 — 상단 맨 윗줄에서는 항상 숨김(로그인 상태와 무관하게) */
.fh-topline .user-menu { display: none !important; }
#companyPanelWatchlistBtn.active { color: var(--warn); }
#companyPanelWatchlistBtn.active.market-kr { color: #6b9bff; }
#companyPanelWatchlistBtn.active.market-us { color: #f60303; }

/* 이모지 대신 쓰는 주황(로고 색) 단색 라인 아이콘 — 탭바/서브탭/위저드 버튼 공용 */
.btn-icon { display: inline-flex; align-items: center; vertical-align: -2px; }
.btn-icon-svg { display: block; color: var(--icon-accent); }
#companyPanelWatchlistBtn.active svg { fill: currentColor; }

.login-header-btn {
  flex: none;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  font-size: 19px;
  line-height: 1;
  background: none;
  border: none;
  color: var(--muted);
}

.user-menu { position: relative; }
.user-avatar-btn {
  flex: none;
  width: 34px;
  height: 34px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
  overflow: hidden;
}
.user-avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; }

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 210;
  min-width: 180px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3);
  padding: 12px;
}
.user-dropdown-name { margin: 0; font-size: 13.5px; font-weight: 700; color: var(--text); }
.user-dropdown-email {
  margin: 2px 0 10px;
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-dropdown-logout {
  width: 100%;
  padding: 8px 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
}

.fh-search {
  position: relative;
  max-width: 860px;
  margin: 0 auto 10px;
  display: flex;
  gap: 8px;
}
.fh-search input[type="text"] { flex: 1; }
.fh-search button { font-size: 18px; padding: 10px 14px; line-height: 1; white-space: nowrap; }
.fh-search button.header-icon-btn { padding: 0; transform: translate(-1px, 1px); }

/* 틀고정 헤더의 검색창은 입력창이 아니라 버튼 — 누르면 전체화면 검색 오버레이가 오른쪽에서 슬라이드인 */
.search-open-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 860px;
  margin: 0 auto 10px;
  height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  text-align: left;
}
.search-open-icon { font-size: 15px; flex: none; }
.search-open-placeholder { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 480;
  background: var(--bg);
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
.search-overlay.open { transform: translateX(0); }

.search-overlay-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
}
.search-overlay-back {
  flex: none;
  width: 34px;
  height: 34px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--muted);
}
.search-overlay-title { margin: 0; font-size: 24px; font-weight: 800; color: var(--text); }

.search-overlay-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 16px 40px;
}

/* 검색창 자체를 알약 모양 하나로 보이게(입력창+버튼을 감싸는 래퍼에 배경·둥근모서리를 주고 내부 요소는 테두리 제거) */
.search-overlay-search {
  margin: 0 0 28px;
  max-width: none;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 4px 4px 18px;
}
.search-overlay-search input[type="text"] {
  border: none;
  background: transparent;
  padding: 11px 0;
}
.search-overlay-search input[type="text"]:focus { outline: none; }
.search-overlay-search button { border-radius: 999px; }

.search-section { margin-bottom: 28px; }
.search-section h3 { margin: 0 0 12px; font-size: 15px; font-weight: 700; color: var(--text); }
.search-section-sub { margin-left: 6px; font-size: 12px; font-weight: 500; color: var(--muted); }
.search-chip-list { display: flex; flex-direction: column; }
.search-chip-empty { padding: 4px 0; font-size: 13px; }

/* 검색 오버레이 최근/인기 검색 한 행 — 로고+이름/티커(누르면 이동) + 오른쪽 관심종목 추가 별 버튼 */
.search-result-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}
.search-result-row:last-child { border-bottom: none; }
.search-result-left {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 4px;
  background: none;
  border: none;
  text-align: left;
}
.search-result-left .ticker-logo-wrap { width: 34px; height: 34px; flex: none; }
.search-result-text { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.search-result-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-result-sub { font-size: 12.5px; color: var(--muted); }
.search-watch-btn {
  flex: none;
  width: 34px;
  height: 34px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--muted);
  position: relative;
}
.search-watch-btn.active { color: var(--warn); }
.search-watch-btn.active.market-kr { color: #6b9bff; }
.search-watch-btn.active.market-us { color: #f60303; }
.search-watch-btn:not(.active)::after {
  content: "+";
  position: absolute;
  right: 0;
  top: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg);
  color: var(--text);
  font-size: 10px;
  font-weight: 800;
  line-height: 12px;
  text-align: center;
}

/* 기업 패널 — 틀고정 탭이 아니라 검색/티커클릭 시 오른쪽에서 슬라이드인하는 전체화면 오버레이.
   chart-modal(400)보다 낮게 둬서 패널 안에서 TradingView 차트를 열면 그 위로 정상적으로 뜸 */
.company-panel {
  position: fixed;
  inset: 0;
  z-index: 350;
  background: var(--bg);
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
.company-panel.open { transform: translateX(0); }

.company-panel-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
}
.company-panel-bar .site-logo.small svg { height: 24px; }
.company-panel-bar .search-open-btn.small {
  width: auto;
  max-width: none;
  margin: 0 0 0 auto;
  height: 34px;
  padding: 0 14px;
  font-size: 16px;
}

.company-panel-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  padding: 14px 20px 96px;
}
.company-panel-body #summarySubtabNav {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  padding-top: 2px;
}
/* 검정 상세화면에서는 상단 고정바(detail-bar) 바로 아래에 서브탭이 틈 없이 붙도록 body의 top padding 자체를 0으로 만들고
   (sticky 요소에 음수 margin으로 상쇄시키는 방식은 스크롤 위치에 따라 어긋나서 padding 자체를 없앰), 서브탭 폭은 화면 끝까지 채움 */
.company-panel-black .company-panel-body { padding-top: 0; }
.company-panel-black .company-panel-body #summarySubtabNav {
  margin: 0 -20px 12px;
  padding: 0 20px;
  background: var(--bg);
}

/* ---------- 종목 상세화면: 이름/가격/등락률 헤더 ---------- */
.company-panel-black { background: var(--bg); }
.company-panel-black .company-panel-body { background: var(--bg); }
.company-panel-black #summarySubtabNav { background: var(--bg); }

.detail-bar { background: var(--bg); border-bottom: none; }
.detail-identity { flex: 1; min-width: 0; display: flex; flex-direction: row; align-items: center; gap: 8px; }
.detail-identity-logo .ticker-logo-wrap { width: 30px; height: 30px; }
.detail-identity-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.detail-identity-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.detail-identity-priceline { display: flex; align-items: baseline; gap: 6px; }
.detail-identity-price { font-size: 16px; font-weight: 800; color: var(--text); }
.detail-identity-change { font-size: 13px; font-weight: 700; }
.detail-bar-actions { flex: none; display: flex; align-items: center; gap: 2px; }

/* ---------- 종목 상세: 차트 위 오버레이(반투명 원형 차트보기 버튼 + 라인/캔들 토글) ---------- */
.summary-chart-wrap { position: relative; }
.chart-expand-btn {
  position: absolute;
  top: 10px;
  left: 8px;
  z-index: 4;
  width: 30px;
  height: 30px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--overlay-chip-bg);
  border: 1px solid var(--overlay-chip-border);
  color: var(--overlay-chip-icon);
  backdrop-filter: blur(2px);
}
/* 라인/캔들 전환 버튼 — 기간 버튼(1일~최대)과 같은 줄에 7번째 버튼으로 들어감(플로팅 아님) */
#summaryChartPeriodNav {
  gap: 2px;
}
#summaryChartPeriodNav .cat-btn {
  background: transparent;
  padding: 7px 8px;
  font-size: 10.5px;
}
.chart-type-single-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7px 10px;
}

/* ---------- 종목 상세: 개요/매출액/invest점수/주요뉴스 서브탭 — 상단 tab-bar와 동일한 톤(굵은 흰 글씨+밑줄) ---------- */
.detail-subtabs {
  display: flex;
  gap: 0;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.detail-subtabs .cat-btn {
  flex: 1 1 0;
  position: relative;
  background: var(--bg);
  border: none;
  border-radius: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  padding: 4px 4px 12px;
  text-align: center;
}
.detail-subtabs .cat-btn.active { color: var(--text); font-weight: 800; }
.detail-subtabs .cat-btn.active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -1px;
  transform: translateX(-50%);
  width: 22px;
  height: 3px;
  border-radius: 2px;
  background: var(--text);
}

.future-beta-warning {
  text-align: center;
  padding: 12px 16px;
  margin: 16px 0 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--warn);
  background: var(--warn-soft);
  border: 1px solid var(--warn);
  border-radius: 8px;
}

.tab-bar {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  background: transparent;
  border-radius: 8px;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab-bar .cat-btn { font-size: 12.5px; padding: 10px 6px; flex: 1 1 0; text-align: center; }

.cat-btn {
  flex: 0 0 auto;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  padding: 9px 12px;
  white-space: nowrap;
}
.cat-btn.active { color: var(--text); border-color: var(--text); font-weight: 800; }

/* 상단 고정 탭바(투데이/시장/인사이트 등) — 배경/테두리를 페이지 배경과 통일, 선택 시 굵은 글씨 + 중앙 하단 짧은 밑줄 */
.tab-bar .cat-btn {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  background: transparent;
  border-color: transparent;
  border-radius: 0;
  color: var(--muted);
  font-weight: 600;
}
.tab-bar .cat-btn.active {
  background: transparent;
  border-color: transparent;
  color: var(--text);
  font-weight: 800;
}
.tab-bar .cat-btn .tab-emoji {
  grid-column: 1;
  justify-self: end;
  margin-right: 3px;
}
.tab-bar .cat-btn .tab-label {
  grid-column: 2;
}
.tab-bar .cat-btn.active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0px;
  transform: translateX(-50%);
  width: 18px;
  height: 3px;
  border-radius: 2px;
  background: var(--text);
}
/* 국내 선택 시에도 탭바(관심종목~뉴스·공시)는 해외와 동일하게 흰 배경 그대로 둠(위 로고줄만 주황) —
   해외 모드는 탭바가 투명해서 .fixed-header의 흰 배경(var(--bg))이 그대로 비치는 것이므로, 국내는 위가
   주황이라 탭바에 직접 같은 색을 칠해야 함. 화면 끝까지 이어지도록 14px 패딩을 음수 마진으로 상쇄 */
body[data-market-mode="kr"] .tab-bar {
  background: var(--bg);
  margin-left: -14px;
  margin-right: -14px;
  padding-left: 14px;
  padding-right: 14px;
  border-radius: 0; /* 화면 끝까지 닿는 사각 배경이라 둥근 모서리가 있으면 양끝 구석이 안 채워져 보임 */
}
.cat-historical-up .cat-arrow { color: var(--pos); }
.cat-historical-down .cat-arrow { color: var(--neg); }

.top30-sub-nav {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  margin-bottom: 12px;
}
.top30-sub-nav::-webkit-scrollbar { display: none; }
/* 버튼이 많아 가로로 길어져도 각 버튼은 줄어들지 않고 그대로 유지(가로 스크롤로 접근) */
.top30-sub-nav .cat-btn { flex: 0 0 auto; white-space: nowrap; }

/* 해외 선택 시 하위 서브버튼(관심종목/Top랭킹/인사이트 등의 .cat-btn) 테두리를 빨간색으로 강조 —
   상승압력·투자안정 2개(.top-ranking-tab-orange)는 기존 주황 테두리 유지를 위해 제외 */
body[data-market-mode="us"] .carousel-panel .cat-btn:not(.top-ranking-tab-orange) { border-color: rgba(246, 3, 3, 0.45); }
body[data-market-mode="us"] .carousel-panel .cat-btn.active:not(.top-ranking-tab-orange) { border-color: #f60303; }

/* Top랭킹 탭 — 기업가치+투자동향을 합친 14개 서브버튼. 마지막 2개(상승 압력·투자 안정)만 주황으로 구분 */
.top-ranking-sub-nav { padding-bottom: 2px; }
.top-ranking-tab { display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.top-ranking-tab .btn-icon-svg { display: block; flex: none; }
.top-ranking-tab-orange { border-color: rgba(224, 70, 0, 0.5); color: #e04600; }
.top-ranking-tab-orange.active { color: #e04600; border-color: #e04600; background: rgba(224, 70, 0, 0.08); }

/* 인사이트 "1.자산&투자사" 선택 시에만 보이는 2단 서브버튼(윗줄 자산운용사/아랫줄 투자회사) */
.insight-firms-nav { flex-direction: column; overflow-x: visible; }
.insight-firms-row { display: flex; align-items: center; gap: 4px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.insight-firms-row::-webkit-scrollbar { display: none; }
.insight-firms-row-label { flex: 0 0 auto; font-size: 11px; color: var(--muted); font-weight: 700; width: 62px; }

/* 실적&공시 일정(인사이트 탭) — 예전 텍스트 목록 */
.econ-cal-list { display: flex; flex-direction: column; }
.econ-cal-row {
  display: grid;
  grid-template-columns: 78px 76px 1fr;
  gap: 8px;
  align-items: center;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}
.econ-cal-row:last-child { border-bottom: none; }
.econ-cal-date { color: var(--muted); font-variant-numeric: tabular-nums; }
.econ-cal-cat { font-size: 11px; color: var(--accent); font-weight: 700; }
.econ-cal-title { font-weight: 600; }

/* 캘린더 패널(하단 네비) — 이번달/다음달 월간 그리드. 잘 보이도록 칸/숫자/로고를 크게 표시 */
.cal-wrap { display: flex; flex-direction: column; gap: 28px; margin-bottom: 4px; }
.cal-month-title { margin: 0 0 10px; font-size: 19px; font-weight: 800; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.cal-dow { text-align: center; font-size: 13px; font-weight: 700; color: var(--muted); padding-bottom: 6px; }
.cal-dow-sun { color: var(--pos); }
.cal-dow-sat { color: var(--accent); }
.cal-day {
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  padding-top: 8px;
  border-radius: 10px;
  border: 1px solid transparent;
}
.cal-day-empty { visibility: hidden; }
.cal-day-num { font-size: 16px; font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; }
.cal-day-sun .cal-day-num { color: var(--pos); }
.cal-day-sat .cal-day-num { color: var(--accent); }
.cal-day-today { background: var(--accent-soft); border-color: var(--accent); }
.cal-day-today .cal-day-num { color: var(--accent); font-weight: 800; }
.cal-day.has-event { cursor: pointer; }
.cal-day.has-event:active { background: var(--card-bg); }
.cal-day-icons { display: flex; align-items: center; justify-content: center; gap: 2px; min-height: 16px; flex-wrap: nowrap; }
.cal-day-icon-logo .ticker-logo-wrap { width: 18px; height: 18px; border-width: 1px; }
.cal-day-icon-flag { font-size: 15px; line-height: 1; }
.cal-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.cal-dot-rate { background: #6b9bff; }
.cal-dot-cpi { background: #f5a623; }
.cal-dot-jobs { background: #4caf7d; }
.cal-dot-13f { background: #b57bf5; }
.cal-dot-opex { background: #8a94a6; }
.cal-dot-pce { background: #e0a03c; }
.cal-dot-gdp { background: #47b8e0; }
.cal-dot-ism { background: #d97ad9; }
.cal-dot-retail { background: #9ccc65; }
.cal-dot-cnpmi { background: #e05656; }
.cal-dot-trade { background: #56c2e0; }
.cal-dot-industry { background: #c9a227; }
.cal-dot-minwage { background: #e0567a; }
.cal-dot-etc { background: var(--muted); }
.cal-day-more { font-size: 10px; color: var(--muted); line-height: 1; }

.cal-agenda-heading { margin: 22px 0 8px; font-size: 16px; font-weight: 800; }
.cal-agenda { display: flex; flex-direction: column; }
.cal-agenda-group { padding: 11px 4px; border-bottom: 1px solid var(--border); border-radius: 6px; transition: background 0.4s; }
.cal-agenda-group:last-child { border-bottom: none; }
.cal-agenda-group.cal-agenda-flash { background: var(--accent-soft); }
.cal-agenda-date { font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.cal-agenda-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 14px; }
.cal-agenda-cat { flex: none; font-size: 12px; color: var(--accent); font-weight: 700; width: 76px; }
.cal-agenda-logo { flex: none; }
.cal-agenda-logo .ticker-logo-wrap { width: 24px; height: 24px; }
.cal-agenda-text { font-weight: 600; }

/* 날짜 칸 클릭 시 뜨는 확대 팝업 */
.calendar-day-modal-body { flex: 1; overflow-y: auto; padding: 18px 16px; }
.cal-day-modal-row { display: flex; align-items: center; gap: 14px; padding: 16px 4px; border-bottom: 1px solid var(--border); }
.cal-day-modal-row:last-child { border-bottom: none; }
.cal-day-modal-logo .ticker-logo-wrap { width: 40px; height: 40px; }
.cal-day-modal-flag { flex: none; width: 40px; text-align: center; font-size: 26px; line-height: 1; }
.cal-day-modal-text { display: flex; flex-direction: column; gap: 4px; font-size: 16px; font-weight: 700; }
.cal-day-modal-text b { font-size: 13px; color: var(--accent); font-weight: 800; }

/* 6.미래산업 성장성 — 기관별(블랙록/JP모건/골드만삭스) 유망 산업 20개 성장률 목록 */
.future-ind-group { margin-top: 18px; }
.future-ind-group:first-of-type { margin-top: 10px; }
.future-ind-group-title { font-size: 14px; font-weight: 800; margin: 0 0 6px; }
.future-ind-list { display: flex; flex-direction: column; }
.future-ind-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 7px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.future-ind-row:last-child { border-bottom: none; }
.future-ind-name { font-weight: 600; }
.future-ind-cagr { white-space: nowrap; }

/* 3.신기술 — MIT/McKinsey/IEEE/OECD 요약 카드 */
.tech-insight-list { display: flex; flex-direction: column; gap: 14px; }
.tech-insight-card {
  display: flex;
  gap: 12px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}
.tech-insight-img { flex: none; width: 84px; height: 84px; border-radius: 10px; object-fit: cover; background: var(--bg); }
.tech-insight-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.tech-insight-source { font-size: 11px; font-weight: 700; color: var(--accent); }
.tech-insight-title { margin: 0; font-size: 14px; font-weight: 800; line-height: 1.35; }
.tech-insight-summary { margin: 2px 0 4px; font-size: 12.5px; line-height: 1.55; color: var(--muted); }
.tech-insight-link { font-size: 12px; font-weight: 700; color: var(--accent); text-decoration: none; }
.tech-insight-link:hover { text-decoration: underline; }

/* 5.뉴스 — 주요기업 최신 뉴스 TOP20(최신순) */
.major-news-list { display: flex; flex-direction: column; }
.major-news-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 2px; border-bottom: 1px solid var(--border); }
.major-news-row:last-child { border-bottom: none; }
.major-news-logo { flex: none; margin-top: 1px; }
.major-news-body { min-width: 0; }
.major-news-title { display: block; font-size: 13.5px; font-weight: 700; color: var(--text); text-decoration: none; line-height: 1.4; }
.major-news-title:hover { text-decoration: underline; }
.major-news-meta { margin-top: 3px; font-size: 11.5px; color: var(--muted); }

/* ---------- 7탭 스와이프 캐로셀 ---------- */
.carousel-viewport {
  position: relative;
  overflow: hidden;
  touch-action: pan-y;
  transition: height 0.25s ease;
}
.carousel-panel {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
}
.carousel-panel.snapping { transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1); }

.loading-splash {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.loading-splash-logo { width: min(140px, 32vw); height: auto; border-radius: 22%; animation: splash-pulse 1.4s ease-in-out infinite; }
.loading-splash-caption { margin: 0; font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: -0.1px; }
@keyframes splash-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.chart-modal {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: var(--bg);
  flex-direction: column;
}

.chart-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.chart-modal-close {
  padding: 2px 8px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
}

/* 미래예측 모달 상단(틀고정 헤더) — 로고·한글이름·티커·점수 3종을 한 줄로 배치, 좁은 화면에서만 2줄로 감싸짐 */
.chart-modal-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.future-modal-identity {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.future-modal-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 34vw;
}
.future-modal-ticker { font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.future-modal-scores { display: flex; align-items: center; gap: 6px; flex: none; }
.mini-score-circle.small { width: 24px; height: 24px; font-size: 10.5px; font-weight: 800; border-width: 1.5px; }

.chart-modal-frame {
  flex: 1;
  width: 100%;
  border: none;
  background: #000;
}

/* 상승 압력/투자 안정 설명 옆 "+자세히" 버튼 + 배점 기준 모달 — 화면 전체가 아니라 스마트폰 화면 절반 높이 시트로 표시 */
.score-method-detail-btn {
  flex: none;
  padding: 2px 9px;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 999px;
  cursor: pointer;
}
.score-method-modal {
  position: fixed;
  inset: 0;
  z-index: 410;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
}
.score-method-sheet {
  width: 100%;
  max-width: 480px;
  max-height: 50vh;
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 16px 16px 0 0;
  overflow: hidden;
}
.score-method-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  flex: none;
}
.score-method-title { font-size: 14px; font-weight: 800; color: var(--text); }
.score-method-body {
  flex: 1;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.score-method-card {
  flex: 0 0 100%;
  scroll-snap-align: start;
  padding: 14px;
  overflow-y: auto;
  box-sizing: border-box;
  border-right: 1px solid var(--border);
}
.score-method-card:last-child { border-right: none; }
.score-method-card h4 { margin: 0 0 10px; font-size: 13.5px; }
.score-method-swipe-hint { font-size: 10.5px; font-weight: 400; color: var(--muted); margin-left: 6px; }

/* 배점 기준 모달 카드 상단 — 예시 종목 로고+이름 */
.smb-header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.smb-header .ticker-logo-wrap { width: 26px; height: 26px; flex: none; }
.smb-header-name { font-size: 13px; font-weight: 800; color: var(--text); }

/* 배점 항목 하나 = 상승형 막대그래프 한 줄(라벨+점수 → 막대 → 설명) */
.score-bar-graph { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }

/* FOMO지수·VIX 구간 게이지 — 색상 구간 막대 위에 현재값 위치를 삼각형 포인터로 표시 */
.macro-gauge { margin: 0 0 12px; }
.macro-gauge-track {
  position: relative;
  display: flex;
  width: 100%;
  height: 10px;
  border-radius: 5px;
  overflow: visible;
}
.macro-gauge-zone:first-child { border-radius: 5px 0 0 5px; }
.macro-gauge-zone:last-child { border-radius: 0 5px 5px 0; }
.macro-gauge-pointer {
  position: absolute;
  top: -7px;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid var(--text);
  transform: translateX(-6px);
}
.macro-gauge-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
}
.smb-row { margin-bottom: 12px; }
.smb-row-top { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 4px; }
.smb-label { font-size: 12.5px; font-weight: 700; color: var(--text); }
.smb-value { font-size: 12.5px; font-weight: 800; }
.smb-value.stars { font-size: 16px; letter-spacing: 1px; }
.smb-track { height: 8px; border-radius: 4px; background: var(--track-fill); overflow: hidden; }
.smb-fill { height: 100%; border-radius: 4px; transition: width 0.4s ease; }
.smb-desc { margin: 4px 0 0; font-size: 11px; color: var(--muted); }
.smb-desc b { color: var(--text); }
.smb-formula { margin: 4px 0 8px; font-size: 13px; font-weight: 700; color: var(--text); padding-top: 8px; border-top: 1px dashed var(--border); }

.login-modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: var(--bg);
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.login-modal-close {
  position: sticky;
  top: 0;
  align-self: flex-start;
  margin: 16px 0 0 16px;
  padding: 4px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 22px;
  z-index: 1;
}

.login-modal-body {
  flex: 1;
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
  padding: 12px 24px 60px;
  display: flex;
  flex-direction: column;
}

.login-title {
  margin: 16px 0 0;
  text-align: center;
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
}
.login-quote {
  margin: 16px 0 40px;
  padding: 0;
  border: none;
  text-align: center;
  font-size: 19px;
  font-weight: 800;
  line-height: 1.5;
  color: var(--text);
}
.login-quote-kr {
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: -0.2px;
}
.login-quote-en { display: inline-block; margin-top: 12px; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.login-quote-author { display: inline-block; margin-top: 6px; font-size: 12.5px; font-weight: 500; color: var(--muted); }

.login-provider-list { display: flex; flex-direction: column; gap: 12px; }

.login-provider-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 54px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  border: 1px solid transparent;
}
.login-provider-icon { position: absolute; left: 18px; width: 20px; height: 20px; flex: none; }

.login-provider-google { background: #fff; color: #1f1f1f; border-color: var(--border); }
.login-provider-kakao { background: #FEE500; color: #191600; }
.login-provider-naver { background: #03C75A; color: #fff; }

.login-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 22px 0;
  color: var(--muted);
  font-size: 11.5px;
}
.login-divider::before,
.login-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.login-email-form { display: flex; flex-direction: column; gap: 10px; }
.login-email-input {
  width: 100%;
  height: 50px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-size: 14px;
}
.login-error { margin: 0; font-size: 12.5px; color: var(--bad); }
.login-email-submit {
  width: 100%;
  height: 54px;
  margin-top: 2px;
  border-radius: 14px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
}

.login-switch-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 18px;
  font-size: 12.5px;
}
.login-switch-btn { background: none; border: none; color: var(--accent); font-size: 12.5px; font-weight: 700; padding: 0; }

.login-forgot-btn {
  margin: 14px auto 0;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 12px;
  padding: 0;
}

/* 예전엔 전체화면 고정 모달 안이라 flex:1로 남은 세로 공간을 채웠지만, 이제 탭 화면 안에 그대로 이어붙는(인라인)
   카드라 페이지 자체가 스크롤되므로 별도 높이 강제나 세로 스크롤이 필요 없음 */
.future-inline-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 16px;
}
.future-inline-header {
  padding: 10px 12px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
}
.future-chart-body {
  padding: 12px 10px 24px;
  background: var(--card-bg);
}
/* 화면이 좁을 땐(모바일) 차트를 억지로 줄이지 않고 최소폭을 유지해 라벨 글자가 너무 작아지지 않게 하고,
   대신 가로 스크롤로 볼 수 있게 함(데이터 비율 자체는 항상 정확하게 유지됨).
   스크롤은 이 컨테이너 자신에게 걸어서(캡션·구분선 등은 제외) 1번·2번 그래프가 서로 묶이지 않고 각자 따로 스크롤됨 */
.future-chart-container {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.future-chart-container svg { min-width: 600px; width: 100%; height: auto; display: block; }
/* VIX지수를 활용한 투자시점 점검표(3번 차트) — 1년 단위 점(약 30개)이 항상 넉넉한 간격으로 보이도록
   화면 폭에 맞춰 줄어들지 않고(width:auto) 실제 SVG 폭(JS에서 점 개수에 비례해 계산)만큼 항상 가로 스크롤됨 */
.future-macro-chart svg { min-width: 780px; width: auto; }
.future-chart-caption {
  max-width: 720px;
  margin: 10px auto 0;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}
.future-chart-divider {
  max-width: 720px;
  margin: 22px auto;
  border: none;
  border-top: 1px solid var(--border);
}
.future-chart-subheading {
  max-width: 720px;
  margin: 0 auto 12px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.2px;
  color: var(--text);
  text-align: center;
}
.future-chart-wip {
  font-size: 12px;
  font-weight: 700;
  color: var(--warn);
}

/* 과거분석/미래예측/s리포트 버튼을 누르면 펼쳐지는 범위를 주황 반투명 박스로 표시 — 어디까지가 펼쳐진 내용인지 한눈에 보이게 함 */
.flush-section.section-expanded {
  background: rgba(233, 85, 0, 0.06);
  border: 1px solid rgba(233, 85, 0, 0.28);
  border-radius: 12px;
  padding: 14px 12px;
}

/* FOMO/VIX 차트 제목 옆 "+자세히" 버튼 행 — 제목은 그대로 가운데 정렬 유지하면서 버튼만 오른쪽에 붙임 */
.future-chart-heading-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: 720px;
  margin: 0 auto 12px;
}
.future-chart-heading-row .future-chart-subheading {
  margin: 0;
}
/* "+자세히"를 눌러 펼친 차트 영역도 동일한 주황 반투명 박스 언어로 표시 */
.chart-detail-wrap.chart-detail-expanded {
  background: rgba(233, 85, 0, 0.06);
  border: 1px solid rgba(233, 85, 0, 0.28);
  border-radius: 12px;
  padding: 12px 8px;
}

.chat-ticker-suggest {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 10;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  max-height: 220px;
  overflow-y: auto;
}

/* 작은 로고 - 한글이름 - 티커(거래소) 순으로 한 줄에 표시하는 컴팩트한 행 */
.chat-ticker-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  cursor: pointer;
}
.chat-ticker-option:hover { background: var(--accent-soft); }
.chat-ticker-option .ticker-logo-wrap { width: 20px; height: 20px; flex: none; }
.chat-ticker-option-name { font-size: 12.5px; font-weight: 700; color: var(--text); }
.chat-ticker-option-sub { font-size: 11px; color: var(--muted); }

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.card h2 {
  font-size: 16px;
  margin: 0 0 12px;
}

/* 기업(검색) 탭 하위 섹션들 — 카드 박스(배경/테두리/패딩) 없이 좌우 공간을 그대로 사용 */
.flush-section {
  margin-bottom: 16px;
}

.flush-section h2 {
  font-size: 16px;
  margin: 0 0 12px;
}

.section-heading-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}
.section-heading-row h2 { margin: 0; }
.ground-open-btn {
  flex: none;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}

/* 관심종목 맨 위 자기진단 CTA 배너 버튼 */
.self-test-banner-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 6px 12px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  text-align: left;
  cursor: pointer;
}
.self-test-banner-icon { flex: none; font-size: 16px; line-height: 1; }
.self-test-banner-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0; }
.self-test-banner-title { font-size: 12.5px; font-weight: 800; color: var(--accent); line-height: 1.3; }
.self-test-banner-sub { font-size: 10px; color: var(--muted); line-height: 1.3; }
.self-test-banner-arrow { flex: none; font-size: 20px; color: var(--accent); }

/* 투자성향 자기진단 테스트: 풀스크린 모달(.chart-modal 패턴 재사용) */
.self-test-modal { background: var(--bg); }
.self-test-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px 16px 32px;
}

.self-test-progress-track {
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
  margin-bottom: 14px;
}
.self-test-progress-fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width 0.25s ease; }
.self-test-qnum { font-size: 12px; font-weight: 700; color: var(--muted); margin: 0 0 6px; }
.self-test-question { font-size: 18px; font-weight: 800; color: var(--text); line-height: 1.4; margin: 0 0 20px; }
.self-test-options { display: flex; flex-direction: column; gap: 10px; }
.self-test-option-btn {
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}
.self-test-option-btn:active { border-color: var(--accent); background: var(--accent-soft); }

/* 결과 상단 — 선택한 투자법에 따라 생성되는 주식/현금·채권 비중 바(기존 높이의 절반, 아주 가늘게) */
.self-test-alloc-bar-wrap { margin-bottom: 18px; }
.self-test-alloc-label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 6px; }
.self-test-alloc-label { font-size: 12px; font-weight: 700; color: var(--muted); margin: 0; }
.self-test-alloc-confirm-btn {
  flex: none;
  padding: 4px 12px;
  font-size: 11.5px;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 999px;
  cursor: pointer;
}
.self-test-alloc-bar {
  display: flex;
  width: 100%;
  height: 20px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.self-test-alloc-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  transition: width 0.3s ease;
}
.self-test-alloc-stock { background: var(--accent); }
.self-test-alloc-bond { background: var(--good); }
/* 세그먼트가 좁아서 글자가 안 들어갈 땐(전체 그래프에서만) 막대 아래에 따로 표시 — 전체를 가운데 정렬한 한 줄이 아니라,
   각 텍스트를 해당 세그먼트 너비만큼 차지하는 칸에 넣어서 그 항목 막대 바로 아래에 오도록 함 */
.self-test-alloc-below { display: flex; margin: 4px 0 0; font-size: 11px; font-weight: 600; color: var(--muted); }
.self-test-alloc-below-item { text-align: center; overflow: hidden; white-space: nowrap; }

/* 관심목록 탭 상단 고정 — 자기진단에서 방법을 고르면 계속 여기 떠 있음. %만 표시, 훨씬 더 얇게 */
.watchlist-selftest-pin { margin: 10px 0; }
.watchlist-selftest-pin .self-test-alloc-bar-compact { height: 12px; border-radius: 4px; }
.watchlist-selftest-pin .self-test-alloc-seg { font-size: 8.5px; }

.self-test-result-card { text-align: center; padding: 8px 0 22px; }
.self-test-result-emoji { font-size: 56px; line-height: 1; margin-bottom: 8px; }
.self-test-result-name { font-size: 21px; font-weight: 800; color: var(--text); margin: 0 0 4px; }
.self-test-result-figure { font-size: 12.5px; font-weight: 700; color: var(--accent); margin: 0 0 10px; }
.self-test-result-desc { font-size: 13.5px; color: var(--muted); line-height: 1.5; margin: 0; }
.self-test-result-caution { font-size: 12px; color: var(--warn); line-height: 1.55; margin: 10px 0 0; text-align: left; background: var(--warn-soft); border-radius: 8px; padding: 10px 12px; }

.self-test-method-list { display: flex; flex-direction: column; gap: 8px; }
.self-test-method-label { font-size: 13px; font-weight: 800; color: var(--text); margin: 4px 0 2px; }
.self-test-method-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}
.self-test-method-btn.active { border-color: var(--accent); background: var(--accent-soft); }
.self-test-method-num {
  flex: none;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}
.self-test-method-text { font-size: 13px; color: var(--text); line-height: 1.5; }
.self-test-method-text .muted { font-size: 11.5px; }

.self-test-age-input-wrap { display: flex; gap: 8px; margin: 2px 0 4px 36px; }
.self-test-age-input-wrap input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}
.self-test-age-input-wrap button {
  flex: none;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.self-test-retry-btn {
  width: 100%;
  margin-top: 18px;
  padding: 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}
.self-test-disclaimer { font-size: 11px; color: var(--muted); text-align: center; margin: 10px 0 0; }

/* 투자 그라운드: 졸라맨 + 회사 로고 + 52주 5등분 가격표를 보여주는 풀스크린 모달(.chart-modal 패턴 재사용) */
.ground-modal { background: var(--bg); }
.ground-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 24px 16px;
  display: flex;
  justify-content: center;
}
.ground-body svg { width: 100%; max-width: 360px; height: auto; }
.ground-share-btn {
  flex: none;
  margin: 12px 16px 20px;
  height: 48px;
  border-radius: 12px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

/* 공유하기 바텀시트 */
.share-sheet { position: fixed; inset: 0; z-index: 520; }
.share-sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.5); }
.share-sheet-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--card-bg);
  border-radius: 16px 16px 0 0;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.share-sheet-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 50px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}
.share-sheet-icon { font-size: 18px; }
.share-sheet-cancel {
  height: 46px;
  margin-top: 4px;
  border-radius: 12px;
  border: none;
  background: var(--bg);
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

/* 기업 탭 가격 차트는 최소폭을 강제하지 않고 화면 폭에 그대로 맞춰 가로 스크롤 없이 한눈에 보이게 함
   (viewBox 기반 SVG라 폭이 줄어도 데이터 비율 자체는 항상 정확함) */
#summaryChartContainer {
  max-width: none;
  overflow-x: hidden;
  width: 100%;
}
#summaryChartContainer svg {
  min-width: 0;
  width: 100%;
  height: auto;
  display: block;
}

/* 분기 실적 그래프(막대 5개)도 좁은 화면에서 가로 스크롤 없이 한 화면에 다 들어오도록 */
#quarterlyEarningsSection .future-chart-container { max-width: none; }
#quarterlyEarningsSection .future-chart-container svg { min-width: 0; width: 100%; }

.peers-inline { margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--border); }

/* 기간 버튼: 그래프와 같은 폭에서 균등 분할, 테두리는 없애고 active 상태는 굵은 흰 글자로만 구분 */
#summaryChartPeriodNav {
  width: 100%;
  overflow-x: visible;
}
#summaryChartPeriodNav .cat-btn { flex: 1 1 0; text-align: center; border: none; }

input[type="text"], input[type="password"] {
  flex: 1;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

button {
  padding: 10px 16px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

button:hover { filter: brightness(1.05); }
button:disabled { opacity: 0.6; cursor: not-allowed; }

.popular-table-wrap { overflow-x: auto; }

.load-more-btn { display: block; width: 100%; margin-top: 12px; text-align: center; }
table.popular-table th:nth-child(4),
table.popular-table td:nth-child(4),
table.popular-table th:nth-child(5),
table.popular-table td:nth-child(5) { min-width: 46px; }

.top30-status { margin-top: 12px; font-size: 13px; }

table.top30-table { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 13px; }
table.top30-table th, table.top30-table td { padding: 8px 6px; border-bottom: 1px solid var(--border); text-align: center; }
.dividend-warn { display: inline-block; font-size: 10.5px; font-weight: 700; color: var(--warn); white-space: nowrap; cursor: help; }
table.top30-table tbody tr:nth-child(-n+3) td:nth-child(1) { color: var(--gold); font-weight: 800; }

table.s-report-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 13px; }
table.s-report-table th, table.s-report-table td { padding: 8px 6px; border-bottom: 1px solid var(--border); text-align: center; }
table.s-report-table td:first-child { text-align: left; font-weight: 600; }
.s-report-verdict { margin-top: 12px; padding: 10px 12px; background: var(--accent-soft); border-radius: 10px; font-size: 13px; line-height: 1.5; }

/* 브랜드평판순 표: 기업 헤더는 다른 열과 같이 가운데 정렬 유지, 데이터 행(기업명)만 왼쪽 정렬 */
.brand-rep-table td:nth-child(2), .brand-rep-table th:nth-child(2) { width: 40%; }
.brand-rep-table td:nth-child(2) { text-align: left; }
.brand-rep-table th:nth-child(3), .brand-rep-table th:nth-child(4) { white-space: nowrap; }
.brand-rep-table th:nth-child(4) { min-width: 58px; }
.brand-rep-name-cell { display: flex; align-items: center; gap: 8px; }
.brand-rep-name-text { display: flex; flex-direction: column; gap: 2px; text-align: left; }
.brand-rep-ticker { font-size: 11px; font-weight: 600; }

/* ---------- 기업검색 위저드 ---------- */
.wizard-question { font-size: 16px; font-weight: 700; margin: 4px 0 16px; line-height: 1.4; }
.wizard-root-options { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.wizard-root-option {
  width: 100%;
  text-align: left;
  white-space: normal;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
}
.wizard-root-option:hover { border-color: var(--accent); }
.wizard-option-sub { display: block; margin-top: 4px; font-size: 12px; font-weight: 400; color: var(--muted); }
.wizard-option-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.wizard-option-btn {
  padding: 10px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  white-space: normal;
}
/* 랭킹찾기 목록의 마지막 2개(상승 압력·투자 안정)는 주황으로 강조 — Top랭킹 탭과 동일한 시각 언어 */
.wizard-option-btn-orange { border-color: #e04600; color: #e04600; background: rgba(224, 70, 0, 0.06); }
.wizard-sector-checklist {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
  padding: 2px;
  margin-bottom: 16px;
}
.wizard-sector-item {
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
}
.wizard-sector-item.checked { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.wizard-criteria-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.wizard-criteria-item {
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
}
.wizard-criteria-item:hover { border-color: var(--accent); }
.wizard-confirm-btn {
  display: block;
  width: 100%;
  padding: 12px;
  margin-bottom: 10px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}
.wizard-back-btn {
  display: block;
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.wizard-share-row { display: flex; gap: 10px; margin-top: 18px; }
.wizard-share-row .cat-btn { flex: 1; text-align: center; padding: 12px; font-size: 13px; }

/* 인사이트 보유종목 표 — 화면 밖으로 넘치지 않게(가로 스크롤 없이) table-layout:fixed로 4개 컬럼 비율을 고정하고,
   "비중 (변동)" 컬럼(3번째)에 더 넓은 비율을 줘서 줄바꿈 없이 한 줄로 표시. 그래도 폭이 모자라는 극단적인 경우(초소형 화면)엔
   overflow-x가 아니라 텍스트를 말줄임(ellipsis)해서 화면 우측으로 밀려나가는 일이 없도록 함 */
table.insight-holdings-table { table-layout: fixed; width: 100%; }
table.insight-holdings-table col.col-rank { width: 10%; }
table.insight-holdings-table col.col-name { width: 28%; }
table.insight-holdings-table col.col-weight { width: 33%; }
table.insight-holdings-table col.col-value { width: 29%; }
table.insight-holdings-table th, table.insight-holdings-table td { padding: 8px 4px; overflow: hidden; }
table.insight-holdings-table td span, table.insight-holdings-table td b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; display: inline-block; vertical-align: bottom; }

.source-note {
  font-size: 12px;
  color: var(--muted);
  background: var(--accent-soft);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 0 0 16px;
}

.ticker-link { cursor: pointer; }
.ticker-link:hover { text-decoration: underline; color: var(--accent); }

.price-chart-link { color: inherit; text-decoration: none; }
.price-chart-link:hover { text-decoration: underline; color: var(--accent); }

.chart-link-btn {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  vertical-align: middle;
}
.chart-link-btn:hover { color: var(--accent); border-color: var(--accent); }

.status-box {
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 14px;
}
.status-box.loading { background: var(--accent-soft); color: var(--accent); }
.status-box.error { background: var(--bad-soft); color: var(--bad); border: 1px solid var(--bad-soft-border); }

.section-body { font-size: 14px; }
.section-body .error-inline { color: var(--bad); font-size: 13px; }
.section-body .muted { color: var(--muted); }

.summary-text { font-size: 15px; }
.company-meta { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 10px; font-size: 13px; color: var(--muted); clear: both; }
.company-meta span b { color: var(--text); }

.summary-main { overflow: auto; } /* 아래 float 클리어(플로트된 로고가 company-meta를 밀어내지 않도록) */
.summary-ticker-logo-wrap {
  float: left;
  width: 48px;
  height: 48px;
  margin: 2px 10px 4px 0;
  border-radius: 50%;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}
.summary-ticker-logo { width: 72%; height: 72%; object-fit: contain; }
.summary-ticker-badge {
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0.3px;
  background: var(--accent-soft);
}

/* 표(인기·과거·급등·급락)에서 티커 앞에 붙는 작은 원형 기업 로고 */
.ticker-cell { display: inline-flex; align-items: center; gap: 5px; }
.ticker-logo-wrap {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}
.ticker-logo { width: 72%; height: 72%; object-fit: contain; }
.ticker-logo-badge {
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 800;
  color: var(--accent);
  background: var(--accent-soft);
}

/* 지수 탭 — 이미지 스타일 카드 리스트(왼쪽 종목/날짜/티커, 오른쪽 가격/변동량) */
/* 새로고침 버튼 대신 아래로 당겨서 새로고침(pull-to-refresh) — 평소엔 높이 0으로 숨겨져 있다가 당기는 동안만 표시 */
.pull-refresh {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 0;
  overflow: visible;
  margin-bottom: 0;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}
.pull-refresh-visible { opacity: 1; margin-bottom: 8px; }
.pull-refresh-text {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 14px;
}
.pull-refresh-ready .pull-refresh-text { color: var(--accent); border-color: var(--accent); }
.idx-list { display: flex; flex-direction: column; }
.idx-name .ticker-logo-wrap { margin-right: 6px; vertical-align: -5px; }
.crypto-logo-wrap { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; margin-right: 5px; vertical-align: -3px; }
.crypto-logo { width: 16px; height: 16px; border-radius: 50%; object-fit: contain; }
.crypto-logo-badge { font-size: 13px; line-height: 1; }
.idx-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
}
.idx-row:last-child { border-bottom: none; }
.idx-row-clickable { cursor: pointer; border-radius: 8px; }
.idx-row-clickable:hover, .idx-row-clickable:focus-visible { background: var(--accent-soft); outline: none; }
.idx-left { min-width: 0; }
.idx-name { font-weight: 800; font-size: 15px; line-height: 1.25; }
.idx-sub { margin-top: 4px; font-size: 12px; color: var(--muted); }
.idx-clock { color: var(--bad); }
.idx-clock-live { color: var(--text); }
.idx-ticker { color: var(--muted); letter-spacing: 0.2px; }
.idx-right { text-align: right; white-space: nowrap; flex: none; }
.idx-price { font-weight: 800; font-size: 16px; }
.idx-delta { margin-top: 3px; font-size: 12.5px; font-weight: 700; }

/* 원자재/채권/외환 상세페이지 — 종목이 아니라 시세+개요+뉴스만 표시 */
.asset-detail-price-block { padding: 14px 2px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.asset-detail-price-row { display: flex; align-items: baseline; gap: 10px; }
.asset-detail-price { font-weight: 800; font-size: 24px; }
.asset-detail-delta { font-size: 14px; font-weight: 700; }
.asset-detail-section-title { margin: 18px 0 8px; font-size: 14px; font-weight: 800; color: var(--text); }
.asset-detail-overview { font-size: 14px; line-height: 1.6; color: var(--text); }
.asset-detail-news { display: flex; flex-direction: column; gap: 12px; }

.stock-card-right { flex: none; white-space: nowrap; text-align: right; }
.stock-card-r1, .stock-card-r2 { display: flex; align-items: baseline; justify-content: flex-end; gap: 8px; }
.stock-card-r2 { margin-top: 3px; }
.stock-card-price { font-weight: 800; font-size: 16px; }
.stock-card-change { font-weight: 700; font-size: 12.5px; min-width: 52px; text-align: right; }
.stock-card-volume { font-size: 12px; color: var(--muted); font-weight: 600; }
.stock-card-pct { font-size: 12.5px; font-weight: 700; min-width: 52px; text-align: right; }

/* ---------- 관심종목: 그룹 탭 + 정렬/추가/공유 툴바 ---------- */
.wl-group-row { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.wl-group-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  flex: 1;
  min-width: 0;
}
.wl-group-tabs::-webkit-scrollbar { display: none; }
.wl-group-tab {
  flex: 0 0 auto;
  white-space: nowrap;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  padding: 7px 13px;
}
.wl-group-tab.active { color: var(--text); border-color: var(--text); background: var(--bg); }
.wl-group-tab-add { color: var(--accent); border-style: dashed; }
/* 그룹 탭 길게 누르기 → 인라인 이름변경, "+ 새 그룹" 클릭 → 인라인 생성. 탭과 같은 자리에서 입력창+확인(✓) 버튼만 보임 */
.wl-group-tab-editing { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border-color: var(--accent); }
.wl-group-tab-rename-input {
  width: 70px;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}
.wl-group-tab-rename-confirm {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}
.wl-group-manage-btn {
  flex: none;
  width: 28px;
  height: 28px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--muted);
  font-size: 13px;
}

.wl-toolbar { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.wl-tool-btn {
  flex: none;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  padding: 6px 10px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.wl-tool-btn-share { margin-left: auto; color: var(--text); }
.wl-tool-caret { font-size: 9px; }
.wl-sort-wrap { position: relative; }
.wl-sort-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 60;
  min-width: 120px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3);
  padding: 6px;
  display: flex;
  flex-direction: column;
}
.wl-sort-option {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  padding: 8px 10px;
  border-radius: 6px;
}
.wl-sort-option.active { color: var(--accent); font-weight: 800; }
.wl-sort-option:hover, .wl-sort-option:focus-visible { background: var(--accent-soft); outline: none; }

/* ---------- 관심종목 그룹 관리 모달 ---------- */
.wl-group-modal-body { padding: 14px 12px; overflow-y: auto; }
.wl-group-modal-list { display: flex; flex-direction: column; gap: 8px; }
.wl-group-modal-row, .wl-group-modal-new { display: flex; align-items: center; gap: 8px; }
.wl-group-modal-new { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.wl-group-name-input {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13.5px;
  padding: 9px 10px;
}
.wl-group-row-btn {
  flex: none;
  width: 34px;
  height: 34px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
}
.wl-group-save-btn { color: var(--accent); }
.wl-group-delete-btn { color: var(--neg); }

.market-delay-note { margin: 0 0 10px; font-size: 11.5px; font-weight: 600; color: var(--muted); text-align: center; }

/* ---------- 시장 상단 4x2 위젯(카드 2장, 각 2x2, 오늘 스파크라인) ---------- */
.mkt-widget { margin-bottom: 14px; }
.mkt-widget-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.mkt-widget-track::-webkit-scrollbar { display: none; }
.mkt-widget-card {
  flex: 0 0 100%;
  scroll-snap-align: start;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--card-bg);
}
.mkt-widget-cell {
  padding: 14px 12px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  min-width: 0;
}
.mkt-widget-cell:nth-child(2n) { border-right: none; }
.mkt-widget-cell:nth-last-child(-n+2) { border-bottom: none; }
.mkt-widget-cell.price-chart-link { cursor: pointer; }
.mkt-widget-cell.price-chart-link:hover, .mkt-widget-cell.price-chart-link:focus-visible { background: var(--accent-soft); outline: none; }
.mkt-widget-cell-name-row { display: flex; align-items: baseline; gap: 4px; min-width: 0; }
.mkt-widget-cell-name { flex: 1 1 auto; min-width: 0; font-size: 12.5px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mkt-widget-cell-clock { flex: none; font-size: 9.5px; font-weight: 600; }
.mkt-widget-cell-price { margin-top: 6px; font-size: 19px; font-weight: 800; color: var(--text); }
.mkt-widget-cell-delta { margin-top: 2px; font-size: 12px; font-weight: 700; }
.mkt-spark { display: block; width: 100%; height: 20px; margin-top: 4px; }

.mkt-widget-footer { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 8px; position: relative; }
.mkt-widget-dots { display: flex; gap: 5px; }
.mkt-widget-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--border); }
.mkt-widget-dot.active { background: var(--text); width: 16px; border-radius: 3px; }
.mkt-widget-edit-btn {
  position: absolute;
  right: 0;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 6px;
}

/* ---------- 시장 위젯 종목 수정 모달 ---------- */
.mkt-widget-edit-body { padding: 14px 12px; overflow-y: auto; }
/* 저장 버튼을 맨 위로 — 선택 개수 표시와 한 줄로 묶어 스크롤해도 계속 보이도록 sticky */
.mkt-widget-edit-topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; position: sticky; top: 0; z-index: 1; background: var(--bg); padding: 4px 0 12px; margin-bottom: 4px; }
.mkt-widget-edit-count { margin: 0; font-size: 13px; font-weight: 700; color: var(--accent); }
.mkt-widget-edit-group { margin-bottom: 16px; }
.mkt-widget-edit-group-label { margin: 0 0 8px; font-size: 12px; font-weight: 700; color: var(--muted); }
.mkt-widget-edit-opt { display: flex; align-items: center; gap: 8px; padding: 8px 2px; font-size: 13.5px; color: var(--text); }
.mkt-widget-edit-opt input { flex: none; width: 16px; height: 16px; }
.mkt-widget-edit-save { flex: none; text-align: center; padding: 8px 18px; font-size: 13.5px; }

.summary-action-row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.summary-action-btn {
  flex: 0 0 auto;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  white-space: nowrap;
}
.summary-action-btn.active { color: var(--text); border-color: var(--text); font-weight: 800; }
#tickerHistoricalRow { margin-top: 14px; }

table.fin-table { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: 13px; }
table.fin-table th, table.fin-table td { padding: 8px 6px; border-bottom: 1px solid var(--border); text-align: right; }
table.fin-table th:first-child, table.fin-table td:first-child { text-align: left; }
.delta-up { color: var(--pos); font-weight: 800; }
.delta-down { color: var(--neg); font-weight: 800; }

/* 모바일 하단 고정 네비게이션 — 글자 없이 아이콘만(홈/캘린더/내투자/관심/로그인), 좌우 여백을 두고 둥글게 뜬
   반투명 바 위에 버튼을 올림(눌린 아이콘은 배경 없이 흰색으로만 하이라이트). company-panel(350)보다 z-index가
   낮아 전체화면 오버레이가 열리면 자연스럽게 그 아래로 가려짐 */
/* 섹터맵(지도) 하단 네비와 디자인 통일 — 화면 폭 꽉 채운 바 형태, 아이콘+라벨, 선택=주황/비선택=회색 */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  display: flex;
  border-top: 1px solid var(--border);
  background: var(--card-bg);
  padding: 1px 4px calc(1px + env(safe-area-inset-bottom, 0px));
}
.bottom-nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 2px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav-btn svg { width: 26px; height: 26px; position: relative; top: 3px; }
#bottomNavMoreBtn svg { width: 29px; height: 29px; top: 3px; }
#bottomNavMoreBtn { position: relative; top: -2px; }
#bottomNavMarketBtn svg { top: 5px; }
.bottom-nav-btn.active { color: var(--text); }
.bottom-nav-btn.active svg { color: var(--text); }
.bottom-nav-btn:active,
.bottom-nav-btn:focus,
.bottom-nav-btn:focus-visible { background: none; outline: none; }

/* 더보기 패널 — 하단 네비 마지막 버튼에서 열리는, 전체화면이 아니라 오른쪽 최대 75%만 차지하는 슬라이드인 드로어 */
.more-panel {
  position: fixed;
  inset: 0;
  z-index: 490;
  display: none;
}
.more-panel-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.28s ease;
}
.more-panel.open .more-panel-backdrop { opacity: 1; }
.more-panel-sheet {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 75%;
  max-width: 340px;
  background: var(--card-bg);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  padding: calc(20px + env(safe-area-inset-top, 0px)) 0 24px;
}
.more-panel.open .more-panel-sheet { transform: translateX(0); }
.more-panel-close {
  align-self: flex-end;
  margin: 0 14px 8px 0;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: var(--subtle-fill);
  color: var(--text);
  font-size: 15px;
  line-height: 1;
}
.more-panel-user {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 4px 18px 18px;
  background: none;
  border: none;
  color: var(--text);
  text-align: left;
}
.more-panel-avatar {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--subtle-fill-2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.more-panel-avatar-img { width: 100%; height: 100%; object-fit: cover; }
.more-panel-avatar-initial { font-size: 16px; font-weight: 700; color: var(--muted); }
.more-panel-user-name { flex: 1; font-size: 16px; font-weight: 700; }
.more-panel-chevron { flex: none; width: 18px; height: 18px; color: var(--muted); }
.more-panel-divider { height: 1px; background: var(--border); margin: 0 0 8px; }
.more-panel-list { display: flex; flex-direction: column; padding: 4px 8px; }
.more-panel-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 10px;
  background: none;
  border: none;
  border-radius: 10px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  text-align: left;
}
.more-panel-item:active { background: var(--subtle-fill); }
.more-panel-item svg { flex: none; width: 20px; height: 20px; color: var(--muted); }
.more-panel-item-label { flex: 1; }
.more-panel-badge {
  flex: none;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--subtle-fill-2);
  color: var(--muted);
}
.more-panel-pro-badge {
  display: inline-block;
  margin-left: 4px;
  font-size: 11px;
  font-weight: 800;
  color: #e04600;
}

/* 더보기 패널 맨 아래 "시스템" — 지금 앱에 있는 기능을 텍스트로 나열(참조용, 클릭 동작 없음) */
.more-panel-section-label {
  padding: 4px 18px 6px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}
.more-panel-feature-list {
  margin: 0;
  padding: 0 18px 16px;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.more-panel-feature-list li {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.4;
}

/* 더보기 패널 상단 "화면 테마" 행 — 아이콘+라벨은 다른 항목과 동일, 오른쪽에 화이트/블랙 선택 토글만 추가 */
.more-panel-theme-row { cursor: default; }
.more-panel-theme-row:active { background: none; }
.theme-toggle { flex: none; display: flex; gap: 4px; margin-left: auto; }
.theme-toggle-btn {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.theme-toggle-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(90px + env(safe-area-inset-bottom, 0px));
  z-index: 600;
  transform: translateX(-50%) translateY(10px);
  background: rgba(20, 22, 28, 0.95);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 999px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.net-income-cell { display: inline-block; padding: 2px 8px; border-radius: 6px; font-weight: 700; }
.net-income-cell.positive { background: rgba(26, 156, 92, 0.18); color: var(--good); }
.net-income-cell.negative { background: rgba(214, 69, 69, 0.18); color: var(--bad); }

.bar-chart { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 42px 46px 1fr; align-items: center; gap: 8px; font-size: 13px; }
.bar-row .bar-label { color: var(--muted); }
.bar-track { background: var(--border); border-radius: 6px; overflow: hidden; height: 26px; position: relative; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 6px 0 0 6px; }
.bar-fill.self { background: #7c3aed; }
.bar-fill-profit {
  position: absolute; top: 0; left: 0; height: 100%;
  background: var(--pos); border-radius: 6px 0 0 6px; z-index: 1;
  display: flex; align-items: center; justify-content: flex-start; overflow: visible;
}
.profit-label {
  margin-left: 6px; color: #fff; font-weight: 700; font-size: 10px;
  white-space: nowrap; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}
.bar-loss-zone { height: 26px; position: relative; overflow: hidden; }
.bar-loss { position: absolute; top: 0; right: 0; height: 100%; background: var(--neg); border-radius: 6px 0 0 6px; }
.loss-label {
  position: absolute; top: 50%; right: 5px; transform: translateY(-50%);
  z-index: 2; color: #fff; font-weight: 700; font-size: 10px;
  white-space: nowrap; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}
.bar-value { text-align: right; font-variant-numeric: tabular-nums; }
.bar-revenue-label {
  position: absolute; top: 50%; right: 8px; transform: translateY(-50%);
  z-index: 2; color: var(--text); font-weight: 700; font-size: 12px;
  white-space: nowrap; text-shadow: 0 1px 2px rgba(255, 255, 255, 0.55);
}
.margin-pct { font-size: 11px; margin-left: 4px; font-weight: 600; }
.margin-pct.good { color: var(--pos); }
.margin-pct.bad { color: var(--neg); }

.qbar-dates { font-size: 12px; margin: 10px 0 2px; }

.peer-row {
  display: grid;
  grid-template-columns: 120px 1fr 80px 65px 55px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.peer-table-header {
  display: grid;
  grid-template-columns: 120px 1fr 80px 65px 55px;
  gap: 10px;
  font-size: 11px;
  color: var(--muted);
  margin-top: 14px;
  padding: 0 0 4px;
}
.peer-table-header span:nth-child(3),
.peer-table-header span:nth-child(4),
.peer-table-header span:nth-child(5) { text-align: right; }
.peer-price, .peer-score { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.peer-table-header + .bar-chart { margin-top: 6px; }
.bar-label.self { font-weight: 800; }

@media (max-width: 480px) {
  .peer-row, .peer-table-header {
    grid-template-columns: 46px 1fr 46px 42px 32px;
    gap: 5px;
    font-size: 10.5px;
  }
  .bar-label { overflow-wrap: break-word; }
}

.news-item { padding: 12px 0; border-bottom: 1px solid var(--border); }
.news-item:last-child { border-bottom: none; }
.news-item .news-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.news-item .news-title a { color: var(--text); text-decoration: none; }
.news-item .news-title a:hover { color: var(--accent); }
.news-item .news-meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.news-item .news-summary { font-size: 13px; color: var(--text); }
.news-item .news-original { font-size: 12px; color: var(--muted); font-style: italic; }
.news-item .news-source { font-size: 11px; color: var(--muted); opacity: 0.75; margin-top: 2px; }

/* invest점수 서브탭: 원형점수를 제목 아래 중앙에 두고, 상세 설명은 그 아래 전체 폭으로 작고 흐리게 */
.invest-score-label {
  display: inline-block;
  margin: 4px 0 14px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.3px;
}
.invest-score-h2 {
  font-size: 19px;
  font-weight: 800;
  color: var(--text);
}

.score-wrap { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; }
.score-badge {
  flex-shrink: 0;
  width: 110px; height: 110px;
  border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--accent-soft);
  border: 3px solid var(--accent);
}
.score-badge .score-num { font-size: 30px; font-weight: 800; color: var(--accent); }
.score-badge .score-num.ipo-label { font-size: 19px; }
.score-badge .score-den { font-size: 12px; color: var(--muted); }
.score-badge.risk { background: var(--good-soft); border-color: var(--good); }
.score-badge.risk .score-num { color: var(--good); }
.score-badge.macro .score-num { font-size: 26px; color: inherit; }
.score-badge.macro .score-den { font-size: 10px; text-align: center; line-height: 1.2; padding: 0 6px; color: inherit; opacity: 0.75; }
.score-macro-vix-line { margin: -6px 0 14px; font-size: 11.5px; color: var(--muted); }

.mini-score-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}
.mini-score { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; }
.mini-score-circle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  background: var(--accent-soft);
  border: 2px solid var(--accent);
  color: var(--accent);
}
.mini-score-circle.risk { background: var(--good-soft); border-color: var(--good); color: var(--good); }
.mini-score-label { font-size: 11px; color: var(--muted); white-space: nowrap; text-align: center; }

.score-pill-empty { color: var(--muted); font-weight: 700; }

.score-details { flex: 1; min-width: 220px; font-size: 13px; }
.score-details ul { margin: 0; padding-left: 18px; }
.score-details li { margin-bottom: 6px; font-size: 11.5px; color: var(--muted); }
.score-details li b { color: var(--text); font-weight: 700; }

.disclaimer { margin-top: 14px; font-size: 11px; color: var(--muted); border-top: 1px dashed var(--border); padding-top: 10px; }
/* 랭킹 결과가 시가총액 상위 일부만 스캔된 상태일 때 공지 바로 밑에 붙는 주의문 — 눈에 띄게 주황색+굵게 */
.top30-scope-note { margin: 6px 0 10px; font-size: 12px; font-weight: 700; color: var(--warn); }
/* 탭 상단 1줄 설명 — disclaimer를 맨 위에 놓는 변형(테두리를 아래쪽으로) */
.tab-note { margin-top: 0; margin-bottom: 12px; border-top: none; padding-top: 0; border-bottom: 1px dashed var(--border); padding-bottom: 9px; }

.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(0,0,0,0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 로그인 동의 문구 · 사이트 공통 푸터 (면책·출처·약관 링크) ===== */
.login-consent {
  margin-top: 14px;
  font-size: 11.5px;
  color: var(--muted);
  text-align: center;
  line-height: 1.6;
}
.login-consent a { color: var(--muted); text-decoration: underline; }

.site-footer {
  margin-top: 28px;
  padding: 18px 16px calc(78px + env(safe-area-inset-bottom, 0px)); /* 하단 고정 내비게이션에 가리지 않도록 여유 확보 */
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.site-footer p {
  max-width: 860px;
  margin: 0 auto 6px;
  font-size: 11px;
  line-height: 1.65;
  color: var(--muted);
  text-align: center;
}
.site-footer-links a { color: var(--muted); text-decoration: underline; margin: 0 2px; }
