/* ============================================================
   강대리의 투자 노트 — 공통 디자인 토큰
   리스트 뷰와 리포트 페이지가 모두 이 파일을 먼저 읽습니다.
   ============================================================ */

@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css");

:root {
  /* 배경 / 표면 */
  --bg: #f1f4f8;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #eef2f7;

  /* 잉크 */
  --ink: #0f1a2b;
  --ink-2: #33415a;
  --muted: #6a7686;
  --muted-2: #8b95a3;

  /* 선 */
  --line: #e3e8ef;
  --line-2: #cfd8e3;

  /* 브랜드 */
  --navy: #13294b;
  --navy-2: #1d3c6e;
  --accent: #1a56b8;
  --accent-soft: #e9f0fc;

  /* 시세 방향 (국내 관행: 상승 = 적색, 하락 = 청색) */
  --up: #c0392b;
  --down: #1560bd;

  /* 의미 색 */
  --pos: #0d7a4f;
  --pos-soft: #e7f4ed;
  --pos-line: #bfe0cf;
  --neg: #c0392b;
  --neg-soft: #fcecea;
  --neg-line: #f2cdc8;
  --warn: #9a6408;
  --warn-soft: #fdf4e3;
  --warn-line: #ecdcb4;
  --info: #1a56b8;
  --info-soft: #e9f0fc;
  --info-line: #cadcf6;

  /* 투자의견 등급 색 */
  --rate-buy: #0d7a4f;
  --rate-buy-bg: #e7f4ed;
  --rate-accumulate: #1a56b8;
  --rate-accumulate-bg: #e9f0fc;
  --rate-neutral: #9a6408;
  --rate-neutral-bg: #fdf4e3;
  --rate-reduce: #c0392b;
  --rate-reduce-bg: #fcecea;

  /* 형태 */
  --r-xs: 6px;
  --r-sm: 9px;
  --r-md: 13px;
  --r-lg: 18px;
  --sh-1: 0 1px 2px rgba(15, 26, 43, .05), 0 1px 3px rgba(15, 26, 43, .04);
  --sh-2: 0 1px 2px rgba(15, 26, 43, .05), 0 10px 28px rgba(15, 26, 43, .07);
  --sh-nav: 0 1px 0 var(--line), 0 4px 14px rgba(15, 26, 43, .04);

  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
    "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --font-num: "Pretendard Variable", Pretendard, ui-sans-serif, system-ui, sans-serif;
}

.cookie-banner {
  position: fixed;
  z-index: 1000;
  right: 20px;
  bottom: 20px;
  left: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  max-width: 760px;
  margin: 0 auto;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface, #fff);
  box-shadow: 0 12px 40px rgba(20, 35, 60, .18);
  color: var(--text);
}

.cookie-banner__text { display: grid; gap: 4px; font-size: 13px; line-height: 1.5; }
.cookie-banner__text b { font-size: 14px; }
.cookie-banner__actions { display: flex; gap: 8px; flex: none; }
.cookie-banner button {
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.cookie-banner .cookie-banner__accept { border-color: var(--accent); background: var(--accent); color: #fff; }

@media (max-width: 560px) {
  .cookie-banner { align-items: stretch; flex-direction: column; gap: 12px; }
  .cookie-banner__actions button { flex: 1; }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 { margin: 0; letter-spacing: -.015em; font-weight: 700; }
p { margin: 11px 0; }
a { color: inherit; }

/* 모든 수치는 자릿수 정렬 — 표·리스트의 신뢰감은 여기서 나옵니다 */
.num, table td, table th, .metric__v, .kpi__v {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* 방향 색 유틸 */
.up { color: var(--up); }
.down { color: var(--down); }
.mut { color: var(--muted); }

/* 상단 고정 내비게이션 (리포트 페이지에서 report.js가 주입) */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  box-shadow: var(--sh-nav);
}
.topbar__in {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 22px;
  height: 54px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.topbar__brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--navy);
  text-decoration: none;
}
.topbar__mark {
  width: 23px; height: 23px;
  border-radius: 7px;
  background: linear-gradient(140deg, var(--navy), var(--accent));
  color: #fff;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 800; letter-spacing: 0;
}
.topbar__spacer { flex: 1; }
.topbar__back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  text-decoration: none;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  transition: border-color .15s, color .15s, background .15s;
}
.topbar__back:hover { border-color: var(--line-2); color: var(--navy); background: var(--surface-2); }

/* 투자의견 배지 — 리스트와 리포트에서 동일한 형태 */
.rate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -.01em;
  padding: 4px 11px;
  border-radius: 999px;
  white-space: nowrap;
  border: 1px solid transparent;
}
.rate--buy { color: var(--rate-buy); background: var(--rate-buy-bg); border-color: var(--pos-line); }
.rate--accumulate { color: var(--rate-accumulate); background: var(--rate-accumulate-bg); border-color: var(--info-line); }
.rate--neutral { color: var(--rate-neutral); background: var(--rate-neutral-bg); border-color: var(--warn-line); }
.rate--reduce { color: var(--rate-reduce); background: var(--rate-reduce-bg); border-color: var(--neg-line); }

@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .topbar__in { padding: 0 16px; height: 50px; }
}
