/*
 * EdgeLab 모니터 — 다크 단일 테마.
 *
 * 방향: 야간 미국장 모니터링용 계기판. 배경은 깊은 남색 잉크, 숫자는
 * tabular-nums 고정폭, 상태(양/음/경고)는 채도 낮춘 신호색만 사용.
 * 장식 그림자 대신 1px 경계와 표면 명도 2단으로 깊이를 만든다.
 * 모든 색을 명시적으로 칠한다 — 호스트 테마 상속 없음.
 */

:root {
  /* 다크 전용은 결정이지 누락이 아니다 (2026-08-27). 실제 사용 시각이
     프리마켓~애프터(한국 밤~새벽)이고, 손익 신호색(--pos/--neg)·유리
     알파·배경 광원이 전부 어두운 바닥을 가정해 조율돼 있다. 라이트
     팔레트는 이 네 층을 다시 계산해야 성립한다 — 토큰 스왑이 아니다.
     meta[color-scheme] 만으로는 네이티브 컨트롤이 안 따라오는 경우가
     있어 CSS 쪽에도 선언한다. */
  color-scheme: dark;
  --bg: #0b0f17;
  --bg-raise: #0e141f;
  --surface: #121a28;
  --surface-2: #182235;
  --border: rgba(148, 163, 184, 0.16);
  --border-strong: rgba(148, 163, 184, 0.28);
  --text: #e7ecf5;
  --muted: #8e9bb1;
  /* 2026-08-27: 3.11:1 로 WCAG AA(4.5) 미달이었다 — 하필 손절 여유·
     보유일수·확인 시각처럼 '놓치면 위험한' 보조 정보에 쓰이는 색이다.
     색조(220°)와 채도는 유지하고 명도만 올려 양쪽 배경에서 통과시켰다
     (vs bg 5.03:1 · vs surface 4.58:1). */
  --faint: #7483a2;
  /* 2026-10-12 (판정 49): 손익 색을 국내 증권앱 문법으로 — 수익 빨강 · 손실 파랑.
     동료 TossMock 앱과 토스가 같은 규칙이고, 사용자 눈이 이미 그 방향으로 읽는다.
     강조색은 손실 파랑과 겹치지 않게 바이올렛으로 옮겼다(동료 앱의 '정보=보라').
     오류·차단은 손익과 섞이지 않게 별도 주황(--danger)을 쓴다. */
  --accent: #9d8cff;
  --accent-soft: rgba(157, 140, 255, 0.14);
  --pos: #ff5c6c;
  --pos-soft: rgba(255, 92, 108, 0.13);
  --neg: #5a9bff;
  --neg-soft: rgba(90, 155, 255, 0.13);
  --danger: #ff9b4a;
  /* 상태 양호(LIVE·정상·이상 없음)는 손익이 아니다 — 초록으로 따로 둔다. */
  --ok: #3ddc97;
  --danger-soft: rgba(255, 155, 74, 0.13);
  --warn: #ffb454;
  --warn-soft: rgba(255, 180, 84, 0.12);
  --radius: 20px;
  --radius-small: 14px;
  --radius-large: 22px;
  --tab-height: 64px;
  --pad: 16px;
  font-size: 16px;
}

/* 시그니처 숫자 서체 — Space Grotesk (OFL, 셀프호스트, tnum 지원).
 * 숫자·라틴만 담당하고 한글·기호는 시스템 스택으로 자연 폴백한다. */
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url("fonts/space-grotesk.woff2") format("woff2");
}

* { box-sizing: border-box; }

/* 스크롤바 숨김 — 설치형 앱 문법 (스크롤 동작은 그대로) */
html { scrollbar-width: none; }
html::-webkit-scrollbar, body::-webkit-scrollbar,
.sheet::-webkit-scrollbar { width: 0; height: 0; display: none; }
.sheet { scrollbar-width: none; }

/* display 를 지정한 요소(.overlay 등)에서도 hidden 속성이 항상 이긴다. */
[hidden] { display: none !important; }

html { background: var(--bg); }

