/* ============================================================
   Financial Planner · Toss-inspired design system
   ============================================================ */
:root {
  --primary: #6E1E2B;          /* 옥스블러드 — 브랜드 포인트색 */
  --primary-strong: #561620;
  --primary-soft: #F3E9E9;
  --bg: #FAF7F0;               /* 웜 아이보리 페이퍼 */
  --bg-card: #FFFFFF;
  --text: #1C1B19;             /* 웜 잉크 */
  --text-sub: #4A463F;
  --text-mute: #8A8478;        /* 웜 그레이 */
  --border: #ECE5D8;           /* 웜 괘선(hairline) */
  --border-strong: #DBD3C4;
  --red: #B23A2E;              /* 상승(한국 관습) — 웜 레드 */
  --red-soft: #F7ECEA;
  --green: #2F7D63;            /* 성장/긍정 — 딥 그린 */
  --green-soft: #E9F3EE;
  --amber: #B5821F;
  --shadow-sm: none;           /* 에디토리얼 = 평면, 괘선으로 구획 */
  --shadow-md: none;
  --shadow-lg: 0 12px 48px rgba(28, 27, 25, .12);
  --radius: 6px;
  --radius-lg: 10px;
  --font-serif: 'Noto Serif KR', Georgia, 'Times New Roman', serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui,
               'Segoe UI', Roboto, 'Apple SD Gothic Neo', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum";
  letter-spacing: -.01em;
  max-width: 100%;
  overflow-x: hidden;   /* 어떤 요소도 페이지를 가로로 밀어내지 못하게 */
}

button { font-family: inherit; cursor: pointer; border: none; background: none; }
input { font-family: inherit; }

/* -------- App Shell -------- */
.app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo {
  width: 32px; height: 32px;
  flex-shrink: 0;
}
.brand-name { font-family: var(--font-serif); font-size: 19px; font-weight: 600; color: var(--text); letter-spacing: 0; }
.brand-sub { font-size: 11px; letter-spacing: .18em; color: var(--text-mute); padding-left: 10px; border-left: 1px solid var(--border-strong); align-self: center; }

.steps {
  display: flex;
  gap: 2px;
  margin-left: auto;
  background: var(--bg);
  padding: 4px;
  border-radius: 999px;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 1;
  min-width: 0;
}
.steps::-webkit-scrollbar { display: none; }
.step {
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-mute);
  transition: all .18s ease;
  white-space: nowrap;
  flex-shrink: 0;
}
.step:hover { color: var(--text-sub); }
.step.active { background: var(--text); color: white; }
/* 단계 메뉴가 좁으면 옆으로 밀리며 끝 탭이 가려졌다(2026-10-02 사용자: '리서치 탭이 안 보인다') — 769~1100px 은 칸을 줄인다.
   그래도 넘치면 app.js _stepNavShowActive 가 고른 탭을 보이는 자리로 민다 */
@media (min-width: 769px) and (max-width: 1100px) {
  .topbar-inner { gap: 14px; }
  .step { padding: 7px 10px; }
}
@media (min-width: 769px) and (max-width: 900px) { .brand-sub { display: none; } }   /* 800px 에서 20~30px 모자랐다 */

.topbar-meta { margin-left: 8px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge-mute  { background: var(--bg); color: var(--text-mute); }
.badge-live  { background: var(--green-soft); color: var(--green); }
.badge-local { background: var(--primary-soft); color: var(--primary-strong); }

/* -------- Content -------- */
.content {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 24px 96px;
  width: 100%;
}
.view { display: none; }
.view.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.hero { padding: 24px 4px 28px; }
.hero-title {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -.01em;
  margin: 0 0 8px;
}
.hero-sub { color: var(--text-sub); font-size: 15px; margin: 0; }

/* -------- Card -------- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.card h2 {
  font-family: var(--font-serif);
  font-size: 18px;
  margin: 0 0 18px;
  font-weight: 600;
  letter-spacing: -.01em;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-header h2 { margin-bottom: 0; }

/* 포지션 카드 액션 버튼 그룹 */
.position-actions {
  display: flex;
  gap: 6px;
  align-self: flex-start;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.position-actions .btn-ghost { white-space: nowrap; }

.muted { color: var(--text-mute); font-size: 13px; }

/* -------- Holdings list -------- */
.holdings { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.holding-row {
  display: grid;
  gap: 8px;
  align-items: center;
  /* 데스크톱 기본: 8컬럼 */
}
/* 데스크톱 컬럼 정의 — ticker/cash 동일한 8열 (비중고정 자물쇠는 3.최적화 탭으로 이동)
   del(32) | 증권유형(auto) | 증권명(1fr) | 현재가·등락(92px~) | 수량(52px) | 평가금액(118px~) | 추세(96px~) | 비중(auto)
   평가금액이 76px/0.42fr로 좁아 '₩1,136,...'처럼 잘렸고 추세 스파크라인이 1.65fr로 남는 폭을
   거의 다 가져갔다. 둘의 배분을 뒤집고 수량 입력칸도 좁혔다.
   ※ 헤더 그리드는 app.js의 _rowGridD에 따로 있으니 함께 고쳐야 한다. */
/* 유형·비중 열은 고정폭 — auto 로 두면 헤더(글자)와 행(배지) 폭이 달라져 라벨이 값 위에 안 온다 */
.holding-row--ticker,
.holding-row--cash { grid-template-columns: 32px 56px 1fr minmax(92px,0.8fr) 52px minmax(118px,0.95fr) minmax(96px,0.85fr) 58px; }

.holding-row {
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  background: var(--bg);
  border-radius: 10px;
  transition: background .15s;
}
.holding-row:hover { background: #f1f3f5; }
.holding-row select,
.holding-row input[type=number] {
  width: 100%;
  background: white;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border .15s;
}
.holding-row select:focus,
.holding-row input[type=number]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-soft);
}
.lock-btn {
  font-size: 15px;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: var(--text-mute);
  background: white;
  border: 1px solid var(--border-strong);
  transition: all .15s ease;
  display: flex; align-items: center; justify-content: center;
}
.lock-btn:hover { background: var(--primary-soft); }
.lock-btn.locked {
  background: var(--primary); color: white; border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(49,130,246,.32);
}
.holding-row.is-locked {
  background: var(--primary-soft);
  outline: 1px solid #c9deff;
}

/* ── 포지션 비중 배지 (auto 너비) ── */
.pos-weight-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 8px;
  padding: 4px 8px;
  white-space: nowrap;
  letter-spacing: -.3px;
  min-height: 28px;
  min-width: 40px;
}

/* ── 스파크라인 아래 % 라벨 (HTML — 늘어나지 않음) ── */
.spark-pct-label {
  font-size: 10px;
  font-weight: 600;
  text-align: center;
  line-height: 1;
  margin-top: 1px;
  letter-spacing: -.2px;
  white-space: nowrap;
}

/* ── 포지션 컬럼 헤더 행 ── */
.holding-row-header {
  pointer-events: none;  /* 헤더 전체는 클릭 차단, 기간 버튼은 아래에서 복원 */
  background: var(--bg) !important;
  border: none !important;
  box-shadow: none !important;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--border-strong) !important;
  border-radius: 0 !important;
}
.holding-row-header:hover { background: var(--bg) !important; }
/* 헤더 내 버튼(가격/재무 토글·기간·연도)은 클릭 허용 */
.holding-row-header button { pointer-events: all; }
.spark-period-btn { pointer-events: all; }

/* 평가금액 읽기전용 표시 */
.notional-display {
  display: flex;
  align-items: center;
  gap: 1px;
  font-size: 12px;
  color: var(--text);
  padding: 5px 8px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  min-width: 0;
  overflow: hidden;
  cursor: default;
  white-space: nowrap;
}
.notional-sym {
  color: var(--text-mute);
  font-size: 11px;
  font-weight: 500;
  flex-shrink: 0;
}
.notional-num {
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
}
.notional-empty {
  color: var(--text-mute);
}

/* 정렬 가능한 열 제목 (헤더는 pointer-events:none 이라 여기서 되살린다) */
.holding-row-header .col-header.sortable {
  pointer-events: all;
  cursor: pointer;
  border-radius: 5px;
  padding: 2px 4px;
  margin: -2px -4px;
  transition: background .15s, color .15s;
}
.holding-row-header .col-header.sortable:hover { background: var(--primary-soft, #f3e7ea); color: var(--primary, #6E1E2B); }
.holding-row-header .col-header.sorted { color: var(--primary, #6E1E2B); font-weight: 700; }
.col-header {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-mute);
  letter-spacing: .03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
}

/* ── 증권명 인라인 입력 (라벨처럼 보이다가 클릭하면 편집) ── */
.name-inline-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  padding: 4px 2px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  width: 100%;
  min-width: 0;
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
  cursor: pointer;
}
.name-inline-input::placeholder {
  color: var(--text-mute);
  font-weight: 400;
}
.name-inline-input:hover {
  border-bottom-color: var(--border-strong);
  cursor: text;
}
.name-inline-input:focus {
  border-bottom-color: var(--primary);
  cursor: text;
}

/* ── 현금 이름 라벨 ── */
.cash-name-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
  padding: 4px 2px;
}

/* ----- Weight breakdown donuts (Step 1) ----- */
.weights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));   /* Look-through 2타일 자동 배치 */
  gap: 14px;
  margin-top: 12px;
}
@media (max-width: 720px) {
  .weights-grid { grid-template-columns: 1fr; }
}
/* Look-through 타일: 도넛(좌, 고정 크기 — 두 차트 동일) + 범례(우) */
.wt-lt-body { display: flex; gap: 16px; align-items: center; }
.lt-chartbox { position: relative; flex: 0 0 190px; width: 190px; max-width: 190px;
               min-width: 0; height: 190px; }   /* min-width:0 — 캔버스 고유폭이 축소를 막는 것 방지 */
.lt-legend { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px;
             font-size: 11.5px; max-height: 230px; overflow-y: auto; }
.lt-leg-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.lt-leg-row .nm { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis;
                  white-space: nowrap; color: var(--text-sub); }
.lt-leg-row .pc { font-weight: 700; color: var(--text); flex: 0 0 auto;
                  font-variant-numeric: tabular-nums; }
.lt-dot { width: 9px; height: 9px; border-radius: 2px; flex: 0 0 auto; }
@media (max-width: 640px) {
  .wt-lt-body { flex-direction: column; align-items: stretch; }
  .lt-chartbox { flex-basis: auto; width: 180px; height: 180px; margin: 0 auto; }
}

/* 비중 = 산업별 단일 타일: 도넛(좌) + 국내/해외 범례(우) 나란히 */
#weightsGrid { grid-template-columns: 1fr; }
.wt-industry-body { display: flex; gap: 22px; align-items: center; }
.wt-industry-body .wt-chart { flex: 0 0 clamp(240px, 42%, 360px); }
.wt-industry-body > #weightByIndustryLegend { flex: 1 1 auto; min-width: 0; }
@media (max-width: 640px) {
  .wt-industry-body { flex-direction: column; align-items: stretch; }
  .wt-industry-body .wt-chart { flex-basis: auto; width: 100%; }
}
.weight-tile {
  background: var(--bg);
  border-radius: 14px;
  padding: 14px;
}
.wt-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-sub);
  margin-bottom: 8px;
}
.wt-chart {
  position: relative;
  height: 320px;
}
/* Stacked bars stay at the same height whether LT is on or off — the
   columns just split into two narrower bars. Legend lives to the right
   so categories with long names (e.g. "Information Technology /
   Systems Software") don't overflow the chart area. */
.weights-grid.lt-mode .wt-chart { height: 320px; }
#lookThroughBtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--text-sub);
  transition: all .15s ease;
}
#lookThroughBtn:hover {
  background: var(--primary-soft);
  color: var(--primary-strong);
}
#lookThroughBtn.on {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px rgba(49,130,246,.32);
}

/* ----- Black-Litterman view UI ----- */
.bl-presets {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin: 10px 0 14px;
}
.bl-presets .bl-preset { font-size: 12px; }

.bl-view-list {
  display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px;
}
.bl-view-row {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  gap: 12px; align-items: center;
  padding: 12px 14px;
  background: var(--bg);
  border-radius: 12px;
  border-left: 3px solid var(--primary);
}
.bl-view-row.kind-rel { border-left-color: var(--amber); }
.bl-view-desc { font-size: 13px; font-weight: 600; }
.bl-kind-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px; font-weight: 700;
  background: var(--primary-soft); color: var(--primary-strong);
  text-align: center;
}
.bl-view-row.kind-rel .bl-kind-pill {
  background: #fff5e0; color: #b8631a;
}

.bl-view-add {
  background: var(--bg);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
}
.bl-add-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 1fr auto;
  gap: 14px; align-items: end;
}
.bl-add-grid select {
  width: 100%;
  background: white;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
}
.bl-add-grid input[type=number] {
  background: white;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  width: 100%;
}
.bl-params {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 6px;
}
.bl-params input[type=number] {
  background: white;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  width: 100%;
}

/* engine info grid */
.engine-info-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
.positive { color: var(--green); }
.negative { color: var(--red); }
.remove-btn {
  font-size: 14px;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: var(--text-mute);
  background: white;
  border: 1px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center;
}
.remove-btn:hover { color: var(--red); background: var(--red-soft); border-color: var(--red); }

.summary-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 4px 4px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.summary-row .label { font-size: 13px; color: var(--text-mute); margin-bottom: 4px; }
.summary-row .big { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }

