/* ─────────────────────────────────────────────
   RedShot · 마법공식 투자 대시보드
───────────────────────────────────────────── */

/* ── 변수 ── */
:root {
  --primary:      #8B1A1A;   /* RedShot 브랜드 크림슨 */
  --primary-light:#b91c1c;
  --primary-pale: #fef2f2;
  --bg:           #f4f6f9;
  --white:        #ffffff;
  --border:       #d6d9e0;
  --border-light: #eaecf0;
  --text:         #1a1a1a;
  --text-muted:   #6b7280;
  --up:           #c0392b;   /* 상승 빨강 (한국 관례) */
  --dn:           #1a6dad;   /* 하락 파랑 */
  --green:        #16a34a;
  --table-head:   #f0f3f8;
  --shadow:       0 1px 4px rgba(0,0,0,.08);
  --shadow-md:    0 4px 12px rgba(0,0,0,.10);
  --radius:       6px;
  --radius-lg:    10px;
}

/* ── 리셋 & 베이스 ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Noto Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  /* 최후 안전망 — 어떤 자식 요소가 폭을 초과해도 body 가로 스크롤 차단.
     특정 테이블·카드는 자체 .table-wrap(overflow-x:auto)으로 가로 스크롤 허용. */
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select { font-family: inherit; }

/* ── 컨테이너 ── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* ── 유틸 ── */
.ta-c { text-align: center; }
.ta-r { text-align: right; }
.mono { font-variant-numeric: tabular-nums; letter-spacing: -.3px; }
.up   { color: var(--up) !important; }
.dn   { color: var(--dn) !important; }
.neutral { color: var(--text-muted); }
.text-muted  { color: var(--text-muted); font-size: 12px; }
.text-error  { color: var(--up); }
.ml-auto { margin-left: auto; }
.hidden  { display: none; }