/* 2026-08-27: 배경 광원을 body 에서 고정 레이어로 옮겼다. body 배경은
   문서와 함께 스크롤해서, 유리(backdrop-filter)가 스크롤 중에 뒤 기울기를
   계속 다시 샘플링하며 어른거렸다. 화면에 못박으면 유리가 가만히 있는다.
   광원은 기존 상단 청색(7%)을 그대로 두고 하단에 4% 한 개만 더했다 —
   숫자 대비를 건드리지 않는 세기다. */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    /* 오로라 — 블루·바이올렛 두 색만 (동료 앱 AuroraBackground 와 같은 규칙).
       숫자 대비를 지키려고 상단에만 모으고 세기는 낮게 둔다. */
    radial-gradient(90% 46% at 12% -8%, rgba(72, 115, 255, 0.20), transparent 62%),
    radial-gradient(70% 40% at 96% 2%, rgba(158, 97, 245, 0.15), transparent 64%),
    radial-gradient(80% 40% at 50% 108%, rgba(107, 82, 250, 0.08), transparent 70%);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
    "Apple SD Gothic Neo", "Noto Sans KR", "Segoe UI", Roboto, sans-serif;
  font-size: 0.9375rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  /* 한국어는 어절 단위로만 끊는다 (2026-08-27) */
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.num {
  font-family: "Space Grotesk", "Pretendard Variable", Pretendard, -apple-system,
    BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 8px; top: -48px;
  background: var(--surface-2); color: var(--text);
  padding: 8px 14px; border-radius: var(--radius-small);
  text-decoration: none; z-index: 60; transition: top 0.15s;
}
.skip-link:focus { top: 8px; }

/* ---- 상단바 -------------------------------------------------------------- */

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) var(--pad) 12px;
  background: rgba(11, 15, 23, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.brand {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700; font-size: 1.05rem; letter-spacing: -0.03em;
}
.brand em { font-style: normal; color: var(--accent); }

.paper-badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 999px;
  font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.04em;
  color: var(--warn); background: var(--warn-soft);
  border: 1px solid rgba(255, 180, 84, 0.35);
  white-space: nowrap;
}

.topbar-status { display: inline-flex; align-items: center; }
.sync { margin-left: auto; font-size: 0.75rem; color: var(--faint); }

/* 히어로가 스크롤 밖일 때 상단바가 총 자산을 이어받는다 */
.topbar-equity {
  font-size: 0.9375rem; font-weight: 800; letter-spacing: -0.02em;
  animation: equity-in 0.18s ease both;
}
@keyframes equity-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* ---- 연결 배너 ------------------------------------------------------------ */

.conn-banner {
  position: sticky; top: 0; z-index: 29;
  display: flex; align-items: center; gap: 10px;
  margin: 0; padding: 9px var(--pad);
  font-size: 0.8125rem; color: var(--warn);
  background: #201a10; border-bottom: 1px solid rgba(255, 180, 84, 0.3);
}
.conn-banner span { flex: 1 1 auto; }

/* ---- 레이아웃 · 탭 --------------------------------------------------------- */

.layout { max-width: 760px; margin: 0 auto; }

.content {
  padding: 14px var(--pad) calc(var(--tab-height) + env(safe-area-inset-bottom, 0px) + 24px);
}

.tabnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(3, 1fr);
  height: calc(var(--tab-height) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(14, 20, 31, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
}

.tab-btn {
  appearance: none; background: none; border: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--faint);
  font: inherit; font-size: 0.6875rem; font-weight: 600;
  cursor: pointer; transition: color 0.15s ease;
}
.tab-btn svg { width: 22px; height: 22px; transition: transform 0.18s ease; }
.tab-btn { position: relative; }
.tab-btn::after {
  content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 2px;
  border-radius: 0 0 2px 2px;
  background: linear-gradient(90deg, var(--accent), #7fb4ff);
  opacity: 0; transform: scaleX(0.4); transition: all 0.22s ease;
}
.tab-btn[aria-current="page"] { color: var(--accent); }
.tab-btn[aria-current="page"]::after { opacity: 1; transform: scaleX(1); }
.tab-btn[aria-current="page"] svg { transform: translateY(-1px); stroke-width: 2.2; }
.tab-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 10px; }

/* ---- 패널 ------------------------------------------------------------------ */

/* 탭바가 화면 이름을 이미 말한다 — 제목은 스크린리더 전용으로 내리고
 * 콘텐츠(자산 숫자·세그먼트)가 각 화면의 첫 인상이 되게 한다. */
