:root {
  --bg: #14161c;
  --card-bg: #1c1f27;
  --text: #eceef2;
  --muted: #9aa2b1;
  --border: #2b2f3a;
  --accent: #6b9bff;
  --accent-soft: #22314f;
  --good: #1a9c5c;
  --bad: #d64545;
  --warn: #c98a1a;
  --pos: #d64545; /* 양수/상승 = 빨강(한국식) */
  --neg: #3b7dd8; /* 음수/하락 = 파랑(한국식) */
  --radius: 12px;
}

* { 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: #000;
  border-bottom: 1px solid var(--border);
  padding: 14px 14px 0px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.fh-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 860px;
  margin: 0 auto 10px;
}

.site-logo { display: block; line-height: 0; cursor: pointer; }
.site-logo svg { height: 34px; width: auto; display: block; }

.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-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; }
#companyPanelWatchlistBtn.active { color: var(--warn); }

/* 이모지 대신 쓰는 주황(로고 색) 단색 라인 아이콘 — 탭바/서브탭/위저드 버튼 공용 */
.btn-icon { display: inline-flex; align-items: center; vertical-align: -2px; }
.btn-icon-svg { display: block; }
#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-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: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: #000;
}

/* ---------- 종목 상세화면: 검정 배경 + 이름/가격/등락률 헤더 ---------- */
.company-panel-black { background: #000; }
.company-panel-black .company-panel-body { background: #000; }
.company-panel-black #summarySubtabNav { background: #000; }

.detail-bar { background: #000; border-bottom-color: #14161c; }
.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: rgba(20, 22, 28, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  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: #000;
  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: #fff; 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: #fff;
}

.future-beta-warning {
  text-align: center;
  padding: 12px 16px;
  margin: 16px 0 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--warn);
  background: #362a12;
  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: #000;
  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: #fff; border-color: #fff; font-weight: 800; }

/* 상단 고정 탭바(투데이/시장/인사이트 등) — 검은 배경/테두리로 통일, 선택 시 굵은 흰 글씨 + 중앙 하단 짧은 밑줄 */
.tab-bar .cat-btn {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  background: #000;
  border-color: #000;
  border-radius: 0;
  color: var(--muted);
  font-weight: 600;
}
.tab-bar .cat-btn.active {
  background: #000;
  border-color: #000;
  color: #fff;
  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: #fff;
}
.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; }

/* 인사이트 "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: #e0567c; }
.cal-dow-sat { color: #6b9bff; }
.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: #e0567c; }
.cal-day-sat .cal-day-num { color: #6b9bff; }
.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-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: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.loading-splash-logo { width: min(340px, 78vw); height: auto; animation: splash-pulse 1.4s ease-in-out infinite; }
@keyframes splash-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.chart-modal {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: #000;
  flex-direction: column;
}

.chart-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: #000;
  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); }

/* 배점 항목 하나 = 상승형 막대그래프 한 줄(라벨+점수 → 막대 → 설명) */
.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-track { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); 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: #000;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 16px;
}
.future-inline-header {
  padding: 10px 12px;
  background: #000;
  border-bottom: 1px solid var(--border);
}
.future-chart-body {
  padding: 12px 10px 24px;
  background: #000;
}
/* 화면이 좁을 땐(모바일) 차트를 억지로 줄이지 않고 최소폭을 유지해 라벨 글자가 너무 작아지지 않게 하고,
   대신 가로 스크롤로 볼 수 있게 함(데이터 비율 자체는 항상 정확하게 유지됨).
   스크롤은 이 컨테이너 자신에게 걸어서(캡션·구분선 등은 제외) 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 #23262f;
}
.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: #f5a623;
}

.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;
}

/* 투자 그라운드: 졸라맨 + 회사 로고 + 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; }
table.top30-table tbody tr:nth-child(-n+3) td:nth-child(1) { color: #b8860b; font-weight: 800; }

/* 브랜드평판순 표: 기업 헤더는 다른 열과 같이 가운데 정렬 유지, 데이터 행(기업명)만 왼쪽 정렬 */
.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;
}
.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: #3a1f20; color: var(--bad); border: 1px solid #5c2b2b; }

.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; }

.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: #fff; border-color: #fff; background: #000; }
.wl-group-tab-add { color: var(--accent); border-style: dashed; }
.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); }

/* ---------- 시장 상단 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 { font-size: 12.5px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.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; }
.mkt-widget-edit-count { margin: 0 0 12px; font-size: 13px; font-weight: 700; color: var(--accent); position: sticky; top: 0; background: #000; padding: 4px 0; }
.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 { width: 100%; text-align: center; padding: 12px; font-size: 13.5px; margin-top: 6px; margin-bottom: 20px; }

.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: #fff; border-color: #fff; 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: calc(14px + env(safe-area-inset-bottom, 0px));
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 58px;
  width: fit-content;
  margin: 0 auto;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.035);
  backdrop-filter: blur(4px) saturate(130%);
  -webkit-backdrop-filter: blur(4px) saturate(130%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.bottom-nav-btn {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  color: rgba(255, 255, 255, 0.45);
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav-btn svg { width: 24px; height: 24px; }
.bottom-nav-btn.active { color: #fff; }
/* 국기 아이콘은 currentColor가 아니라 고유색이라 위 color 토글이 안 먹혀서 opacity로 별도 활성 표시 */
.bottom-nav-btn.flag-btn svg { width: 26px; height: 26px; border-radius: 50%; }
.bottom-nav-btn.flag-btn { opacity: .55; }
.bottom-nav-btn.flag-btn.active { opacity: 1; }
.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: rgba(255, 255, 255, 0.06);
  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: rgba(255, 255, 255, 0.08);
  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: rgba(255, 255, 255, 0.05); }
.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: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.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: #143327; 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: #143327; 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; }
/* 탭 상단 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); } }