/* ── 헤더 ── */
.site-header {
  background: var(--primary);
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.site-header .container {
  display: flex; align-items: center; gap: 24px;
  height: 54px;
}
.logo { font-size: 22px; font-weight: 700; letter-spacing: -1px; display: flex; align-items: center; }
.logo-red   { color: #fff; }
.logo-shot  { color: #ffaaaa; }
.logo-bullseye { width: 0.76em; height: 0.76em; vertical-align: -0.08em; margin: 0 0.02em; flex-shrink: 0; }

.main-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav-link {
  color: rgba(255,255,255,.80);
  padding: 6px 14px;
  border-radius: 4px;
  font-size: 13px; font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-link:hover,
.nav-link.active {
  background: rgba(255,255,255,.18);
  color: #fff;
}
.menu-toggle {
  display: none;
  background: none; border: none;
  flex-direction: column; gap: 5px; padding: 4px;
  margin-left: auto;
}
.menu-toggle span {
  display: block; width: 22px; height: 2px;
  background: #fff; border-radius: 2px;
}

/* ── 시장 지수 바 ── */
.index-bar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 8px 0;
}
.index-bar__items {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
.index-item { display: flex; align-items: center; gap: 6px; }
.index-name { color: var(--text-muted); font-size: 12px; }
.index-value { font-weight: 700; font-size: 15px; }
.index-change { font-size: 12px; }
.index-divider { width: 1px; height: 16px; background: var(--border); }

/* ── 메인 콘텐츠 ── */
.main-content { padding: 20px 0 40px; }

/* ── 섹션 ── */
.section {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.section-title {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.section-title h2 {
  font-size: 15px; font-weight: 700;
  border-left: 3px solid var(--primary);
  padding-left: 10px;
}
.refresh-status-wrap { display: flex; align-items: center; gap: 12px; margin-left: auto; flex-wrap: wrap; }
/* 모바일에선 status 라벨 + 버튼들이 좁아 글자가 세로로 깨지는 걸 방지 */
.refresh-status-wrap .btn { white-space: nowrap; }
@media (max-width: 768px) {
  .refresh-status-wrap { gap: 8px; margin-left: 0; width: 100%; justify-content: flex-start; }
  .refresh-status-wrap .btn { font-size: 12px; padding: 4px 10px; }
  .refresh-status-wrap .link-more { margin-left: auto; }
}
.link-more { font-size: 12px; color: var(--primary-light); }

/* 자동갱신 상태 표시 */
.refresh-status {
  font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 12px;
  white-space: nowrap; font-variant-numeric: tabular-nums; letter-spacing: 0.02em;
}
.refresh-status.market-open  { background: #dcfce7; color: #15803d; border: 1px solid #4ade80; }
.refresh-status.market-closed { background: #f3f4f6; color: #9ca3af; border: 1px solid #e5e7eb; }

/* AI 분석 캐시 뱃지 */
.cache-badge {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; color: #6b7280; background: #f3f4f6;
  border: 1px solid #e5e7eb; border-radius: 6px;
  padding: 4px 10px; margin-bottom: 10px;
}
.cache-refresh-btn {
  background: none; border: none; color: var(--primary-light);
  font-size: 12px; cursor: pointer; text-decoration: underline; padding: 0;
}
.cache-refresh-btn:hover { color: var(--primary); }
.link-more:hover { text-decoration: underline; }

/* ── 통계 카드 그리드 ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-card.highlight { border-color: var(--primary-light); background: var(--primary-pale); }
.stat-label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.stat-value { font-size: 24px; font-weight: 700; line-height: 1.2; }
.stat-sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.four-col { grid-template-columns: repeat(4, 1fr); }

/* ── 2열 레이아웃 ── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── 포트폴리오 hero (대시보드 전용) v2 ────────── */
.pf-hero {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--white);
}
.pf-pnl {
  flex: 0 0 36%;
  padding: 22px 26px;
  display: flex; flex-direction: column; justify-content: center;
}
.pf-pnl.up { background: linear-gradient(135deg, #fff5f5 0%, #fecaca 100%); }
.pf-pnl.dn { background: linear-gradient(135deg, #eff6ff 0%, #bfdbfe 100%); }
.pf-pnl-label {
  font-size: 12px; color: var(--text-muted);
  font-weight: 600; letter-spacing: .3px;
  margin-bottom: 6px;
}
.pf-pnl-value {
  font-size: 30px; font-weight: 800;
  line-height: 1.15; letter-spacing: -.5px;
  font-variant-numeric: tabular-nums;
}
.pf-pnl.up .pf-pnl-value { color: var(--up); }
.pf-pnl.dn .pf-pnl-value { color: var(--dn); }
.pf-pnl-pct {
  display: inline-block; margin-top: 8px;
  padding: 3px 11px; border-radius: 999px;
  background: rgba(255,255,255,.75);
  font-size: 13px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.pf-pnl.up .pf-pnl-pct { color: var(--up); }
.pf-pnl.dn .pf-pnl-pct { color: var(--dn); }
.pf-metrics {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}
.pf-metric {
  padding: 22px 16px;
  text-align: center;
  border-left: 1px solid var(--border-light);
  display: flex; flex-direction: column; justify-content: center;
}
.pf-metric:first-child { border-left: none; }
.pf-metric-label { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.pf-metric-value { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pf-metric-sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

@media (max-width: 880px) {
  .pf-hero { flex-direction: column; }
  .pf-pnl { flex: none; }
  .pf-metrics { grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--border-light); }
  .pf-metric { padding: 14px 8px; }
  .pf-pnl-value { font-size: 24px; }
}

/* ── 보유 주식 — 표 + 도넛 사이드 ────────── */
.holdings-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 16px;
  align-items: start;
}
@media (max-width: 880px) { .holdings-layout { grid-template-columns: 1fr; } }

.return-cell {
  display: inline-flex; align-items: center; gap: 8px;
  justify-content: flex-end;
}
.return-bar-mini {
  width: 50px; height: 4px; border-radius: 2px;
  background: rgba(0,0,0,.06);
  position: relative; overflow: hidden;
  flex-shrink: 0;
}
.return-bar-mini > i {
  position: absolute; top: 0; bottom: 0;
  border-radius: 2px;
}
.return-bar-mini > i.up { background: var(--up); left: 0; }
.return-bar-mini > i.dn { background: var(--dn); right: 0; }
.return-pct {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  min-width: 60px; text-align: right;
}

.donut-side {
  background: #fafbfc;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.donut-side-title {
  font-size: 12px; color: var(--text-muted);
  font-weight: 600; letter-spacing: .3px;
  text-align: center; margin-bottom: 10px;
}
.donut-side .chart-wrap {
  height: 170px;
  margin-bottom: 10px;
}
.donut-list {
  display: flex; flex-direction: column; gap: 4px;
  max-height: 200px; overflow-y: auto;
  list-style: none; padding: 0; margin: 0;
}
.donut-list li {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 6px; border-radius: 4px;
  font-size: 12px;
}
.donut-list li:hover { background: rgba(0,0,0,.04); }
.donut-list .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.donut-list .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-list .pct { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }

/* ── 보유 종목 수익률 — 가로 막대 차트 ────────── */
.return-chart-wrap {
  position: relative;
  width: 100%;
  /* 종목 수에 따라 JS에서 height를 동적 조정 */
}

/* ── 차트 ── */
.chart-wrap { position: relative; height: 200px; }
.chart-wrap.tall { height: 260px; }
.chart-wrap.price-chart-wrap { height: 340px; }

/* ── 표 ── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
/* 넓은 테이블용 상단 가로 스크롤바 미러 — 페이지 하단까지 내리지 않고 좌우 이동.
   JS가 data-scroll-mirror="tableId"로 타겟 테이블과 폭·스크롤 동기화. */
.table-scroll-top {
  overflow-x: auto;
  overflow-y: hidden;
  height: 14px;
  margin-bottom: 2px;
  background: transparent;
}
.table-scroll-top > div { height: 1px; }
/* 스크롤바 가시성 향상 — 기본 얇은 스크롤바는 놓치기 쉬움 */
.table-scroll-top::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar { height: 12px; }
.table-scroll-top::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb {
  background: #9ca3af;
  border-radius: 6px;
  border: 2px solid #f9fafb;
}
.table-scroll-top::-webkit-scrollbar-thumb:hover,
.table-wrap::-webkit-scrollbar-thumb:hover { background: #6b7280; }
.table-scroll-top::-webkit-scrollbar-track,
.table-wrap::-webkit-scrollbar-track { background: #f3f4f6; border-radius: 6px; }
/* 대시보드 TOP 15 등 14 컬럼 테이블 전용 — 노트북 폭(1280px 이하)에서
   가로 스크롤 방지 위해 padding·font 축소. stocks.html 스크리너는 영향 없음.
   1499px 이하에서는 hide-tablet으로 추가 컬럼 숨김(이평선·Pre-Surge·PEAD·손절가).
   잔여 폭 초과 가능성 차단을 위해 .compact 본인은 가로 스크롤 자체 차단(잘림 허용). */
.table-wrap.compact { overflow-x: hidden; }
.table-wrap.compact .data-table { font-size: 12px; table-layout: auto; }
.table-wrap.compact .data-table th,
.table-wrap.compact .data-table td { padding: 6px 7px; }
/* 종목명 컬럼은 가장 긴 텍스트라 폭의 큰 부분을 차지. 노트북 폭에서 ellipsis로 잘라
   다른 컬럼이 밀려 가로 스크롤 유발하는 것 방지. analysis 페이지에서 풀네임 확인 가능. */
.table-wrap.compact .data-table .stock-name-link { max-width: 180px; }
.table-wrap.compact .data-table .stock-name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  display: inline-block; max-width: 160px; vertical-align: bottom;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  background: var(--table-head);
  padding: 9px 12px;
  font-weight: 600; font-size: 12px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  color: var(--text-muted);
  user-select: none;
}
.data-table th.sortable-col { transition: background .15s; }
.data-table th.sortable-col:hover { background: #fce8e8; color: var(--primary); }
.data-table th.sort-asc,
.data-table th.sort-desc { background: var(--primary-pale); color: var(--primary); }
.th-label { }
.sort-icon { margin-left: 4px; font-size: 11px; color: #aaa; }
.sort-asc  .sort-icon,
.sort-desc .sort-icon { color: var(--primary); }
.data-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}
.row-hover:hover { background: #fff0f0; cursor: pointer; }
.table-note { font-size: 11px; color: var(--text-muted); margin-top: 8px; }

.stock-name-link { display: flex; flex-direction: column; gap: 1px; }
.stock-name { font-weight: 600; }
.stock-code { font-size: 11px; color: var(--text-muted); }
.rank-num { font-weight: 700; color: var(--primary); }

.detail-table th { text-align: left; width: 140px; background: var(--table-head); font-size: 13px; }
.detail-table td { width: 120px; }

/* ── 배지 ── */
.market-badge {
  display: inline-block;
  padding: 2px 7px; border-radius: 4px;
  font-size: 11px; font-weight: 700; letter-spacing: .3px;
  white-space: nowrap;
}
.market-badge.kospi  { background: #dbeafe; color: #1d4ed8; }
.market-badge.kosdaq { background: #fef3c7; color: #b45309; }

/* 보유 종목 스크리닝 / 실시간 메타 라인 */
.screening-meta {
  display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px;
}
.smeta-item {
  font-size: 11px; padding: 1px 6px; border-radius: 4px;
  background: var(--bg-secondary, #f1f5f9); color: var(--text-muted);
  white-space: nowrap;
}
.smeta-item.rank   { background: #dbeafe; color: #1d4ed8; font-weight: 700; }
.smeta-item.pead   { background: #fef3c7; color: #b45309; font-weight: 700; }
.smeta-item.realtime { background: #f0fdf4; color: #15803d; font-weight: 600; }

.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 12px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
}
.badge-blue   { background: var(--primary-pale); color: var(--primary); }
.badge-red    { background: #fde8e8; color: var(--up); }
.badge-green  { background: #dcfce7; color: #16a34a; }
.badge-yellow { background: #fef9c3; color: #a16207; }
.badge-gray   { background: #f3f4f6; color: #6b7280; }
.badge-up     { background: #fde8e8; color: #c0392b; font-weight: 700; }
.badge-down   { background: #dbeafe; color: #1d4ed8; font-weight: 700; }
.badge-empty  { color: var(--text-muted); }
.rank-badge { background: var(--primary-pale); color: var(--primary); padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 700; }
.dividend-badge { background: #f0fdf4; color: var(--green); padding: 2px 8px; border-radius: 10px; font-size: 12px; }
/* 포트폴리오 보완 추천 카드 — 대시보드 4번 섹션 */
.reco-card {
  margin-top: 16px;
  background: linear-gradient(135deg, #f0f9ff 0%, #ecfdf5 100%);
  border: 1px solid #bae6fd;
  border-radius: 12px;
  padding: 16px 18px;
}
.reco-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; margin-bottom: 14px;
}
.reco-title { font-size: 15px; font-weight: 700; color: #0c4a6e; margin: 0; }
.reco-desc  { font-size: 12px; color: #475569; margin: 3px 0 0; line-height: 1.45; }
.reco-badge {
  background: #fff; border: 1px solid #bae6fd; color: #0369a1;
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 10px;
  white-space: nowrap; flex-shrink: 0;
}
.reco-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.reco-item {
  display: block;
  background: #fff;
  border: 1px solid #e0f2fe;
  border-radius: 10px;
  padding: 12px 14px;
  text-decoration: none;
  color: inherit;
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
.reco-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(14, 165, 233, .12);
  border-color: #38bdf8;
}
.reco-item-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.reco-name { font-size: 14px; font-weight: 700; color: #0f172a; }
.reco-code { font-size: 11px; color: #94a3b8; font-family: ui-monospace, monospace; }
.reco-reason {
  font-size: 12px; color: #334155; line-height: 1.5;
  margin-bottom: 8px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.reco-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.reco-price { font-size: 12px; color: #475569; font-family: ui-monospace, monospace; }
.reco-er { font-size: 11px; color: #6b7280; font-weight: 600; }
.reco-er.hi { color: #16a34a; }

@media (max-width: 640px) {
  .reco-grid { grid-template-columns: 1fr; }
}

/* 매도/손절 상태 칩 — 보유 종목 행의 4종 신호 표기 (🔴/🟠/🟣/🟡) */
.sell-chip {
  display: inline-block;
  font-size: 14px;
  line-height: 1;
  padding: 2px 1px;
  cursor: help;
  vertical-align: middle;
}
.sell-chip + .sell-chip { margin-left: 2px; }
.sell-chip.ok { color: #d1d5db; font-size: 12px; font-weight: 700; }

.invest-badge { padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.invest-badge.short { background: #fde8e8; color: #c0392b; }
.invest-badge.long  { background: #dbeafe; color: #1d4ed8; }
.invest-badge.both  { background: #fef3c7; color: #92400e; }
.invest-badge.watch { background: #f3f4f6; color: #6b7280; }
.invest-period { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.invest-type-card {
  border-radius: 12px;
  padding: 14px 18px;
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 16px;
  background: #fff;
  border: 1px solid #eef0f3;
  border-left-width: 3px;
  box-shadow: 0 1px 2px rgba(16,24,40,.04);
}
.invest-type-card.short { border-left-color: #dc2626; }
.invest-type-card.long  { border-left-color: #2563eb; }
.invest-type-card.both  { border-left-color: #ea580c; }
.invest-type-card.watch { border-left-color: #9ca3af; }
.invest-type-card .it-icon { font-size: 26px; }
.invest-type-card .it-label { font-size: 11px; color: #6b7280; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; }
.invest-type-card .it-value { font-size: 18px; font-weight: 700; color: #111827; }
.invest-type-card.short .it-value { color: #dc2626; }
.invest-type-card.long  .it-value { color: #2563eb; }
.invest-type-card.both  .it-value { color: #ea580c; }
.invest-type-card .it-period { font-size: 12.5px; margin-top: 3px; color: #4b5563; }

/* ── 감성 온도계 ── */
.sentiment-box { text-align: center; }
.sentiment-label-row { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 10px; }
.sentiment-emoji { font-size: 28px; }
.sentiment-text { font-size: 16px; font-weight: 700; }
.sentiment-pct { font-size: 22px; font-weight: 700; color: var(--primary); }
.thermometer-track {
  width: 100%; height: 12px;
  background: #e5e7eb; border-radius: 6px; overflow: hidden;
  margin: 8px 0;
}
.thermometer-fill {
  height: 100%;
  background: linear-gradient(90deg, #2e73b5 0%, #facc15 50%, #c0392b 100%);
  border-radius: 6px;
  transition: width .5s;
}
.thermometer-track.mini { height: 8px; flex: 1; }
.thermometer-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); }
.pead-info { margin-top: 14px; font-size: 13px; }

/* ── 종목별 뉴스 그리드 ── */
.stock-news-wrap {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
  margin-top: 4px;
}
.stock-news-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: #fff;
}
.stock-news-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.stock-news-name {
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stock-news-name:hover { color: var(--primary); }
.stock-news-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.news-item {
  display: flex;
  align-items: flex-start;
  gap: 7px;
}
.news-icon {
  font-size: 10px;
  font-weight: 700;
  margin-top: 3px;
  flex-shrink: 0;
  width: 12px;
  text-align: center;
}
.news-icon.news-up    { color: #16a34a; }
.news-icon.news-neu-p { color: #65a30d; }
.news-icon.news-neu   { color: #9ca3af; }
.news-icon.news-dn    { color: #dc2626; }
.news-body { min-width: 0; }
.news-title {
  display: block;
  font-size: 12px;
  color: var(--text);
  text-decoration: none;
  line-height: 1.45;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.news-title:hover { color: var(--primary); text-decoration: underline; }
.news-meta {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.news-loading, .news-empty {
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 0;
}

.sentiment-bar-mini {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0 14px; font-size: 13px; flex-wrap: wrap;
}
.sentiment-dot {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 50%; background: #ccc; vertical-align: middle;
  margin-right: 4px;
}
.sentiment-dot.positive     { background: var(--up); }
.sentiment-dot.neutral-pos  { background: #f59e0b; }
.sentiment-dot.neutral      { background: #9ca3af; }
.sentiment-dot.negative     { background: var(--dn); }

.mini-bar-wrap { display: flex; align-items: center; gap: 6px; }
.mini-bar { height: 6px; background: var(--primary-light); border-radius: 3px; transition: width .3s; }

/* ── 필터 pills ── */
.filter-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  padding: 3px 10px; border-radius: 12px; font-size: 12px;
  background: #e5e7eb; color: var(--text-muted);
}
.pill-active { background: var(--primary-pale); color: var(--primary); font-weight: 600; }

/* ── 종목 헤더 ── */
.stock-header { margin-bottom: 16px; }
.stock-header-top { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 12px; }
.stock-header-code { font-size: 12px; color: var(--text-muted); }
.stock-header-name { font-size: 22px; font-weight: 700; margin: 2px 0; }
.sector-tag { background: var(--primary-pale); color: var(--primary); padding: 2px 10px; border-radius: 10px; font-size: 12px; }
.stock-price-block { text-align: right; }
.stock-big-price { font-size: 30px; font-weight: 700; }
.stock-big-price .unit { font-size: 14px; font-weight: 400; color: var(--text-muted); }
.stock-change { font-size: 16px; font-weight: 600; }

/* ── 신호 리스트 ── */
.signal-list { display: flex; flex-direction: column; gap: 14px; }
.signal-item { display: flex; gap: 12px; padding: 12px; border-radius: var(--radius); background: var(--bg); }
.signal-item.signal-active { background: #fef3f2; border-left: 3px solid var(--up); }
.signal-icon { font-size: 20px; flex-shrink: 0; }
.signal-title { font-weight: 600; font-size: 13px; }
.signal-desc { font-size: 13px; color: var(--text-muted); margin-top: 3px; }

/* ── AI 박스 ── */
.ai-box { background: var(--bg); border-radius: var(--radius); padding: 16px; }
.ai-result { margin-top: 12px; line-height: 1.8; font-size: 14px; }

/* ── 버튼 ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px; border-radius: var(--radius);
  font-size: 13px; font-weight: 600;
  border: none; transition: all .15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); }
.btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn-outline:hover { background: var(--primary-pale); }
.btn-outline.active { background: var(--primary); color: #fff; }
.btn-lg { padding: 10px 28px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── 알림 설정 폼 ── */
.settings-card {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  margin-bottom: 14px;
  overflow: hidden;
}
.settings-card-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  background: var(--table-head);
  border-bottom: 1px solid var(--border-light);
}
.settings-card-header h3 { font-size: 14px; font-weight: 700; flex: 1; }
.settings-icon { font-size: 18px; }
.settings-card-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }

.form-row { display: flex; align-items: center; gap: 12px; }
.form-row label { min-width: 90px; font-size: 13px; color: var(--text-muted); }
.form-input {
  flex: 1; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 13px; outline: none;
  transition: border-color .15s;
}
.form-input:focus { border-color: var(--primary-light); }
.time-input { flex: 0 0 100px; }

.schedule-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.alert-options { display: flex; flex-direction: column; gap: 10px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox-row input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); }

.toggle-switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: #ccc; border-radius: 22px; cursor: pointer;
  transition: .2s;
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 16px; height: 16px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .2s;
}
input:checked + .toggle-slider { background: var(--primary); }
input:checked + .toggle-slider::before { transform: translateX(18px); }

.form-actions { display: flex; align-items: center; gap: 14px; padding: 8px 0; }
.test-result { font-size: 13px; }
.test-result.success { color: var(--green); }
.alert { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; }
.alert-error { background: #fde8e8; color: var(--up); }

/* ── 매수 신호 카드 그리드 ── */
.buy-signal-grid { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.buy-signal-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; padding: 2px 2px 4px;
}
.buy-signal-header .title {
  font-size: 14px; font-weight: 700; color: #111827;
  display: flex; align-items: center; gap: 6px;
}
.buy-signal-header .count-muted { font-size: 12px; color: #6b7280; font-weight: 500; }

.buy-signal-tier { display: flex; flex-wrap: wrap; gap: 10px; }

.buy-signal-card {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px;
  border: 1.5px solid; border-radius: var(--radius-lg);
  background: #fff; transition: box-shadow 0.15s, transform 0.15s;
  min-height: 60px;
}
.buy-signal-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,0.07); transform: translateY(-1px); }
.buy-signal-card .card-icon { font-size: 20px; flex-shrink: 0; line-height: 1; padding-top: 2px; }
.buy-signal-card .card-body { flex: 1; min-width: 0; }
.buy-signal-card .card-title {
  font-size: 13px; font-weight: 700; line-height: 1.3;
  display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap;
}
.buy-signal-card .card-title .count-badge {
  font-size: 10.5px; font-weight: 600; padding: 1px 7px;
  border-radius: 999px; background: rgba(0,0,0,0.08); color: #4b5563;
}
.buy-signal-card .card-desc {
  font-size: 11px; color: #6b7280; margin: 3px 0 6px; line-height: 1.4;
}
.buy-signal-card .card-stocks { display: flex; flex-wrap: wrap; gap: 5px; font-size: 12px; }
.buy-signal-card .stock-chip {
  font-weight: 600; padding: 2px 8px; border-radius: 4px; text-decoration: none;
}
.buy-signal-card .stock-chip:hover { text-decoration: underline; opacity: 0.85; }
.buy-signal-card .more-muted { font-size: 11px; color: #9ca3af; align-self: center; }

/* 티어별 사이즈 */
.buy-signal-tier.tier-1 .buy-signal-card { flex: 1 1 100%; padding: 16px 18px; min-height: 70px; }
.buy-signal-tier.tier-1 .card-icon { font-size: 26px; padding-top: 0; }
.buy-signal-tier.tier-1 .card-title { font-size: 15px; }
.buy-signal-tier.tier-1 .card-desc { font-size: 12px; }
.buy-signal-tier.tier-1 .card-stocks { font-size: 13px; }

.buy-signal-tier.tier-2 .buy-signal-card { flex: 1 1 calc(50% - 5px); min-width: 280px; }

.buy-signal-tier.tier-3 .buy-signal-card {
  flex: 1 1 calc(33.333% - 7px); min-width: 220px;
  padding: 10px 12px; min-height: 50px;
}
.buy-signal-tier.tier-3 .card-icon { font-size: 17px; padding-top: 1px; }
.buy-signal-tier.tier-3 .card-title { font-size: 12px; }
.buy-signal-tier.tier-3 .card-desc { display: none; }
.buy-signal-tier.tier-3 .card-stocks { font-size: 11px; }
.buy-signal-tier.tier-3 .card-title .count-badge { font-size: 10px; padding: 0 6px; }

/* 등급별 색상 */
.card-blast {
  border-color: #a855f7;
  background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
  animation: pulse-border-blast 2s infinite;
}
.card-blast .card-title, .card-blast .stock-chip { color: #7e22ce; }
.card-blast .stock-chip { background: #e9d5ff; }
@keyframes pulse-border-blast {
  0%, 100% { border-color: #a855f7; }
  50%       { border-color: #7e22ce; box-shadow: 0 0 0 3px rgba(168,85,247,.2); }
}

.card-vcp-a {
  border-color: #fb923c;
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
}
.card-vcp-a .card-title, .card-vcp-a .stock-chip { color: #c2410c; }
.card-vcp-a .stock-chip { background: #fed7aa; }

.card-strong {
  border-color: #fca5a5;
  background: linear-gradient(135deg, #fef2f2 0%, #fff1f2 100%);
}
.card-strong .card-title, .card-strong .stock-chip { color: #dc2626; }
.card-strong .stock-chip { background: #fee2e2; }

.card-vcp-b {
  border-color: #facc15;
  background: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%);
}
.card-vcp-b .card-title, .card-vcp-b .stock-chip { color: #a16207; }
.card-vcp-b .stock-chip { background: #fef08a; }

.card-leader {
  border-color: #c4b5fd;
  background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
}
.card-leader .card-title, .card-leader .stock-chip { color: #7c3aed; }
.card-leader .stock-chip { background: #ddd6fe; }

.card-normal {
  border-color: #86efac;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
}
.card-normal .card-title, .card-normal .stock-chip { color: #15803d; }
.card-normal .stock-chip { background: #bbf7d0; }

/* 모바일: 1열 스택 */
@media (max-width: 640px) {
  .buy-signal-tier.tier-2 .buy-signal-card,
  .buy-signal-tier.tier-3 .buy-signal-card { flex: 1 1 100%; min-width: 0; }
  .buy-signal-tier.tier-3 .card-desc { display: block; }
  .buy-signal-tier.tier-1 .buy-signal-card { padding: 12px 14px; }
  .buy-signal-tier.tier-1 .card-icon { font-size: 22px; }
}

.btn-sm { padding: 5px 12px; font-size: 12px; }

.buy-signal-row {
  background: linear-gradient(90deg, #f0fdf4 0%, #ffffff 100%) !important;
  border-left: 3px solid #16a34a;
}
.buy-signal-row:hover { background: #dcfce7 !important; }
.strong-signal-row {
  background: linear-gradient(90deg, #fef2f2 0%, #ffffff 100%) !important;
  border-left: 3px solid #dc2626;
}
.strong-signal-row:hover { background: #fee2e2 !important; }
.vcp-a-signal-row {
  background: linear-gradient(90deg, #fff7ed 0%, #ffffff 100%) !important;
  border-left: 3px solid #fb923c;
}
.vcp-a-signal-row:hover { background: #ffedd5 !important; }
.vcp-b-signal-row {
  background: linear-gradient(90deg, #fefce8 0%, #ffffff 100%) !important;
  border-left: 3px solid #facc15;
}
.vcp-b-signal-row:hover { background: #fef9c3 !important; }
.buy-dot { margin-right: 3px; }

/* 내 보유 종목 하이라이트 */
.my-holding-row {
  background: linear-gradient(90deg, #fefce8 0%, #ffffff 100%) !important;
  border-left: 3px solid #eab308;
}
.my-holding-row:hover { background: #fef9c3 !important; }
.my-holding-row.buy-signal-row {
  background: linear-gradient(90deg, #f0fdf4 0%, #fefce8 50%, #ffffff 100%) !important;
  border-left: 3px solid #16a34a;
  border-right: 3px solid #eab308;
}
.my-badge {
  color: #eab308;
  font-size: 12px;
  margin-right: 2px;
}

/* ── 진입/손절/목표가 ── */
.price-col th, .price-col td { white-space: nowrap; }
.price-col.entry th { color: var(--primary); }
.price-col.stop  th { color: var(--up); }
.price-col.target th { color: var(--green); }
.price-pct { display: block; font-size: 11px; }

.price-trio {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.price-trio-card {
  position: relative;
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 18px 14px 14px;
  text-align: center;
  border: 1px solid #eef0f3;
  box-shadow: 0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.03);
  overflow: hidden;
  transition: transform .15s, box-shadow .15s;
}
.price-trio-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0;
  height: 3px; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.price-trio-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16,24,40,.06), 0 2px 4px rgba(16,24,40,.04);
}
.price-trio-card.entry::before  { background: var(--primary-light); }
.price-trio-card.stop::before   { background: #ef4444; }
.price-trio-card.target::before { background: #10b981; }
.price-trio-card.rr::before     { background: #eab308; }

.price-trio-label { font-size: 11px; color: #6b7280; margin-bottom: 8px; font-weight: 600; letter-spacing: 0.02em; }
.price-trio-value { font-size: 20px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; color: #111827; }
.price-trio-card.stop .price-trio-value   { color: #dc2626; }
.price-trio-card.target .price-trio-value { color: #059669; }
.price-trio-card.entry .price-trio-value  { color: var(--primary); }
.price-trio-value .unit { font-size: 12px; font-weight: 400; color: #9ca3af; }
.price-trio-sub { font-size: 11.5px; color: #6b7280; margin-top: 6px; }

/* ── 종목 상세: 매수 등급 배지 (hero) ── */
.grade-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 13px; font-weight: 700;
  padding: 4px 12px; border-radius: 20px;
  margin-left: 4px;
  border: 1px solid;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  animation: grade-glow 2.4s ease-in-out infinite;
}
.grade-chip--blast  { background:#faf5ff; color:#7e22ce; border-color:#d8b4fe; }
.grade-chip--vcp-a  { background:#fff7ed; color:#c2410c; border-color:#fdba74; }
.grade-chip--strong { background:#fef2f2; color:#dc2626; border-color:#fca5a5; }
.grade-chip--vcp-b  { background:#fefce8; color:#a16207; border-color:#fde68a; }
.grade-chip--normal { background:#f0fdf4; color:#15803d; border-color:#86efac; }
.grade-chip--leader { background:#faf5ff; color:#7c3aed; border-color:#d8b4fe; animation: none; }

/* glow를 완화 — currentColor alpha 불가능하므로 색상별 alpha ring 별도 지정 */
.grade-chip--vcp-a  { --ring: rgba(251,146,60,0.25); }
.grade-chip--strong { --ring: rgba(239,68,68,0.25); }
.grade-chip--vcp-b  { --ring: rgba(250,204,21,0.3); }
.grade-chip--normal { --ring: rgba(74,222,128,0.3); }
.grade-chip--blast  { --ring: rgba(168,85,247,0.25); }
@keyframes grade-glow {
  0%, 100% { box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 0 0 0 var(--ring, transparent); }
  50%      { box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 0 0 4px var(--ring, transparent); }
}

/* ── 종목 상세: 툴팁 힌트 아이콘 ── */
.info-hint {
  display: inline-block; cursor: help;
  font-size: 11px; opacity: .55; margin-left: 2px;
  font-weight: 400; user-select: none;
}

/* ── 종목 상세: 2:1 레이아웃 (차트 + 신호) ── */
.analysis-split {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}
@media (max-width: 900px) { .analysis-split { grid-template-columns: 1fr; } }

/* ── 종목 상세: 공통 분석 카드 (예상 수익률·Pre-Surge 등) ── */
.analysis-card {
  position: relative;
  padding: 18px 20px;
  border: 1px solid #eef0f3;
  border-radius: 12px;
  margin-bottom: 14px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.03);
}
.analysis-card::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 0;
  width: 3px; border-radius: 12px 0 0 12px;
  background: transparent;
}
.analysis-card.tint-violet::before { background: #8b5cf6; }
.analysis-card.tint-orange::before { background: #f97316; }
.analysis-card.tint-green::before  { background: #10b981; }
.analysis-card.tint-blue::before   { background: #3b82f6; }
.analysis-card.tint-gray::before   { background: #d1d5db; }

.analysis-card-head {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; margin-bottom: 10px;
}
.analysis-card-head h3 {
  font-size: 15px; margin: 0; color: #1f2937; font-weight: 700;
}
.analysis-card-head .subtle {
  font-size: 11px; font-weight: 400; color: #6b7280;
}
.analysis-card-head .spacer { flex: 1; }
.analysis-card-head .big-metric {
  font-size: 28px; font-weight: 800; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.analysis-card-head .big-metric.c-violet { color: #7c3aed; }
.analysis-card-head .big-metric.c-orange { color: #c2410c; }
.analysis-card-head .big-metric.c-green  { color: #16a34a; }
.analysis-card-head .big-metric.c-blue   { color: #1d4ed8; }
.analysis-card-head .big-metric.c-gray   { color: #374151; }
.analysis-card-head .big-metric.c-muted  { color: #9ca3af; }
.analysis-card-head .big-metric .denom { font-size: 12px; color: #6b7280; font-weight: 600; margin-left: 2px; }

/* breakdown-grid: 여러 컴포넌트를 카드로 펼쳐 보여줄 때 (예상 수익률·Pre-Surge 공유) */
.breakdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}
.breakdown-item {
  padding: 11px 13px;
  background: #fff; border: 1px solid #eef0f3;
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(16,24,40,.03);
  transition: transform .15s, box-shadow .15s;
}
.breakdown-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(16,24,40,.05);
  border-color: #e5e7eb;
}
.breakdown-item .b-label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 10.5px; color: #6b7280; margin-bottom: 4px; font-weight: 600;
}
.breakdown-item .b-label .b-weight { font-size: 10px; color: #9ca3af; font-weight: 500; }
.breakdown-item .b-value {
  font-size: 15px; font-weight: 700; color: #1f2937;
  font-variant-numeric: tabular-nums;
}
.breakdown-item .b-value.up    { color: #c2410c; }
.breakdown-item .b-value.dn    { color: #2563eb; }
.breakdown-item .b-value.green { color: #16a34a; }
.breakdown-item .b-value.red   { color: #dc2626; }
.breakdown-item .b-value.muted { color: #9ca3af; }
.breakdown-item .b-meta {
  font-size: 10px; color: #9ca3af; margin-top: 3px; line-height: 1.4;
}
.breakdown-item .b-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 6px;
}
.breakdown-item .b-bar {
  height: 6px; background: #f3f4f6; border-radius: 3px;
  overflow: hidden; margin: 6px 0;
}
.breakdown-item .b-bar-fill {
  height: 100%; background: #0ea5e9; transition: width .3s;
}
.breakdown-item .b-bar-fill.strong { background: #1d4ed8; }
.breakdown-item .b-bar-fill.weak   { background: #94a3b8; }
.breakdown-item .b-bar-fill.empty  { background: #e5e7eb; }

.analysis-footnote {
  margin: 0; font-size: 11px; color: #6b7280; line-height: 1.5;
}

/* 인라인 배지 (Pre-Surge 통과 · surge HOT/WARM/WATCH) */
.inline-pill {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}
.inline-pill--blue   { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.inline-pill--red    { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.inline-pill--orange { background: #fff7ed; color: #ea580c; border-color: #fed7aa; }
.inline-pill--gray   { background: #f3f4f6; color: #6b7280; border-color: #e5e7eb; }
.inline-pill--solid-red    { background: #dc2626; color: #fff; border-color: #dc2626; }
.inline-pill--solid-orange { background: #f59e0b; color: #fff; border-color: #f59e0b; }
.inline-pill--solid-gray   { background: #6b7280; color: #fff; border-color: #6b7280; }

/* 접이식 details — 기본 꾸밈 */
details.analysis-details {
  padding: 10px 14px;
  border: 1px solid #eef0f3;
  border-radius: 10px;
  background: #fafbfc;
  margin-bottom: 10px;
  transition: background .15s;
}
details.analysis-details[open] { background: #fff; border-color: #e5e7eb; }
details.analysis-details > summary {
  cursor: pointer; list-style: none; outline: none;
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 600; color: #6b7280;
  padding: 2px 0;
  transition: color .15s;
}
details.analysis-details:hover > summary { color: #374151; }
details.analysis-details[open] > summary { color: #374151; }
details.analysis-details > summary::-webkit-details-marker { display: none; }
details.analysis-details > summary::marker { content: ''; }
details.analysis-details > summary .caret {
  margin-left: auto; font-size: 11px; color: #9ca3af;
  transition: transform .2s;
}
details.analysis-details[open] > summary .caret { transform: rotate(180deg); }
details.analysis-details[open] > summary { margin-bottom: 10px; }
details.analysis-details > .details-body > :last-child { margin-bottom: 0; }

/* ── 푸터 ── */
.site-footer {
  background: var(--primary);
  color: rgba(255,255,255,.55);
  text-align: center;
  font-size: 12px;
  padding: 14px 0;
}

/* ════════════════════════════
   반응형
════════════════════════════ */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .four-col   { grid-template-columns: repeat(2, 1fr); }
  .price-trio { grid-template-columns: repeat(2, 1fr); }
}

/* 태블릿·노트북(1500px 이하) — 덜 중요한 컬럼 숨겨 TOP 15 가로 스크롤 방지
   컨테이너 max-width가 1200px이라 1281~1499px 뷰포트도 실제 테이블 공간은
   1128px. 14컬럼이 빠듯해서 실제 데이터 폭(긴 종목명·정렬 아이콘 포함) 기준
   넘치는 경우가 있어 브레이크포인트 상향. */
@media (max-width: 1500px) {
  .hide-tablet { display: none !important; }
}

/* 햄버거 전환 break point — 1024px 이하에서 nav를 햄버거 메뉴로 전환.
   회원/관리자 메뉴가 8개라 769~1280px 데스크톱에서 폭 초과되어 body 가로 스크롤이
   생기는 문제 해결. iPad 가로(1024px) 이상에서만 nav 풀 노출, 그 이하는 햄버거. */
@media (max-width: 1024px) {
  .menu-toggle { display: flex; }
  .main-nav {
    display: none;
    position: absolute; top: 54px; left: 0; right: 0;
    background: var(--primary);
    flex-direction: column; padding: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,.2);
    z-index: 99;
  }
  .main-nav.open { display: flex; }
  .site-header .container { position: relative; }
}

@media (max-width: 768px) {
  .two-col { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .hide-mobile { display: none !important; }
  .section { padding: 14px; }

  .stock-header-top { flex-direction: column; }
  .stock-price-block { text-align: left; }
  .stock-big-price { font-size: 24px; }

  .form-row { flex-direction: column; align-items: flex-start; }
  .form-input { width: 100%; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .hide-sm { display: none !important; }
  .index-bar__items { gap: 12px; }
  .stat-value { font-size: 20px; }
  .price-trio { grid-template-columns: 1fr 1fr; }
  .price-trio-value { font-size: 16px; }
}

/* ── 모바일 회귀 보정 (2026-04-26) ──────────────────────────────────
   사용자 제보: 다크 강제 변환 / 보유 종목 표 가로 스크롤 / 가격갱신 버튼 글자 깨짐.
   - color-scheme: light 메타로 다크 변환 차단(base.html). 여기선 시스템 차원 fallback.
   - 보유 종목 표는 모바일에서 컬럼 추가 압축(현재가·미니바·유형·상태 hide-sm/mobile).
   - body·section 명시 배경으로 다크 강제 변환 추가 보호.
*/
.show-mobile { display: none; }
@media (max-width: 768px) {
  .show-mobile { display: inline; }
}
html, body {
  background-color: #f4f6f9 !important;
  color-scheme: light;
  /* Samsung Internet/Edge의 강제 다크 변환 차단 — 일부 환경에서 color-scheme 메타만으로 부족 */
  forced-color-adjust: none;
}
/* 핵심 카드/표/섹션은 색상 자동 변환 차단 + 명시 배경 + 명시 텍스트 색 */
.section, .mypage-card, .pfp-hero, .login-prompt, .signal-item, .ai-box,
.donut-side, .price-trio-card, .analysis-card,
.data-table, .data-table thead, .data-table tbody, .data-table tr,
.toggle-row, .market-badge, .badge,
#alertPreviewBackdrop, #cmpModalBackdrop, .ap-modal, .cmp-modal,
.fb-float-card, .buy-signal-card, .stock-news-card {
  forced-color-adjust: none;
  background-clip: padding-box;
}
/* 표 자체에 라이트 강제 — 다크 변환된 환경에서 검은 배경·검은 글자 회피 */
.data-table { background: #fff !important; color: #1a1a1a !important; }
.data-table th { background: #f0f3f8 !important; color: #6b7280 !important; }
.data-table tbody tr { background: #fff !important; }
.data-table tbody tr:hover { background: #fff0f0 !important; }
/* 섹션/카드 — 흰 배경 + 어두운 텍스트 강제 */
.section, .mypage-card, .pfp-hero, .donut-side {
  background-color: #fff !important;
  color: #1a1a1a !important;
}
/* pfp-hero는 손익에 따라 그라디언트가 들어가 있어 별도 처리: 부모 인라인이 우선 적용되도록 background-color만 안 강제 */
.pfp-hero { background-color: initial !important; }

@media (max-width: 768px) {
  /* 보유 주식 표 — 종목명 컬럼을 sticky-left로 고정 (가로 스크롤 시 안 잘림) */
  .holdings-layout .data-table { font-size: 12.5px; }
  .holdings-layout .data-table th:first-child,
  .holdings-layout .data-table td:first-child {
    position: sticky; left: 0; z-index: 2;
    background: #fff;
    box-shadow: 2px 0 4px -2px rgba(0,0,0,.08);
    min-width: 110px; max-width: 120px;
  }
  .holdings-layout .data-table thead th:first-child {
    background: var(--table-head, #f0f3f8);
  }
  /* 표 padding 축소 — 모바일 전용 */
  .holdings-layout .data-table th,
  .holdings-layout .data-table td {
    padding: 8px 6px;
  }
  /* 도넛 섹션 폭 보정 — 모바일에선 표 아래로 떨어진 뒤 컨테이너 폭 가득 */
  .donut-side { width: 100%; box-sizing: border-box; }
  .donut-side .chart-wrap { height: 200px; max-width: 280px; margin: 0 auto 10px; }

  /* 종목 스크리닝·내 포트폴리오 페이지의 큰 표도 동일 sticky-left 적용 */
  .table-wrap > table.data-table th:first-child,
  .table-wrap > table.data-table td:first-child {
    position: sticky; left: 0; z-index: 2;
    background: #fff;
    box-shadow: 2px 0 4px -2px rgba(0,0,0,.08);
  }
  .table-wrap > table.data-table thead th:first-child {
    background: var(--table-head, #f0f3f8);
  }

  /* 섹션 타이틀 — 모바일에선 줄바꿈 허용 (h2 + 우측 액션 버튼들) */
  .section-title { flex-wrap: wrap; gap: 8px; }
  .section-title h2 { font-size: 16px; }

  /* 보유 종목 비중 도넛 옆 leg ul — 모바일에서 좌측으로 정렬 */
  .donut-list { max-height: 180px; }
}

/* ══════════════════════════════════════════════════════════════════
   Phase A — 반응형 강화 7페이지 (2026-04-26)
   ══════════════════════════════════════════════════════════════════
   stocks/analysis/portfolio/mypage/my-formula/admin/board 모바일 보정.
   DOM 구조 변경 없이 CSS만으로 처리. PC는 영향 없음.
*/
@media (max-width: 768px) {
  /* ── 공통: 컨테이너·섹션 패딩 축소 ─────────────────────────── */
  .container { padding: 0 12px; }
  .section { padding: 12px; margin-bottom: 14px; }
  .section h2 { font-size: 16px; line-height: 1.3; }
  .section h3 { font-size: 14px; }

  /* ── 1. 분석 페이지 (/analysis) ──────────────────────────── */
  /* 진입/손절/목표/R:R 4컬럼 → 모바일 2컬럼 */
  .price-trio { grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
  .price-trio-card { padding: 12px 10px 10px; }
  .price-trio-value { font-size: 17px; }
  .price-trio-label { font-size: 10.5px; margin-bottom: 6px; }
  .price-trio-sub { font-size: 11px; margin-top: 4px; }

  /* 종목 헤더 hero — 종목명·가격·뱃지가 한 줄에 안 들어감 */
  .stock-header-top { gap: 8px; }
  .stock-header-name { font-size: 22px; }
  .stock-big-price { font-size: 22px; }
  .grade-chip { font-size: 11px; padding: 3px 8px; margin-left: 0; }

  /* breakdown(예상 수익 분해 등) 가로 막대 - 모바일에서 살짝 축소 */
  .breakdown-item { font-size: 12px; }
  .breakdown-item .b-bar { height: 6px; }

  /* analysis-card grid - 2열 → 1열 */
  .analysis-card { padding: 12px; }
  .analysis-card h3 { font-size: 13px; }

  /* 가격 차트 - 모바일 높이 축소 */
  .chart-wrap.price-chart-wrap { height: 240px; }
  .chart-wrap { height: 180px; }
  .return-chart-wrap { max-height: 280px; }

  /* ── 2. 종목 스크리닝 (/stocks) ──────────────────────────── */
  /* 매수 신호 배너 그리드 - 모바일 1열 */
  .buy-signal-grid { gap: 8px; }
  .buy-signal-card { padding: 10px 12px; }

  /* 필터 영역(.screening-filters) - 모바일에서 폰트·패딩 축소 (wrap 유지) */
  .screening-filters {
    padding: 10px 12px !important; gap: 6px !important;
  }
  .screening-filters .btn { font-size: 11.5px; padding: 4px 9px; }
  .screening-filters input, .screening-filters select {
    font-size: 12.5px; padding: 6px 10px;
  }
  .screening-filters input[id="filterName"],
  .screening-filters input[id="filterCode"] { flex: 1 1 100% !important; min-width: 0 !important; }

  /* 비교 모드 바 - 모바일에선 stack */
  #cmpBar { flex-wrap: wrap; padding: 8px 10px; font-size: 12px; }
  #cmpBar > * { flex-shrink: 0; }

  /* 비교 모달 - 모바일 풀스크린 시트 */
  .cmp-modal { max-width: 100%; max-height: 95vh; border-radius: 10px 10px 0 0; }
  .cmp-table { font-size: 12px; }
  .cmp-table th, .cmp-table td { padding: 6px 6px; }
  .cmp-stock-head { padding: 8px 4px !important; }

  /* ── 3. 내 포트폴리오 (/portfolio) ──────────────────────── */
  /* hero 손익 카드 - 1열 stack */
  .pfp-hero { grid-template-columns: 1fr !important; gap: 12px !important; padding: 14px !important; }
  .pfp-hero-pnl-value { font-size: 24px !important; }
  .pfp-hero-metrics { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .pfp-hero-metric-value { font-size: 15px !important; }
  .pfp-hero-metric-label { font-size: 10px !important; }

  /* 보유 종목 표 - 분할 익절 진행 바는 표 외 카드처럼 떨어뜨림 */
  .pfp-table { font-size: 11.5px; }
  .pfp-table th, .pfp-table td { padding: 7px 6px; }
  .pfp-targets-cell { font-size: 10px; }

  /* ── 4. 마이페이지 (/mypage) ──────────────────────────── */
  /* mypage-card 패딩 축소 + ATR 슬라이더 wrap + 박스 overflow 차단 */
  .mypage-card {
    padding: 14px 14px 12px;
    overflow-wrap: break-word; word-break: break-word; min-width: 0;
  }
  .mypage-card-title { font-size: 14px; }
  .mypage-card-desc { font-size: 11.5px; }
  /* 토글 행은 모바일에서 수직 stack — flex-wrap + 자식 폭 100% */
  .toggle-row {
    flex-wrap: wrap !important;
    padding: 10px 12px !important;
    gap: 8px !important;
    min-width: 0;
    box-sizing: border-box;
  }
  .toggle-row > .toggle-row-label {
    flex: 1 1 100% !important;
    min-width: 0 !important;
    max-width: 100%;
  }
  /* 토글 라벨 우측의 control(스위치/select/슬라이더) 그룹 — 한 줄 가득 */
  .toggle-row > .switch,
  .toggle-row > select,
  .toggle-row > div:not(.toggle-row-label) {
    flex: 0 0 auto;
    margin-left: 0;
  }
  .toggle-row-title { font-size: 13px; line-height: 1.4; }
  .toggle-row-desc {
    font-size: 11.5px; line-height: 1.5;
    overflow-wrap: break-word; word-break: break-word;
  }
  /* mypage 카드 안 모든 인라인 슬라이더·input 그룹도 폭 보호 */
  .mypage-card input[type="range"] { max-width: 100%; min-width: 0; flex: 1 1 auto; }
  .mypage-card input[type="date"], .mypage-card select { max-width: 100%; min-width: 0; }

  /* 미리보기 모달 모바일 폭 */
  .ap-modal { max-width: 100%; max-height: 95vh; border-radius: 10px 10px 0 0; }
  .ap-tg-pre { font-size: 11.5px; padding: 10px; }
  .ap-email-frame { min-height: 320px; }

  /* 플로팅 피드백 카드 - 화면 가득 - 이미 처리됨 */

  /* ── 5. 마이공식 (/my-formula) ──────────────────────────── */
  /* 빌더 행: 필드·연산자·값을 모바일에선 wrap (커스텀 셀렉터·기본 셀렉터 모두) */
  .formula-row, .mf-row, .mf-condition-row { flex-wrap: wrap; gap: 6px; }
  .formula-row select, .formula-row input,
  .mf-row select, .mf-row input,
  .mf-condition-row select, .mf-condition-row input {
    min-width: 0; flex: 1 1 calc(50% - 4px);
  }
  .preset-grid, .mf-preset-grid { grid-template-columns: 1fr !important; gap: 10px; }
  .mf-preset { padding: 10px; }

  /* mf-* 카드 박스 폭 보호 — 자식이 부모 폭을 넘지 않도록 */
  .mf-wrap, .mf-card, .mf-active, .mf-builder {
    max-width: 100%; box-sizing: border-box;
    overflow-wrap: break-word;
  }
  .mf-card, .mf-active { padding: 14px; }
  .mf-builder { padding: 12px; }
  /* mf-cond-row 그리드 자식의 min-width: 0 (grid 자식 기본 min-width: auto 회피) */
  .mf-cond-row { gap: 6px !important; }
  .mf-cond-row > select,
  .mf-cond-row > input,
  .mf-cond-row > .mf-remove {
    min-width: 0 !important; max-width: 100%;
  }
  .mf-cond-row select, .mf-cond-row input { font-size: 12.5px; padding: 6px 8px; }
  /* mf-active-row(활성 공식 select + 토글 + 버튼)가 좁은 화면에서 wrap */
  .mf-active-row { flex-wrap: wrap; gap: 8px; }
  .mf-active-row > select { flex: 1 1 100%; min-width: 0; }
  .mf-active-row > a, .mf-active-row > .btn { margin-left: 0 !important; }

  /* ── 6. 관리자 페이지 (/admin/*) ──────────────────────── */
  /* 와이드 표는 모바일에서 가로 스크롤 + sticky-left 유지.
     상단에 "PC 권장" 배너 추가용 클래스. */
  .admin-mobile-warn {
    background: #fef3c7; border: 1px solid #fde68a;
    color: #92400e; border-radius: 8px;
    padding: 10px 14px; font-size: 12px;
    margin-bottom: 12px; display: block;
  }
  .admin-mobile-warn::before { content: "💻 "; }

  /* 관리자 표는 폰트 더 축소 */
  .admin-table .data-table { font-size: 11.5px; }
  .admin-table .data-table th, .admin-table .data-table td { padding: 7px 6px; }

  /* VCP 튜닝 차트 - 모바일에선 폭 보정 */
  .vcp-tuning-chart { max-width: 100%; overflow: hidden; }

  /* ── 7. 게시판 (/board) ──────────────────────────────── */
  /* 본문 announce-* 카드 모바일 패딩 */
  .announce-hero { padding: 20px 16px 16px; }
  .announce-hero h2 { font-size: 18px; }
  .announce-hero p { font-size: 12.5px; }
  .announce-feature-grid { grid-template-columns: 1fr !important; gap: 8px; }
  .announce-feature { padding: 12px; }
  .announce-section { margin: 14px 0 10px; }
  .announce-section h3 { font-size: 14px; }
  .announce-callout { padding: 10px 12px; font-size: 12.5px; }

  /* 게시판 목록 — 제목 셀 nowrap 해제로 자연 줄바꿈 (가로 스크롤 차단) */
  /* th는 nowrap 유지(짧음). td만 normal로 풀어 제목·이름이 줄바꿈되게 함 */
  .data-table td { white-space: normal; word-break: break-word; }
  /* 단, 숫자·뱃지 등 짧은 셀의 mono 셀은 강제 nowrap 유지 */
  .data-table td.mono, .data-table td.ta-c, .data-table td.ta-r {
    white-space: nowrap;
  }
  /* 첫 컬럼(종목명·제목)은 줄바꿈 허용 (sticky-left와 충돌 없음) */
  .data-table td:first-child { white-space: normal; }

  /* 내 포트폴리오·관심 종목 표 — 인라인 min-width 무력화로 가로 스크롤 차단 */
  /* (스크리닝 /stocks의 의도된 와이드 뷰는 영향 받지 않음 — 거긴 인라인 min-width 없음) */
  .pfp-table, .watchlist-table {
    min-width: 0 !important; width: 100% !important;
    table-layout: auto;
  }
  /* 부모 .table-wrap도 인라인 overflow-x를 풀어 가로 스크롤 자체 제거 */
  .pfp-table-wrap, .watchlist-table-wrap {
    overflow-x: visible !important;
  }
  /* 관심 종목 표 — 컬럼별 hide-mobile 클래스로 처리 (nth-child 의존 제거) */

  /* 글쓰기 Quill 에디터 - 모바일 폭 가득 */
  #editor, .ql-container, .ql-toolbar { font-size: 14px; }
  .ql-toolbar { flex-wrap: wrap; }

  /* ── 공통: form-group·form-row 모바일 stack ───────────── */
  .form-group { margin-bottom: 12px; }
  .form-group label { font-size: 12.5px; }
  .form-input { font-size: 14px; padding: 9px 10px; }

  /* ── 공통: 큰 모달 backdrop의 padding 줄여 화면 가득 ────── */
  .ap-backdrop, .cmp-backdrop { padding: 10px; align-items: flex-end; }

  /* ── 공통: 가로 스크롤 인디케이터 thin ───────────── */
  .table-wrap::-webkit-scrollbar { height: 6px; }
  .table-wrap::-webkit-scrollbar-thumb { background: rgba(0,0,0,.2); border-radius: 3px; }
}

@media (max-width: 480px) {
  /* 매우 좁은 화면(아이폰 SE 등) — 4컬럼 hero metric을 2x2로 */
  .pfp-hero-metrics { grid-template-columns: 1fr 1fr !important; }
  .price-trio-value { font-size: 16px; }
  .stock-header-name { font-size: 19px; }
  .stock-big-price { font-size: 20px; }
  /* 비교 표 - 헤더 종목 셀 텍스트 축소 */
  .cmp-stock-head div:first-child { font-size: 12px !important; }
  .cmp-stock-head div:last-child { font-size: 10px !important; }
}

/* ══════════════════════════════════════════════════════════════════
   Phase B — 모바일 전용 카드 뷰 (2026-04-26)
   ══════════════════════════════════════════════════════════════════
   .mobile-cards 클래스가 붙은 <table>은 모바일에서 표 → 카드 전환.
   PC는 그대로 표 유지. 같은 DOM, CSS-only 분기.

   적용:
   - B-1 dashboard.html  단기 매수 타이밍 TOP 20
   - B-2 my_portfolio.html  보유 종목·관심 종목
   - B-3 stocks.html  종목 스크리닝
*/
@media (max-width: 768px) {
  /* 표 컨테이너 — 가로 스크롤 제거 */
  .mobile-cards-wrap {
    overflow-x: visible !important;
    padding: 0;
  }
  .mobile-cards-wrap .table-scroll-top { display: none !important; }

  /* 표·thead·tbody·tr·td → block 변환 */
  table.mobile-cards,
  table.mobile-cards thead,
  table.mobile-cards tbody,
  table.mobile-cards tr,
  table.mobile-cards td {
    display: block;
    width: 100%;
    box-sizing: border-box;
  }
  /* 헤더(thead)·정렬 가능 컬럼은 카드 뷰에서 숨김 */
  table.mobile-cards thead { display: none !important; }
  /* min-width 인라인 무력화 (my_portfolio의 880/960px 인라인 등) */
  table.mobile-cards { min-width: 0 !important; }

  /* 각 tr을 카드처럼 — 흰 배경, 보더, 패딩, 그림자 */
  table.mobile-cards tbody tr {
    background: #fff !important;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 8px;
    box-shadow: 0 1px 2px rgba(17,24,39,.04);
    border-bottom: 1px solid #e5e7eb;  /* tr의 td border 덮음 */
  }
  table.mobile-cards tbody tr:last-child { margin-bottom: 0; }
  /* 매수/보유 신호 카드 강조 색 */
  table.mobile-cards tbody tr.buy-signal-row { border-left: 4px solid #16a34a; padding-left: 10px; }
  table.mobile-cards tbody tr.vcp-a-signal-row { border-left: 4px solid #fb923c; padding-left: 10px; }
  table.mobile-cards tbody tr.strong-signal-row { border-left: 4px solid #dc2626; padding-left: 10px; }
  table.mobile-cards tbody tr.vcp-b-signal-row { border-left: 4px solid #facc15; padding-left: 10px; }
  table.mobile-cards tbody tr.my-holding-row { border-left: 4px solid #eab308; padding-left: 10px; }

  /* 각 td → 카드 안 한 줄 */
  table.mobile-cards tbody td {
    border: 0 !important;
    padding: 3px 0 !important;
    text-align: left !important;
    white-space: normal !important;
    background: transparent !important;
    position: static !important; /* sticky-left 해제 */
    box-shadow: none !important;
    min-width: 0 !important; max-width: 100% !important;
  }
  /* 빈 td 또는 hide-mobile/hide-sm 가져간 td는 카드에서 자리 안 차지 */
  table.mobile-cards tbody td:empty { display: none; }

  /* td에 data-mobile-label 속성을 주면 ::before로 라벨 표시 */
  table.mobile-cards tbody td[data-mobile-label]::before {
    content: attr(data-mobile-label) " : ";
    color: #6b7280; font-size: 11px; font-weight: 600;
    margin-right: 4px;
  }

  /* 첫 번째 td(순위) — 카드 우상단 작은 뱃지 (dashboard) */
  table.mobile-cards tbody td.rank-num {
    display: inline-block !important; width: auto !important;
    font-size: 10px; font-weight: 700; color: #6b7280;
    background: #f3f4f6; padding: 2px 8px !important;
    border-radius: 99px;
    margin-bottom: 6px;
  }
  table.mobile-cards tbody td.rank-num::before { content: "#"; color: #9ca3af; }

  /* 종목명 td (.stock-name 또는 .stock-name-link 포함) — 큰 글씨 */
  /* dashboard: rank-num + 종목 td(2번째) / portfolio: 종목 td가 1번째 */
  table.mobile-cards tbody td:has(.stock-name),
  table.mobile-cards tbody td:has(.stock-name-link) {
    font-size: 15px; font-weight: 700; color: #111827;
    margin-bottom: 4px;
    padding: 4px 0 !important;
  }
  table.mobile-cards tbody .stock-code { font-size: 11px; color: #9ca3af; font-weight: 400; margin-left: 4px; }
  table.mobile-cards tbody .stock-name { font-weight: 700; }

  /* 가격·등락률 row를 inline 배치 */
  table.mobile-cards tbody td.price-row,
  table.mobile-cards tbody td.change-row {
    display: inline-block !important;
    width: auto !important;
    margin-right: 14px;
  }
  table.mobile-cards tbody td.change-row { font-weight: 700; }

  /* 평가손익 셀 — 카드 우측 큰 글씨 박스 (my_portfolio) */
  table.mobile-cards tbody td.profit-cell {
    background: #f9fafb;
    border-radius: 6px;
    padding: 8px 10px !important;
    margin-top: 6px;
    text-align: right !important;
    font-size: 14px;
  }
  table.mobile-cards tbody td.profit-cell::before {
    content: "평가손익";
    display: block;
    font-size: 10px; color: #6b7280; font-weight: 600;
    text-align: left;
    margin-bottom: 2px;
  }

  /* badge·empty 셀 미니멀 */
  .badge-empty { color: #d1d5db; font-size: 11px; }

  /* 비교 모드 체크박스 셀 (스크리닝) — 카드 우상단 작은 inline */
  table.mobile-cards tbody td.cmp-cell {
    display: inline-block !important;
    width: auto !important; min-width: 0 !important;
    margin-right: 8px;
    padding: 0 !important;
  }
  table.mobile-cards thead .cmp-cell { display: none !important; } /* 헤더는 카드 뷰에서 어차피 숨김 */

  /* 시장 뱃지 셀 — 종목명 옆 inline */
  table.mobile-cards tbody td:has(.market-badge) {
    display: inline-block !important;
    width: auto !important;
    margin-left: 4px;
    padding: 0 !important;
  }
  table.mobile-cards tbody td:has(.market-badge)::before { display: none; }

  /* PEAD·뱃지 등 짧은 td는 inline */
  table.mobile-cards tbody td:has(> .badge) {
    display: inline-block !important;
    width: auto !important;
    margin-right: 8px;
    padding: 0 !important;
  }

  /* 카드 안 a (analysis 링크) — 블록 전체 클릭 가능 */
  table.mobile-cards tbody tr a.stock-name-link {
    display: block;
    color: inherit;
  }

  /* 진입가/손절가/목표가는 hide-mobile으로 카드에서 안 보이지만, 보이는 것이라면 mini chip 처리 */
  table.mobile-cards tbody td.price-col {
    display: inline-block !important;
    width: auto !important;
    margin-right: 10px;
    font-size: 12px;
  }
}

/* ── 게시판 공지글 디자인 클래스 (announce-*) ───────────────────────────
   _bleach가 인라인 style을 제거하므로 본문은 클래스로만 디자인.
   Claude 자동 공지 등록 + 관리자 수동 공지 모두 재사용. */
.announce-hero {
  background: linear-gradient(135deg, #eef2ff 0%, #ede9fe 50%, #fdf2f8 100%);
  border: 1px solid #c7d2fe; border-radius: 14px;
  padding: 28px 28px 24px; margin: 0 0 18px;
  text-align: center;
}
.announce-hero h2 {
  font-size: 22px; font-weight: 800; color: #312e81;
  margin: 0 0 6px;
}
.announce-hero p {
  font-size: 14px; color: #4c1d95; margin: 0;
}
.announce-hero .announce-badge {
  display: inline-block; font-size: 11px; font-weight: 700;
  background: #6366f1; color: #fff; padding: 3px 10px;
  border-radius: 99px; letter-spacing: 0.5px; margin-bottom: 12px;
}

.announce-section { margin: 22px 0 14px; }
.announce-section h3 {
  font-size: 15px; font-weight: 700; color: #1f2937;
  display: flex; align-items: center; gap: 8px;
  border-left: 3px solid #6366f1; padding-left: 10px;
  margin: 0 0 10px;
}

.announce-feature-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px; margin: 10px 0;
}
.announce-feature {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
  padding: 14px;
}
.announce-feature .announce-feature-icon { font-size: 22px; }
.announce-feature .announce-feature-title {
  font-size: 13px; font-weight: 700; color: #111827;
  margin: 6px 0 4px;
}
.announce-feature .announce-feature-desc {
  font-size: 12px; color: #6b7280; line-height: 1.5;
}

.announce-tag-row {
  display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0;
}
.announce-tag {
  display: inline-block; font-size: 12px; font-weight: 600;
  padding: 3px 9px; border-radius: 6px;
  background: #eef2ff; color: #4338ca;
}
.announce-tag-success { background: #dcfce7; color: #166534; }
.announce-tag-warn    { background: #fef3c7; color: #92400e; }
.announce-tag-info    { background: #e0f2fe; color: #075985; }

.announce-callout {
  background: #f9fafb; border-left: 4px solid #6366f1;
  border-radius: 0 8px 8px 0; padding: 12px 16px; margin: 12px 0;
}
.announce-callout.warn { background: #fffbeb; border-left-color: #f59e0b; }
.announce-callout.success { background: #f0fdf4; border-left-color: #10b981; }
.announce-callout p { margin: 0; font-size: 13px; line-height: 1.6; color: #374151; }

.announce-step-list {
  list-style: none; padding: 0; margin: 8px 0; counter-reset: announce-step;
}
.announce-step-list li {
  position: relative; padding: 10px 12px 10px 42px;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 8px;
  margin-bottom: 8px; font-size: 13px; color: #374151; line-height: 1.6;
  counter-increment: announce-step;
}
.announce-step-list li:before {
  content: counter(announce-step);
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px; border-radius: 50%;
  background: #6366f1; color: #fff;
  font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}

.announce-footer {
  margin-top: 24px; padding-top: 14px;
  border-top: 1px solid #e5e7eb;
  font-size: 12px; color: #9ca3af; text-align: center;
}

.announce-divider {
  height: 1px; border: 0; margin: 22px 0;
  background: linear-gradient(90deg, transparent, #c7d2fe 30%, #c7d2fe 70%, transparent);
}

/* 본문 ul/ol 가독성 */
.announce-section ul,
.announce-section ol { padding-left: 22px; margin: 8px 0; }
.announce-section ul li,
.announce-section ol li { margin: 6px 0; font-size: 13px; line-height: 1.6; color: #374151; }
.announce-section ul li strong,
.announce-section ol li strong { color: #111827; }

/* ── 인증 페이지 ── */
.auth-wrap { display:flex; justify-content:center; align-items:flex-start; padding:40px 16px; }
.auth-card { background:var(--white); border:1px solid var(--border); border-radius:12px; padding:40px; width:100%; max-width:420px; box-shadow:var(--shadow); }
.auth-card-wide { max-width:580px; }
.auth-logo { font-size:24px; font-weight:900; color:var(--primary); text-align:center; margin-bottom:8px; }
.auth-title { font-size:20px; font-weight:700; text-align:center; margin-bottom:4px; }
.auth-subtitle { font-size:13px; color:var(--text-muted); text-align:center; margin-bottom:24px; }
.auth-footer { text-align:center; margin-top:20px; font-size:14px; color:var(--text-muted); }
.auth-footer a { color:var(--primary); font-weight:600; }
.form-row { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.form-group { margin-bottom:16px; }
.form-label { display:block; font-size:13px; font-weight:600; margin-bottom:6px; }
.form-hint { font-weight:400; color:var(--text-muted); font-size:12px; }
.form-input { width:100%; padding:9px 12px; border:1px solid var(--border); border-radius:6px; font-size:14px; box-sizing:border-box; transition:border .2s; }
.form-input:focus { outline:none; border-color:var(--primary); }
.form-input:disabled { background:#f3f4f6; cursor:not-allowed; }
.req { color:var(--up); }
.btn-full { width:100%; justify-content:center; }
.privacy-box { border:1px solid var(--border); border-radius:8px; padding:16px; margin-bottom:20px; }
.privacy-title { font-weight:700; font-size:14px; margin-bottom:10px; }
.privacy-content { font-size:13px; color:var(--text-muted); line-height:1.7; max-height:120px; overflow-y:auto; margin-bottom:12px; }
.privacy-content p { margin:0 0 4px; }
.checkbox-label { display:flex; align-items:center; gap:8px; font-size:14px; cursor:pointer; }
.checkbox-label input[type=checkbox] { width:16px; height:16px; accent-color:var(--primary); cursor:pointer; }
.alert { padding:12px 16px; border-radius:8px; margin-bottom:16px; font-size:14px; }
.alert-error   { background:#fde8e8; color:#991b1b; border:1px solid #fca5a5; }
.alert-success { background:#f0fdf4; color:#166534; border:1px solid #86efac; }

/* 네비게이션 인증 버튼 */
.nav-login   { font-weight:600; }
.nav-logout  { color:var(--text-muted) !important; }
.nav-register { margin-left:4px; }

/* 로그인 유도 배너 */
.login-prompt { display:flex; align-items:center; justify-content:space-between; gap:16px; background:var(--primary-pale); border:1px solid #fca5a5; border-radius:10px; padding:16px 20px; margin-bottom:16px; flex-wrap:wrap; }

/* 탭 바 */
.tab-bar { display:flex; gap:4px; margin-bottom:16px; border-bottom:2px solid var(--border); padding-bottom:0; }
.tab-btn { background:none; border:none; padding:8px 18px; font-size:14px; font-weight:600; cursor:pointer; color:var(--text-muted); border-bottom:2px solid transparent; margin-bottom:-2px; border-radius:6px 6px 0 0; }
.tab-btn.active { color:var(--primary); border-bottom-color:var(--primary); }
.tab-count { background:var(--primary-pale); color:var(--primary); border-radius:10px; padding:1px 7px; font-size:11px; margin-left:4px; }
.tab-panel.hidden { display:none; }

/* 게시판 */
.board-title-link { color:var(--text); text-decoration:none; font-weight:500; }
.board-title-link:hover { color:var(--primary); text-decoration:underline; }
.board-notice-title { font-weight:700; }
.board-content img { max-width:100%; height:auto; border-radius:6px; margin:8px 0; }

/* 토글 스위치 */
.toggle-switch { position:relative; display:inline-block; width:44px; height:24px; flex-shrink:0; }
.toggle-switch input { opacity:0; width:0; height:0; }
.toggle-slider { position:absolute; cursor:pointer; inset:0; background:#d1d5db; border-radius:24px; transition:.25s; }
.toggle-slider::before { content:''; position:absolute; width:18px; height:18px; left:3px; bottom:3px; background:#fff; border-radius:50%; transition:.25s; }
.toggle-switch input:checked + .toggle-slider { background:var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform:translateX(20px); }

/* 토글 스위치 (alt 네이밍 — .switch + .slider, mypage/notifications 공용) */
.switch { position:relative; display:inline-block; width:44px; height:24px; flex-shrink:0; }
.switch input { opacity:0; width:0; height:0; }
.switch .slider {
  position:absolute; cursor:pointer; top:0; left:0; right:0; bottom:0;
  background:#d1d5db; border-radius:24px; transition:.25s;
}
.switch .slider::before {
  content:''; position:absolute; height:18px; width:18px; left:3px; bottom:3px;
  background:#fff; border-radius:50%; transition:.25s;
  box-shadow:0 2px 4px rgba(0,0,0,.2);
}
.switch input:checked + .slider { background:#3b82f6; }
.switch input:checked + .slider::before { transform:translateX(20px); }
.switch input:focus-visible + .slider { box-shadow:0 0 0 3px rgba(59,130,246,.3); }

/* 토글 라인 행 (mypage·notifications 공용) */
.toggle-row {
  display:flex; align-items:center; gap:12px;
  padding:12px 14px;
  border:1px solid #f3f4f6; border-radius:10px;
  transition:background .15s;
}
.toggle-row:hover { background:#f9fafb; }
.toggle-row + .toggle-row { margin-top:8px; }
.toggle-row-label { flex:1; min-width:0; }
.toggle-row-title { display:block; font-size:14px; font-weight:600; color:#1f2937; }
.toggle-row-desc  { display:block; font-size:12px; color:#6b7280; margin-top:2px; line-height:1.45; }

/* 섹션 내부 그룹 타이틀 (공용) */
.mp-group-title {
  font-size:12px; font-weight:700; color:#6b7280;
  text-transform:uppercase; letter-spacing:.5px;
  margin:20px 0 10px;
}
.mp-group-title:first-child { margin-top:0; }

/* 관심 종목 버튼 */
.watch-btn {
  display:inline-flex; align-items:center; gap:5px;
  padding:4px 12px; border-radius:20px;
  border:1.5px solid #d1d5db; background:#f9fafb;
  color:#6b7280; font-size:13px; font-weight:500;
  cursor:pointer; transition:all .2s; vertical-align:middle;
  margin-left:10px;
}
.watch-btn svg { fill:none; stroke:#9ca3af; stroke-width:1.8; transition:all .2s; }
.watch-btn:hover { border-color:#f59e0b; color:#b45309; background:#fffbeb; }
.watch-btn:hover svg { stroke:#f59e0b; }
.watch-btn.active { border-color:#f59e0b; background:#fef3c7; color:#92400e; }
.watch-btn.active svg { fill:#f59e0b; stroke:#f59e0b; }
.watch-btn:active { transform:scale(0.95); }

/* 마이페이지 포트폴리오 */
.portfolio-add-form { background:var(--bg); border-radius:8px; padding:16px; margin-bottom:4px; }
.btn-icon-del { background:none; border:none; color:#c0392b; cursor:pointer; font-size:14px; padding:2px 6px; border-radius:4px; }
.btn-icon-del:hover { background:#fde8e8; }