.panel-title {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.panel.enter .panel-body { animation: panel-in 0.22s ease both; }
.panel.enter .panel-body > * { animation: panel-in 0.3s ease both; }
.panel.enter .panel-body > *:nth-child(2) { animation-delay: 0.03s; }
.panel.enter .panel-body > *:nth-child(3) { animation-delay: 0.06s; }
.panel.enter .panel-body > *:nth-child(4) { animation-delay: 0.09s; }
.panel.enter .panel-body > *:nth-child(5) { animation-delay: 0.12s; }
.panel.enter .panel-body > *:nth-child(n+6) { animation-delay: 0.15s; }

@keyframes panel-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.panel-body { display: flex; flex-direction: column; gap: 12px; }

/* ---- 오늘: 히어로 ------------------------------------------------------------ */

.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot-live { background: var(--ok); animation: pulse 2.4s ease-out infinite; }
.dot-stale { background: var(--warn); }
.dot-unknown { background: var(--danger); }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(61, 220, 151, 0.45); }
  70% { box-shadow: 0 0 0 8px rgba(61, 220, 151, 0); }
  100% { box-shadow: 0 0 0 0 rgba(61, 220, 151, 0); }
}

.ftxt-live { color: var(--ok); }
.ftxt-stale { color: var(--warn); }
.ftxt-unknown { color: var(--danger); }

.note {
  border-radius: var(--radius);
  padding: 12px 14px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.note-warn { border-color: rgba(255, 180, 84, 0.4); background: var(--warn-soft); }
.note-danger { border-color: rgba(255, 155, 74, 0.4); background: var(--danger-soft); }
.note-title { font-weight: 700; font-size: 0.875rem; margin-bottom: 2px; }
.note-warn .note-title { color: var(--warn); }
.s4-pending-note { font-size: 0.8125rem; color: var(--warn); }
.note-danger .note-title { color: var(--danger); }
.note-text { font-size: 0.8125rem; color: var(--muted); }

/* 히어로는 카드가 아니다 — 잉크 배경 위에 숫자가 직접 선다 (증권앱 홈 문법). */
.hero-open { padding: 10px 2px 2px; }
.hero-label {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 0.8125rem; font-weight: 600; color: var(--muted);
}
.hero-live {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.6875rem; font-weight: 700;
}
.hero-value {
  font-size: 2.875rem; font-weight: 700; letter-spacing: -0.045em;
  margin-top: 6px; line-height: 1.08;
}
.hero-value-dim { color: var(--faint); }

.pnl-pill {
  display: inline-flex; align-items: center;
  margin-top: 10px; padding: 5px 12px; border-radius: 999px;
  font-size: 0.875rem; font-weight: 800; letter-spacing: -0.01em;
}
.pill-pos { color: var(--pos); background: var(--pos-soft); }
.pill-neg { color: var(--neg); background: var(--neg-soft); }
.pill-flat { color: var(--muted); background: var(--surface-2); }
.hero-footnote { margin-top: 2px; padding: 0 2px; font-size: 0.6875rem; color: var(--faint); }

/* 자산곡선 스파크라인 */
.equity-spark { margin-top: 14px; }
.equity-spark canvas { display: block; width: 100%; }
.spark-caption { margin-top: 2px; font-size: 0.6875rem; color: var(--faint); }
.hero-sub { margin-top: 6px; font-size: 0.75rem; }
.spark-mini { margin-top: 0; opacity: 0.9; }

.asset-bar {
  margin-top: 10px; height: 6px; border-radius: 3px;
  background: var(--surface-2); overflow: hidden;
}
.asset-bar-fill {
  height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), #7fb4ff);
  transition: width 0.4s ease;
}
.asset-bar-legend { margin-top: 6px; font-size: 0.6875rem; color: var(--muted); }

.sym-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  font-size: 0.75rem; font-weight: 800; letter-spacing: 0;
  flex: none;
}
.hold-with-avatar { display: flex; align-items: center; gap: 10px; }

.progress-track {
  height: 6px; border-radius: 3px; background: var(--surface-2);
  overflow: hidden; margin-top: 6px;
}
.progress-fill {
  height: 100%; border-radius: 3px; background: var(--accent);
  transition: width 0.4s ease;
}

.pos { color: var(--pos); }
.neg { color: var(--neg); }
.flat { color: var(--muted); }

/* ---- 보유 종목 카드 -------------------------------------------------------- */