/* -------- Fields / inputs -------- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));   /* 1fr 은 가로로 스크롤되는 선택 막대(.seg)의 한 줄 폭보다 좁아지지 못해 폰에서 카드 밖으로 넘쳤다 (2026-09-28) */
  gap: 16px;
}
@media (max-width: 720px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

.field { padding: 8px 0; }
.field label {
  display: block; font-size: 13px; color: var(--text-sub);
  margin-bottom: 8px; font-weight: 600;
}

.seg {
  display: inline-flex;
  background: var(--bg);
  border-radius: 12px;
  padding: 4px;
  gap: 2px;
  flex-wrap: wrap;
}
.seg button {
  padding: 9px 14px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-mute);
  transition: all .15s;
}
.seg button:hover { color: var(--text); }
.seg button.on {
  background: white;
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.seg-lg button { padding: 12px 20px; font-size: 14px; }

.toggle { display: flex; align-items: center; gap: 12px; }
.toggle input[type=checkbox] { display: none; }
.toggle label {
  width: 44px; height: 26px; border-radius: 999px;
  background: var(--border-strong); position: relative;
  cursor: pointer; transition: background .2s; margin: 0;
}
.toggle label::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: white; transition: left .2s; box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.toggle input:checked + label { background: var(--primary); }
.toggle input:checked + label::after { left: 21px; }
.toggle-hint { font-size: 12px; color: var(--text-mute); }

.input-row {
  display: flex;
  align-items: center;
  background: white;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 4px 16px;
  max-width: 240px;
}
.input-row input {
  flex: 1; padding: 12px 0; border: none; outline: none;
  font-size: 16px; font-weight: 600;
}
.input-row .suffix { color: var(--text-mute); font-weight: 600; }

/* -------- Buttons -------- */
.btn-primary {
  background: var(--primary);
  color: white;
  font-size: 15px;
  font-weight: 700;
  padding: 16px 28px;
  border-radius: 14px;
  transition: all .15s;
  letter-spacing: -.01em;
}
.btn-primary:hover { background: var(--primary-strong); }
.btn-primary:disabled { cursor: not-allowed; }

.btn-ghost {
  font-size: 14px;
  font-weight: 600;
  padding: 12px 18px;
  border-radius: 12px;
  color: var(--text-sub);
  background: var(--bg);
  transition: all .15s;
}
.btn-ghost:hover { background: #f0f2f4; color: var(--text); }

/* 상단 "게임으로" — 게임 모드(자오선 연대기) 입구 */
.btn-game { font-size: 12px; padding: 7px 13px; border-radius: 999px; background: var(--primary); color: #fff3d6; white-space: nowrap; }
.btn-game:hover { background: var(--primary-strong); color: #fff; }
.btn-game:disabled { opacity: .6; cursor: progress; }

/* Dream House 오버레이 — 게임(iframe)이 화면 전체를 쓴다 */
/* 집 안 컴퓨터로 MERIDIAN 을 켠 상태 — 같은 버튼이 '화면 끄기'가 된다 */
/* Merdian World 우편함 새 소식 수 — 버튼 안 작은 알약 */
.btn-game .world-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; margin-left: 6px; padding: 0 5px; border-radius: 9px; background: #ffb347; color: #3a2616; font-size: 11px; font-weight: 800; line-height: 1; vertical-align: 1px; font-variant-numeric: tabular-nums; }
.btn-game.screen-off { background: #2f4858; color: #d8ecf5; }
.btn-game.screen-off:hover { background: #1f3340; color: #fff; }
/* Merdian World 를 뒤에 둔 채 MERIDIAN 을 볼 때 — 오른쪽 아래 '돌아가기' 단추 (휴대폰은 아래 탭 막대 위) */
.world-return {
  position: fixed; z-index: 9500;
  right: calc(16px + env(safe-area-inset-right, 0px)); bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 18px;
  border: 0; border-radius: 999px; background: #2f4858; color: #eaf5fa;
  font-size: 14px; font-weight: 700; white-space: nowrap; cursor: pointer;
  box-shadow: 0 6px 18px rgba(20, 30, 40, .28);
}
.world-return:hover { background: #1f3340; color: #fff; }
.world-return:focus-visible { outline: 2px solid #ffb347; outline-offset: 2px; }
.world-return[hidden] { display: none; }
@media (max-width: 768px) { .world-return { bottom: calc(56px + 14px + env(safe-area-inset-bottom, 0px)); } }
.dream-overlay { position: fixed; inset: 0; z-index: 10000; background: #c3e6f3; }
.dream-overlay[hidden] { display: none; }
.dream-overlay iframe { display: block; width: 100%; height: 100%; border: 0; }
html.dream-open, html.dream-open body { overflow: hidden; }

.btn-excel {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 10px;
  background: #1d6f42;
  color: #fff;
  border: none;
  cursor: pointer;
  transition: background .15s, transform .1s;
}
.btn-excel:hover { background: #155534; transform: translateY(-1px); }
.btn-excel:active { transform: translateY(0); }

.footer-cta {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px;
  margin-top: 28px;
}
.footer-cta.inline { margin-top: 16px; justify-content: flex-end; }
.footer-cta .btn-primary { margin-left: auto; }

/* -------- Metric grid -------- */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
@media (max-width: 720px) { .metric-grid { grid-template-columns: repeat(2, 1fr); } }

.metric-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 22px;
  border: 1px solid var(--border);
}
.metric-card.alert { background: linear-gradient(180deg, var(--red-soft), white 65%); }
.metric-label { font-size: 13px; color: var(--text-sub); font-weight: 600; margin-bottom: 6px; }
.metric-value { font-size: 26px; font-weight: 800; letter-spacing: -.025em; }
.metric-value.blue { color: var(--primary); }
.metric-value.red { color: var(--red); }
.metric-foot { font-size: 12px; color: var(--text-mute); margin-top: 4px; }
.metric-foot.positive { color: var(--green); }
.metric-foot.negative { color: var(--red); }

/* -------- Charts -------- */
.chart-wrap { position: relative; height: 320px; }
.chart-wrap.small { height: 260px; }

/* -------- Distribution bar -------- */
.dist-bar {
  display: flex; height: 28px; border-radius: 999px; overflow: hidden;
  margin: 18px 0 12px;
}
.dist-bar > div {
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: white;
}
.dist-legend {
  display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--text-sub);
}
.dist-legend > div { display: flex; align-items: center; gap: 6px; }
.dot {
  width: 10px; height: 10px; border-radius: 50%; display: inline-block;
}
.dot.worst { background: var(--red); }
.dot.bad { background: #ff9500; }
.dot.med { background: var(--primary); }
.dot.good { background: var(--green); }
.dot.frontier { background: var(--primary); }
.dot.current { background: var(--amber); }
.dot.best { background: var(--green); }
.dot.min { background: var(--text); }

/* -------- Delta list (optimize) -------- */
.delta-list { display: flex; flex-direction: column; gap: 10px; }
.delta-row {
  display: grid;
  grid-template-columns: 1.4fr 80px 80px 80px;
  align-items: center;
  font-size: 13px;
}
.delta-row .name { font-weight: 600; }
.delta-row .from, .delta-row .to { color: var(--text-sub); text-align: right; }
.delta-row .arrow { color: var(--text-mute); text-align: center; }
.delta-row .delta { text-align: right; font-weight: 700; }
.delta-row .delta.up { color: var(--green); }
.delta-row .delta.down { color: var(--red); }
.delta-row .bar {
  grid-column: 1 / -1;
  height: 4px; border-radius: 2px;
  background: var(--bg);
  margin-top: 4px; overflow: hidden;
}
.delta-row .bar > span { display:block; height:100%; background: var(--primary); }

/* -------- Frontier -------- */
.frontier-legend {
  display: flex; gap: 16px; flex-wrap: wrap;
  font-size: 12px; color: var(--text-sub); margin-top: 10px;
}
.frontier-legend > div { display: flex; align-items: center; gap: 6px; }

/* -------- Preset chips -------- */
.preset-row {
  display: flex; flex-wrap: wrap; gap: 8px;
  align-items: center;
  padding: 12px 0 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.preset-chip {
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all .15s;
}
.preset-chip:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-1px);
}

/* -------- History list -------- */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.history-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto auto auto;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  background: var(--bg);
  border-radius: 12px;
  font-size: 13px;
  transition: background .12s;
}
.history-row:hover { background: #f1f3f5; }
.history-row input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); }
.history-row .label { font-weight: 700; color: var(--text); }
.history-row .meta { color: var(--text-mute); font-size: 12px; }
.history-row .pill {
  display: inline-block; padding: 3px 8px; border-radius: 999px;
  background: white; font-size: 11px; font-weight: 700; color: var(--primary-strong);
  border: 1px solid var(--border-strong);
}
.history-row .pill.red { color: var(--red); }
.history-row button {
  font-size: 12px; padding: 6px 10px; border-radius: 8px;
  color: var(--text-mute); background: white;
}
.history-row button:hover { color: var(--red); background: var(--red-soft); }

#compareBar {
  position: sticky; bottom: 16px;
  display: none;
  align-items: center; justify-content: space-between;
  background: var(--text); color: white;
  padding: 10px 16px; border-radius: 12px;
  margin: 12px 0 0; box-shadow: var(--shadow-md);
}
#compareBar.show { display: flex; }
#compareBar button {
  background: var(--primary); color: white;
  padding: 8px 16px; border-radius: 8px; font-weight: 700; font-size: 13px;
}

/* -------- Compare grid (side-by-side metric cards) -------- */
.compare-col {
  display: flex; flex-direction: column; gap: 12px;
}
.compare-col h3 {
  font-size: 14px;
  margin: 0 0 6px;
  color: var(--text-sub);
}
.compare-row {
  display: grid;
  grid-template-columns: 1fr 110px;
  gap: 6px;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: 10px;
  font-size: 13px;
}
.compare-row .name { font-weight: 600; }
.compare-row .val  { text-align: right; font-weight: 700; }
.compare-row.better .val { color: var(--green); }
.compare-row.worse  .val { color: var(--red); }

/* -------- WB drilldown table -------- */
.drill-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 13px;
}
.drill-table th, .drill-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.drill-table th { color: var(--text-sub); font-weight: 600; white-space: nowrap; }
.drill-table td { white-space: nowrap; }
.drill-table td.num { text-align: right; font-weight: 600; font-feature-settings: "tnum"; }
.drill-table td.red { color: var(--red); }
/* 그룹 헤더 행 (그룹별 Component VaR) */
.drill-table tr.drill-grp td {
  background: var(--bg);
  border-top: 2px solid var(--border-strong);
  font-family: var(--font-serif);
  white-space: nowrap;
}
.drill-table tr.drill-grp td b { color: var(--text); }

/* -------- WB metadata grid -------- */
.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.meta-cell {
  background: var(--bg);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
}
.meta-cell .k { color: var(--text-mute); font-size: 11px; font-weight: 600; }
.meta-cell .v { font-weight: 700; word-break: break-all; margin-top: 2px; }

/* -------- WB console (warnings/errors) -------- */
#wbConsole {
  background: #0e1525;
  color: #cbd5e1;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  border-radius: 12px;
  padding: 14px 16px;
  max-height: 220px;
  overflow: auto;
}
#wbConsole .warn { color: #ffb020; }
#wbConsole .err  { color: #ff6b7a; }

.position-kind-pill {
  font-size: 10px; padding: 2px 7px; border-radius: 999px;
  font-weight: 700;
}
.kind-ticker { background: #e8f3ff; color: var(--primary-strong); }
.kind-isin   { background: #fff4e0; color: #b8631a; }
.kind-cash   { background: #eafaf3; color: #138a5e; }
.kind-bond   { background: #f3f0ff; color: #5b3fd4; }

/* ── 종목 검색 자동완성 드롭다운 ── */
.name-search-wrap {
  position: relative;
  min-width: 0;
}
.security-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: auto;           /* right: 0 제거 → 부모 너비 종속 해제 */
  min-width: max(100%, 360px);  /* 최소 360px, 부모보다 넓으면 부모 따라감 */
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,23,51,.12);
  z-index: 200;
  overflow: hidden;
  max-height: 300px;
  overflow-y: auto;
}
.security-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.security-item:last-child { border-bottom: none; }
.security-item:hover { background: var(--bg); }
.security-item-ticker {
  font-weight: 700;
  color: var(--primary);
  min-width: 68px;
  font-size: 12px;
  flex-shrink: 0;
}
.security-item-name {
  flex: 1;
  min-width: 120px;     /* 이름이 120px 이상 확보 */
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.security-item-mkt {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  flex-shrink: 0;
  margin-right: 2px;
}
.security-item-mkt.kr { background: #fff0f0; color: #e03131; }
.security-item-mkt.us { background: #e8f4fd; color: #1971c2; }
.security-item-type {
  font-size: 10px;
  color: var(--text-mute);
  background: var(--bg);
  padding: 1px 4px;
  border-radius: 3px;
  flex-shrink: 0;
  margin-left: auto;
}
.security-item-cat {
  font-size: 11px;
  color: var(--text-mute);
  white-space: nowrap;
  flex-shrink: 0;
  background: var(--bg);
  border-radius: 4px;
  padding: 2px 6px;
}
/* 채권 검색 결과 — 만기/쿠폰 메타 텍스트 */
.security-item-bond-meta {
  font-size: 10px;
  color: #0891b2;
  background: #ecfeff;
  border-radius: 4px;
  padding: 1px 5px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: auto;
}

/* legacy aliases */
.kind-equity { background: #e8f3ff; color: var(--primary-strong); }
.kind-et     { background: #fff4e0; color: #b8631a; }

.persona-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 8px;
}
.persona-card {
  background: var(--bg);
  border: 2px solid transparent;
  border-radius: 14px;
  padding: 18px;
  cursor: pointer;
  transition: all .15s;
  text-align: left;
}
.persona-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  background: white;
  box-shadow: var(--shadow-md);
}
.persona-card .pname { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.persona-card .psum  { font-size: 12px; color: var(--text-sub); margin-bottom: 10px; line-height: 1.45; }
.persona-card .pstat { font-size: 11px; color: var(--text-mute); }

.consent-box {
  background: var(--bg);
  border-radius: 14px;
  padding: 22px;
}
.consent-org { display: flex; align-items: center; gap: 12px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.consent-list { padding-left: 18px; margin: 12px 0; }
.consent-list li { font-size: 14px; padding: 4px 0; color: var(--text-sub); }
.consent-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.md-account {
  background: var(--bg);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 10px;
}
.md-account-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.md-account-head .name { font-weight: 700; font-size: 14px; }
.md-account-head .num  { color: var(--text-mute); font-size: 12px; }
.md-product-row {
  display: grid;
  grid-template-columns: 50px 1fr 90px 130px 60px;
  gap: 10px;
  padding: 6px 0;
  border-top: 1px dashed var(--border);
  font-size: 13px;
}
.md-product-row .type-pill { font-size: 10px; padding: 3px 6px; border-radius: 5px; text-align: center; font-weight: 700; align-self: center; }
.md-product-row .num { text-align: right; font-feature-settings: "tnum"; }
.md-product-row .ccy { color: var(--text-mute); font-size: 11px; align-self: center; }
.t-eq { background: #e8f3ff; color: var(--primary-strong); }
.t-etf { background: #fff4e0; color: #b8631a; }
.t-bond { background: #f0e8ff; color: #5e3edc; }
.t-cash { background: #eafaf3; color: #138a5e; }
.t-other { background: var(--border); color: var(--text-mute); }

.md-summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
  margin: 18px 0;
  padding: 14px;
  background: var(--primary-soft);
  border-radius: 12px;
}
.md-summary .sumcell { font-size: 12px; }
.md-summary .sumcell .k { color: var(--primary-strong); font-weight: 700; }
.md-summary .sumcell .v { font-weight: 700; font-size: 14px; margin-top: 2px; }

.md-cta-grid { margin-top: 12px; }
.md-cta {
  padding: 22px 20px !important;
  font-size: 15px;
  text-align: center;
  border-radius: 16px !important;
}

/* -------- Analyze side-by-side layout -------- */
.analyze-sidebyside {
  display: grid;
  grid-template-columns: minmax(0, 1fr);   /* 분석 설정을 전체 폭으로 — 1fr 은 가장 넓은 선택 막대보다 좁아지지 못해 360px 폰에서 카드가 394px 로 넘쳤다 */
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}
.analyze-col-left,
.analyze-col-right { display: flex; flex-direction: column; }

/* 우측 메트릭 고정 2×2 그리드 */
.metric-grid-2x2 {
  grid-template-columns: repeat(2, 1fr) !important;
}

@media (max-width: 900px) {
  .analyze-sidebyside { grid-template-columns: minmax(0, 1fr); }
}

/* -------- Macro Indicators -------- */
.macro-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 12px;
  margin-top: 4px;
}

/* 매크로 지표 — 한 줄 티커(오른쪽 → 왼쪽 무한 이동) */
.macro-ticker {
  overflow: hidden;
  position: relative;
  width: 100%;
  margin-top: 4px;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 5%, #000 95%, transparent);
          mask-image: linear-gradient(to right, transparent, #000 5%, #000 95%, transparent);
}
.macro-ticker-track {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  will-change: transform;
  animation: macroTickerScroll 40s linear infinite;
}
.macro-ticker:hover .macro-ticker-track { animation-play-state: paused; }
@keyframes macroTickerScroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-33.333%); }   /* 3벌 중 1벌 이동 = seamless */
}
.macro-ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 20px;
  border-right: 1px solid var(--border, #ececec);
  cursor: pointer;
  font-size: 13px;
  flex: 0 0 auto;
}
.macro-ticker-item:hover { background: var(--bg-soft, #f6f3ec); }
.mti-name { color: var(--text-mute); font-weight: 500; }
.mti-spark { width: 46px; height: 16px; display: inline-flex; align-items: center; }
.mti-val { font-weight: 700; font-variant-numeric: tabular-nums; }
.mti-unit { font-weight: 500; font-size: 11px; color: var(--text-mute); margin-left: 2px; }
.mti-chg { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) {
  .macro-ticker-track { animation: none; }
}
.macro-tile {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--bg);
  cursor: pointer;
  transition: box-shadow .15s ease, transform .15s ease, border-color .15s ease;
}
.macro-tile:hover {
  box-shadow: 0 6px 18px rgba(0, 0, 0, .08);
  transform: translateY(-2px);
  border-color: #c4cdd6;
}
.macro-tile-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
}
.macro-tile-name { font-size: 12px; font-weight: 600; color: var(--text-mute); }
.macro-tile-chg  { font-size: 11px; font-weight: 700; white-space: nowrap; }
.macro-tile-val {
  font-size: 21px;
  font-weight: 700;
  color: var(--text);
  margin: 5px 0 8px;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.macro-tile-unit { font-size: 11px; font-weight: 500; color: var(--text-mute); }
.macro-spark { height: 44px; }
.macro-tile-foot { font-size: 10px; color: var(--text-mute); margin-top: 7px; }

/* 하이퍼스케일러 CapEx */
.cx-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.cx-headline { font-size: 14px; color: var(--text-sub); }
.cx-headline b { font-size: 24px; color: var(--text); font-weight: 800; }
.cx-per { font-size: 12px; color: var(--text-mute); }
.cx-yoybig { font-size: 14px; font-weight: 700; }
.cx-chart-wrap { position: relative; height: 230px; margin: 6px 0 12px; }
.cx-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.cx-table-wrap { overflow-x: auto; border-top: 1px solid var(--border); padding-top: 8px; }
.cx-matrix { width: 100%; border-collapse: collapse; min-width: 520px; font-size: 12px; }
.cx-th { text-align: right; font-weight: 600; color: var(--text-mute); padding: 6px 8px; white-space: nowrap; border-bottom: 1px solid var(--border-strong); }
.cx-th-name { text-align: left; }
.cx-td { text-align: right; padding: 6px 8px; white-space: nowrap; color: var(--text); font-variant-numeric: tabular-nums; border-bottom: 1px solid var(--border); }
.cx-tdname { text-align: left; font-weight: 600; }
.cx-total td { border-top: 2px solid var(--border-strong); font-weight: 800; background: var(--bg); }
.cx-pending { margin-top: 10px; font-size: 11px; color: #9a6a00; background: #fff8e6; border: 1px solid #ffe8b3; border-radius: 8px; padding: 6px 9px; }
.cx-note { margin-top: 10px; font-size: 11px; color: var(--text-mute); padding-top: 9px; border-top: 1px dashed var(--border-strong); line-height: 1.5; }

/* 스트레스 경보 */
.sa-top { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.sa-gauge { flex: 0 0 auto; text-align: center; min-width: 120px; }
.sa-score { font-size: 40px; font-weight: 800; line-height: 1; }
.sa-score-max { font-size: 14px; font-weight: 600; color: var(--text-mute); }
.sa-level { display: inline-block; margin-top: 6px; padding: 3px 14px; border-radius: 14px; color: #fff; font-size: 13px; font-weight: 700; }
.sa-bar { margin-top: 8px; height: 7px; border-radius: 4px; background: var(--border-strong); overflow: hidden; }
.sa-fill { height: 100%; border-radius: 4px; transition: width .4s; }
.sa-advisory { flex: 1; min-width: 200px; }
.sa-adv { font-size: 14px; font-weight: 600; line-height: 1.5; }
.sa-updated { font-size: 11px; color: var(--text-mute); margin-top: 4px; }
.sa-signals { display: flex; flex-direction: column; gap: 2px; border-top: 1px solid var(--border); padding-top: 10px; }
.sa-row { display: grid; grid-template-columns: 14px 132px 66px 46px 1fr; align-items: center; gap: 8px; padding: 5px 2px; font-size: 12px; }
.sa-dot { width: 9px; height: 9px; border-radius: 50%; }
.sa-name { font-weight: 600; color: var(--text); }
.sa-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; }
.sa-badge { text-align: center; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 6px; border: 1px solid; }
.sa-note { color: var(--text-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sa-notify { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--bg); border: 1px solid var(--border-strong); }
.sa-notify-head { font-size: 13px; font-weight: 700; color: var(--text); }
.sa-notify-desc { font-size: 11px; color: var(--text-mute); margin: 4px 0 8px; line-height: 1.5; }
.sa-notify-row { display: flex; gap: 8px; flex-wrap: wrap; }
.sa-input { font-size: 13px; padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: 8px; background: #fff; color: var(--text); }
.sa-save { font-size: 13px; font-weight: 600; padding: 7px 16px; border: none; border-radius: 8px; background: var(--primary, var(--primary)); color: #fff; cursor: pointer; }
.sa-save:hover { background: var(--primary-strong, var(--primary-strong)); }
.sa-ghost { font-size: 13px; font-weight: 600; padding: 7px 14px; border: 1px solid var(--border-strong); border-radius: 8px; background: #fff; color: var(--text-sub); cursor: pointer; }
.sa-ghost:hover { background: var(--bg); }
.sa-kakao-ok { font-size: 13px; font-weight: 700; color: #12b886; display: inline-flex; align-items: center; }

/* 국장 예보 */
.fc-presslabel { font-size: 11px; color: var(--text-mute); margin-top: 6px; }
.sa-disclaimer { margin-top: 12px; font-size: 11px; color: var(--text-mute); line-height: 1.5; padding-top: 10px; border-top: 1px dashed var(--border-strong); }
@media (max-width: 560px) { .sa-row { grid-template-columns: 12px 1fr 58px 42px; } .sa-note { display: none; } }

/* -------- Stress Test -------- */
.stress-scenario-desc-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 4px;
}
.stress-scen-badge {
  background: color-mix(in srgb, var(--sc-color) 8%, white);
  border: 1.5px solid color-mix(in srgb, var(--sc-color) 25%, white);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stress-scen-name {
  font-size: 14px;
  font-weight: 800;
  color: var(--sc-color);
  letter-spacing: -.01em;
}
.stress-scen-period {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-mute);
}
.stress-scen-desc {
  font-size: 12px;
  color: var(--text-sub);
  margin-top: 2px;
  line-height: 1.45;
}

/* 3 result cards in a row */
.stress-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.stress-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.stress-card-header {
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--sc-color) 7%, white);
}
.stress-card-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--sc-color);
}
.stress-card-period {
  font-size: 11px;
  color: var(--text-mute);
  margin-top: 2px;
}
.stress-card-body {
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.stress-metric-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.stress-metric-label {
  font-size: 12px;
  color: var(--text-mute);
  font-weight: 600;
  white-space: nowrap;
}
.stress-metric-vals {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.stress-metric-before {
  font-size: 13px;
  color: var(--text-sub);
  text-decoration: line-through;
  text-decoration-color: var(--border-strong);
}
.stress-metric-after {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}
.stress-metric-after.loss { color: var(--red); }
.stress-metric-after.gain { color: var(--green); }
.stress-delta-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.stress-delta-pill.neg { background: var(--red-soft); color: var(--red); }
.stress-delta-pill.pos { background: var(--green-soft); color: var(--green); }
.stress-vol-mult {
  font-size: 11px;
  color: var(--text-mute);
  margin-left: 4px;
}

@media (max-width: 900px) {
  .stress-scenario-desc-grid { grid-template-columns: 1fr; }
  .stress-cards-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .stress-scenario-desc-grid { gap: 8px; }
  .stress-cards-grid { gap: 10px; }
}

/* -------- Table scroll wrapper -------- */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.table-scroll::-webkit-scrollbar { height: 4px; }
.table-scroll::-webkit-scrollbar-track { background: transparent; }
.table-scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }

/* -------- Analyze loading card -------- */
.analyze-loading-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 28px 24px;
}
/* 분석 전 안내 placeholder */
.analyze-placeholder-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 24px;
  border: 1.5px dashed var(--border-strong);
  background: var(--bg);
  box-shadow: none;
}
.analyze-ph-icon { flex-shrink: 0; font-size: 30px; opacity: .55; filter: grayscale(1); }
.analyze-ph-text { display: flex; flex-direction: column; gap: 5px; }
.analyze-ph-text strong { font-size: 14px; color: var(--text); }
.analyze-ph-text span { font-size: 12.5px; color: var(--text-mute); line-height: 1.55; }
/* 스트레스 사용자 지정 기간 */
.stress-custom { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--border-strong); }
.stress-custom-title { font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.stress-custom-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.stress-custom-row label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--text-mute); }
.stress-custom-row input {
  border: 1px solid var(--border-strong); border-radius: 8px; padding: 6px 9px;
  font-size: 13px; color: var(--text); background: #fff; outline: none;
}
.stress-custom-row input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.analyze-spinner {
  flex-shrink: 0;
  width: 36px; height: 36px;
  border: 3px solid var(--primary-soft);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.analyze-loading-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.analyze-loading-text strong {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.analyze-loading-text span {
  font-size: 13px;
  color: var(--text-mute);
}

/* -------- Optimization Method Cards (새 가로 레이아웃) -------- */

/* 가로 4개 카드 행 */
.method-cards-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 12px 0 0;
}

/* 개별 방법론 카드 */
.method-card {
  background: #fff;
  border: 1.5px solid var(--border-strong);
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color .18s, box-shadow .18s, background .18s;
  user-select: none;
}
.method-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 10px rgba(49,130,246,.10);
}
.method-card.active {
  border-color: var(--primary);
  background: rgba(49,130,246,.04);
  box-shadow: 0 3px 16px rgba(49,130,246,.15);
}
.method-card-no {
  font-size: 10px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 4px;
  padding: 1px 6px;
  display: inline-block;
  margin-bottom: 7px;
}
.method-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
  line-height: 1.3;
}
.method-card-eng {
  font-size: 10.5px;
  color: var(--text-mute);
  margin-bottom: 8px;
}
.method-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.method-card-tags span {
  font-size: 10px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 4px;
  padding: 1px 6px;
}

/* 선택된 카드 아래 설정 패널 */
.method-panel {
  margin-top: 20px;
  padding: 20px;
  background: var(--bg);
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  animation: fadeSlideDown .18s ease;
}
@keyframes fadeSlideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.method-panel-inner {
  display: flex;
  gap: 28px;
  align-items: flex-start;
}
.method-panel-left  { flex: 1; min-width: 0; }
.method-panel-right { flex: 0 0 240px; }
.method-panel-desc {
  font-size: 12.5px;
  color: var(--text-mute);
  line-height: 1.65;
  margin-bottom: 12px;
}

.paper-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 6px;
  padding: 4px 10px;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.paper-download-btn:hover {
  background: var(--primary);
  color: #fff;
}

@media (max-width: 900px) {
  .method-cards-row { grid-template-columns: repeat(2, 1fr); }
  .method-panel-inner { flex-direction: column; }
  .method-panel-right { flex: none; width: 100%; }
}
@media (max-width: 540px) {
  .method-cards-row { grid-template-columns: 1fr 1fr; }
}

/* -------- Trading Tab -------- */
.broker-bar {
  display: flex;
  gap: 24px;
  align-items: center;
  padding: 14px 20px;
  flex-wrap: wrap;
}
.broker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-sub);
}
.broker-item strong { font-weight: 700; color: var(--text); }
.broker-item.active strong { color: var(--primary); }
.broker-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border-strong);
  flex-shrink: 0;
}
.broker-dot.active {
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
}
.broker-label {
  font-size: 11px;
  color: var(--text-mute);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 999px;
}

/* Order table inside trade section */
.trade-order-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.trade-order-table th,
.trade-order-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.trade-order-table th { color: var(--text-sub); font-weight: 600; }
.trade-order-table td.num { text-align: right; font-feature-settings: "tnum"; font-weight: 600; }
.trade-action-buy  { color: var(--primary); font-weight: 800; }
.trade-action-sell { color: var(--red);     font-weight: 800; }
.trade-action-hold { color: var(--text-mute); font-weight: 600; }

/* Summary bar above execute button */
.trade-summary-bar {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--bg);
  border-radius: 12px;
  font-size: 13px;
}
.trade-summary-item { display: flex; flex-direction: column; gap: 2px; }
.trade-summary-item .k { font-size: 11px; color: var(--text-mute); font-weight: 600; }
.trade-summary-item .v { font-weight: 700; }
.trade-summary-item .v.buy  { color: var(--primary); }
.trade-summary-item .v.sell { color: var(--red); }

@media (max-width: 768px) {
  .broker-bar { gap: 14px; padding: 12px 14px; }
  .trade-summary-bar { gap: 14px; }
}

/* -------- Footer -------- */
.foot {
  margin-top: auto;
  padding: 16px 24px 32px;
  text-align: center;
  color: var(--text-mute);
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.foot-creed {
  font-family: var(--font-serif);
  font-size: 13px;
  color: var(--text);
  letter-spacing: .02em;
}

/* ═══════════ 투자 신조 (전 화면 상시) ═══════════ */
.manifesto {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border-strong);
  background: var(--bg-soft, #f6f3ec);
  text-align: center;
  padding: 9px 16px;
}
.manifesto-line {
  font-family: var(--font-serif);
  font-size: 13.5px;
  letter-spacing: .04em;
  color: var(--text);
}
.manifesto-line em {
  font-style: normal;
  font-weight: 700;
  color: var(--primary, #7b2d3a);
  border-bottom: 2px solid currentColor;
  padding-bottom: 1px;
}
@media (max-width: 720px) {
  .manifesto { padding: 8px 12px; }
  .manifesto-line { font-size: 12px; letter-spacing: .02em; }
}

/* ═══════════ 투자 철학 분석 ═══════════ */

/* 탭 */
.philosophy-card { }
.phil-tabs {
  display: flex; gap: 4px;
  border-bottom: 2px solid var(--border);
  margin: 12px 0 20px;
}
.phil-tab {
  padding: 8px 16px; border-radius: 8px 8px 0 0;
  font-size: 13px; font-weight: 600; cursor: pointer;
  border: none; background: none; color: var(--text-sub);
  transition: color .15s, background .15s;
}
.phil-tab:hover { background: var(--bg); color: var(--text); }
.phil-tab.active {
  color: var(--primary); border-bottom: 2px solid var(--primary);
  margin-bottom: -2px;
}
.phil-pane { animation: fadeIn .2s ease; }

/* DNA 레이아웃 */
.phil-dna-layout {
  display: grid; grid-template-columns: 240px 1fr; gap: 24px; align-items: start;
}
.phil-radar-wrap { display: flex; justify-content: center; }

/* 스타일 배지 */
.phil-style-badge {
  display: inline-block; padding: 5px 12px;
  background: var(--primary-soft); color: var(--primary);
  border-radius: 20px; font-size: 12px; font-weight: 700;
  margin-bottom: 14px;
}

/* 점수 바 */
.phil-score-bars { display: flex; flex-direction: column; gap: 7px; }
.phil-score-row { display: flex; align-items: center; gap: 8px; }
.phil-score-label { width: 46px; font-size: 12px; color: var(--text-sub); font-weight: 600; }
.phil-bar-bg { flex: 1; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.phil-bar-fill { height: 100%; border-radius: 4px; transition: width .5s ease; }
.phil-score-val { width: 28px; text-align: right; font-size: 12px; font-weight: 700; color: var(--text-sub); }

/* Gap 분석 */
.phil-gaps { margin-top: 14px; }
.phil-gap-item {
  display: flex; flex-direction: column; gap: 2px;
  padding: 7px 10px; border-radius: 8px; margin-bottom: 6px; font-size: 12px;
}
.phil-gap-warn { background: #fff7ed; border-left: 3px solid var(--amber); }
.phil-gap-info { background: var(--bg); border-left: 3px solid var(--border-strong); }
.phil-gap-fix { font-size: 11px; color: var(--text-mute); }
.phil-all-ok { margin-top: 12px; font-size: 13px; color: var(--green); font-weight: 600; }

/* 실제 보유 종목 (SEC 13F) */
.famous13f-section { margin-bottom: 4px; }
.famous13f-head, .famous-models-head {
  font-size: 15px; font-weight: 700; color: var(--text);
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin: 2px 0 12px;
}
.famous13f-head span, .famous-models-head span {
  font-size: 12px; font-weight: 500; color: var(--text-mute);
}
.famous-models-head { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--border-strong); }
.famous13f-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px;
}
.f13-card {
  border: 1.5px solid var(--border); border-radius: 14px; padding: 14px; background: var(--bg-card);
}
.f13-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.f13-emoji { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; flex-shrink: 0; border: 1px solid var(--border-strong); border-radius: 50%; font-family: var(--font-serif); font-size: 13px; font-weight: 600; color: var(--text-sub); letter-spacing: .03em; }
.f13-id { flex: 1; min-width: 0; }
.f13-name { font-size: 15px; font-weight: 700; color: var(--text); }
.f13-fund { font-size: 12px; color: var(--text-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.f13-date {
  font-size: 11px; color: var(--text-sub); background: var(--bg);
  padding: 2px 7px; border-radius: 6px; white-space: nowrap;
}
.f13-canvas-wrap { position: relative; height: 176px; margin: 8px 0 12px; }
.f13-legend { display: flex; flex-direction: column; gap: 4px; }
.f13-leg { font-size: 12px; color: var(--text-sub); display: flex; align-items: center; gap: 6px; }
.f13-leg strong { color: var(--text); font-weight: 700; margin-left: auto; }
.f13-dot { width: 9px; height: 9px; border-radius: 2px; flex-shrink: 0; }
.f13-leg-other { cursor: pointer; border-radius: 5px; padding: 1px 4px; margin: 0 -4px; transition: background .12s; }
.f13-leg-other:hover { background: var(--bg-subtle, #f3f4f6); }
.f13-caret { font-size: 9px; color: var(--text-mute); margin-right: 1px; width: 9px; display: inline-block; }
.f13-others { margin: 3px 0 4px 15px; padding-left: 9px; border-left: 2px solid var(--border-strong); display: flex; flex-direction: column; gap: 3px; }
.f13-leg-sub { font-size: 11.5px; color: var(--text-mute); }
.f13-meta { font-size: 11px; color: var(--text-mute); margin-top: 7px; padding-top: 7px; border-top: 1px dashed var(--border-strong); }
.f13-note {
  font-size: 11px; color: #9a6a00; background: #fff8e6; border: 1px solid #ffe8b3;
  border-radius: 8px; padding: 7px 9px; margin-top: 10px; line-height: 1.45;
}
.f13-hist-btn {
  width: 100%; margin-top: 10px; padding: 8px 10px; font-size: 12px; font-weight: 600;
  color: var(--text-sub); background: var(--bg); border: 1px solid var(--border-strong);
  border-radius: 9px; cursor: pointer; transition: background .12s, border-color .12s;
}
.f13-hist-btn:hover { background: #eef2ff; border-color: var(--primary, var(--primary)); color: var(--primary, var(--primary)); }

/* 13F 5년 추이 모달 */
.f13-modal-close {
  position: absolute; top: 16px; right: 18px; background: none; border: none;
  font-size: 18px; cursor: pointer; color: var(--text-mute); line-height: 1;
}
.f13-hist-title { font-size: 16px; font-weight: 700; color: var(--text); padding-right: 24px; }
.f13-hist-sub { font-size: 12px; color: var(--text-mute); margin: 2px 0 12px; }
.f13-hist-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.f13-hist-chip {
  font-size: 13px; font-weight: 600; padding: 6px 14px; border-radius: 8px; cursor: pointer;
  color: var(--text-sub); background: var(--bg); border: 1px solid var(--border-strong);
  transition: all .12s;
}
.f13-hist-chip:hover { border-color: var(--primary, var(--primary)); }
.f13-hist-chip.active {
  color: #fff; background: var(--primary, var(--primary)); border-color: var(--primary, var(--primary));
}
.f13-hist-meta { font-size: 12px; color: var(--text-sub); margin-bottom: 10px; text-align: center; }

/* ── 투자일지 노트 (옥스포드 노트) ───────────────────────────── */
.journal-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(20,20,30,.5); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.journal-sheet {
  position: relative; width: min(560px, 96vw); max-height: 92vh; overflow-y: auto;
  background: #fbf7ec; border-radius: 14px; padding: 20px 22px 18px;
  box-shadow: 0 30px 70px rgba(0,0,0,.4);
}
.journal-close {
  position: absolute; top: 14px; right: 16px; background: none; border: none;
  font-size: 18px; cursor: pointer; color: #9b9384; line-height: 1; z-index: 2;
}
.journal-mute {
  position: absolute; top: 13px; right: 44px; background: none; border: none;
  font-size: 16px; cursor: pointer; line-height: 1; z-index: 2; opacity: .85;
}
.journal-mute:hover { opacity: 1; }
.journal-head { font-size: 16px; font-weight: 800; color: #2b2b3a; padding-right: 24px; }
.journal-sub  { font-size: 12px; color: #8b95a1; margin: 3px 0 4px; }

/* 템플릿 선택 카드 */
.journal-tpl-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 10px 0 14px; }
.journal-tpl-card {
  text-align: left; cursor: pointer; padding: 14px; border-radius: 12px;
  border: 1.5px solid #e6dfcb; background: #fffdf6;
  transition: transform .1s, border-color .1s, box-shadow .1s;
}
.journal-tpl-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.12); }
.journal-tpl-icon { color: var(--text-sub); line-height: 0; display: inline-block; }
.journal-tpl-name { font-weight: 700; font-size: 14px; color: #2b2b3a; margin-top: 6px; }
.journal-tpl-desc { font-size: 11px; color: #8b95a1; margin-top: 2px; }

/* 지난 일지 목록 */
.journal-past { margin-top: 8px; border-top: 1px dashed #d9d2bd; padding-top: 10px; }
.journal-past-title { font-size: 12px; font-weight: 700; color: #6b6450; margin-bottom: 6px; }
.journal-past-item {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  background: transparent; border: none; border-radius: 8px; padding: 6px 8px; cursor: pointer; font-size: 12px;
}
.journal-past-item:hover { background: #f1ead6; }
.journal-past-date { font-weight: 600; color: #2b2b3a; white-space: nowrap; }
.journal-past-icon { font-size: 14px; }
.journal-past-prev { color: #8b95a1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 노트 작성 화면 */
.journal-paper-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 0; padding-right: 26px; }
.journal-tab {
  display: inline-block; font-weight: 700; font-size: 13px; color: #fff;
  background: var(--primary); padding: 6px 14px; border-radius: 8px 8px 0 0;
}
.journal-date { border: 1px solid #d9d2bd; border-radius: 8px; padding: 5px 8px; font-size: 12px; background: #fffdf6; color: #2b2b3a; }
.journal-book {
  position: relative; border-radius: 8px;
  box-shadow: inset 0 0 0 1px #ece6d3;
}
.journal-rings { display: none; }
.journal-paper {
  display: block; width: 100%; min-height: 340px; box-sizing: border-box;
  border: none; outline: none; resize: vertical;
  padding: 16px 18px;
  line-height: 1.7; font-size: 15px;
  font-family: 'Pretendard', system-ui, sans-serif; color: #2b2b3a;
  background-color: #fffdf5;
  border-radius: 8px;
}
.journal-paper::placeholder { color: #b9b29c; }
.journal-blocks { display: flex; flex-direction: column; gap: 8px; background: #f6f1e6; padding: 8px; border-radius: 8px; }
.journal-block { display: flex; gap: 8px; align-items: flex-start; background: #fffdf5; border: 1px solid #e7e0d0; border-radius: 8px; padding: 8px 10px; }
.journal-block.dragging { opacity: .45; border-style: dashed; }
.journal-block-handle { cursor: grab; color: #c0b9a6; padding: 5px 2px 0; line-height: 0; flex-shrink: 0; touch-action: none; }
.journal-block-handle:active { cursor: grabbing; }
.journal-block-main { flex: 1; min-width: 0; }
.journal-block-title { font-size: 12px; font-weight: 600; color: #6b6452; margin-bottom: 3px; }
.journal-block-text { width: 100%; border: none; outline: none; resize: vertical; background: transparent; font-family: 'Pretendard', system-ui, sans-serif; font-size: 14px; line-height: 1.6; color: #2b2b3a; min-height: 36px; }
.journal-block-text::placeholder { color: #c9c2b0; }
.journal-hint { font-size: 11px; color: #b9b29c; margin-top: 8px; display: flex; align-items: center; gap: 5px; }
.journal-actions { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.journal-btn {
  font-size: 13px; padding: 7px 14px; border-radius: 9px; cursor: pointer; font-weight: 600;
  border: 1px solid #d9d2bd; background: #fffdf6; color: #5b5440;
}
.journal-btn:hover { background: #f1ead6; }
.journal-btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.journal-btn.primary:hover { background: var(--primary-strong); }
.journal-del { color: #e03131; border-color: #f3c0c0; }
@media (max-width: 480px) { .journal-tpl-grid { grid-template-columns: 1fr; } }

/* 유명 투자자 */
.phil-famous-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.famous-card {
  border: 1.5px solid var(--border); border-radius: 14px;
  padding: 16px 18px; display: flex; flex-direction: column; gap: 10px;
}
.famous-head { display: flex; justify-content: space-between; align-items: flex-start; }
.famous-name { font-size: 15px; font-weight: 700; }
.famous-subtitle { font-size: 11px; color: var(--text-mute); margin-top: 2px; }

.sim-badge {
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px; white-space: nowrap;
}
.sim-high { background: #d3f8e0; color: #0a6e35; }
.sim-mid  { background: #fff7ed; color: #8a4d00; }
.sim-low  { background: #fff1f3; color: #c0392b; }

.alloc-bar-wrap { }
.alloc-bar {
  display: flex; height: 10px; border-radius: 6px; overflow: hidden; gap: 1px;
}
.alloc-seg { height: 100%; min-width: 3px; }
.alloc-legend {
  display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 6px;
}
.alloc-leg-item { font-size: 10.5px; color: var(--text-sub); display: flex; align-items: center; gap: 4px; }
.alloc-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.famous-desc { font-size: 12px; color: var(--text-sub); line-height: 1.55; margin: 0; }
.famous-sw { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sw-title { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.sw-item { font-size: 11px; color: var(--text-sub); line-height: 1.6; }
.famous-quote {
  font-size: 11px; color: var(--text-mute); font-style: italic;
  border-top: 1px solid var(--border); padding-top: 8px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* 연구 기반 뷰 */
.phil-research-grid { display: flex; flex-direction: column; gap: 12px; }
.research-card {
  border: 1.5px solid var(--border); border-radius: 14px; padding: 16px 18px;
  transition: border-color .2s, box-shadow .2s;
}
.research-card:hover { border-color: var(--primary-strong); }
.research-card-activated {
  border-color: var(--primary) !important;
  background: var(--primary-soft);
}
.research-head {
  display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px;
}
.research-icon { font-size: 22px; flex-shrink: 0; margin-top: 1px; }
.research-title-group { flex: 1; }
.research-title { font-size: 14px; font-weight: 700; }
.research-source {
  display: inline-block; margin-top: 3px; padding: 2px 8px;
  background: var(--bg); border: 1px solid var(--border-strong);
  border-radius: 20px; font-size: 10.5px; color: var(--text-sub);
}
.research-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; }
.conf-dots { font-size: 11px; letter-spacing: 2px; }
.conf-high { color: var(--green); }
.conf-mid  { color: var(--amber); }
.conf-low  { color: var(--text-mute); }
.research-horizon {
  font-size: 10.5px; font-weight: 600; padding: 2px 8px;
  border-radius: 20px; white-space: nowrap;
}
.research-desc { font-size: 12.5px; color: var(--text-sub); line-height: 1.55; margin: 0 0 8px; }
.research-evidence {
  font-size: 11.5px; color: var(--text-mute); background: var(--bg);
  border-radius: 8px; padding: 7px 10px; margin-bottom: 8px;
}
.research-match {
  font-size: 12px; padding: 7px 10px; border-radius: 8px; margin-bottom: 8px; line-height: 1.6;
}
.research-match.ok   { background: #eafaf3; color: #0a6e35; }
.research-match.miss { background: var(--bg); color: var(--text-sub); }
.research-footer { display: flex; gap: 8px; flex-wrap: wrap; }
.research-action-btn { font-size: 12px; padding: 5px 14px; }

@media (max-width: 860px) {
  .phil-dna-layout { grid-template-columns: 1fr; }
  .phil-radar-wrap { margin: 0 auto; }
  .phil-famous-grid { grid-template-columns: 1fr; }
}

/* -------- Toast -------- */
.toast {
  position: fixed;
  bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--text); color: white;
  padding: 14px 22px; border-radius: 14px;
  font-size: 14px; font-weight: 600;
  opacity: 0; pointer-events: none;
  transition: all .25s ease;
  box-shadow: var(--shadow-lg);
  z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* -------- Loading button state -------- */
.btn-primary.loading {
  position: relative; color: transparent !important;
}
.btn-primary.loading::after {
  content: ''; position: absolute;
  top: 50%; left: 50%;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.4); border-top-color: white;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: translate(-50%,-50%) rotate(360deg); } }

/* ============================================================
   MOBILE RESPONSIVE
   768px : tablet  |  480px : phone
   ============================================================ */

/* ── Bottom nav bar (hidden on desktop) ── */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 200;
  background: rgba(255,255,255,.96);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.mobile-nav-inner {
  display: flex;
  width: 100%;
  height: 56px;
  /* 5개 탭은 화면 폭에 균등 배치 (overflow-x:auto 가 flex:1 분배를 막아 제거) */
}
.mob-tab {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-mute);
  font-size: 10px;
  font-weight: 600;
  padding: 6px 4px;
  transition: color .15s;
  letter-spacing: 0;
}
.mob-tab svg { width: 20px; height: 20px; stroke-width: 1.8; }
.mob-tab.active { color: var(--primary); }
.mob-tab.active svg { stroke-width: 2.4; }

/* ── 768px: tablet adjustments ── */
@media (max-width: 768px) {
  /* show bottom nav, hide topbar steps */
  .mobile-nav { display: flex; }
  .steps { display: none; }

  /* topbar */
  .topbar-inner { padding: 10px 16px; gap: 10px; }
  .topbar-meta { margin-left: auto; }
  .topbar-meta .badge-local { display: none; }

  /* page content — extra bottom padding for nav bar */
  .content { padding: 16px 16px 72px; }

  /* cards */
  .card { padding: 18px 16px; border-radius: 16px; }
  .card h2 { font-size: 15px; margin-bottom: 14px; }

  /* hero */
  .hero { padding: 14px 4px 20px; }
  .hero-title { font-size: 24px; }
  .hero-sub { font-size: 13px; }

  /* card header stacks on mobile */
  .card-header { flex-wrap: wrap; gap: 10px; }

  /* 포지션 액션 버튼 — 2×2 그리드 (한 줄에 두 개씩, 텍스트 안 깨짐) */
  .position-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    width: 100%;
  }
  .position-actions .btn-ghost {
    width: 100%;
    justify-content: center;
    text-align: center;
    font-size: 12.5px;
    padding: 11px 8px;
    white-space: nowrap;
  }

  /* preset chip row — horizontal scroll */
  .preset-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 10px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .preset-row::-webkit-scrollbar { display: none; }

  /* seg control — horizontal scroll */
  .seg {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .seg::-webkit-scrollbar { display: none; }
  .seg button { white-space: nowrap; }

  /* 컬럼 헤더 — 모바일 카드 레이아웃에선 데스크탑 9열 그리드가 화면을 넘침.
     라벨은 숨기고 '추세' 기간 토글 버튼만 우측에 한 줄로 표시. */
  .holding-row-header {
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 6px 10px !important;
    flex-wrap: wrap;
  }
  .holding-row-header > span { display: none !important; }

  /* ── Holding rows: 모바일 컴팩트 (12컬럼, 이름+티커 한 줄) ──
     child order: ①del ②badge ③name ④id ⑤shares ⑥notional ⑦spark ⑧weight ⑨lock
     Row 1: [✕] [배지] [이름──────] [티커──] [🔓]
     Row 2: [수량] [평가금액] [비중] [📈 수익률버튼]
     Row 3: [그래프] (수익률버튼 탭 시 펼침)            */
  .holding-row--ticker,
  .holding-row--cash {
    grid-template-columns: repeat(12, 1fr) !important;
    grid-template-rows: auto auto auto !important;
    row-gap: 6px !important;
    column-gap: 4px !important;
    padding: 9px 8px !important;
  }
  /* ① del → r1 */
  .holding-row > :nth-child(1) { grid-column: 1/2;   grid-row:1; align-self:center; }
  /* ② badge → r1 */
  .holding-row > :nth-child(2) { grid-column: 2/4;   grid-row:1; align-self:center; }
  /* ③ name → r1 */
  .holding-row > :nth-child(3) { grid-column: 4/9;   grid-row:1; min-width:0; align-self:center; }
  /* ④ id(티커) → r1 (이름 옆, 자물쇠 삭제로 끝까지 확장) */
  .holding-row > :nth-child(4) { grid-column: 9/13;  grid-row:1; min-width:0; align-self:center; }
  /* ⑤ shares(수량) → r2 */
  .holding-row > :nth-child(5) { grid-column: 1/4;   grid-row:2; min-width:0; align-self:center; }
  /* ⑥ notional(평가금액) → r2 */
  .holding-row > :nth-child(6) { grid-column: 4/8;   grid-row:2; min-width:0; align-self:center; }
  /* ⑧ weight(비중) → r2 */
  .holding-row > :nth-child(8) {
    grid-column: 8/10; grid-row:2;
    font-size: 11px; padding: 4px 4px; min-height: auto;
    align-self: center; justify-self: center; white-space: nowrap;
  }
  /* del / lock 버튼은 1칸 셀에 맞게 작게 */
  .holding-row > :nth-child(1) button,
  .holding-row > :nth-child(9) button {
    width: 100% !important; min-width: 0 !important; padding: 5px 0 !important;
  }
  /* ⑦ sparkline(수익률버튼) → r2, 탭하면 r3로 펼침 */
  .holding-row > :nth-child(7) {
    grid-column: 10/13;
    grid-row: 2;
    min-width: 0 !important;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 30px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 4px 3px;
    overflow: hidden;
  }
  /* 접힘 상태: 그래프(svg) 숨기고 "📈 +수익률%" 버튼 */
  .holding-row > :nth-child(7) svg { display: none !important; }
  .holding-row > :nth-child(7)::before { content: "📈"; font-size: 11px; flex: none; }
  .holding-row > :nth-child(7) .spark-pct-label { margin: 0; font-size: 11px; flex: none; }
  /* 펼침 상태(.spark-open): r4 전체폭에 그래프 표시 */
  .holding-row.spark-open > :nth-child(7) {
    grid-column: 1/13;
    grid-row: 3;
    flex-direction: column;
    align-items: stretch;
    background: transparent;
    border: none;
    padding: 4px 0;
    min-height: 46px;
  }
  .holding-row.spark-open > :nth-child(7) svg { display: block !important; height: 36px !important; width: 100% !important; }
  .holding-row.spark-open > :nth-child(7)::before { display: none; }
  .holding-row.spark-open > :nth-child(7) .spark-pct-label { text-align: center; margin-top: 1px; }

  /* 재무·배당 미니차트(.mini-chart)는 모바일에서도 막대 표시 — 가격 스파크라인만 접음 */
  .holding-row > :nth-child(7):has(.mini-chart)::before { display: none; }
  .holding-row > :nth-child(7) .mini-chart svg {
    display: block !important;
    height: 24px !important;
    flex: 1 1 auto;
    min-width: 0;
    width: auto !important;
  }

  /* 모달 사이드 패널(연간 배당표·QoQ표)은 모바일에서 차트 아래 전체폭 */
  .modal-side {
    flex: 1 1 100% !important;
    max-width: none !important;
    border-left: none !important;
    padding-left: 0 !important;
    align-self: stretch !important;
    margin-top: 6px;
  }

  /* inputs full-width */
  .holding-row input[type=number],
  .holding-row input[type=text]   { max-width:none !important; width:100% !important; font-size:12px; padding:5px 6px; }

  /* 평가금액 — 좁은 셀에 맞게 작은 폰트 */
  .holding-row .notional-display { font-size:10.5px !important; padding:5px 6px !important; gap:1px; }
  .holding-row .notional-num     { font-size:10.5px; }
  .holding-row .notional-sym     { font-size:10px; }
  .holding-row select              { max-width:none !important; width:100% !important; font-size:12px; padding:5px 6px; }

  /* name-search-wrap full width */
  .name-search-wrap { width:100%; }

  /* metric grid: 2×2 */
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .metric-card { padding: 14px 16px; }
  .metric-value { font-size: 20px; }

  /* optimize results: single column */
  #optResult .grid-2 { grid-template-columns: minmax(0, 1fr); }

  /* weight delta list */
  .delta-row { grid-template-columns: 1.2fr 60px 60px; }
  .delta-row .arrow { display: none; }

  /* BL add grid → single column */
  .bl-add-grid { grid-template-columns: 1fr; }
  .bl-params { grid-template-columns: 1fr 1fr; }

  /* footer CTA */
  .footer-cta { flex-wrap: wrap; gap: 8px; }
  .footer-cta .btn-primary { margin-left: 0; flex: 1 0 100%; text-align: center; }
  .footer-cta .btn-ghost   { flex: 1; }
  .footer-cta .cta-stress  { flex: 1 0 100%; text-align: center; }  /* 스트레스 버튼은 모바일에서 한 줄 전체 */

  /* summary row */
  .summary-row .big { font-size: 20px; }

  /* history rows */
  .history-row {
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto auto auto;
    gap: 6px 8px;
  }
  .history-row .label { grid-column: 2; grid-row: 1; }
  .history-row .meta  { grid-column: 2; grid-row: 2; }
  .history-row .pill  { grid-column: 1 / -1; grid-row: 3; }
  .history-row button { grid-column: 3; grid-row: 1; }

  /* chart heights */
  .chart-wrap       { height: 240px; }
  .chart-wrap.small { height: 200px; }
  .wt-chart         { height: 240px !important; }

  .persona-grid { grid-template-columns: 1fr; }

  /* compare bar */
  #compareBar { bottom: 72px; }
}

/* ── 480px: phone adjustments ── */
@media (max-width: 480px) {
  .topbar-inner { padding: 10px 12px; }
  .brand-name { font-size: 15px; }

  .content { padding: 16px 16px 72px; }

  .hero-title { font-size: 20px; }
  .hero-sub   { font-size: 12px; }

  .card { padding: 14px 12px; }

  .seg button { padding: 8px 10px; font-size: 12px; }
  .seg-lg button { padding: 10px 14px; font-size: 13px; }

  .btn-primary { padding: 14px 20px; font-size: 14px; }
  .btn-ghost   { padding: 10px 14px; font-size: 13px; }

  .metric-value { font-size: 18px; }
  .metric-card  { padding: 12px 14px; }

  /* weights donuts: single column on phones */
  .weights-grid { grid-template-columns: 1fr; }

  /* frontier legend wrap */
  .frontier-legend { gap: 10px; }
}

/* ════════════════════════════════════════════════════════════════
   투자 성향 진단 + GAP 분석 — styles
   ════════════════════════════════════════════════════════════════ */

/* ── 투자자 유형 필 ─────────────────────────────────────────── */
.profile-type-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 99px;
  vertical-align: middle;
}

/* ── 인트로 그리드 ───────────────────────────────────────────── */
.profile-intro {
  padding: 8px 0 4px;
}
.profile-intro-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 8px;
}
@media (max-width: 540px) {
  .profile-intro-grid { grid-template-columns: 1fr; }
}
.profile-intro-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.profile-intro-icon {
  color: var(--text-sub);
  display: inline-flex;
  align-items: center;
  line-height: 0;
  flex-shrink: 0;
  margin-top: 1px;
}
.profile-intro-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.profile-intro-text strong {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}
.profile-intro-text span {
  font-size: 12px;
  color: var(--text-mute);
}

/* ── 퀴즈 ────────────────────────────────────────────────────── */
.profile-quiz {
  padding: 4px 0 8px;
}
.profile-quiz-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.profile-quiz-prog-bar {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.profile-quiz-prog-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 99px;
  transition: width 0.3s ease;
}
.profile-quiz-prog-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-mute);
  white-space: nowrap;
}
.profile-quiz-question {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.profile-q-emoji {
  font-size: 28px;
  flex-shrink: 0;
}
.profile-q-text {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
  line-height: 1.4;
}
.profile-option-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
@media (max-width: 540px) {
  .profile-option-grid { grid-template-columns: 1fr; }
  .profile-q-text { font-size: 15px; }
}
.profile-option-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 14px 16px;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  font-family: inherit;
}
.profile-option-btn:hover {
  border-color: var(--primary);
  background: rgba(49, 130, 246, 0.04);
  transform: translateY(-1px);
}
.profile-option-btn.selected {
  border-color: var(--primary);
  background: rgba(49, 130, 246, 0.08);
  box-shadow: 0 0 0 2px rgba(49, 130, 246, 0.15);
}
.profile-opt-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}
.profile-opt-sub {
  font-size: 12px;
  color: var(--text-mute);
}
.profile-quiz-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 4px;
}
.profile-quiz-skip:hover { color: var(--text-main) !important; }

/* ── 결과 ────────────────────────────────────────────────────── */
.profile-result {
  padding: 4px 0 8px;
}
.profile-result-hero {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px;
  border: 1.5px solid;
  border-radius: 14px;
  margin-bottom: 16px;
}
.profile-result-emoji {
  font-size: 32px;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  flex-shrink: 0;
}
.profile-result-info { flex: 1; }

/* 강점·약점 그리드 */
.profile-sw-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
@media (max-width: 540px) {
  .profile-sw-grid { grid-template-columns: 1fr; }
}
.profile-sw-col { display: flex; flex-direction: column; gap: 6px; }
.profile-sw-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}
.profile-sw-item {
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 7px;
  font-weight: 500;
}
.profile-sw-item.strength { background: rgba(32, 201, 151, 0.08); color: #157060; }
.profile-sw-item.weakness { background: rgba(240, 68, 82, 0.08);  color: #b52030; }

/* 섹션 */
.profile-section {
  margin-bottom: 18px;
}
.profile-section-sub {
  font-size: 12.5px;
  color: var(--text-mute);
  margin: 4px 0 12px;
  line-height: 1.55;
}

/* ── 투자 원칙 섹션 ── */
.profile-section-principles {
  background: #f8fafc;
  border-radius: 12px;
  padding: 16px;
  border: 1px solid var(--border-strong);
}
.principle-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
.principle-metric {
  background: #fff;
  border-radius: 10px;
  padding: 12px;
  text-align: center;
  border: 1px solid var(--border-strong);
}
.principle-metric-val {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 4px;
}
.principle-metric-label {
  font-size: 10.5px;
  color: var(--text-mute);
  line-height: 1.3;
}
.principle-detail-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
}
.principle-detail-row:last-of-type { border-bottom: none; }
.principle-detail-label {
  color: var(--text-mute);
  min-width: 90px;
  font-size: 12px;
}
.principle-detail-val {
  color: var(--text);
  font-weight: 600;
}
.principle-notes {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.principle-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.5;
}
.principle-note-num {
  min-width: 20px;
  height: 20px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ── 최적화 가이드 섹션 ── */
.profile-section-optguide {
  background: #fffbf0;
  border-radius: 12px;
  padding: 16px;
  border: 1px solid #fde68a;
}
.opt-guide-recommend {
  background: #fff;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.opt-guide-method-label {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
}
.opt-guide-reason {
  font-size: 12.5px;
  color: var(--text-mute);
  margin: 0;
  line-height: 1.6;
}
.opt-guide-steps-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.opt-guide-steps {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.opt-guide-step {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.5;
}
.opt-guide-step-num {
  min-width: 22px;
  height: 22px;
  background: #f59e0b;
  color: #fff;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.opt-guide-alt {
  font-size: 12px;
  color: var(--text-mute);
  background: #f9fafb;
  border-radius: 7px;
  padding: 8px 12px;
  line-height: 1.5;
}
.opt-guide-alt-label {
  font-size: 10px;
  font-weight: 700;
  color: #6b7280;
  background: #e5e7eb;
  border-radius: 4px;
  padding: 1px 6px;
  margin-right: 6px;
}
@media (max-width: 640px) {
  .principle-grid { grid-template-columns: repeat(2, 1fr); }
}

.profile-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 10px;
}

/* 추천 배분 바 */
.profile-rec-bar {
  display: flex;
  height: 18px;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 10px;
}
.profile-rec-seg { flex-shrink: 0; transition: width 0.3s; }
.profile-rec-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}
.profile-rec-leg-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-sub);
}
.profile-rec-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* GAP placeholder */
.profile-gap-placeholder {
  padding: 16px;
  border: 1.5px dashed var(--border);
  border-radius: 10px;
  text-align: center;
}

/* GAP 테이블 */
.gap-table-wrap {
  overflow-x: auto;
  margin-bottom: 10px;
}
.gap-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.gap-table th {
  padding: 7px 10px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  white-space: nowrap;
}
.gap-row td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.gap-row:last-child td { border-bottom: none; }
.gap-dim { font-size: 13px; min-width: 52px; }
.gap-bar-wrap {
  width: 80px;
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}
.gap-bar-fill {
  height: 100%;
  border-radius: 99px;
}
.gap-bar-fill.current { background: var(--primary); }
.gap-bar-fill.ideal   { background: #20c997; }
.gap-val {
  font-size: 11px;
  color: var(--text-mute);
  vertical-align: middle;
}
.gap-status {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 99px;
  white-space: nowrap;
}
.gap-status.gap-ok    { background: rgba(32,201,151,0.12); color: #157060; }
.gap-status.gap-over  { background: rgba(255,176,32,0.12);  color: #a06000; }
.gap-status.gap-under { background: rgba(49,130,246,0.12);  color: #1453c8; }
.gap-rec {
  font-size: 11.5px;
  max-width: 160px;
  line-height: 1.4;
}

/* GAP 요약 */
.profile-gap-summary { margin-top: 6px; }
.profile-gap-summary-text {
  font-size: 13px;
  color: var(--text-sub);
  padding: 10px 14px;
  background: rgba(255, 176, 32, 0.07);
  border-left: 3px solid #ffb020;
  border-radius: 0 8px 8px 0;
  line-height: 1.5;
}
.profile-gap-warn-icon {
  margin-right: 4px;
  color: #ffb020;
}
.profile-all-ok {
  font-size: 13px;
  color: #157060;
  padding: 10px 14px;
  background: rgba(32, 201, 151, 0.07);
  border-left: 3px solid #20c997;
  border-radius: 0 8px 8px 0;
}

/* 하단 CTA */
.profile-cta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 8px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
}

/* 연구 기반 뷰 — 투자자 유형 추천 배지 */
.research-card-relevant {
  border-color: rgba(49, 130, 246, 0.35) !important;
  box-shadow: 0 0 0 2px rgba(49, 130, 246, 0.10);
}
.research-profile-badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  background: rgba(49, 130, 246, 0.12);
  color: #1453c8;
  white-space: nowrap;
}


/* ---- Sparkline (YoY mini chart) ---- */
.sparkline-wrap {
  width: 100%;
  height: auto;
  min-width: 80px;
  display: flex;
  flex-direction: column;
  overflow: visible;
}
.sparkline-wrap svg {
  display: block;
  flex-shrink: 0;
}

/* ── 증권 그룹 (드래그앤드롭 바스켓) ───────────────────────────── */
#groupsArea { margin-top: 14px; }
.groups-empty {
  margin-top: 6px; padding: 14px 16px; font-size: 12.5px; line-height: 1.6;
  color: var(--text-mute); border: 1px dashed var(--border-strong); border-radius: 8px;
  background: rgba(0,0,0,.012);
}
.groups-empty b { color: var(--text); }
.groups-head {
  display: flex; align-items: baseline; gap: 10px; margin: 4px 2px 8px;
}
.groups-title { font-family: var(--font-serif); font-size: 15px; color: var(--text); }
.groups-hint  { font-size: 11px; color: var(--text-mute); }

.grp-basket {
  border: 1px solid var(--border-strong); border-radius: 8px; padding: 8px 10px 10px;
  margin-bottom: 10px; background: #fff;
}
.grp-basket.grp-pool { background: rgba(0,0,0,.015); border-style: dashed; }
.grp-basket-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 7px;
}
.grp-basket-name { font-weight: 600; font-size: 13px; color: var(--text); }
.grp-name-input {
  font-family: var(--font-serif); font-size: 14px; font-weight: 600; color: var(--text);
  border: none; border-bottom: 1px solid transparent; background: transparent;
  padding: 1px 2px; flex: 0 1 auto; min-width: 60px; max-width: 220px; outline: none;
}
.grp-name-input:hover  { border-bottom-color: var(--border-strong); }
.grp-name-input:focus  { border-bottom-color: var(--primary); }
.grp-count {
  font-size: 10.5px; color: var(--text-mute); background: rgba(0,0,0,.05);
  border-radius: 10px; padding: 1px 7px; min-width: 16px; text-align: center;
}
.grp-del {
  margin-left: auto; border: none; background: transparent; color: var(--text-mute);
  font-size: 17px; line-height: 1; cursor: pointer; padding: 0 4px; border-radius: 4px;
}
.grp-del:hover { color: var(--primary); background: rgba(110,30,43,.08); }

.grp-dropzone {
  display: flex; flex-wrap: wrap; gap: 6px; min-height: 38px;
  padding: 6px; border-radius: 6px; transition: background .12s, box-shadow .12s;
  align-content: flex-start;
}
.grp-dropzone.drag-over {
  background: rgba(110,30,43,.06); box-shadow: inset 0 0 0 1.5px var(--primary);
}
.grp-placeholder { font-size: 11px; color: var(--text-mute); padding: 4px 4px; align-self: center; }

.grp-chip {
  display: inline-flex; align-items: center; gap: 6px; cursor: grab;
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: 6px;
  padding: 4px 9px; font-size: 12px; color: var(--text); user-select: none;
  transition: border-color .12s, box-shadow .12s;
}
.grp-chip:hover { border-color: var(--primary); }
.grp-chip:active { cursor: grabbing; }
.grp-chip.dragging { opacity: .45; }
.grp-chip-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--primary); flex-shrink: 0;
}
.grp-chip-grip {
  display: inline-flex; align-items: center; flex-shrink: 0;
  color: var(--text-mute); opacity: .65; cursor: grab; line-height: 0;
}
.grp-chip:hover .grp-chip-grip { color: var(--primary); opacity: 1; }
.grp-chip:active .grp-chip-grip { cursor: grabbing; }
.grp-chip-sub { font-size: 10px; color: var(--text-mute); margin-left: 2px; }

/* ── 포트폴리오 바: 모바일에서 생성/불러오기/저장 버튼 줄바꿈 ────────── */
.pf-bar-actions { flex-shrink: 0; }
/* 태블릿 폭(641~1000px)에서 단추 다섯이 한 줄로 카드 밖까지 26px 넘쳐 페이지가 옆으로 밀렸다 — 카드 폭 안에서 줄을 바꾼다 (2026-09-28) */
#portfolioBar .pf-bar-actions { flex-wrap: wrap; max-width: 100%; }
@media (max-width: 640px) {
  #portfolioBar .pf-bar-actions {
    width: 100%;
    flex-wrap: wrap;
    flex-shrink: 1;
  }
  #portfolioBar .pf-bar-actions button {
    flex: 1 1 calc(50% - 4px);   /* 한 줄에 2개씩, 넘치면 줄바꿈 */
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 10px;
    padding-right: 10px;
    white-space: nowrap;
  }
  /* 생성 버튼은 한 줄 전체 (가장 중요) */
  #portfolioBar .pf-bar-actions #btnCreatePortfolio { flex-basis: 100%; }
}

/* ── 포스트잇 메모 위젯 (좌우 여백) ───────────────────────────── */
.sticky-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;   /* 레이어는 클릭 통과, 메모만 클릭 받음 */
  z-index: 45;
}
.sticky-note {
  position: fixed;
  display: flex;
  flex-direction: column;
  width: 152px;
  min-height: 108px;
  padding: 24px 13px 14px;
  box-sizing: border-box;
  font-family: 'Gaegu', 'Nanum Pen Script', system-ui, cursive;
  font-size: 17px;
  line-height: 1.42;
  color: #463c30;
  background: #fff7ae;
  border-radius: 2px;
  box-shadow: 1px 4px 12px rgba(0, 0, 0, .16), 0 1px 2px rgba(0, 0, 0, .08);
  pointer-events: auto;
  cursor: grab;            /* 본체를 잡으면 이동 */
  transition: box-shadow .15s ease;
}
.sticky-note:hover {
  box-shadow: 2px 7px 18px rgba(0, 0, 0, .22), 0 1px 2px rgba(0, 0, 0, .1);
  z-index: 2;
}
.sticky-note.dragging {
  cursor: grabbing;
  z-index: 200;
  user-select: none;
  transition: none;
  box-shadow: 3px 11px 26px rgba(0, 0, 0, .3);
}
/* 빨간 압정 핀 */
.sticky-pin {
  position: absolute;
  top: -9px;
  left: 50%;
  margin-left: -8px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #ff9c8f 0%, #e04338 45%, #b5281f 100%);
  box-shadow: 0 2px 4px rgba(0, 0, 0, .35), inset -1px -1px 2px rgba(0, 0, 0, .25);
}
.sticky-pin::after {        /* 핀 바늘 그림자 */
  content: '';
  position: absolute;
  top: 13px;
  left: 50%;
  width: 2px;
  height: 7px;
  margin-left: -1px;
  background: rgba(0, 0, 0, .18);
  transform: rotate(8deg);
  transform-origin: top center;
}
.sticky-text {
  flex: 1 1 auto;          /* 높이 고정 시 텍스트가 남은 공간 채움 */
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-y: auto;        /* 내용이 넘치면 메모 안에서 스크롤 */
  min-height: 78px;
  cursor: text;
}
.sticky-text:empty::before {
  content: attr(data-ph);
  color: rgba(0, 0, 0, .3);
}
/* 우하단 크기조절 그립 */
.sticky-resize {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 15px;
  height: 15px;
  cursor: nwse-resize;
  opacity: 0;
  transition: opacity .15s ease;
  background: linear-gradient(135deg,
    transparent 0 46%, rgba(0, 0, 0, .3) 46% 54%,
    transparent 54% 66%, rgba(0, 0, 0, .3) 66% 74%, transparent 74%);
}
.sticky-note:hover .sticky-resize { opacity: .7; }
/* 좌하단 회전 핸들 */
.sticky-rotate {
  position: absolute;
  left: 3px;
  bottom: 2px;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(0, 0, 0, .42);
  cursor: grab;
  opacity: 0;
  transition: opacity .15s ease;
}
.sticky-note:hover .sticky-rotate { opacity: .7; }
.sticky-rotate:active { cursor: grabbing; }
.sticky-del {
  position: absolute;
  top: 0;
  right: 4px;
  border: none;
  background: transparent;
  font-size: 18px;
  line-height: 1.2;
  color: rgba(0, 0, 0, .32);
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s ease;
}
.sticky-note:hover .sticky-del { opacity: 1; }
.sticky-del:hover { color: rgba(0, 0, 0, .6); }

.sticky-toolbar {
  position: fixed;
  left: 14px;
  bottom: 14px;
  z-index: 46;
  display: flex;
  gap: 8px;
}
.sticky-add,
.sticky-save {
  display: inline-flex;
  align-items: center;
  border: none;
  border-radius: 22px;
  padding: 8px 15px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .2px;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .22);
  transition: filter .15s ease, transform .1s ease;
}
.sticky-add { background: var(--primary, #7b2d3a); color: #fff; }
.sticky-save { background: #fff; color: var(--primary, #7b2d3a); border: 1px solid var(--primary, #7b2d3a); }
.sticky-add:hover, .sticky-save:hover { filter: brightness(1.05); }
.sticky-add:active, .sticky-save:active { transform: translateY(1px); }

/* 본문(1080px) 양옆 여백이 부족한 화면에선 여백 포스트잇 숨김 */
@media (max-width: 1365px) {
  .sticky-layer,
  .sticky-toolbar { display: none; }
}

/* 메모 리스트 버튼 (좌하단 고정) */
.sticky-mfab {
  position: fixed;
  left: 14px;
  bottom: 14px;
  z-index: 46;
  display: none;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  background: var(--primary, #7b2d3a);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(0, 0, 0, .25);
}
@media (max-width: 1365px) {
  .sticky-mfab { display: flex; align-items: center; justify-content: center; }
}
/* 리스트 모드: 화면 크기와 무관하게 메모 버튼 표시 */
.sticky-mfab.force { display: flex !important; align-items: center; justify-content: center; }
/* 모바일: 하단 네비 위로 올림 */
@media (max-width: 768px) {
  .sticky-mfab { bottom: 78px; }
}

/* ── 국내 팩터 베팅 (추정 팩터모델 익스포저) ───────────────────────────── */
/* 0이 시장 평균이라 막대를 가운데 축 기준 좌우로 뻗게 그린다 — 부호가 곧 베팅 방향 */
.fx-block { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.fx-head { font-size: 13px; font-weight: 700; color: var(--text); }
.fx-bar {
  position: relative;
  width: 120px;
  height: 8px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
}
.fx-axis {
  position: absolute; left: 50%; top: 0; bottom: 0;
  width: 1px; background: var(--border);
}
.fx-fill { position: absolute; top: 1px; bottom: 1px; border-radius: 2px; }
.fx-fill.pos { background: var(--primary); }
.fx-fill.neg { background: #e8590c; }
.fx-z {
  font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.fx-z.pos { color: var(--primary); }
.fx-z.neg { color: #e8590c; }

/* ── 서브탭: 하단 탭별 세부 화면 전환 ─────────────────────────────────────
   모바일은 헤더 아래 가로 스크롤 바, 데스크탑(861px~)은 본문 왼쪽 레일.
   한 탭에 카드가 최대 8개까지 쌓여 모바일 스크롤이 과도하게 길어지던 걸 나눈다. */
.shell { display: block; }
.subtab-bar {
  display: flex;
  gap: 6px;
  padding: 10px 16px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  /* 헤더(.topbar, sticky top:0) 바로 아래에 붙여 스크롤해도 남아 있게 한다.
     모바일에서 카드가 길어질수록 세부 화면 전환이 화면 밖으로 사라지면 안 된다. */
  position: sticky;
  top: 55px;                      /* .topbar 실측 높이 — 겹치면 알약 상단이 잘린다 */
  z-index: 40;
  background: rgba(255,255,255,.94);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.subtab-bar::-webkit-scrollbar { display: none; }
.subtab {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-mute);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 99px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
}
.subtab:hover { color: var(--text); border-color: var(--border-strong); }
.subtab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.subtab .st-s { display: none; }                 /* 짧은 이름 — 좁은 휴대폰에서만 (Black-Litterman → BL) */
/* 휴대폰 · 태블릿 가로 막대 — 칩이 왼쪽에 몰려 오른쪽이 비어 보였다(2026-09-29 사용자) → 남는 폭을 칩이 나눠 가져 막대 너비를 채운다.
   다 못 들어가면 예전처럼 옆으로 밀어 본다 */
@media (max-width: 860px) {
  .subtab { flex: 1 0 auto; text-align: center; padding: 7px 10px; }
}
@media (max-width: 560px) {
  .subtab .st-l { display: none; }
  .subtab .st-s { display: inline; }
}
@media (max-width: 400px) {
  .subtab-bar { gap: 4px; }
  .subtab { padding: 7px 8px; font-size: 12px; }
}

@media (min-width: 861px) {
  /* 레일을 화면에 고정한다. sticky는 부모(.shell) 안에서만 붙어 있어서 페이지 위·아래
     끝에서는 흐름을 따라 흘러가 버렸다. fixed로 두면 스크롤 위치와 무관하게 항상
     화면 왼쪽 중앙에 머문다 — 사용자의 시선이 어디에 있든 같은 자리에 있다.
     대신 흐름에서 빠지므로 본문 왼쪽에 레일 폭만큼 여백을 만들어 자리를 비워 준다. */
  .shell {
    display: block;
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 24px;
    box-sizing: border-box;
  }
  .subtab-bar {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    /* 콘텐츠 영역(최대 1080px, 좌우 24px 패딩)의 왼쪽 끝에 맞춘다.
       화면이 1080px보다 좁으면 24px에 붙는다. */
    left: max(24px, calc(50vw - 516px));
    width: 156px;
    flex-direction: column;
    gap: 2px;
    padding: 0;
    max-height: calc(100vh - 150px);
    overflow-y: auto;
    scrollbar-width: none;
    /* 떠 있는 패널로 읽히도록 옅은 테두리와 아주 연한 바탕을 준다 */
    background: rgba(255,255,255,.72);
    backdrop-filter: saturate(140%) blur(8px);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 1px 6px rgba(0,0,0,.03);
    padding: 6px;
    z-index: 30;                 /* 헤더(50)·모달(9000+)보다 아래 */
    /* 스크롤을 따라 미세하게 흘렀다 제자리로 돌아오는 움직임은 JS(_subRailFollow)가
       transform으로 준다. will-change로 매 프레임 리페인트를 피한다. */
    will-change: transform;
  }
  @media (prefers-reduced-motion: reduce) {
    .subtab-bar { transition: none !important; }
  }
  .subtab-bar::-webkit-scrollbar { display: none; }
  .subtab {
    width: 100%;
    text-align: left;
    border: none;
    border-left: 2px solid transparent;
    border-radius: 0 6px 6px 0;
    padding: 9px 12px;
    font-size: 13px;
  }
  .subtab:hover { background: var(--bg); color: var(--text); }
  .subtab.active {
    background: var(--primary-soft);
    border-left-color: var(--primary);
    color: var(--primary-strong);
  }
  /* 레일이 fixed라 흐름에서 빠졌으므로, 본문 왼쪽에 레일 폭(156)+간격(20)만큼 비운다 */
  .content { width: auto; max-width: none;
             padding: 32px 0 96px 176px; min-width: 0; }
}

/* 서브탭이 선택을 대신하므로 기존 중복 선택 UI는 감춘다.
   · #methodCardsRow — 최적화 방법 5장 카드. 각 방법의 설명은 선택된 패널의
     .method-panel-desc 에 그대로 있으므로 정보가 사라지지 않는다.
   · #researchCats   — 리서치 카테고리 버튼. 서브탭과 완전히 같은 목록이다.
   DOM에는 남겨둔다 — 서브탭이 이 요소들을 프로그램적으로 클릭해 구동한다. */
#methodCardsRow, #researchCats { display: none !important; }

/* ── 매크로 주요지표: 지표당 카드 1장 ────────────────────────────────────
   종전 한 줄 티커(.macro-ticker)는 흐르는 동안 원하는 지표를 붙잡기 어려웠다.
   격자는 한눈에 다 보이고 개수가 늘어도 줄만 늘어난다. */
.macro-ind-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: stretch;
  text-align: left;
  font-family: inherit;
  background: var(--bg-soft, #f6f3ec);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px 10px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.macro-ind-card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 2px 10px rgba(0,0,0,.05);
  transform: translateY(-1px);
}
.mic-name {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-mute);
  letter-spacing: .01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mic-val {
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.mic-unit { font-size: 11.5px; font-weight: 500; color: var(--text-mute); margin-left: 3px; }
.mic-chg { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.mic-spark { display: block; margin-top: 6px; height: 34px; }

/* 모바일: 12개 카드가 1열이면 스크롤이 과도하게 길다. 최소폭을 줄여 2열이 들어가게 한다
   (375px 화면 기준 가용폭 ~330px → 150px 2열 + gap 10px). */
@media (max-width: 520px) {
  .macro-grid { grid-template-columns: repeat(auto-fit, minmax(142px, 1fr)); gap: 10px; }
  .macro-ind-card { padding: 10px 11px 9px; }
  .mic-val { font-size: 16.5px; }
  .mic-spark { height: 28px; }
  .mic-spark svg { height: 28px !important; }
}

/* ── 모바일: 포지션 저장을 기준일 옆으로 ─────────────────────────────────
   상단 포트폴리오 바에 버튼이 5개 늘어서 있어 모바일에서 2줄을 차지했다.
   가장 자주 쓰는 '포지션 저장'만 기준일 옆으로 내리고 아이콘만 남긴다.
   데스크탑은 종전 그대로(상단 바에 글자 버튼). */
.save-inline { display: none; }
@media (max-width: 720px) {
  /* '기준 통화 [KRW] 기준일 [날짜] [저장]'이 한 줄에 들어가도록 폭을 깎는다.
     날짜 입력은 네이티브라 내재 폭이 커서 폰트·패딩을 줄여야 줄바꿈이 안 난다. */
  /* 한 줄에 다 넣으려면 328px가 필요한데 가용폭이 326px였다 — 간격·라벨을 조인다 */
  .pos-meta-row { gap: 5px !important; }
  .pos-meta-lbl { font-size: 11px !important; margin-left: 0 !important; }
  #baseCurrencySelect { padding: 3px 4px; font-size: 11.5px; }
  .asof-date {
    font-size: 11.5px !important;
    padding: 3px 4px !important;
    max-width: 104px;
  }
  .save-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 9px;
    margin-left: 2px;
    line-height: 1;
    color: var(--primary);
    border-color: var(--primary);
  }
  .save-inline svg { margin: 0; }
  /* 기존 `#portfolioBar .pf-bar-actions button {display:flex}` (명시도 1,1,1)이
     단독 ID(1,0,0)를 이긴다. 부모 ID를 붙여 (2,0,0)으로 올린다. */
  #portfolioBar #btnSavePortfolio { display: none; }
}

/* ── 시장 히트맵 (KSIC 대분류 > 중분류 > 종목 트리맵) ─────────────────
   타일은 JS가 절대좌표로 배치한다(squarified treemap). 여기서는 색·글자만 맡는다.
   배색이 앱의 다른 지표와 반대다 — 히트맵은 하락=빨강 / 상승=초록. */
.kh-wrap {
  position: relative;
  width: 100%;
  height: 560px;
  margin-top: 6px;
  border-radius: 10px;
  overflow: hidden;
  background: #262b34;
  cursor: zoom-in;
}
.kh-msg {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: #9aa3b2; font-size: 13px;
}
.kh-g, .kh-sec { position: absolute; overflow: hidden; }
/* 대분류(제조업·금융보험업…) 머리글 — 가장 어둡게 해서 층위를 구분한다 */
.kh-g-t {
  /* height 는 JS(KH_GH)가 인라인으로 덮어쓴다 — 트리맵이 그 높이만큼 자식 영역을
     줄여 잡으므로 두 값이 어긋나면 타일이 머리글에 깔린다. 여기 값은 대비용. */
  position: absolute; left: 0; top: 0; right: 0; height: 17px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; letter-spacing: .02em;
  color: #e7ecf3; background: #0f1319;
  white-space: nowrap; overflow: hidden;
}
/* 중분류(전자·자동차·화학…) 머리글 */
.kh-sec-t {
  position: absolute; left: 0; top: 0; right: 0; height: 15px;   /* JS(KH_SH)와 일치 */
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 600; letter-spacing: .01em;
  color: #aeb8c8; background: #1b2029;
  white-space: nowrap; overflow: hidden;
}
.kh-t {
  position: absolute;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 0 2px;
  overflow: hidden;
  color: #fff; line-height: 1.15; text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .45);
  /* 경계선을 border로 주면 타일 크기가 밀려 면적이 어긋난다 — inset shadow로 그린다 */
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .3);
}
.kh-t:hover { box-shadow: inset 0 0 0 2px #fff; z-index: 2; }
.kh-n {
  font-weight: 700; max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kh-p { font-weight: 600; opacity: .93; }
.kh-e { font-size: 10px; opacity: .55; }

/* 머리 오른쪽 조작(날짜 · 시장 · 범례 · 새로고침)이 줄바꿈 없이 이어져 좁은 화면 · 좌측 레일이 있는 900px 에서 카드 밖으로 넘쳤다 (2026-09-28) */
#kospiHeatCard .card-header { flex-wrap: wrap; gap: 10px; }
#kospiHeatCard .card-header > div:last-child { flex-wrap: wrap; max-width: 100%; }

/* 시장 탭 — 위 한국 · 미국, 한국이면 옆에 코스피 · 코스닥 (2026-10-06) */
.kh-tabs { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kh-seg {
  display: inline-flex; gap: 2px; padding: 2px;
  background: var(--bg-subtle, #f4f4f5);
  border: 1px solid var(--border); border-radius: 8px;
}
.kh-seg-sub { padding: 1px; border-style: dashed; }
.kh-seg-sub .kh-tab { font-size: 11px; padding: 3px 8px; }
.kh-tab {
  border: 0; background: transparent; cursor: pointer;
  font-size: 12px; font-weight: 600; color: var(--text-mute, #8b95a1);
  padding: 4px 10px; border-radius: 6px; line-height: 1.4;
}
.kh-tab:hover { color: var(--text, #191f28); }
.kh-tab.active {
  background: #fff; color: var(--text, #191f28);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}

.kh-legend { display: flex; border-radius: 6px; overflow: hidden; }
.kh-legend i {
  font-style: normal; font-size: 10px; font-weight: 600;
  color: #fff; padding: 3px 6px; line-height: 1.4;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .4);
}

/* 크게 보기 모달 */
.kh-modal {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0, 0, 0, .55);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.kh-modal-box {
  background: #fff; border-radius: 16px; padding: 14px 14px 12px;
  width: min(1600px, 96vw); height: min(1000px, 92vh);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .3);
  display: flex; flex-direction: column;
}
.kh-modal-hd {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 8px; flex-wrap: wrap;
}
.kh-modal-t { font-size: 15px; font-weight: 700; color: var(--text, #191f28); margin-right: auto; }
.kh-modal-x {
  border: 1px solid var(--border); background: #fff; cursor: pointer;
  width: 28px; height: 28px; border-radius: 8px;
  font-size: 13px; color: var(--text-mute, #8b95a1); line-height: 1;
}
.kh-modal-x:hover { background: var(--bg-subtle, #f4f4f5); color: var(--text, #191f28); }
/* 모달 안에서는 남는 높이를 전부 쓴다 */
.kh-modal .kh-wrap { flex: 1; height: auto; min-height: 0; margin-top: 0; cursor: default; }

@media (max-width: 860px) {
  .kh-wrap { height: 460px; }
}
@media (max-width: 560px) {
  .kh-wrap { height: 380px; }
  .kh-legend { display: none; }   /* 헤더가 좁아 범례가 제목을 밀어낸다 */
  .kh-modal { padding: 8px; }
  .kh-modal-box { width: 100vw; height: 100vh; border-radius: 0; }
}

/* ── 리스크 산출 방식 탭 (Time series / Factor) ───────────────────── */
.rt-tabs {
  display: inline-flex; gap: 2px; padding: 2px; margin-bottom: 14px;
  background: var(--bg-subtle, #f4f4f5);
  border: 1px solid var(--border); border-radius: 8px;
}
.rt-tab {
  border: 0; background: transparent; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--text-mute, #8b95a1);
  padding: 6px 14px; border-radius: 6px; line-height: 1.4;
}
.rt-tab:hover { color: var(--text, #191f28); }
.rt-tab.active {
  background: #fff; color: var(--text, #191f28);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}

/* ── 팩터 리스크 분해 ──────────────────────────────────────────── */
.fr-top {
  display: flex; gap: 22px; align-items: center; flex-wrap: wrap;
  padding: 14px 0 6px;
}
.fr-total { display: flex; flex-direction: column; gap: 2px; min-width: 150px; }
.fr-total-l { font-size: 12px; color: var(--text-mute, #8b95a1); }
.fr-total-v { font-size: 30px; font-weight: 700; color: var(--text, #191f28); line-height: 1.1; }
.fr-buckets { flex: 1; min-width: 300px; display: flex; flex-direction: column; gap: 5px; }
.fr-b {
  display: grid; grid-template-columns: 86px 1fr 66px 44px;
  align-items: center; gap: 8px; font-size: 12px;
}
.fr-b-l { display: flex; align-items: center; gap: 6px; font-weight: 600; color: var(--text, #191f28); }
.fr-b-l i { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.fr-b-bar { height: 8px; background: var(--bg-subtle, #f1f3f5); border-radius: 4px; overflow: hidden; }
.fr-b-bar i { display: block; height: 100%; border-radius: 4px; }
.fr-b-v { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.fr-b-p { text-align: right; color: var(--text-mute, #8b95a1); font-variant-numeric: tabular-nums; }

.fr-h {
  font-size: 13px; font-weight: 700; color: var(--text, #191f28);
  margin: 20px 0 8px;
}
.fr-tw { overflow-x: auto; }          /* 좁은 화면에서 표만 가로 스크롤 */
.fr-t { width: 100%; border-collapse: collapse; font-size: 12px; }
.fr-t th, .fr-t td {
  padding: 6px 8px; text-align: left; white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.fr-t th { font-weight: 600; color: var(--text-mute, #8b95a1); }
.fr-t td { font-variant-numeric: tabular-nums; }
.fr-t .r { text-align: right; }
.fr-t .neg { color: #1f6feb; }        /* 상쇄(음수) 기여 — 위험이 아니라 헤지 */
.fr-t tbody tr:last-child td { border-bottom: 0; }
.fr-kind {
  display: inline-block; font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 4px; border: 1px solid;
}
.fr-foot { font-size: 11px; line-height: 1.6; margin: 14px 0 0; }

@media (max-width: 560px) {
  .fr-total-v { font-size: 24px; }
  .fr-b { grid-template-columns: 68px 1fr 58px 38px; font-size: 11px; }
}

/* ── 방법 × 기간 VaR 매트릭스 ─────────────────────────────────────── */
.vm-w { overflow-x: auto; }           /* 좁은 화면에서 표만 가로 스크롤 */
.vm { width: 100%; border-collapse: collapse; font-size: 13px; }
.vm th, .vm td {
  padding: 10px 12px; text-align: center; border: 1px solid var(--border);
}
.vm thead th {
  background: var(--bg-subtle, #f8f9fa); font-size: 12px;
  font-weight: 600; color: var(--text-mute, #8b95a1);
}
.vm tbody th {
  text-align: left; white-space: nowrap; font-weight: 600;
  background: var(--bg-subtle, #f8f9fa); font-size: 12px;
}
.vm td { cursor: pointer; }
.vm td:hover { background: var(--bg-subtle, #f8f9fa); }
.vm td b {
  display: block; font-size: 15px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.vm td i {
  display: block; font-style: normal; font-size: 11px; margin-top: 2px;
  color: var(--text-mute, #8b95a1); font-variant-numeric: tabular-nums;
}
.vm td.on { background: #eef6fd; box-shadow: inset 0 0 0 2px #1c7ed6; }
.vm td.on b { color: #1c7ed6; }
.vm-foot { font-size: 11px; line-height: 1.6; margin: 12px 0 0; }

@media (max-width: 560px) {
  .vm th, .vm td { padding: 8px 6px; }
  .vm td b { font-size: 13px; }
}

/* ── 히트맵 기준일 네비게이션 ─────────────────────────────────────── */
.kh-nav { display: inline-flex; align-items: center; gap: 4px; }
.kh-nav-b {
  border: 1px solid var(--border); background: #fff; cursor: pointer;
  height: 26px; min-width: 26px; padding: 0 6px; border-radius: 6px;
  font-size: 11px; line-height: 1; color: var(--text-mute, #8b95a1);
}
.kh-nav-b:hover:not(:disabled) { background: var(--bg-subtle, #f4f4f5); color: var(--text, #191f28); }
.kh-nav-b:disabled { opacity: .35; cursor: default; }
.kh-nav-b.kh-latest { padding: 0 8px; font-weight: 600; }
/* 이미 최신 거래일이면 눌러도 바뀌는 게 없다는 걸 눌린 모양으로 알린다 */
.kh-nav-b.kh-latest.on { background: var(--bg-subtle, #f4f4f5); opacity: .55; cursor: default; }
.kh-date {
  border: 1px solid var(--border); border-radius: 6px; height: 26px;
  padding: 0 6px; font-size: 12px; background: #fff;
  color: var(--text, #191f28); font-variant-numeric: tabular-nums;
}

@media (max-width: 560px) {
  .kh-date { font-size: 11px; padding: 0 4px; }
  .kh-nav-b.kh-latest { display: none; }   /* 헤더가 좁다 — 달력으로 최신일 선택 가능 */
}

/* ── 팩터 리스크 2단 구성: 덩어리 머리글 + 그 안의 축 ─────────────── */
.fr-sec { margin-top: 18px; }
.fr-sec-h {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 0 6px; border-bottom: 2px solid var(--border);
  margin-bottom: 2px;
}
.fr-sec-n {
  display: flex; align-items: center; gap: 7px; margin-right: auto;
  font-size: 13px; font-weight: 700; color: var(--text, #191f28);
}
.fr-sec-n i { width: 9px; height: 9px; border-radius: 2px; flex-shrink: 0; }
.fr-sec-v { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.fr-sec-v.neg { color: #1f6feb; }
.fr-sec-p {
  font-size: 12px; color: var(--text-mute, #8b95a1);
  min-width: 52px; text-align: right; font-variant-numeric: tabular-nums;
}
.fr-omit { font-size: 11px; color: var(--text-mute, #8b95a1); margin: 6px 0 0; }

/* ── G·I·FC 3축 경기국면 ─────────────────────────────────────────── */
.gf-now { display: flex; align-items: center; gap: 14px; padding: 14px 0 4px; flex-wrap: wrap; }
.gf-badge { display: flex; gap: 5px; }
.gf-sg {
  font-size: 15px; font-weight: 800; letter-spacing: -.02em;
  padding: 6px 11px; border-radius: 9px; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.gf-sg.pos { background: #fff0e6; color: #d9480f; }      /* + = 확대/상승/긴축 */
.gf-sg.neg { background: #e7f0fb; color: #1864ab; }      /* − = 둔화/하락/완화 */
.gf-nm { display: flex; flex-direction: column; gap: 1px; }
.gf-nm-en { font-size: 19px; font-weight: 700; color: var(--text, #191f28); line-height: 1.2; }
.gf-nm-kr { font-size: 12px; color: var(--text-mute, #8b95a1); }

.gf-axes { display: flex; flex-direction: column; gap: 7px; margin-top: 12px; }
.gf-ax {
  display: grid; grid-template-columns: 96px 1fr 52px minmax(190px, 1.1fr);
  align-items: center; gap: 10px; font-size: 12px;
}
.gf-ax-l { font-weight: 700; color: var(--text, #191f28); }
.gf-ax-l i { font-style: normal; color: var(--text-mute, #8b95a1); font-weight: 500; margin-left: 5px; }
/* 가운데가 0 — 좌우로 뻗는 막대라야 부호가 한눈에 보인다 */
.gf-ax-bar { position: relative; height: 9px; background: var(--bg-subtle, #f1f3f5); border-radius: 5px; }
.gf-ax-bar::after {
  content: ''; position: absolute; left: 50%; top: -2px; bottom: -2px;
  width: 1px; background: var(--border-strong, #ced4da);
}
.gf-ax-bar b { position: absolute; top: 0; bottom: 0; border-radius: 5px; }
.gf-ax-z { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.gf-ax-z.pos { color: #d9480f; }
.gf-ax-z.neg { color: #1864ab; }
.gf-ax-raw { color: var(--text-mute, #8b95a1); font-variant-numeric: tabular-nums; }
.gf-ax-raw i { font-style: normal; display: block; font-size: 11px; opacity: .8; }

.gf-warn {
  font-size: 12px; line-height: 1.6; margin: 12px 0 0; padding: 9px 12px;
  background: #fff9db; border-left: 3px solid #f59f00; border-radius: 0 8px 8px 0;
  color: #664d03;
}
.gf-h { font-size: 13px; font-weight: 700; color: var(--text, #191f28); margin: 22px 0 8px; }
.gf-h-s { font-weight: 500; font-size: 11px; color: var(--text-mute, #8b95a1); margin-left: 6px; }

/* 데이터 신선도 — 어느 소스가 국면 기준월을 붙들고 있는지 한눈에 */
.gf-fresh {
  margin: 12px 0 0; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--bg-subtle, #f8f9fa);
}
.gf-fresh-t { font-size: 11px; font-weight: 700; color: var(--text-mute, #8b95a1); margin-bottom: 7px; }
.gf-fs-w { display: flex; flex-wrap: wrap; gap: 6px; }
.gf-fs {
  flex: 1 1 170px; min-width: 0; padding: 6px 9px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg, #fff);
  font-size: 11px; color: var(--text-mute, #8b95a1);
}
.gf-fs.block { border-color: #74c0fc; background: #eef6fd; }   /* 국면 진행을 막고 있는 소스 */
.gf-fs b { font-weight: 800; color: var(--text, #191f28); margin-right: 4px; }
.gf-fs em {
  font-style: normal; float: right; font-weight: 700;
  color: var(--text, #191f28); font-variant-numeric: tabular-nums;
}
.gf-fs i { font-style: normal; display: block; font-size: 10px; opacity: .85; margin-top: 2px; }
.gf-fresh-n { font-size: 11px; line-height: 1.6; color: var(--text-mute, #8b95a1); margin: 8px 0 0; }
.gf-fresh-n b { color: var(--text, #191f28); }
.gf-fresh-n .gf-od { color: #c92a2a; }

.gf-sig {
  font-size: 11.5px; line-height: 1.65; margin: 0 0 9px;
  color: var(--text-mute, #8b95a1);
}
.gf-sig b { color: var(--text, #191f28); }

.gf-map { display: flex; flex-direction: column; gap: 6px; }
.gf-row { display: grid; grid-template-columns: 30px repeat(4, 1fr); gap: 6px; align-items: stretch; }
.gf-row-l {
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; color: var(--text-mute, #8b95a1);
  background: var(--bg-subtle, #f8f9fa); border-radius: 8px;
}
.gf-cell {
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 9px;
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.gf-cell.on { border-color: #c92a2a; border-width: 2px; background: #fff5f5; padding: 7px 8px; }
.gf-cell-k { font-size: 10px; font-weight: 700; color: var(--text-mute, #8b95a1); }
.gf-cell.on .gf-cell-k { color: #c92a2a; }
.gf-cell-n {
  font-size: 12px; font-weight: 700; color: var(--text, #191f28);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gf-cell-s { font-size: 10px; color: var(--text-mute, #8b95a1); }

.gf-two { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
.gf-sc-w { width: 100%; }
.gf-sc { width: 100%; height: auto; display: block; }
.gf-cap { font-size: 11px; color: var(--text-mute, #8b95a1); margin: 6px 0 0; line-height: 1.6; }
.gf-cap i {
  display: inline-block; width: 8px; height: 8px; border-radius: 2px;
  margin: 0 3px 0 8px; vertical-align: middle;
}
.gf-cap i:first-child { margin-left: 0; }

.gf-tr { display: flex; flex-direction: column; gap: 6px; }
.gf-t { display: grid; grid-template-columns: minmax(120px, 1.4fr) 1fr 38px; align-items: center; gap: 8px; font-size: 12px; }
.gf-t-n { color: var(--text, #191f28); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gf-t-n em { font-style: normal; color: var(--text-mute, #8b95a1); font-size: 11px; }
.gf-t-bar { height: 8px; background: var(--bg-subtle, #f1f3f5); border-radius: 4px; overflow: hidden; }
.gf-t-bar b { display: block; height: 100%; background: #4c6ef5; border-radius: 4px; }
.gf-t.same .gf-t-bar b { background: #adb5bd; }         /* 유지는 회색 — 전이가 눈에 띄어야 한다 */
.gf-t-p { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

.gf-tw { overflow-x: auto; }
.gf-hm { width: 100%; border-collapse: collapse; font-size: 11px; }
.gf-hm th, .gf-hm td {
  padding: 5px 6px; text-align: center; border: 1px solid #fff;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.gf-hm thead th { background: var(--bg-subtle, #f8f9fa); font-size: 10px; color: var(--text-mute, #8b95a1); }
.gf-hm thead th.on, .gf-hm td.on { box-shadow: inset 0 0 0 2px #c92a2a; }
.gf-hm .gf-hm-a { text-align: left; background: var(--bg-subtle, #f8f9fa); font-weight: 600; color: var(--text, #191f28); }
.gf-hm .gf-grp td {
  text-align: left; background: #fff; border: 0; padding: 9px 0 3px;
  font-size: 11px; font-weight: 700; color: var(--text-mute, #8b95a1);
}
.gf-hm .gf-na { background: #f8f9fa; color: #ced4da; }
/* 칸 = 중앙값 + 신뢰구간. 구간이 0을 걸치는 칸(dim)은 숫자까지 힘을 뺀다 */
.gf-hm td .gf-v { display: block; font-weight: 700; font-size: 11.5px; }
.gf-hm td .gf-ci { display: block; font-size: 9.5px; opacity: .72; margin-top: 1px; letter-spacing: -.2px; }
.gf-hm td.dim .gf-v { font-weight: 500; }
.gf-sig-eg {
  font-variant-numeric: tabular-nums; font-size: 10.5px; padding: 0 4px; border-radius: 3px;
  background: var(--bg-subtle, #f1f3f5); color: var(--text, #191f28);
}

/* KOSPI 업종별 펼치기 — 기본은 접힘. 표에 .gf-open 이 붙으면 하위 행이 보인다 */
.gf-hm .gf-sub { display: none; }
.gf-hm.gf-open .gf-sub { display: table-row; }
.gf-exp {
  display: inline-flex; align-items: center; gap: 5px; border: 0; background: none; padding: 0;
  font: inherit; font-weight: 600; color: var(--text, #191f28); cursor: pointer; text-align: left;
}
.gf-exp svg { flex: 0 0 auto; color: var(--text-mute, #8b95a1); transition: transform .15s; }
.gf-exp[aria-expanded="true"] svg { transform: rotate(90deg); }
.gf-exp em {
  font-style: normal; font-size: 10px; font-weight: 700; color: #6E1E2B;
  background: rgba(110, 30, 43, .08); border-radius: 9px; padding: 1px 7px;
}
.gf-exp:hover em, .gf-exp:focus-visible em { background: rgba(110, 30, 43, .16); }
.gf-hm .gf-ctx td {
  text-align: left; white-space: normal; border: 0; border-left: 3px solid #6E1E2B;
  background: #fbf7f5; color: var(--text-mute, #8b95a1);
  font-size: 11px; line-height: 1.65; padding: 8px 10px;
}
.gf-hm .gf-ctx td b { color: var(--text, #191f28); }
.gf-hm .gf-subgrp td {
  text-align: left; border: 0; background: #fff;
  padding: 7px 0 2px 20px; font-size: 10px; font-weight: 700; color: #adb5bd;
}
.gf-hm td.gf-ind { padding-left: 20px; font-weight: 500; background: #fcfcfd; }
.gf-hm td.gf-ind span { vertical-align: middle; }
.gf-rho {
  font-style: normal; margin-left: 6px; font-size: 9.5px; font-weight: 600; vertical-align: middle;
  font-variant-numeric: tabular-nums; color: #adb5bd;
}
.gf-rho.lo { color: #1c7ed6; }   /* KOSPI 상관 0.5 미만 — 따로 움직이는 업종 */
.gf-foot { font-size: 11px; line-height: 1.6; margin: 14px 0 0; }

@media (max-width: 860px) {
  .gf-two { grid-template-columns: 1fr; gap: 14px; }
  .gf-ax { grid-template-columns: 78px 1fr 46px; }
  .gf-ax-raw { grid-column: 1 / -1; padding-left: 78px; }
  .gf-row { grid-template-columns: 24px repeat(2, 1fr); }
  .gf-row-l { grid-row: span 2; }
}

/* ── 국면 이동 · 챙겨 볼 발표 (매크로 › 국면 · 경기 · 2026-09-28) ─────────────────── */
.rm-sec + .rm-sec { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.rm-h { font-size: 13px; font-weight: 700; color: var(--text, #191f28); margin: 4px 0 10px; }
.rm-h span { font-weight: 500; font-size: 11px; color: var(--text-mute, #8b95a1); margin-left: 6px; }
.rm-sec + .rm-sec .rm-h ~ .rm-h { margin-top: 18px; }
.rm-now { display: flex; align-items: flex-start; gap: 10px; }
.rm-now p { margin: 0; font-size: 14px; line-height: 1.55; color: var(--text, #191f28); }
.rm-pill {
  flex: 0 0 auto; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  margin-top: 1px; white-space: nowrap;
}
.rm-pill.hot { background: #fff0f0; color: #c92a2a; }
.rm-pill.mid { background: #fff4e6; color: #d9480f; }
.rm-pill.low { background: var(--bg-subtle, #f1f3f5); color: var(--text-sub, #4e5968); }
.rm-moves { margin: 8px 0 0; padding-left: 18px; font-size: 13px; line-height: 1.65; }
.rm-last, .rm-note { margin: 8px 0 0; font-size: 12px; line-height: 1.65; color: var(--text-mute, #8b95a1); }
.rm-last b, .rm-note b { color: var(--text, #191f28); }
.rm-src { color: var(--text-mute, #8b95a1); font-size: 12px; }
.rm-flip, .rm-edge {
  font-style: normal; font-size: 10.5px; font-weight: 700; border-radius: 6px; padding: 1px 6px; white-space: nowrap;
}
.rm-flip { color: #c92a2a; background: #fff0f0; }
.rm-edge { color: #b35c00; background: #fff4e6; }

.rm-axes { display: flex; flex-direction: column; gap: 9px; margin: 14px 0 0; }
.rm-ax {
  display: grid; grid-template-columns: 88px minmax(0, 1fr) 112px minmax(0, 1.15fr);
  gap: 10px; align-items: center; font-size: 12px;
}
.rm-ax-l { font-weight: 700; color: var(--text, #191f28); }
.rm-ax-l i { font-style: normal; margin-left: 5px; color: var(--text-mute, #8b95a1); font-weight: 500; }
/* 가운데가 0 — 옅은 띠는 경계(±0.25), 빈 점은 어제 이맘때, 찬 점은 지금 */
.rm-ax-bar { position: relative; height: 12px; border-radius: 6px; background: var(--bg-subtle, #f1f3f5); }
.rm-ax-bar::after {
  content: ''; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--border-strong, #ced4da);
}
.rm-ax-bar s { position: absolute; top: 0; bottom: 0; background: rgba(245, 159, 0, .18); text-decoration: none; }
.rm-ax-bar u, .rm-ax-bar b {
  position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; box-sizing: border-box;
}
.rm-ax-bar u { border: 2px solid #8b95a1; background: #fff; }
.rm-ax-bar b { box-shadow: 0 0 0 2px #fff; z-index: 1; }
.rm-ax-z { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; color: var(--text, #191f28); }
.rm-ax-z i { display: block; font-style: normal; font-weight: 500; font-size: 10.5px; color: var(--text-mute, #8b95a1); }
.rm-ax-raw { color: var(--text-mute, #8b95a1); font-variant-numeric: tabular-nums; min-width: 0; }

.rm-mk { margin: 14px 0 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; }
.rm-mk-h { font-size: 12px; font-weight: 700; color: var(--text, #191f28); }
.rm-mk-h span { font-weight: 500; font-size: 11px; color: var(--text-mute, #8b95a1); margin-left: 6px; }
.rm-mk p { margin: 6px 0 8px; font-size: 13px; line-height: 1.55; }
.rm-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rm-chip {
  font-size: 11.5px; padding: 3px 8px; border-radius: 8px; background: var(--bg-subtle, #f1f3f5);
  color: var(--text-sub, #4e5968); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.rm-chip b { color: var(--text, #191f28); }
.rm-chip i { font-style: normal; margin-left: 4px; color: var(--text-mute, #8b95a1); }
.rm-chip i.up { color: #d9480f; }
.rm-chip i.dn { color: #1864ab; }

.rm-chart { margin: 16px 0 0; }
.rm-leg { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; font-size: 11px; color: var(--text-mute, #8b95a1); margin-bottom: 6px; }
.rm-leg b { font-weight: 700; color: var(--text-sub, #4e5968); }
.rm-leg b i { display: inline-block; width: 12px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 5px; }
.rm-leg span { margin-left: auto; }
.rm-svg { display: block; width: 100%; height: auto; overflow: visible; }
.rm-svg .rm-band { fill: rgba(245, 159, 0, .10); }
.rm-svg .rm-grid { stroke: #ece9e2; stroke-width: 1; }
.rm-svg .rm-zero { stroke: #b9b3a8; stroke-width: 1; }
.rm-svg text { fill: #8A8478; font-size: 10px; font-variant-numeric: tabular-nums; }
.rm-svg .rm-dot { fill: #fff; }

.rm-lead { margin: 0 0 12px; font-size: 13px; line-height: 1.7; color: var(--text, #191f28); }
.rm-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.rm-tile { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: 12px; line-height: 1.6; min-width: 0; }
.rm-tile.live { border-color: #f0b4b4; background: #fffafa; }
.rm-tile-h { display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--text, #191f28); font-size: 13px; }
.rm-p { margin-left: auto; font-size: 10.5px; font-weight: 700; border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.rm-p.hot { background: #fff0f0; color: #c92a2a; }
.rm-p.mid { background: #fff4e6; color: #d9480f; }
.rm-p.low { background: var(--bg-subtle, #f1f3f5); color: var(--text-mute, #8b95a1); }
.rm-tile-now { margin-top: 6px; font-weight: 700; color: var(--text, #191f28); font-variant-numeric: tabular-nums; }
.rm-tile-now span { font-weight: 500; color: var(--text-mute, #8b95a1); margin-left: 6px; }
.rm-tile-next { margin-top: 2px; color: var(--text-sub, #4e5968); }
.rm-tile p { margin: 7px 0 0; color: var(--text-sub, #4e5968); }
.rm-to { display: inline-block; font-weight: 700; color: var(--text, #191f28); margin-right: 2px; }

.rm-soon, .rm-rec { list-style: none; margin: 0; padding: 0; }
.rm-row {
  display: grid; grid-template-columns: 118px 196px minmax(0, 1fr); gap: 10px; align-items: baseline;
  padding: 8px 0; border-top: 1px solid var(--border); font-size: 12px;
}
.rm-row:first-child { border-top: 0; }
.rm-when { font-variant-numeric: tabular-nums; color: var(--text, #191f28); font-weight: 600; white-space: nowrap; }
.rm-when i { font-style: normal; font-size: 10px; color: var(--text-mute, #8b95a1); font-weight: 500; }
.rm-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.rm-tier, .rm-axt { font-style: normal; font-size: 10.5px; font-weight: 700; border-radius: 6px; padding: 1px 7px; white-space: nowrap; }
.rm-tier.hot { background: #c92a2a; color: #fff; }
.rm-tier.mid { background: #fff4e6; color: #d9480f; }
.rm-tier.low { background: var(--bg-subtle, #f1f3f5); color: var(--text-mute, #8b95a1); }
.rm-axt { background: var(--bg-subtle, #f1f3f5); color: var(--text-sub, #4e5968); }
.rm-axt.g { color: #2b8a3e; }
.rm-axt.i { color: #d9480f; }
.rm-axt.fc { color: #1864ab; }
.rm-axt.kr { color: #6E1E2B; }
.rm-what { min-width: 0; }
.rm-what b { display: block; font-weight: 600; color: var(--text, #191f28); }
.rm-what i { display: block; font-style: normal; color: var(--text-mute, #8b95a1); margin-top: 1px; }
.rm-row.rm-t1 .rm-what b { font-weight: 700; }   /* .t1 · .t2 는 ui-system.css 의 제목 글꼴 — 쓰면 줄이 커진다 */
.rm-more {
  margin: 8px 0 0; border: 1px solid var(--border); background: none; border-radius: 8px; padding: 5px 12px;
  font: inherit; font-size: 12px; color: var(--text-sub, #4e5968); cursor: pointer;
}
.rm-more:hover { color: var(--text, #191f28); border-color: var(--border-strong, #ced4da); }
.rm-rec li {
  display: grid; grid-template-columns: 118px 132px minmax(0, 1fr); gap: 10px; padding: 6px 0;
  border-top: 1px solid var(--border); font-size: 12px; font-variant-numeric: tabular-nums; color: var(--text-sub, #4e5968);
}
.rm-rec li:first-child { border-top: 0; }
.rm-foot { margin: 16px 0 0; font-size: 11px; line-height: 1.65; color: var(--text-mute, #8b95a1); }

@media (max-width: 860px) {
  .rm-tiles { grid-template-columns: minmax(0, 1fr); }
  .rm-ax { grid-template-columns: 72px minmax(0, 1fr) 92px; row-gap: 3px; }
  .rm-ax-raw { grid-column: 2 / -1; }
  .rm-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .rm-rec li { grid-template-columns: 112px minmax(0, 1fr); row-gap: 2px; }
  .rm-rec li span:last-child { grid-column: 1 / -1; }
  .rm-leg span { margin-left: 0; flex-basis: 100%; }
}

/* ── 새 소식 N (2026-09-28) — 포트폴리오 › 소식 · 매크로 › 데이터에 안 본 것이 있으면
   서브탭 칩 · 위 단계 메뉴 · 아래 탭 막대에 붉은 N ── */
.nb {
  display: inline-flex; align-items: center; justify-content: center; min-width: 15px; height: 15px; padding: 0 3px;
  margin-left: 5px; border-radius: 8px; background: #e03131; color: #fff; font-size: 9.5px; font-weight: 800;
  line-height: 1; vertical-align: 1px; font-family: inherit; letter-spacing: 0; font-style: normal;
}
.step.active .nb { box-shadow: 0 0 0 1.5px #fff; }
.mob-tab { position: relative; }
.mob-tab .nb { position: absolute; top: 5px; left: calc(50% + 7px); margin: 0; }

/* ── 리서치 글 인쇄(PDF 저장) ─────────────────────────────────────
   PDF 라이브러리를 쓰지 않고 브라우저 인쇄를 그대로 쓴다 — 한글 폰트와 SVG 도해가
   화면에서 이미 정확히 그려지고 있으므로, 래스터로 굽지 않고 벡터 그대로 내보내는
   편이 결과가 낫다. _rsPrint()가 body에 .rs-printing 을 붙인 동안만 적용된다. */
@media print {
  body.rs-printing > *:not(#researchModal) { display: none !important; }
  body.rs-printing #researchModal {
    position: static !important; inset: auto !important;
    background: #fff !important; padding: 0 !important; z-index: auto !important;
    display: block !important;
  }
  body.rs-printing #researchModal > div {
    max-width: none !important; width: auto !important; max-height: none !important;
    overflow: visible !important; box-shadow: none !important;
    border-radius: 0 !important; padding: 0 !important;
  }
  body.rs-printing .rs-noprint { display: none !important; }
  /* 표·도해·인용이 쪽 경계에서 잘리면 읽을 수 없다 */
  body.rs-printing table, body.rs-printing figure,
  body.rs-printing pre, body.rs-printing blockquote { page-break-inside: avoid; }
  body.rs-printing h1, body.rs-printing h2,
  body.rs-printing h3, body.rs-printing h4 { page-break-after: avoid; }
  body.rs-printing svg { max-width: 100% !important; height: auto !important; }
  body.rs-printing a { text-decoration: none !important; }
  @page { margin: 14mm 12mm; }
}

/* 화면에는 안 보이고 읽어 주기에만 남는 글 */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ── 시장 히트맵 — 최신 거래일의 갱신 안내 (휴장 · 장 중 · 종가 대기 · 2026-09-28) ── */
.kh-fresh { display: block; color: var(--text-sub); font-size: 12px; margin-bottom: 3px; }
.kh-fresh-late { color: var(--amber); }

/* ── 날짜 칩 — 시황 리포트 · 보유 종목 소식이 같이 쓴다 (요일이 먼저 읽히게) ── */
.rp-days, .pn-days {
  display: flex; gap: 6px; overflow-x: auto; padding: 2px 1px 6px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.rp-days::-webkit-scrollbar, .pn-days::-webkit-scrollbar { display: none; }
.rp-day {
  position: relative;               /* 안의 읽어 주기 글(.sr-only · 절대 위치)이 가로 스크롤 줄 밖으로 새어 페이지를 1,150px 로 넓혔다 (2026-09-28 UAT) */
  flex: 0 0 auto; min-width: 58px; padding: 7px 10px 6px;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg-card);
  color: var(--text-sub); font-variant-numeric: tabular-nums; transition: border-color .15s, background .15s;
}
.rp-day:hover { border-color: var(--border-strong); }
.rp-day:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.rp-day .rp-wd { font-size: 11px; font-weight: 600; color: var(--text-mute); letter-spacing: .02em; }
.rp-day .rp-md { font-size: 14px; font-weight: 700; color: var(--text); }
.rp-day.on { border-color: var(--primary); background: var(--primary-soft); }
.rp-day.on .rp-wd { color: var(--primary); }
.rp-dots { display: flex; gap: 3px; margin-top: 2px; }
.rp-dots i { width: 6px; height: 6px; border-radius: 50%; border: 1px solid var(--border-strong); }
.rp-dots i.on { background: var(--primary); border-color: var(--primary); }
.pn-n { font-size: 10.5px; color: var(--text-mute); }

/* ── 매크로 › 데이터 — 시황 리포트 (모닝리포트 · 마감리포트) ── */
.rp-card .rp-days { margin-bottom: 10px; }
.rp-kinds { display: flex; flex-wrap: wrap; margin-bottom: 4px; }
.rp-kinds .rt-tab small, .pn-kinds .rt-tab small { font-size: 11px; font-weight: 500; color: var(--text-mute); margin-left: 2px; }
.rt-tab:disabled { opacity: .45; cursor: default; }
.rp-doc { padding-top: 12px; max-width: 72ch; }
.rp-kick { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 12px; color: var(--text-mute); }
.rp-chip {
  font-size: 11px; font-weight: 700; color: var(--primary-strong); background: var(--primary-soft);
  border-radius: 99px; padding: 2px 9px;
}
.rp-mkt { margin: 8px 0 0; font-size: 13px; color: var(--text-mute); }
.rp-mkt b { color: var(--text); font-weight: 600; }
.rp-title {
  font-family: var(--font-serif); font-size: 20px; font-weight: 600; line-height: 1.45;
  margin: 6px 0 0; letter-spacing: -.01em; text-wrap: balance;
}
.rp-lead { margin: 10px 0 0; font-size: 15px; line-height: 1.75; color: var(--text-sub); }
.rp-facts {
  list-style: none; padding: 0; margin: 14px 0 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px;
}
.rp-facts li {
  border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px;
  display: flex; flex-direction: column; gap: 1px; font-variant-numeric: tabular-nums;
}
.rp-facts span { font-size: 11.5px; color: var(--text-mute); }
.rp-facts b { font-size: 15px; font-weight: 700; color: var(--text); }
.rp-facts em { font-style: normal; font-size: 12px; font-weight: 600; }
.rp-sec h4 { margin: 18px 0 4px; font-size: 13.5px; font-weight: 700; color: var(--text); }
.rp-sec p { margin: 0; font-size: 14px; line-height: 1.8; color: var(--text-sub); }
.rp-sec p + p { margin-top: 4px; }
.rp-sec .rp-ln { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: baseline; }
.rp-sec .rp-ln b { font-size: 12.5px; font-weight: 700; color: var(--text); white-space: nowrap; }
.rp-sec.rp-sum { margin-top: 16px; padding: 4px 14px 10px; border-left: 3px solid var(--border, #e5e8eb); background: var(--bg); border-radius: 0 8px 8px 0; }
.rp-extra { margin-top: 16px; background: var(--bg); border-radius: 8px; padding: 12px 14px; }
.rp-extra h4 { margin: 0 0 6px; font-size: 13px; font-weight: 700; }
.rp-extra h4 small { font-weight: 500; color: var(--text-mute); margin-left: 4px; }
.rp-extra p { margin: 4px 0 0; font-size: 13px; line-height: 1.7; color: var(--text-sub); }
.rp-extra p span { display: inline-block; min-width: 7.5em; color: var(--text-mute); }
.rp-extra em, .rp-doc .rp-facts em { font-style: normal; }
.rp-extra .rp-note { font-size: 11.5px; color: var(--text-mute); }
.rp-doc .up { color: var(--green); }
.rp-doc .dn { color: var(--red); }
/* ── 시황 리포트 그래프 (2026-09-29) — 지수 카드 · 대형주 지도 · 업종 막대 · 오른/내린 종목 · 금리 · 환율 표. 글은 72ch, 그래프는 카드 폭 ── */
.rp-doc { max-width: 980px; }
.rp-doc .rp-title, .rp-doc .rp-lead, .rp-doc .rp-sec, .rp-doc .rp-extra, .rp-doc .rp-foot, .rp-doc .rp-facts { max-width: 72ch; }
.rpc-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 14px 0 6px; }
.rpc-cards.n2 { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 680px; }
.rpc-cards.n1 { grid-template-columns: minmax(0, 340px); }
.rpc-card { min-width: 0; padding: 12px 14px 10px; border: 1px solid var(--border); border-radius: 12px; background: #fff; scroll-snap-align: start; }
.rpc-name { margin: 0; font-size: 13px; font-weight: 700; color: var(--text); }
.rpc-name small { margin-left: 2px; font-size: 11px; font-weight: 500; color: var(--text-mute); }
.rpc-px { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; margin: 4px 0 0; font-variant-numeric: tabular-nums; }
.rpc-px b { font-size: 22px; font-weight: 800; letter-spacing: -.01em; color: var(--text); }
.rpc-px span { font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.rpc-sp { position: relative; height: 60px; margin: 8px 0 0; }
.rpc-sp .rpc-spark { display: block; width: 100%; height: 60px; }
.rpc-sp span { position: absolute; right: 0; bottom: -3px; padding: 0 2px; font-size: 10px; color: var(--text-mute); background: rgba(255, 255, 255, .85); }
.rpc-spark .l { fill: none; stroke-width: 1.6; stroke-linejoin: round; }
.rpc-spark.up .l { stroke: var(--green); }
.rpc-spark.up .a { fill: rgba(47, 125, 99, .10); }
.rpc-spark.dn .l { stroke: var(--red); }
.rpc-spark.dn .a { fill: rgba(178, 58, 46, .08); }
.rpc-spark.flat .l { stroke: var(--text-mute); }
.rpc-spark.flat .a { fill: rgba(138, 132, 120, .08); }
.rpc-range { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; font-size: 10.5px; color: var(--text-mute); }
.rpc-range i { position: relative; flex: 1; height: 4px; border-radius: 2px; background: var(--border-strong); }
.rpc-range em {
  position: absolute; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%;
  background: var(--text); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--border-strong);
}
.rpc-dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px 14px; margin: 9px 0 0; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.rpc-dl div { display: flex; justify-content: space-between; gap: 6px; min-width: 0; }
.rpc-dl dt { color: var(--text-mute); white-space: nowrap; }
.rpc-dl dd { margin: 0; overflow: hidden; font-weight: 600; color: var(--text-sub); white-space: nowrap; text-overflow: ellipsis; }
.rpc-sec { margin: 16px 0 0; }
.rpc-sec h5 { margin: 0 0 8px; font-size: 13px; font-weight: 700; color: var(--text); }
.rpc-sec h5 small { margin-left: 4px; font-size: 11.5px; font-weight: 500; color: var(--text-mute); }
.rpc-mapbox { margin: 14px 0 4px; padding: 12px 14px 14px; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.rpc-mapbox > .rpc-sec:first-child { margin-top: 0; }
.rpc-map { width: 100%; overflow: hidden; border-radius: 6px; background: #2B2925; }
.rpc-map svg { display: block; }
.rpc-map rect.g { fill: #2B2925; }
.rpc-map g rect { stroke: #2B2925; stroke-width: 1; }
.rpc-map text { fill: #fff; font-family: Pretendard, system-ui, sans-serif; font-weight: 700; text-anchor: middle; pointer-events: none; }
.rpc-map text.p { font-weight: 600; opacity: .92; }
.rpc-map text.gh { font-size: 10.5px; text-anchor: start; letter-spacing: .02em; fill: rgba(255, 255, 255, .82); }
.rpc-legend { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin: 6px 0 0; font-size: 10.5px; color: var(--text-mute); font-variant-numeric: tabular-nums; }
.rpc-legend i { width: 56px; height: 8px; border-radius: 2px; background: linear-gradient(90deg, rgb(178, 58, 46), rgb(132, 126, 116)); }
.rpc-legend i.u { background: linear-gradient(90deg, rgb(132, 126, 116), rgb(47, 125, 99)); }
.rpc-note { margin: 4px 0 0; font-size: 11px; line-height: 1.5; color: var(--text-mute); }
.rpc-bars { display: flex; flex-direction: column; gap: 5px; max-width: 680px; }
.rpc-bar { display: grid; grid-template-columns: 7.2em minmax(0, 1fr) 5.4em; align-items: center; gap: 8px; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.rpc-bar .n { overflow: hidden; color: var(--text-sub); white-space: nowrap; text-overflow: ellipsis; }
.rpc-bar .t { position: relative; height: 12px; border-radius: 3px; background: var(--bg); }
.rpc-bar .t::before { content: ''; position: absolute; top: -2px; bottom: -2px; left: 50%; width: 1px; background: var(--border-strong); }
.rpc-bar .t i { position: absolute; top: 0; bottom: 0; border-radius: 3px; }
.rpc-bar .t i.pos { left: 50%; background: var(--green); }
.rpc-bar .t i.neg { right: 50%; background: var(--red); }
.rpc-bar > b { font-weight: 700; text-align: right; }
.rpc-bar > b em { font-style: normal; }
.rpc-bars.is-br .rpc-bar { grid-template-columns: 4.2em minmax(0, 1fr) auto; }
.rpc-bar .t.br { display: flex; overflow: hidden; }
.rpc-bar .t.br::before { display: none; }
.rpc-bar .t.br i { position: static; height: 100%; border-radius: 0; }
.rpc-tw { overflow-x: auto; max-width: 680px; }
.rpc-rates { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.rpc-rates th, .rpc-rates td { padding: 7px 6px; border-top: 1px solid var(--border); text-align: left; white-space: nowrap; }
.rpc-rates tr:first-child th, .rpc-rates tr:first-child td { border-top: 0; }
.rpc-rates th { font-weight: 600; color: var(--text-sub); }
.rpc-rates th small { font-size: 10.5px; font-weight: 500; color: var(--text-mute); }
.rpc-rates td.v { font-weight: 700; color: var(--text); text-align: right; }
.rpc-rates td.c { font-size: 12px; font-weight: 600; text-align: right; }
.rpc-rates td.s { width: 96px; }
.rpc-rates .rpc-spark { display: block; width: 90px; height: 24px; }
.rpc-wait { margin: 12px 0 0; font-size: 12.5px; color: var(--text-mute); }
@media (max-width: 640px) {                   /* 휴대폰 — 지수 카드는 옆으로 넘겨 보기(다음 카드가 살짝 보이게) */
  .rpc-cards, .rpc-cards.n2 { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 84%; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; }
  .rpc-mapbox { padding: 10px 10px 12px; }
  .rpc-bar { grid-template-columns: 6.4em minmax(0, 1fr) 4.9em; font-size: 12px; }
  /* 금리 · 환율 표 — 한 줄에 다 안 들어가 선이 밀려났다 → 이름 | 값 / 전일 대비 | 선 두 줄로 */
  .rpc-rates, .rpc-rates tbody { display: block; }
  .rpc-rates tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto 60px; grid-template-areas: "n v s" "n c s";
    column-gap: 10px; align-items: center; padding: 7px 2px; border-top: 1px solid var(--border);
  }
  .rpc-rates tr:first-child { border-top: 0; }
  .rpc-rates th, .rpc-rates td { padding: 0; border: 0; }
  .rpc-rates th { grid-area: n; white-space: normal; }
  .rpc-rates td.v { grid-area: v; }
  .rpc-rates td.c { grid-area: c; font-size: 11.5px; }
  .rpc-rates td.s { grid-area: s; width: auto; }
  .rpc-rates .rpc-spark { width: 60px; }
}
.rp-foot {
  margin: 18px 0 0; padding-top: 10px; border-top: 1px solid var(--border);
  font-size: 11.5px; line-height: 1.65; color: var(--text-mute);
}

/* ── 포트폴리오 › 소식 — 보유 종목의 뉴스 · 공시 (날짜별) ── */
.pn-tools { display: flex; flex-direction: column; gap: 10px; margin-bottom: 2px; }
.pn-tools[hidden] { display: none; }
.pn-kinds { margin-bottom: 0; align-self: flex-start; }
.pn-day { margin-top: 16px; }
.pn-dh {
  display: flex; align-items: baseline; gap: 8px; margin: 0;
  font-family: var(--font-serif); font-size: 16px; font-weight: 600; color: var(--text);
}
.pn-dh span { font-family: inherit; font-size: 13px; font-weight: 500; color: var(--text-mute); }
.pn-dh small { margin-left: auto; font-family: 'Pretendard', system-ui, sans-serif; font-size: 11.5px; font-weight: 600; color: var(--text-mute); }
.pn-list { list-style: none; padding: 0; margin: 6px 0 0; }
.pn-it { padding: 14px 0; border-top: 1px solid var(--border); }
.pn-top { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.pn-kind {
  font-size: 11px; font-weight: 700; border-radius: 99px; padding: 2px 8px;
  color: var(--primary-strong); background: var(--primary-soft);
}
.is-doc .pn-kind { color: var(--green); background: var(--green-soft); }
.pn-corp { font-size: 13px; font-weight: 700; color: var(--text); }
.pn-src { font-size: 12px; color: var(--text-mute); }
.pn-fix { font-size: 11px; font-weight: 600; color: var(--amber); border: 1px solid currentColor; border-radius: 99px; padding: 0 7px; }
/* 국내 기사(GDELT · 2026-09-28) — 제목 · 언론사 · 원문 링크만. 같은 소식을 쓴 다른 언론 수 */
.is-kr .pn-kind { color: #6E1E2B; background: rgba(110, 30, 43, .08); }
.is-kr .pn-title { margin-top: 6px; }
.pn-more { font-size: 11px; font-weight: 600; color: var(--text-sub); background: var(--bg-subtle, #f1f3f5); border-radius: 99px; padding: 1px 8px; cursor: help; }
.pn-title { margin: 7px 0 0; font-size: 15.5px; font-weight: 600; line-height: 1.55; color: var(--text); text-wrap: pretty; }
.pn-en { margin: 3px 0 0; font-size: 12px; line-height: 1.5; color: var(--text-mute); }
.pn-sum { margin-top: 10px; background: var(--bg); border-radius: 8px; padding: 10px 12px 8px; max-width: 72ch; }
.pn-lines { list-style: none; padding: 0; margin: 0; }
.pn-lines li { position: relative; padding-left: 13px; font-size: 13.5px; line-height: 1.7; color: var(--text-sub); }
.pn-lines li::before {
  content: ''; position: absolute; left: 2px; top: .72em;
  width: 4px; height: 4px; border-radius: 50%; background: var(--primary);
}
.pn-facts { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; }
.pn-facts span { color: var(--text-mute); margin-right: 4px; }
.pn-facts b { font-weight: 700; font-variant-numeric: tabular-nums; }
.pn-by { margin: 6px 0 0; font-size: 11px; color: var(--text-mute); }
.pn-sumrow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 10px; }
.pn-sumbtn { font-size: 12px; }
.pn-wait { font-size: 12px; color: var(--text-mute); margin: 10px 0 0; }
.pn-sumrow .pn-wait { margin: 0; }
.pn-link {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 10px;
  font-size: 12.5px; font-weight: 600; color: var(--primary); text-decoration: none;
}
.pn-link:hover { text-decoration: underline; }
.pn-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.pn-card .pn-foot {                                   /* ui-system.css 의 .muted 가 뒤에 로드돼 같은 명시도를 이긴다 — 카드로 한 단계 올린다 */
  margin: 16px 0 0; padding-top: 10px; border-top: 1px solid var(--border);
  font-size: 11.5px; line-height: 1.65; color: var(--text-mute);
}
.pn-card .pn-foot:empty { display: none; }
.pn-live { color: var(--primary); font-weight: 600; }
.pn-kr { font-weight: 600; color: var(--text-sub); }
@media (max-width: 560px) {
  .rp-kinds .rt-tab small { display: block; margin: 1px 0 0; }
  .rp-title { font-size: 18px; }
  .rp-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pn-title { font-size: 15px; }
}

/* ── 포트폴리오 › 소식 › 증시 캘린더 (2026-09-28) — 공식 발표처 일정을 주 단위로 ── */
.ec-card .card-header { flex-wrap: wrap; gap: 10px; }
.ec-weeks { margin-bottom: 0; }
.ec-range { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--text-sub); font-variant-numeric: tabular-nums; }
.ec-day { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.ec-day.is-today { padding-left: 8px; padding-right: 8px; background: var(--primary-soft); border-radius: 8px; border-top-color: transparent; }
.ec-date { display: flex; flex-direction: column; gap: 1px; padding-top: 4px; font-variant-numeric: tabular-nums; }
.ec-date b { font-size: 15px; font-weight: 800; color: var(--text); }
.ec-date span { font-size: 12px; font-weight: 700; color: var(--primary); white-space: nowrap; }
.ec-day.is-off .ec-date span { color: var(--red); }
.ec-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ec-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px;
  width: 100%; padding: 5px 4px; text-align: left; border-radius: 6px; background: transparent;
}
.ec-row:hover { background: rgba(28, 27, 25, .04); }
.ec-row:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.ec-chip { font-size: 11px; font-weight: 700; border-radius: 6px; padding: 2px 7px; white-space: nowrap; }
.ec-c-macro .ec-chip { color: #3E5C76; background: #E9EEF3; }
.ec-c-cb .ec-chip { color: var(--primary-strong); background: var(--primary-soft); }
.ec-c-off .ec-chip { color: var(--red); background: var(--red-soft); }
.ec-c-exp .ec-chip { color: var(--amber); background: #F6EEDC; }
.ec-c-earn .ec-chip { color: var(--green); background: var(--green-soft); }
.ec-c-div .ec-chip { color: #6B5B2E; background: #F1ECDD; }
.ec-c-ev .ec-chip { color: #6A4C8C; background: #EFEAF5; }
.is-today .ec-c-cb .ec-chip { background: #fff; }
.ec-t { min-width: 0; font-size: 13.5px; line-height: 1.45; color: var(--text); overflow-wrap: anywhere; }
.ec-t.is-key { font-weight: 700; }
.ec-t i { margin-right: 3px; font-style: normal; color: var(--amber); }
.ec-t small { font-size: 11.5px; font-weight: 500; color: var(--text-mute); }
.ec-when { font-size: 12px; color: var(--text-mute); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ec-when em { margin-left: 3px; padding: 0 5px; font-style: normal; font-size: 10.5px; font-weight: 700; color: var(--amber); border: 1px solid currentColor; border-radius: 99px; }
.ec-desc { margin: 2px 4px 8px; padding: 8px 10px; background: var(--bg); border-radius: 8px; font-size: 12.5px; line-height: 1.65; color: var(--text-sub); }
.is-today .ec-desc { background: #fff; }
.ec-desc small { display: block; margin-top: 3px; font-size: 11px; color: var(--text-mute); }
.ec-none { margin: 0; padding: 6px 4px; font-size: 12.5px; color: var(--text-mute); }
.ec-foot { margin: 12px 0 0; padding-top: 10px; border-top: 1px solid var(--border); font-size: 11.5px; line-height: 1.65; color: var(--text-mute); }
/* 지난 일정의 발표 결과 (2026-09-29) — 제목 아래 한 줄. 화살표는 직전 값보다 높다 · 낮다만 */
.ec-res {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; margin: 0 4px 4px; padding: 3px 8px 4px 10px;
  border-left: 2px solid var(--border-strong); font-size: 12.5px; line-height: 1.5; color: var(--text-sub); font-variant-numeric: tabular-nums;
}
.ec-res-k { font-size: 10.5px; font-weight: 700; letter-spacing: .03em; color: var(--text-mute); }
.ec-res-per { font-size: 11.5px; color: var(--text-mute); }
.ec-res b { font-weight: 700; color: var(--text); }
.ec-dir { margin-left: -5px; font-style: normal; font-size: 9.5px; color: var(--text-sub); }
.ec-res small { font-size: 11.5px; color: var(--text-mute); }
.ec-res.is-wait { color: var(--text-mute); }
.ec-res-note { font-weight: 700; color: var(--text); }
/* 지난 일정의 요점 · 원문 링크 · 주 넘기기 (2026-10-09 — FOMC 의사록 · 성명 · 삼성전자 잠정실적 …) */
.ec-lines { list-style: disc; margin: 0 4px 4px; padding: 2px 8px 4px 26px; border-left: 2px solid var(--border-strong); font-size: 12.5px; line-height: 1.6; color: var(--text); }
.ec-lines li { margin: 1px 0; overflow-wrap: anywhere; }
.ec-link { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 600; color: var(--primary); text-decoration: none; white-space: nowrap; }
.ec-link:hover { text-decoration: underline; }
.ec-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.ec-src-link { margin: 0 4px 6px 14px; }
.ec-res.is-link { color: var(--text-sub); }
.ec-weeks .ec-step { display: inline-flex; align-items: center; padding: 6px 8px; }
.ec-weeks .ec-step:disabled { opacity: .35; cursor: default; }
.pn-head-tools { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.pn-span { margin-bottom: 0; }
.pn-span .rt-tab { padding: 4px 10px; font-size: 12px; }
@media (max-width: 560px) {
  .ec-day { grid-template-columns: 46px minmax(0, 1fr); gap: 8px; }
  .ec-row { grid-template-columns: auto minmax(0, 1fr); row-gap: 1px; }
  .ec-when { grid-column: 2; }
}

/* ── 분석 › 요약 — 투자위원회 CIO · CRO 일일 보고 · 회의록 (2026-09-28) ── */
.cm-card .rp-days { margin-bottom: 6px; }
.cm-when { margin: 4px 0 0; font-size: 13px; font-weight: 600; color: var(--text-sub); }
.cm-before { margin: 4px 0 0; font-size: 12px; color: var(--amber); }
.cm-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.cm-panel { border: 1px solid var(--border); border-radius: 10px; padding: 14px 14px 12px; min-width: 0; }
.cm-panel h3 {
  display: flex; align-items: center; gap: 8px; margin: 0 0 10px;
  font-family: var(--font-serif); font-size: 16px; font-weight: 600; color: var(--text);
}
.cm-who, .cm-level {
  font-family: 'Pretendard', system-ui, sans-serif; font-style: normal; font-size: 11px; font-weight: 700;
  border-radius: 99px; padding: 2px 8px; white-space: nowrap;
}
.cm-who { color: var(--primary-strong); background: var(--primary-soft); }
.cm-level { margin-left: auto; }
.cm-lv-lo { color: var(--green); background: var(--green-soft); }
.cm-lv-mid { color: var(--amber); background: #F6EEDC; }
.cm-lv-hi { color: var(--red); background: var(--red-soft); }
.cm-metrics { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
.cm-metrics li { display: flex; flex-direction: column; gap: 1px; min-width: 0; font-variant-numeric: tabular-nums; }
.cm-metrics span { font-size: 11px; color: var(--text-mute); }
.cm-metrics b { font-size: 14px; font-weight: 700; color: var(--text); overflow-wrap: anywhere; }
.cm-metrics small { font-size: 11px; color: var(--text-mute); }
.cm-card .up { color: var(--green); }
.cm-card .dn { color: var(--red); }
.cm-labs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 10px; }
.cm-lab { font-size: 11px; font-weight: 600; border-radius: 99px; padding: 2px 8px; color: var(--text-sub); background: var(--bg); white-space: nowrap; }
.cm-lab b { font-weight: 800; }
.cm-buy { color: var(--green); background: var(--green-soft); }
.cm-sell { color: var(--red); background: var(--red-soft); }
.cm-na { color: var(--text-mute); }
.cm-sub { margin: 12px 0 4px; font-size: 11.5px; font-weight: 700; color: var(--text-mute); letter-spacing: .02em; }
.cm-top, .cm-dec { list-style: none; padding: 0; margin: 0; }
.cm-top li {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; padding: 6px 0;
  border-top: 1px solid var(--border); font-size: 13px; font-variant-numeric: tabular-nums;
}
.cm-top li:first-child { border-top: 0; }
.cm-top b { font-weight: 700; color: var(--text); }
.cm-top li > span:not(.cm-lab) { font-size: 12px; color: var(--text-sub); }
.cm-top em { font-style: normal; font-size: 12px; font-weight: 700; color: var(--text-sub); }
.cm-top small { flex-basis: 100%; font-size: 12px; line-height: 1.5; color: var(--text-mute); }
.cm-keep { font-style: normal; font-size: 10.5px; color: var(--amber); border: 1px solid currentColor; border-radius: 99px; padding: 0 6px; }
.cm-top em.cm-inc { color: var(--primary); }
.cm-top em.cm-dec2 { color: var(--text-mute); }
.cm-dec li { position: relative; padding-left: 12px; font-size: 12.5px; line-height: 1.6; color: var(--text-sub); }
.cm-dec li::before {
  content: ''; position: absolute; left: 2px; top: .72em;
  width: 4px; height: 4px; border-radius: 50%; background: var(--border-strong);
}
.cm-line { margin: 10px 0 0; font-size: 12.5px; line-height: 1.6; color: var(--text-sub); }
.cm-line span { display: block; margin-bottom: 1px; font-size: 11px; font-weight: 700; color: var(--text-mute); }
.cm-line small { color: var(--text-mute); }
.cm-chair { margin: 12px 0 0; padding: 8px 10px; background: var(--bg); border-radius: 8px; font-size: 12.5px; line-height: 1.6; color: var(--text-sub); }
.cm-chair span { display: block; margin-bottom: 2px; font-size: 11px; font-weight: 700; color: var(--primary); }
.cm-note { margin: 6px 0 0; font-size: 11.5px; line-height: 1.55; color: var(--text-mute); }
.cm-perf { margin-bottom: 2px; }
.cm-mins { margin-top: 16px; }
.cm-tabs { display: inline-flex; flex-wrap: wrap; margin-bottom: 8px; }
.cm-min { border: 1px solid var(--border); border-radius: 10px; padding: 0 14px; }
.cm-min[open] { padding-bottom: 12px; }
.cm-min > summary {
  list-style: none; cursor: pointer; padding: 12px 0;
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; font-size: 14px; font-weight: 700; color: var(--text);
}
.cm-min > summary::-webkit-details-marker { display: none; }
.cm-min > summary small { font-size: 11.5px; font-weight: 500; color: var(--text-mute); }
.cm-min > summary::after { content: '펼치기'; margin-left: auto; font-size: 11.5px; font-weight: 600; color: var(--primary); }
.cm-min[open] > summary::after { content: '접기'; }
.cm-min > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
.cm-att { margin: 0 0 6px; font-size: 12px; color: var(--text-mute); }
.cm-item h5 { margin: 14px 0 6px; font-size: 12.5px; font-weight: 700; color: var(--primary-strong); }
.cm-say { margin: 0 0 6px; max-width: 76ch; font-size: 13px; line-height: 1.65; color: var(--text-sub); }
.cm-say b { margin-right: 4px; font-weight: 700; color: var(--text); }
.cm-say span { margin-right: 6px; font-size: 11px; color: var(--text-mute); }
.cm-say.is-chief b { color: var(--primary-strong); }
.cm-foot { margin: 12px 0 0; font-size: 11.5px; color: var(--text-mute); }
@media (max-width: 1000px) { .cm-grid { grid-template-columns: 1fr; } }
/* 2026-09-29 — 세 칸 대신 탭(최종결정 · CIO · CRO) 하나씩 넓게. 회의록도 고른 탭의 회의 */
.cm-rtabs { margin: 12px 0 0; }
.cm-rtabs .rt-tab small { font-size: 11px; font-weight: 500; color: var(--text-mute); margin-left: 2px; }
.cm-rtabs .rt-tab small.lv-mid { color: var(--amber); font-weight: 700; }
.cm-rtabs .rt-tab small.lv-hi { color: var(--red); font-weight: 700; }
.cm-one { margin-top: 10px; }
.cm-one .cm-panel { padding: 16px 18px 14px; }
.cm-cols { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 0 32px; }
.cm-cols > div > .cm-first { margin-top: 0; }
.cm-metrics.cm-m4 { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 4px; }
.cm-mins { margin-top: 12px; }
@media (max-width: 760px) {
  .cm-cols { grid-template-columns: minmax(0, 1fr); }
  .cm-cols > div > .cm-first { margin-top: 12px; }
  .cm-metrics.cm-m4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cm-one .cm-panel { padding: 14px 14px 12px; }
}
@media (max-width: 560px) {                     /* 휴대폰 — 탭 셋이 가로 너비를 나눠 갖고, 한 줄 요약은 이름 아래로 */
  .cm-rtabs { display: flex; width: 100%; box-sizing: border-box; }
  .cm-rtabs .rt-tab { flex: 1 1 0; min-width: 0; padding: 6px 3px; text-align: center; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .cm-rtabs .rt-tab:first-child { flex-grow: 1.45; }        /* 'CIO/CRO 최종결정' 이 가장 길다 */
  .cm-rtabs .rt-tab small { display: block; margin: 1px 0 0; overflow: hidden; font-size: 10.5px; text-overflow: ellipsis; }
}

/* ── 최적화 — 기대수익률 가정 (2026-09-29) · 샤프 동일 / 위원회 CIO 반영 / BL 균형 ── */
.mu-mode { margin: 4px 0 18px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); }
.mu-mode-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin-bottom: 8px; }
.mu-mode-head b { font-size: 13px; font-weight: 700; color: var(--text); }
.mu-mode-head span { font-size: 12px; color: var(--text-mute); }
.mu-mode .mu-seg { background: var(--surface, #fff); }
.mu-mode-note { margin: 8px 0 0; max-width: 88ch; font-size: 12px; line-height: 1.6; color: var(--text-sub); }
.mu-used { margin: 8px 0 0; font-size: 12px; line-height: 1.6; color: var(--text-sub); }
.mu-table-wrap { overflow-x: auto; }
@media (max-width: 560px) {
  .mu-mode .mu-seg { display: flex; width: 100%; box-sizing: border-box; }
  .mu-mode .mu-seg button { flex: 1 1 0; min-width: 0; padding-left: 6px; padding-right: 6px; }
}

/* ── 분석 › 최적화 (2026-10-02 — 예전 '3 · 최적화' 탭). 위: 요약(CIO · CRO 추천 · 편입 시험 .os-card), 아래: 최적화 방식 탭 ── */
#optHost .os-card { margin-bottom: 16px; }
.opt-mtabs { display: flex; max-width: 100%; box-sizing: border-box; overflow-x: auto; scrollbar-width: none; }
.opt-mtabs::-webkit-scrollbar { display: none; }
.opt-mtabs .rt-tab { flex: none; white-space: nowrap; }
@media (max-width: 480px) { .opt-mtabs .rt-tab { padding: 6px 10px; font-size: 12.5px; } }
.os-hero { padding-top: 2px; }
.os-kick { margin: 0; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; color: var(--primary); }
.os-hero h3 { margin: 4px 0 0; font-family: var(--font-serif); font-size: 26px; font-weight: 600; letter-spacing: -.01em; color: var(--text); }
.os-hero h3 small { margin-left: 6px; font-family: 'Pretendard', system-ui, sans-serif; font-size: 13px; font-weight: 500; color: var(--text-mute); }
.os-joint { margin: 8px 0 0; max-width: 72ch; font-size: 14.5px; line-height: 1.7; color: var(--text-sub); }
.os-run { margin-top: 12px; }
.os-voices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.os-voices p { margin: 0; padding: 10px 12px; background: var(--bg); border-radius: 8px; font-size: 13px; line-height: 1.65; color: var(--text-sub); }
.os-voices b { display: block; margin-bottom: 2px; font-size: 11.5px; color: var(--primary-strong); }
.os-sub { margin: 18px 0 8px; font-size: 13px; font-weight: 700; color: var(--text); }
.os-sub small { margin-left: 4px; font-weight: 500; color: var(--text-mute); }
.os-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }   /* 타일 여섯 → 셋씩 두 줄 (빈 칸 없이) */
.os-tiles.is-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }                        /* 편입 시험 — 넷 */
.os-tile {
  display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 8px; font-variant-numeric: tabular-nums;
}
.os-tile > span { font-size: 11.5px; color: var(--text-mute); }
.os-tile > span small { font-size: 10.5px; }
.os-tile b { font-size: 15px; font-weight: 700; color: var(--text); }
.os-tile b i { font-style: normal; font-weight: 500; color: var(--text-mute); }
.os-tile em { font-style: normal; font-size: 12px; font-weight: 700; color: var(--text-mute); }
.os-tile em.is-good { color: var(--green); }
.os-tile em.is-bad { color: var(--red); }
.os-tile > small { font-size: 11px; color: var(--text-mute); overflow-wrap: anywhere; }
.os-turn { margin: 10px 0 0; font-size: 12.5px; color: var(--text-sub); }
.os-moves { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0 18px; }
.os-moves li {
  display: flex; align-items: baseline; gap: 8px; padding: 6px 0;
  border-bottom: 1px solid var(--border); font-size: 13px; font-variant-numeric: tabular-nums;
}
.os-moves b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.os-moves span { font-size: 12px; color: var(--text-sub); }
.os-moves em { font-style: normal; font-size: 12px; font-weight: 700; }
.os-moves em.cm-inc { color: var(--primary); }
.os-moves em.cm-dec2 { color: var(--text-mute); }
.os-chart { min-width: 0; }
.os-canvas { position: relative; height: 280px; }
.os-tbl-wrap { overflow-x: auto; }
.os-tbl { width: 100%; min-width: 600px; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.os-tbl th, .os-tbl td { padding: 7px 8px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--border); }
.os-tbl th:first-child { text-align: left; }
.os-tbl thead th { font-size: 11.5px; font-weight: 600; color: var(--text-mute); }
.os-tbl tbody th { font-weight: 600; color: var(--text); }
.os-tbl tr.is-now > * { color: var(--text-sub); background: var(--bg); }
.os-tbl tr.is-pick > * { color: var(--primary-strong); font-weight: 700; }
.os-badge {
  margin-left: 5px; padding: 0 6px; border: 1px solid var(--border-strong); border-radius: 99px;
  font-style: normal; font-size: 10px; font-weight: 700; color: var(--text-mute);
}
.os-badge.is-pick { color: #fff; background: var(--primary); border-color: var(--primary); }
.os-foot {
  margin: 14px 0 0; padding-top: 10px; border-top: 1px solid var(--border);
  font-size: 11.5px; line-height: 1.65; color: var(--text-mute);
}
.wi-search { display: flex; gap: 8px; }
.wi-search input {
  flex: 1; min-width: 0; padding: 9px 12px; font-size: 14px; color: var(--text);
  background: var(--bg-card); border: 1px solid var(--border-strong); border-radius: 8px;
}
.wi-search input:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.wi-results { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.wi-results:empty { display: none; }
.wi-pick {
  display: flex; flex-direction: column; gap: 1px; max-width: 100%; padding: 7px 10px; text-align: left;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px;
}
.wi-pick:hover { border-color: var(--primary); }
.wi-pick:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.wi-pick b { font-size: 13px; font-weight: 600; color: var(--text); }
.wi-pick span { font-size: 11px; color: var(--text-mute); }
.wi-lead { margin: 14px 0 0; font-size: 14px; line-height: 1.7; color: var(--text-sub); }
.wi-lead b { color: var(--text); }
.wi-lead small { font-size: 12px; color: var(--text-mute); }
.wi-slide { margin: 12px 0 10px; }
.wi-slide label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--text-sub); }
.wi-slide label b { font-size: 18px; color: var(--primary); font-variant-numeric: tabular-nums; }
.wi-slide label small { margin-left: 4px; font-size: 11.5px; color: var(--text-mute); }
.wi-slide input[type=range] { width: 100%; accent-color: var(--primary); }
.wi-marks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.wi-mark {
  padding: 4px 10px; font-size: 11.5px; font-weight: 600; color: var(--text-sub);
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 99px;
}
.wi-mark:hover { color: var(--primary); border-color: var(--primary); }
.wi-mark:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.wi-story { margin: 12px 0 0; max-width: 76ch; font-size: 14px; line-height: 1.75; color: var(--text-sub); }
.wi-story b { color: var(--text); }
.wi-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 4px; }
@media (max-width: 860px) {
  .wi-charts, .os-voices { grid-template-columns: 1fr; }
  .os-tiles.is-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .os-canvas { height: 240px; }
  .os-hero h3 { font-size: 22px; }
  .os-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 리서치 페이퍼 › 종목 '담아 보기' 창 (2026-10-02) — 입력 줄: 주식 수 / 금액 · 수량 · 새 돈 / 현금 · 계산 */
.pbs-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 14px 0 0; }
.pbs-seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.pbs-seg button { border: none; background: var(--bg-card, #fff); padding: 7px 12px; font-size: 12.5px; font-weight: 600; color: var(--text-sub); cursor: pointer; }
.pbs-seg button + button { border-left: 1px solid var(--border-strong); }
.pbs-seg button.on { background: var(--primary, #6E1E2B); color: #fff; }
.pbs-seg button:disabled { color: var(--text-mute); background: #f4f2ee; cursor: not-allowed; }
.pbs-seg button:focus-visible, .pbs-qty input:focus-visible { outline: 2px solid var(--primary, #6E1E2B); outline-offset: 1px; }
.pbs-qty { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-sub); }
.pbs-qty input { width: 130px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 7px 9px; font-size: 14px; font-variant-numeric: tabular-nums; }
.pbs-form .btn-primary { padding: 7px 16px; }

/* ── 효율적 투자선 한 장 — 후보마다 같은 금액 (리서치 › 요약 · 페이퍼 결론 · 담아 보기 창, 2026-10-02) ── */
.rf-ctl { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 8px; }
.rf-mk-lbl { font-size: 12px; font-weight: 700; color: var(--text-sub); margin-right: -2px; }   /* 후보 시장 (한국 · 미국 · 함께) — 2026-10-03 */
.rf-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.rf-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; font-size: 12px; font-weight: 600;
  color: var(--text-mute); background: var(--bg-card); border: 1px dashed var(--border-strong); border-radius: 99px; cursor: pointer;
}
.rf-chip i { width: 8px; height: 8px; border-radius: 50%; opacity: .45; }
.rf-chip.on { color: var(--text); border-style: solid; border-color: var(--text-sub); }
.rf-chip.on i { opacity: 1; }
.rf-chip:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
/* 특정 주식 추가 (리서치 › 요약, 2026-10-05) — 먹색 ◆ = 직접 고른 종목 (산업 색과 겹치지 않게) */
.rf-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 8px; }
.rf-pick-list { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.rf-pick-list:empty { display: none; }
.rf-pick-add {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 12px; font-size: 12px; font-weight: 700;
  color: #1f2328; background: var(--bg-card); border: 1px solid #1f2328; border-radius: 99px; cursor: pointer;
}
.rf-pick-add:hover, .rf-pick-add[aria-expanded="true"] { background: #1f2328; color: #fff; }
.rf-pick-add:disabled { color: var(--text-mute); border-color: var(--border-strong); background: var(--bg-card); cursor: not-allowed; }
.rf-pick-add:focus-visible, .rf-pick-x:focus-visible, .rf-find-it:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.rf-chip.is-mine { cursor: default; color: var(--text); border-style: solid; border-color: #1f2328; padding-right: 6px; }
.rf-chip.is-mine i { width: 7px; height: 7px; border-radius: 1px; transform: rotate(45deg); background: #1f2328; opacity: 1; }
.rf-pick-x {
  display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; margin: -3px 0 -3px -2px; padding: 0;
  border: none; border-radius: 50%; background: transparent; color: var(--text-mute); cursor: pointer;
}
.rf-pick-x:hover { background: var(--bg); color: var(--text); }
.rf-find { max-width: 560px; margin: 0 0 10px; padding: 10px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--bg-card); }
.rf-find-q { width: 100%; box-sizing: border-box; padding: 8px 10px; font-size: 14px; border: 1px solid var(--border-strong); border-radius: 8px; }
.rf-find-q:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.rf-find-res { display: flex; flex-direction: column; gap: 1px; max-height: 280px; overflow-y: auto; margin-top: 6px; }
.rf-find-res:empty { display: none; }
.rf-find-it {
  display: flex; align-items: baseline; gap: 7px; width: 100%; padding: 7px 8px; text-align: left; font-size: 13px; color: var(--text);
  background: transparent; border: none; border-radius: 6px; cursor: pointer;
}
.rf-find-it:hover { background: var(--bg); }
.rf-find-it b { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.rf-find-it span { flex: 0 0 auto; font-size: 12px; color: var(--text-mute); font-variant-numeric: tabular-nums; }
.rf-find-it em { flex: 0 0 auto; margin-left: auto; padding: 1px 6px; font-style: normal; font-size: 10.5px; font-weight: 700; border-radius: 4px; }
.rf-find-it em.is-kr { color: #6E1E2B; background: #f6ecec; }
.rf-find-it em.is-us { color: #1c5d99; background: #e9f2fa; }
.rf-find-it small { flex: 0 0 auto; font-size: 11px; color: var(--text-mute); }
.rf-find-it:disabled { color: var(--text-mute); cursor: default; background: transparent; }
.rf-find-msg { margin: 6px 2px 0; font-size: 12px; line-height: 1.5; color: var(--text-mute); }
.rf-pick-say { margin: 0 0 8px; padding: 8px 11px; max-width: 86ch; font-size: 13.5px; line-height: 1.7; color: var(--text-sub);
  border-left: 3px solid #1f2328; background: var(--bg-soft, rgba(0,0,0,.025)); border-radius: 0 6px 6px 0; }
.rf-pick-say b { color: var(--text); }
.rf-tbl tr.is-mine > * { background: rgba(31,35,40,.035); }
.rf-tbl tr.is-mine > th:first-child { box-shadow: inset 3px 0 0 #1f2328; }
.rf-say { margin: 0 0 8px; max-width: 80ch; font-size: 13.5px; line-height: 1.7; color: var(--text-sub); }
.rf-say b { color: var(--text); }
/* 투자선에 넣은 보유 종목 · 뺀 종목 (2026-10-03) — 뺀 게 있으면 주황 테두리 */
.rf-cov { margin: 0 0 10px; padding: 7px 10px; max-width: 86ch; font-size: 12.5px; line-height: 1.65; color: var(--text-sub);
  border-left: 3px solid var(--border-strong); background: var(--bg-soft, rgba(0,0,0,.025)); border-radius: 0 6px 6px 0; }
.rf-cov b { color: var(--text); }
.rf-cov.is-warn { border-left-color: #e8590c; }
.rf-cov code { font-size: 11.5px; padding: 0 4px; border-radius: 4px; background: rgba(232,89,12,.1); color: #b8460b; }
.os-canvas.rf-canvas { height: 340px; }
.rf-tbl-wrap { margin-top: 10px; }
.rf-tbl th.rf-name, .rf-tbl tbody th:nth-child(2), .rf-tbl thead th:nth-child(2) { text-align: left; }
.rf-tbl th.rf-name small { margin-left: 4px; font-size: 11px; font-weight: 500; color: var(--text-mute); }
.rf-tbl td em { margin-left: 3px; font-style: normal; font-size: 11px; font-weight: 700; color: var(--text-mute); }
.rf-tbl td em.is-good { color: var(--green); }
.rf-tbl td em.is-bad { color: var(--red); }
.rf-tbl tbody tr[data-code] { cursor: pointer; }
.rf-tbl tbody tr[data-code]:hover > * { background: var(--bg); }
.rf-tbl tbody tr[data-code]:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.rf-tbl tr.rf-bench > * { color: var(--text-sub); }
.rf-n {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 4px; box-sizing: border-box;
  border-radius: 99px; font-size: 11px; font-weight: 700; color: #fff;
}
.rf-n.is-bench { background: var(--text-mute); font-size: 10px; }
.rf-paper { margin: 6px 0 14px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-card); }
@media (max-width: 560px) { .os-canvas.rf-canvas { height: 280px; } }

/* ── 리서치 › 요약 (2026-10-02) — 결론 → 투자선 → 1. 산업 → 2. 종목 → 산업별 글 ── */
.rs-months { margin-bottom: 10px; }
.rs-mkts { display: flex; flex-wrap: wrap; margin: 0 0 8px; }
.rs-lead { padding: 4px 0 14px; border-bottom: 1px solid var(--border); }
.rs-kick { margin: 0; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; color: var(--primary); }
.rs-kick small { margin-left: 6px; font-weight: 500; letter-spacing: 0; color: var(--text-mute); }
.rs-head { margin: 6px 0 0; font-family: var(--font-serif); font-size: 22px; font-weight: 600; line-height: 1.4; color: var(--text); text-wrap: balance; }
.rs-head span { display: inline; }
.rs-head i { font-style: normal; color: var(--text-mute); }
.rs-headline { margin: 8px 0 0; max-width: 78ch; font-size: 14.5px; line-height: 1.75; color: var(--text-sub); }
.rs-mine { margin: 10px 0 0; max-width: 78ch; padding: 10px 12px; font-size: 13.5px; line-height: 1.7; color: var(--text-sub); background: var(--primary-soft); border-radius: 8px; }
.rs-mine b { color: var(--primary-strong); }
.rs-sec { padding: 16px 0 4px; border-bottom: 1px solid var(--border); }
.rs-sec:last-of-type { border-bottom: none; }
.rs-h { margin: 0 0 6px; font-size: 16px; font-weight: 800; color: var(--text); }
.rs-p { margin: 0 0 10px; max-width: 80ch; font-size: 13px; line-height: 1.7; color: var(--text-sub); }
.rs-sub { margin: 16px 0 8px; font-size: 12.5px; font-weight: 700; color: var(--text-mute); letter-spacing: .02em; }
.rs-dot { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; vertical-align: 1px; }
.rs-tbl { min-width: 720px; }
.rs-tbl tbody th, .rs-tbl thead th:nth-child(2) { text-align: left; }
.rs-tbl td:nth-child(3), .rs-tbl thead th:nth-child(3) { text-align: center; }
.rs-tbl a, .rs-paper { color: var(--text); text-decoration: none; border-bottom: 1px dotted var(--text-mute); }
.rs-tbl a:hover, .rs-paper:hover { color: var(--primary); border-bottom-color: var(--primary); }
.rs-tbl tr.is-caution > * { color: var(--text-sub); }
.rs-pill { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 11px; font-weight: 700; white-space: nowrap; border: 1px solid var(--border-strong); color: var(--text-mute); }
.rs-pill.is-focus { color: #fff; background: var(--primary); border-color: var(--primary); }
.rs-pill.is-caution { color: var(--red); background: var(--red-soft); border-color: transparent; }
.rs-range { position: relative; display: inline-block; width: 46px; height: 6px; margin-left: 4px; vertical-align: 1px; border-radius: 3px; background: linear-gradient(90deg, var(--green-soft), var(--red-soft)); border: 1px solid var(--border); }
.rs-range i { position: absolute; top: -3px; width: 3px; height: 10px; margin-left: -1.5px; border-radius: 1px; background: var(--text-sub); }
.rs-med { margin-left: 4px; font-size: 11px; color: var(--text-mute); }
.rs-w .rs-warn { margin-left: 4px; }
.rs-wnote { margin: 6px 0 0; font-size: 11.5px; line-height: 1.6; color: var(--text-mute); }
.rs-why { margin: 0 0 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; }
.rs-why-h { margin: 0 0 4px; font-size: 13.5px; line-height: 1.65; color: var(--text-sub); }
.rs-why-h b { color: var(--text); }
.rs-why ul { margin: 0; padding-left: 20px; font-size: 12.5px; line-height: 1.7; color: var(--text-sub); }
.rs-ind { margin: 0 0 14px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; }
.rs-ind-h { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 0 0 6px; font-size: 15px; color: var(--text); }
.rs-ind-h .rs-paper { margin-left: auto; font-size: 12px; font-weight: 600; }
.rs-picks { list-style: none; margin: 0; padding: 0; }
.rs-pick { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 8px; padding: 9px 0; border-top: 1px solid var(--border); }
.rs-pick.is-more { display: none; }
.rs-ind.is-open .rs-pick.is-more { display: grid; }
.rs-num {
  display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; margin-top: 1px;
  border-radius: 50%; font-size: 11.5px; font-weight: 700; color: var(--c, var(--primary)); border: 1.5px solid var(--c, var(--primary)); box-sizing: border-box;
}
.rs-pick-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin: 0; font-size: 14px; }
.rs-pick-h .md-stock { font-weight: 700; color: var(--primary); text-decoration: none; border-bottom: 1px dotted var(--primary); }
.rs-pick-h small { font-size: 11.5px; color: var(--text-mute); }
.rs-pick-h .rs-gnum { min-width: 18px; height: 18px; font-size: 10.5px; align-self: center; }
.rs-score { margin-left: auto; font-size: 11.5px; font-weight: 700; color: var(--text-sub); font-variant-numeric: tabular-nums; }
.rs-pick-why { margin: 3px 0 0; font-size: 12.5px; line-height: 1.65; color: var(--text-sub); }
.rs-warn {
  display: inline-block; margin: 4px 4px 0 0; padding: 1px 7px; border-radius: 99px; font-style: normal;
  font-size: 10.5px; font-weight: 700; color: var(--amber); background: #FBF3E2;
}
.rs-more { margin-top: 6px; font-size: 12px; padding: 3px 10px; }
.rs-notes { margin: 8px 0 0; padding-left: 18px; font-size: 12px; line-height: 1.65; color: var(--text-mute); }
.rs-others { list-style: none; margin: 0; padding: 0; }
.rs-others li { display: grid; grid-template-columns: minmax(120px, 170px) auto minmax(0, 1fr); align-items: baseline; gap: 4px 12px; padding: 7px 0; border-top: 1px solid var(--border); font-size: 13px; }
.rs-others li > span small { margin-left: 4px; font-size: 11px; color: var(--text-mute); }
.rs-others .md-stock { font-weight: 700; color: var(--primary); text-decoration: none; border-bottom: 1px dotted var(--primary); white-space: nowrap; }
.rs-others em { font-style: normal; font-size: 12px; color: var(--text-mute); }
.rs-papers { margin-bottom: 12px; }
@media (max-width: 560px) {
  .rs-head { font-size: 19px; }
  .rs-others li { grid-template-columns: 1fr; gap: 2px; }
  .rs-ind-h .rs-paper { margin-left: 0; }
}

/* ── 알림 (2026-10-06) — 상단 종 단추 · 알림함 · 설정 · 화면 위 알림 카드 ── */
.btn-bell { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 0; border-radius: 999px; color: var(--text-sub); }
.btn-bell:hover { color: var(--primary); background: var(--primary-soft); }
.al-dot { position: absolute; top: 1px; right: 0; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--primary); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; box-shadow: 0 0 0 2px var(--bg-card); }
.al-back { position: fixed; inset: 0; z-index: 9100; background: rgba(28, 27, 25, .32); display: flex; justify-content: flex-end; }
.al-panel { width: min(420px, 100vw); height: 100%; background: var(--bg-card); border-left: 1px solid var(--border); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: al-in .2s cubic-bezier(.22, .61, .36, 1); }
@keyframes al-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.al-hd { display: flex; align-items: center; gap: 10px; padding: calc(12px + env(safe-area-inset-top, 0px)) 14px 12px 18px; border-bottom: 1px solid var(--border); }
.al-h { font-family: var(--font-serif); font-size: 17px; color: var(--text); margin-right: auto; }
.al-tabs { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.al-tabs button { font-size: 12px; font-weight: 600; color: var(--text-mute); padding: 5px 12px; border-radius: 6px; }
.al-tabs button.on { background: var(--bg-card); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.al-x { width: 32px; height: 32px; border-radius: 8px; color: var(--text-mute); display: inline-flex; align-items: center; justify-content: center; }
.al-x:hover { background: var(--bg); color: var(--text); }
.al-body { flex: 1; overflow-y: auto; padding: 6px 14px calc(18px + env(safe-area-inset-bottom, 0px)); }
.al-pad { padding: 18px 4px; font-size: 13px; }
.al-day { margin: 14px 4px 6px; font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--text-mute); }
.al-item { display: flex; gap: 12px; width: 100%; text-align: left; padding: 11px 10px; border-radius: 10px; color: var(--text); }
.al-item + .al-item { border-top: 1px solid var(--border); border-radius: 0; }
.al-item:hover { background: var(--bg); border-radius: 10px; }
.al-item.new .al-t::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--primary); margin: 0 6px 2px 0; vertical-align: middle; }
.al-ic { flex: 0 0 34px; width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--bg); color: var(--text-sub); }
.al-c-am { background: #FBF2DF; color: var(--amber); }
.al-c-pm { background: #ECEEF4; color: #3D4B66; }
.al-c-news { background: var(--primary-soft); color: var(--primary); }
.al-c-move { background: #EFECE6; color: var(--text); }
.al-c-sec { background: #F6E7E4; color: #9A3B2E; }                       /* 보안 알림 (2026-10-09) */
.al-c-test { background: var(--green-soft); color: var(--green); }
.al-tx { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.al-m, .al-app { font-size: 11px; color: var(--text-mute); }
.al-t { font-size: 14px; font-weight: 700; line-height: 1.4; color: var(--text); }
.al-b { font-size: 13px; line-height: 1.55; color: var(--text-sub); overflow-wrap: anywhere; }
.al-intro { padding: 18px 6px 8px; }
.al-intro-ic { display: inline-flex; width: 56px; height: 56px; border-radius: 16px; align-items: center; justify-content: center; background: var(--primary-soft); color: var(--primary); }
.al-intro-t { margin: 12px 0 10px; font-family: var(--font-serif); font-size: 17px; font-weight: 700; color: var(--text); }
.al-intro-l { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.al-intro-l li { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.55; color: var(--text-sub); }
.al-intro-l li svg { flex: 0 0 18px; margin-top: 1px; color: var(--primary); }
.al-intro-l b { color: var(--text); margin-right: 4px; }
.al-wide { width: 100%; }
.al-fine { margin: 10px 2px 0; font-size: 11.5px; line-height: 1.6; color: var(--text-mute); }
.al-sec { padding: 14px 4px; border-bottom: 1px solid var(--border); }
.al-sec:last-of-type { border-bottom: 0; }
.al-sec h4 { margin: 0 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .03em; color: var(--text-mute); }
.al-row { padding: 6px 0; }
.al-row > label { flex: 0 0 auto; }                 /* 긴 설명 옆에서 스위치가 찌그러지지 않게 */
.al-row .toggle-text b { font-size: 14px; }
.al-note { margin: 0 0 10px; font-size: 12.5px; line-height: 1.6; color: var(--text-sub); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; }
.al-ok { display: flex; gap: 8px; align-items: center; margin: 0 0 10px; font-size: 13px; color: var(--green); }
.al-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.al-btns .btn-ghost { flex: 1; min-width: 140px; }
.al-opt { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 0 2px; font-size: 13px; color: var(--text-sub); }
.al-chips { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.al-chip input { position: absolute; opacity: 0; pointer-events: none; }
.al-chip span { display: inline-block; padding: 6px 12px; border: 1px solid var(--border-strong); border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--text-sub); cursor: pointer; }
.al-chip input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }
.al-chip input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.al-toasts { position: fixed; z-index: 9200; top: calc(var(--topbar-h, 56px) + 10px); right: 16px; width: min(380px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.al-toast { position: relative; pointer-events: auto; background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); animation: al-drop .24s cubic-bezier(.22, .61, .36, 1); transition: opacity .25s, transform .25s; }
.al-toast.out { opacity: 0; transform: translateY(-8px); }
@keyframes al-drop { from { transform: translateY(-10px); opacity: 0; } to { transform: none; opacity: 1; } }
.al-toast-main { display: flex; gap: 11px; width: 100%; text-align: left; padding: 12px 40px 12px 12px; color: var(--text); }
.al-toast .al-b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.al-toast-x { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 7px; color: var(--text-mute); display: inline-flex; align-items: center; justify-content: center; }
.al-toast-x:hover { background: var(--bg); color: var(--text); }
.holding-row.al-flash { animation: al-flash 2.4s ease-out; }
@keyframes al-flash { 0%, 40% { background: var(--primary-soft); } 100% { background: transparent; } }
@media (max-width: 720px) {
  .al-back { align-items: flex-end; }
  .al-panel { width: 100%; height: 88vh; border-left: 0; border-radius: 16px 16px 0 0; animation: sheet-up .22s cubic-bezier(.22, .61, .36, 1); }
  .al-hd { padding-top: 12px; }
  .al-toasts { left: 10px; right: 10px; width: auto; top: calc(var(--topbar-h, 56px) + 6px); }
}
@media (prefers-reduced-motion: reduce) {
  .al-panel, .al-toast, .holding-row.al-flash { animation: none; }
}

/* ── 투자위원회 거버넌스 (2026-10-06) — 회의 종류 · 발동 조건 · 운영 규정 · 연기금 벤치마크 ── */
.cm-kind { display: inline-block; margin-left: 4px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .01em; background: var(--bg); border: 1px solid var(--border); color: var(--text-sub); }
.cm-kind-monthly, .cm-kind-quarterly, .cm-kind-annual { background: var(--green-soft); border-color: #cfe3d8; color: var(--green); }
.cm-kind-adhoc { background: var(--red-soft); border-color: #ecd0cb; color: var(--red); }
.cm-gov { margin: 4px 0 12px; padding: 10px 12px; border-radius: 8px; background: var(--bg); border: 1px solid var(--border); font-size: 13px; line-height: 1.6; color: var(--text-sub); }
.cm-gov p { margin: 0; }
.cm-gov b { color: var(--text); }
.cm-gov ul { margin: 6px 0 0; padding-left: 18px; }
.cm-gov .cm-gov-sub { margin-top: 4px; font-size: 12px; color: var(--text-mute); }
.cm-gov-monthly, .cm-gov-quarterly, .cm-gov-annual { background: var(--green-soft); border-color: #cfe3d8; }
.cm-gov-adhoc { background: var(--red-soft); border-color: #ecd0cb; }
.cm-draft li { opacity: .85; }
.cm-charter { margin: 14px 0 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-card); }
.cm-charter > summary { cursor: pointer; font-weight: 700; font-size: 14px; color: var(--text); }
.cm-charter > summary small { margin-left: 6px; font-weight: 500; font-size: 12px; color: var(--text-mute); }
.cm-bench-wrap { overflow-x: auto; margin: 6px 0 4px; }
.cm-bench { width: 100%; min-width: 620px; border-collapse: collapse; font-size: 12px; line-height: 1.55; }
.cm-bench th, .cm-bench td { padding: 7px 8px; border-top: 1px solid var(--border); text-align: left; vertical-align: top; }
.cm-bench thead th { font-size: 11px; color: var(--text-mute); font-weight: 700; border-top: 0; }
.cm-bench tbody th { white-space: nowrap; color: var(--text); }
/* 분석 › 요약 › 벤치마크 (2026-10-07 · core/committee_bench) — .cm-bench* 는 운영 규정의 연기금 표라 cm-bm- 로 */
.cm-bm-chart { position: relative; height: 210px; margin: 12px 0 6px; }
.cm-bm-wrap { overflow-x: auto; margin: 4px 0 6px; }
.cm-bm-t { width: 100%; border-collapse: collapse; font-size: 12.5px; line-height: 1.5; font-variant-numeric: tabular-nums; }
.cm-bm-t th, .cm-bm-t td { padding: 5px 6px; border-top: 1px solid var(--border); text-align: right; white-space: nowrap; }
.cm-bm-t thead th { font-size: 11px; color: var(--text-mute); font-weight: 700; border-top: 0; }
.cm-bm-t th:first-child { text-align: left; color: var(--text); font-weight: 600; max-width: 9em; overflow: hidden; text-overflow: ellipsis; }
.cm-bm-t thead th:first-child { color: var(--text-mute); }
.cm-bm-act { margin: 10px 0 0; text-align: right; }
.cm-bm-act .btn-ghost { font-size: 12px; padding: 5px 10px; }
.cm-bm-drift { color: var(--amber); }
.cm-src { font-size: 11px; color: var(--primary); }