.pos-card {
  appearance: none; font: inherit; text-align: left;
  display: block; width: 100%; color: var(--text); cursor: pointer;
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.05), transparent 34%), var(--surface);
  border: 0;
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(231, 236, 245, 0.05);
  padding: 12px 14px;
  transition: transform 0.14s ease, filter 0.15s ease;
}
.pos-card:active { transform: scale(0.985); filter: brightness(1.08); }
.pos-static { cursor: default; }
.pos-static:active { transform: none; filter: none; }
.pos-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pos-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.pos-sym-row { display: flex; align-items: center; gap: 8px; }
.pos-sym { font-size: 1.125rem; font-weight: 800; letter-spacing: -0.01em; }
.pos-line { font-size: 0.8125rem; color: var(--muted); margin-top: 3px; }
.pos-right { text-align: right; flex: none; }
.pos-pnl { font-size: 1.125rem; font-weight: 800; letter-spacing: -0.01em; }
.pos-pct { font-size: 0.8125rem; font-weight: 700; margin-top: 1px; }
.pos-meta {
  margin-top: 8px; padding-top: 8px;
  border-top: 1px dashed var(--border);
  font-size: 0.75rem; color: var(--faint);
}

/* 오늘 탭 전략 카드 — 계좌 요약 + 보유 종목 pill. 탭하면 해당 세그먼트로. */
.strat-card {
  appearance: none; font: inherit; text-align: left;
  display: flex; flex-direction: column; gap: 12px;
  width: 100%;
  background: var(--surface);
  border: 0;
  border-radius: var(--radius-large);
  box-shadow: inset 0 1px 0 rgba(231, 236, 245, 0.05);
  padding: 15px 16px;
  color: var(--text); cursor: pointer;
  transition: transform 0.14s ease, filter 0.15s ease;
}
.strat-card:active { transform: scale(0.985); filter: brightness(1.08); }
.strat-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.strat-card-head { display: flex; align-items: center; gap: 12px; }
.strat-card-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 13px;
  font-size: 0.875rem; font-weight: 800; color: #0a1220;
  flex: none;
}
.strat-card-namecol { min-width: 0; flex: 1 1 auto; }
.strat-card-name { font-size: 0.9375rem; font-weight: 800; letter-spacing: -0.01em; }
.strat-card-sub { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }
.strat-card-right { text-align: right; flex: none; }
.strat-card-pnl { font-size: 1.0625rem; font-weight: 800; letter-spacing: -0.015em; }
/* 등락 칩 (동료 앱 ChangeChip) — 퍼센트를 같은 색의 옅은 판 위에 */
.strat-card-pct {
  display: inline-block; margin-top: 3px; padding: 1px 7px; border-radius: 8px;
  font-size: 0.75rem; font-weight: 700;
}
.strat-card-pct.pos { background: var(--pos-soft); }
.strat-card-pct.neg { background: var(--neg-soft); }
.strat-card-stale {
  font-size: 0.75rem;
  color: var(--warn);
  margin-top: 8px;
}
.sym-pill-stale { color: var(--faint); font-weight: 500; }

.strat-card-empty { font-size: 0.75rem; color: var(--faint); }



.sym-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.sym-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 10px;
  background: rgba(11, 15, 23, 0.45);
  font-size: 0.75rem; font-weight: 700;
}
.sym-pill-pct { font-weight: 700; }

/* 조용한 메타 카드 — 참고 수치 모음 */
.meta-card {
  background: var(--surface);
  border-radius: var(--radius-large);
  box-shadow: inset 0 1px 0 rgba(231, 236, 245, 0.05);
  padding: 6px 16px;
}

/* 이벤트 필터 칩 */
.filter-bar { display: flex; gap: 8px; }
.filter-chip {
  appearance: none; font: inherit;
  font-size: 0.8125rem; font-weight: 700;
  padding: 6px 14px; border-radius: 999px;
  background: var(--surface); color: var(--muted);
  border: 1px solid var(--border-strong);
  cursor: pointer; transition: all 0.15s ease;
}
.filter-chip.on {
  background: var(--accent-soft);
  border-color: rgba(157, 140, 255, 0.45);
  color: var(--accent);
}
.filter-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- 격자 · 행 --------------------------------------------------------------- */

.section-label {
  margin-top: 14px;
  font-size: 0.875rem; font-weight: 700; letter-spacing: -0.01em;
  color: var(--text);
}

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.cell {
  background: var(--surface);
  border-radius: var(--radius-small);
  padding: 10px 12px;
}
.cell-k { font-size: 0.6875rem; color: var(--muted); }
.cell-v { font-size: 1rem; font-weight: 700; margin-top: 2px; }

.row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 7px 2px;
  border-bottom: 1px dashed var(--border);
}
.row:last-child { border-bottom: 0; }
.row .k { font-size: 0.8125rem; color: var(--muted); flex: none; }
.row .v { font-size: 0.875rem; font-weight: 600; text-align: right; overflow-wrap: anywhere; }

/* ---- 이벤트 ------------------------------------------------------------------ */

.date-divider {
  margin-top: 10px;
  font-size: 0.75rem; font-weight: 700; color: var(--faint);
}
.date-divider:first-of-type { margin-top: 2px; }

.event-row {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(231, 236, 245, 0.04);
  padding: 11px 14px;
}
.event-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.event-time { font-size: 0.75rem; color: var(--faint); font-variant-numeric: tabular-nums; }
.event-sym { font-size: 0.75rem; font-weight: 700; color: var(--accent); }
.event-title { font-size: 0.875rem; margin-top: 4px; }
.event-meta { font-size: 0.75rem; color: var(--faint); margin-top: 4px; overflow-wrap: anywhere; }

/* 같은 날의 기록은 한 표면 — 행 사이는 머리카락 선. 행 자체는 불투명 검산 표면을 유지한다. */
.event-list {
  display: flex; flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(231, 236, 245, 0.04);
  overflow: hidden;
}
.event-list > .event-row {
  border-radius: 0;
  box-shadow: none;
}
.event-list > .event-row + .event-row { border-top: 1px solid var(--border); }

.event-row.expandable { cursor: pointer; }
.event-row.expandable:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.event-row.expanded { background: var(--surface-2); }
.event-full {
  margin-top: 8px; padding-top: 8px;
  border-top: 1px dashed var(--border);
  display: flex; flex-direction: column; gap: 3px;
}
.event-full-line { font-size: 0.75rem; color: var(--muted); overflow-wrap: anywhere; }

.chip {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 999px;
  font-size: 0.6875rem; font-weight: 700;
  color: var(--accent); background: var(--accent-soft);
  border: 1px solid rgba(157, 140, 255, 0.3);
}
.chip-research { color: var(--warn); background: var(--warn-soft); border-color: rgba(255, 180, 84, 0.35); }
.chip-pos { color: var(--pos); background: var(--pos-soft); border-color: rgba(255, 92, 108, 0.35); }
.chip-sell { color: var(--neg); background: var(--neg-soft); border-color: rgba(90, 155, 255, 0.35); }
/* 오류·거부 칩은 손익 색이 아니다 (2026-10-12) */
.chip-neg { color: var(--danger); background: var(--danger-soft); border-color: rgba(255, 155, 74, 0.35); }
/* 상태 양호(복구·심사 통과·손익비 충족)는 손익이 아니다 — 초록 유지 */
.chip-ok { color: var(--ok); background: rgba(61, 220, 151, 0.12); border-color: rgba(61, 220, 151, 0.35); }
.chip-neutral { color: var(--text); background: var(--surface-2); border-color: var(--border-strong); }
.chip-dim { color: var(--faint); background: transparent; border-color: var(--border); }

/* ---- 전략 ------------------------------------------------------------------- */

.strat-head { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.strat-name { margin: 0; font-size: 1rem; font-weight: 800; letter-spacing: -0.01em; }
.hash {
  font-size: 0.6875rem; color: var(--faint);
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 2px 7px; border-radius: 6px;
  font-variant-numeric: tabular-nums;
}

.primary-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.primary-row .label { font-size: 0.6875rem; color: var(--muted); }
.primary-val { font-size: 1.625rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.primary-sub { font-size: 0.75rem; color: var(--faint); margin-top: 2px; }

.meta-row { font-size: 0.75rem; color: var(--faint); padding: 2px 2px 0; }

/* ---- 손익 검산 장부 --------------------------------------------------------
   2026-08-26: "금액 계산이 사용자 관점에서 안 들어온다"는 지적. 한 줄로
   이어붙인 분해를 세로 항목 + 합계선으로 세워, 더해지는 게 눈에 보이게. */

.ledger {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ledger-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.8125rem;
}
.ledger-k { color: var(--muted); }
.ledger-v { color: var(--text); font-variant-numeric: tabular-nums; }
.ledger-total {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-weight: 700;
}
.ledger-total .ledger-k { color: var(--text); }

/* 완료 거래 승·패 집계 — 최근 몇 건이 한쪽으로 쏠려도 전모가 보이게. */
.tally { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tally-side {
  /* 선택적 글래스: 큰 합계 두 개만 읽는 요약 카드라 대비 손실이
     판단을 바꾸지 않는다. 세로로 훑어 검산하는 장부는 불투명 유지. */
  background: color-mix(in srgb, var(--surface) 62%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius-small);
  padding: 10px 12px;
  border-left: 3px solid var(--border);
}
.tally-side.win { border-left-color: var(--pos); }
.tally-side.loss { border-left-color: var(--neg); }
.tally-k { font-size: 0.6875rem; color: var(--muted); }
.tally-v {
  font-size: 0.9375rem;
  font-weight: 700;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

/* ---- 검토 ------------------------------------------------------------------- */

/* ---- 공용 ------------------------------------------------------------------- */

.muted { color: var(--muted); font-size: 0.8125rem; }
.small { font-size: 0.75rem; }
p.muted { margin: 0; }

.empty {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 18px 14px;
  text-align: center;
}
.empty-title { font-weight: 700; font-size: 0.875rem; color: var(--muted); }
.empty-hint { font-size: 0.75rem; color: var(--faint); margin-top: 3px; }

.btn {
  appearance: none; font: inherit;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 10px; padding: 9px 16px;
  font-size: 0.875rem; font-weight: 700; cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-small { padding: 5px 12px; font-size: 0.75rem; border-radius: 8px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #0a1220; }
.btn-primary:disabled { opacity: 0.55; cursor: default; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.linklike {
  appearance: none; background: none; border: 0; padding: 0 2px 4px;
  margin-top: -4px;
  font: inherit; font-size: 0.8125rem; font-weight: 700;
  color: var(--accent); cursor: pointer; text-align: left;
}
.linklike:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.slow-hint { display: flex; align-items: center; gap: 10px; }

/* ---- 스켈레톤 ------------------------------------------------------------------ */

.skel {
  height: 14px; border-radius: 7px;
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
.skel.tall { height: 72px; border-radius: var(--radius); }
.w40 { width: 40%; } .w60 { width: 60%; } .w80 { width: 80%; } .w90 { width: 90%; }

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

/* ---- 바텀시트 (종목 상세) ----------------------------------------------------------- */

.sheet-backdrop {
  position: fixed; inset: 0; z-index: 44;
  background: rgba(7, 10, 16, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0; transition: opacity 0.22s ease;
}
.sheet-backdrop.open { opacity: 1; }

.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  max-width: 560px; margin: 0 auto;
  /* 선택적 글래스 (2026-08-27): 시트는 오버레이다 — 뒤 화면이 살짝
     비치면 '어디서 열렸는지'가 읽히고, 닫으면 돌아갈 곳이 보인다.
     데이터 카드는 시트 안에서도 불투명을 유지한다 (검산하는 숫자). */
  background: color-mix(in srgb, var(--bg-raise) 88%, transparent);
  backdrop-filter: blur(20px) saturate(120%);
  -webkit-backdrop-filter: blur(20px) saturate(120%);
  border-radius: 24px 24px 0 0;
  border: 1px solid var(--border);
  border-bottom: 0;
  padding: 10px var(--pad) calc(env(safe-area-inset-bottom, 0px) + 18px);
  transform: translateY(102%);
  transition: transform 0.26s cubic-bezier(0.2, 0.9, 0.3, 1);
  max-height: 82dvh; overflow-y: auto;
}
.sheet.open { transform: none; }
body.sheet-locked { overflow: hidden; }

/* 2026-08-27: 손잡이가 장식(aria-hidden)이라 끌어내릴 수도, 누를 수도
   없었다 — 닫기 버튼은 차트 아래라 스크롤해야 나온다. 손잡이 자체를
   닫기 버튼으로 만들어 스크롤 없이 항상 닿게 한다. 터치 타깃은
   44px 를 확보하되 눈에 보이는 선은 그대로 4px 다. */
.sheet-grip {
  display: block; width: 100%; height: 28px;
  padding: 0; border: 0; background: none; cursor: pointer;
  margin: 0 auto 6px;
}
.sheet-grip span {
  display: block; width: 44px; height: 4px; border-radius: 2px;
  background: var(--border-strong);
  margin: 12px auto;
  transition: background 120ms ease, width 120ms ease;
}
.sheet-grip:hover span, .sheet-grip:focus-visible span {
  background: var(--muted); width: 56px;
}
.sheet-body { display: flex; flex-direction: column; gap: 12px; }
.sheet-head { display: flex; align-items: center; gap: 12px; }
.sheet-titlecol { min-width: 0; }
.sheet-sym { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.01em; }
.sheet-subtitle { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }
.sheet-pnl { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.03em; }
.sheet-close { align-self: stretch; text-align: center; margin-top: 4px; }

/* 가격 게이지: 손절 → 진입 → +1R, 현재가 도트 */
.gauge { padding: 2px 2px 0; }
.gauge-track {
  position: relative; display: flex;
  height: 8px; border-radius: 4px; overflow: hidden;
}
.gauge-zone { flex: 1 1 50%; }
.gauge-risk { background: var(--neg-soft); }
.gauge-reward { background: var(--pos-soft); }
.gauge-dot {
  position: absolute; top: 50%;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--pos); border: 2.5px solid var(--bg-raise);
  transform: translate(-50%, -50%);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}
.gauge-dot.neg-dot { background: var(--neg); }
.gauge-labels {
  display: flex; justify-content: space-between; gap: 8px;
  margin-top: 7px; font-size: 0.6875rem; color: var(--faint);
}

/* 상세 차트 · 판단 사유 */
.chart-seg { margin-bottom: 10px; }
.chip-small { padding: 4px 12px; font-size: 0.75rem; }

.detail-chart {
  position: relative;
  border-radius: var(--radius-small); overflow: hidden;
  padding-top: 22px; /* 스크럽 툴팁 자리 */
}
.detail-chart canvas {
  display: block; width: 100%;
  touch-action: pan-y; /* 세로 스크롤은 통과, 가로 문지르기는 스크럽 */
  cursor: crosshair;
}
.chart-tip {
  position: absolute; top: 0; left: 0; z-index: 2;
  padding: 2px 8px; border-radius: 7px;
  background: var(--surface-2);
  font-size: 0.6875rem; font-weight: 700; white-space: nowrap;
  pointer-events: none;
}
.chart-holder { min-height: 40px; }
.blocker-list { display: flex; flex-direction: column; gap: 8px; }
.blocker-row { display: flex; align-items: baseline; gap: 8px; }
.blocker-text { font-size: 0.8125rem; color: var(--muted); }

/* watch 행 버튼화 */
button.watch-row {
  appearance: none; font: inherit; text-align: left;
  width: 100%; background: none; border: 0; border-bottom: 1px dashed var(--border);
  color: var(--text); cursor: pointer;
}
button.watch-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

/* 당겨서 새로고침 */
.ptr {
  position: fixed; top: calc(env(safe-area-inset-top, 0px) + 58px);
  left: 50%; transform: translateX(-50%); z-index: 28;
  padding: 6px 14px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 0.75rem; font-weight: 700; color: var(--muted);
  opacity: 0; pointer-events: none;
}

/* ---- 오버레이 · 로그인 ------------------------------------------------------------ */

.overlay {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(7, 10, 16, 0.86);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.overlay-box {
  position: relative; overflow: hidden;
  width: min(400px, 100%);
  background: var(--bg-raise);
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  padding: 26px 22px;
  display: flex; flex-direction: column; gap: 12px;
  align-items: flex-start;
  animation: panel-in 0.25s ease both;
}

.overlay-danger .overlay-box { border-color: rgba(255, 155, 74, 0.5); }

.login-box::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(60% 46% at 90% -8%, rgba(157, 140, 255, 0.2), transparent 70%),
    radial-gradient(44% 40% at -8% 108%, rgba(167, 139, 250, 0.14), transparent 70%);
}
.login-box > * { position: relative; }

.overlay-title { margin: 0; font-size: 1.125rem; font-weight: 800; }
.overlay-text { margin: 0; font-size: 0.875rem; color: var(--muted); }

.login-box { align-items: stretch; text-align: left; }
.login-brand {
  font-family: "Space Grotesk", sans-serif;
  font-size: 2rem; font-weight: 700; letter-spacing: -0.04em;
}
.login-brand em { font-style: normal; color: var(--accent); }
.login-box .paper-badge { align-self: flex-start; }
.login-box .overlay-text { font-size: 0.8125rem; }

#auth-form { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }

#auth-password {
  font: inherit; font-size: 1rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 12px 14px;
}
#auth-password:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
#auth-password::placeholder { color: var(--faint); }

.auth-error { margin: 0; font-size: 0.8125rem; font-weight: 600; color: var(--danger); }

/* ---- 기타 ------------------------------------------------------------------------ */

.noscript { padding: 24px; color: var(--warn); }

body.violated .layout { filter: blur(3px); pointer-events: none; }

@media (min-width: 700px) {
  :root { --pad: 24px; }
  .hero-value { font-size: 3.25rem; }
}

/* 넓은 화면: 화면 폭 전체를 가로지르는 하단 탭바는 760px 본문과 따로 논다 —
 * 본문 아래 떠 있는 탭 묶음으로 줄인다. 휴대폰 폭은 종전 그대로. */
@media (min-width: 900px) {
  .tabnav {
    left: 50%; right: auto; bottom: 16px;
    width: 360px; height: 58px;
    padding-bottom: 0;
    transform: translateX(-50%);
    border: 1px solid var(--border-strong);
    border-radius: 18px;
    box-shadow: 0 12px 32px rgba(3, 6, 12, 0.55);
  }
  .tab-btn::after { top: auto; bottom: 6px; left: 38%; right: 38%; border-radius: 2px; }
  .tab-btn:hover { color: var(--muted); }
  .tab-btn[aria-current="page"]:hover { color: var(--accent); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---- 전략: 지금 보는 것 ------------------------------------------------------ */

.watch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 7px 2px;
  border-bottom: 1px dashed var(--border);
}
.watch-row:last-of-type { border-bottom: 0; }
.watch-left { display: flex; align-items: baseline; gap: 8px; }
.watch-left-col { min-width: 0; }
.watch-sub { font-size: 0.6875rem; color: var(--faint); margin-top: 1px; }
.watch-sym { font-size: 0.875rem; font-weight: 800; }
.watch-chg { font-size: 0.75rem; font-weight: 700; }
.watch-right { display: flex; align-items: center; gap: 8px; }
.watch-note { font-size: 0.75rem; color: var(--faint); }

/* ---- 전략 세그먼트 · 히어로 --------------------------------------------------- */

.strat-seg {
  position: sticky; top: calc(env(safe-area-inset-top, 0px) + 52px); z-index: 20;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px;
  padding: 6px;
  background: rgba(14, 20, 31, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 16px;
}
.strat-seg-btn {
  appearance: none; font: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 9px 6px;
  background: transparent; color: var(--muted);
  border: 1px solid transparent; border-radius: 12px;
  cursor: pointer; transition: all 0.18s ease;
}
.strat-seg-btn.on { color: var(--text); }
.strat-seg-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.strat-seg-name { font-size: 0.8125rem; font-weight: 800; letter-spacing: 0.02em; }
.strat-seg-pnl { font-size: 0.6875rem; font-weight: 700; white-space: nowrap; }
/* 좁은 화면: 7~8칸이 1fr 로 쪼개지면 손익 숫자가 세 줄로 접혔다 — 칸 최소 폭을 두고 가로로 민다. */
@media (max-width: 560px) {
  .strat-seg {
    grid-auto-columns: minmax(68px, 1fr);
    overflow-x: auto;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
  }
  .strat-seg::-webkit-scrollbar { display: none; }
}

.strat-hero { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.strat-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 14px;
  font-size: 0.9375rem; font-weight: 800; color: #0a1220;
  flex: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}
.strat-hero-col { min-width: 0; }

/* 코덕스 맞대결 계좌 카드 (판정 31) */

/* 점검 블록 (2026-09-08) — 오늘 탭 최상단, 사용자가 확인해야 할 것만 */
.check-block { margin: 6px 0 12px; padding: 10px 12px; border: 1px solid var(--border, #2a2f3a); border-radius: 12px; background: var(--surface); }
.check-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.check-title { font-weight: 700; font-size: 0.9375rem; }
.check-status { font-size: 0.8125rem; font-weight: 600; }
.check-ok { color: var(--ok); }
.check-warn { color: var(--warn); }
.check-row { display: flex; gap: 10px; padding: 4px 0; font-size: 0.8125rem; border-top: 1px dashed var(--border, #2a2f3a); }
.check-k { flex: 0 0 4.2em; color: var(--faint); }
.check-v { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.check-acc { border-top: 1px dashed var(--border, #2a2f3a); padding: 4px 0; }
.check-acc-row { display: grid; grid-template-columns: 2.2em 1fr auto auto; gap: 8px; align-items: baseline; font-size: 0.8125rem; padding: 2px 0; }
.check-acc-name { font-weight: 700; }
.check-acc-fx, .check-acc-pos { font-size: 0.75rem; white-space: nowrap; }
/* 좁은 화면: 계좌 한 줄을 두 줄로 — 1줄 이름·매매·보유, 2줄 환전·환율. 6계좌 × 2줄이 한 화면에 들어온다 */
@media (max-width: 420px) {
  .check-acc-row { grid-template-columns: 2.2em 1fr auto; row-gap: 1px; }
  .check-acc-name { grid-column: 1; grid-row: 1 / span 2; }
  .check-acc-trade { grid-column: 2; grid-row: 1; }
  .check-acc-pos { grid-column: 3; grid-row: 1; }
  .check-acc-fx { grid-column: 2 / span 2; grid-row: 2; }
}
