/* === Design Tokens === */
:root {
  --bg: #ffffff;
  --bg-soft: #fafafa;
  --bg-section: #fcfcfc;

  --ink: #18181b;
  --ink-secondary: #52525b;
  --ink-muted: #a1a1aa;

  --line: #e4e4e7;
  --line-soft: #f4f4f5;

  --primary: #21a7af;
  --primary-soft: #d4f3f5;
  --primary-dark: #1c8d94;

  --c-cash: #71717a;
  --c-stock-kr: #1e40af;
  --c-stock-us: #3b82f6;
  --c-rogup: #ff7800;
  --c-crypto: #a855f7;

  /* 한국 증시 관행: 상승 = 빨강, 하락 = 파랑 */
  --positive: #dc2626;
  --negative: #2563eb;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 24px;

  --font-base: 'Pretendard Variable', 'Pretendard', -apple-system, system-ui, sans-serif;
  --w-medium: 500;
  --w-semibold: 600;

  --container-max: 1440px;
  --pad-x: 64px;
  --overview-w: 460px;
  --gap-cols: 64px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-base);
  font-weight: var(--w-medium);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'tnum' on, 'lnum' on, 'ss06' on;
  line-height: 1.5;
}
h1, h2, h3 { margin: 0; font-weight: var(--w-semibold); }
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }

.report {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 56px var(--pad-x) 96px;
}

/* === Header === */
.report-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
  margin-bottom: 64px;
}
.report-eyebrow-label {
  font-size: 12px;
  font-weight: var(--w-medium);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink);
}
.report-eyebrow-date {
  font-size: 12px;
  font-weight: var(--w-medium);
  letter-spacing: 0.18em;
  color: var(--ink-secondary);
  font-variant-numeric: tabular-nums;
}

.section-eyebrow {
  font-size: 11px;
  font-weight: var(--w-medium);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-secondary);
  margin-bottom: 24px;
}

/* === Hero === */
.hero {
  margin-bottom: 72px;
}
.hero-eyebrow {
  font-size: 12px;
  font-weight: var(--w-medium);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-secondary);
  margin-bottom: 16px;
}
.hero-amount {
  font-weight: var(--w-semibold);
  font-size: clamp(56px, 9vw, 112px);
  line-height: 1;
  letter-spacing: -0.04em;
  margin: 0 0 24px 0;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 16px;
}
.hero-amount-principal {
  font-size: 0.22em;
  color: var(--ink-muted);
  font-weight: var(--w-medium);
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}
.hero-amount-principal:empty {
  display: none;
}
.hero-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  padding: 28px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-top: 28px;
}
.hero-stat-cell {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.hero-stat-cell-label {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-secondary);
  font-weight: var(--w-medium);
}
.hero-stat-cell-label-sub {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--ink-muted);
  font-weight: var(--w-medium);
  margin-left: 2px;
}
.hero-stat-cell-value {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: var(--w-semibold);
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.hero-stat-cell-secondary {
  font-size: 13px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  font-weight: var(--w-medium);
}

.pnl-positive { color: var(--positive); }
.pnl-negative { color: var(--negative); }
.pnl-flat     { color: var(--ink-muted); }

/* hero 아래 derived "실제 현금" 라인 */
.hero-actual-cash {
  margin-top: 18px;
  font-size: 13px;
  color: var(--ink-secondary);
  font-weight: var(--w-medium);
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.hero-actual-cash-label {
  letter-spacing: 0.04em;
}
.hero-actual-cash strong {
  color: var(--ink);
  font-weight: var(--w-semibold);
  font-variant-numeric: tabular-nums;
  font-size: 15px;
}
.hero-actual-cash-note {
  color: var(--ink-muted);
  font-size: 11px;
  letter-spacing: 0.02em;
}

/* === 페이지 탭 (자산 리포트 / 리밸런싱) — hero 아래 영역 전체 토글 === */
.page-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 56px;
}
.page-tab-btn {
  background: none;
  border: 0;
  padding: 16px 28px;
  font-size: 16px;
  font-weight: var(--w-medium);
  color: var(--ink-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s ease, border-color 0.15s ease;
  font-family: inherit;
  letter-spacing: -0.01em;
}
.page-tab-btn:hover { color: var(--ink); }
.page-tab-btn.active {
  color: var(--ink);
  border-bottom-color: var(--primary);
  font-weight: var(--w-semibold);
}
.page-pane { display: none; }
.page-pane.active { display: block; }

/* === REBALANCE PANE — EDITORIAL REDESIGN ===
   Magazine pattern: numbered sections (01/02/03), group ribbons, G01/G02/G03 markers,
   underline-only big % inputs, numbered destination rows. */
.rebalance-pane { display: block; }
.rebalance-loading {
  font-size: 13px;
  color: var(--ink-muted);
  font-style: italic;
  padding: 32px 0;
  text-align: center;
}

/* TOP — 결과 막대 + 우상단 Grand Total */
.rb-top { margin-bottom: 64px; }
.rb-top-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 24px;
  flex-wrap: wrap;
}
.rb-top-eyebrow {
  font-size: 11px;
  font-weight: var(--w-medium);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink);
  position: relative;
  padding-left: 24px;
}
.rb-top-eyebrow::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 14px;
  height: 1px;
  background: var(--ink);
}
.rb-top-total { text-align: right; }
.rb-top-total-label {
  font-size: 10px;
  font-weight: var(--w-medium);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-secondary);
  margin-bottom: 6px;
}
.rb-top-total-amount {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: var(--w-semibold);
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.rb-result-bar {
  display: flex;
  width: 100%;
  height: 56px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--bg-soft);
  border: 1px solid var(--line);
}
.rb-result-segment {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #ffffff;
  font-size: 12px;
  font-weight: var(--w-semibold);
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 14px;
  box-sizing: border-box;
  transition: width 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.rb-result-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 56px;
  font-size: 13px;
  color: var(--ink-muted);
  font-style: italic;
  border: 1px dashed var(--line);
  border-radius: 3px;
}

/* BODY — 2열 grid (좌: 그룹 카드 / 우: target + destination) */
.rb-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 80px;
  align-items: start;
}
.rb-col-left {
  position: sticky;
  top: 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.rb-col-right {
  display: flex;
  flex-direction: column;
}

/* SECTION HEAD — 번호 매겨진 editorial 헤드 */
.rb-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 14px;
  margin-bottom: 24px;
  gap: 16px;
}
.rb-section-head--inline { margin-top: 56px; }
.rb-section-num {
  font-size: 11px;
  font-weight: var(--w-medium);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink);
}
.rb-section-num strong {
  font-weight: var(--w-semibold);
  margin-right: 16px;
  color: var(--ink);
  display: inline-block;
  min-width: 18px;
}
.rb-section-meta {
  font-size: 11px;
  color: var(--ink-secondary);
  font-weight: var(--w-medium);
  letter-spacing: 0.04em;
}

/* GROUP CARDS — 좌측 색상 ribbon + G01 마커 */
.rb-group {
  position: relative;
  padding: 22px 24px 18px 30px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 3px;
  transition: border-color 0.18s ease;
}
.rb-group:hover { border-color: var(--ink-secondary); }
.rb-group::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18px;
  bottom: 18px;
  width: 3px;
  background: var(--rb-group-color, var(--ink-muted));
  border-radius: 0 2px 2px 0;
}
.rb-group-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 12px;
}
.rb-group-marker {
  font-size: 10px;
  font-weight: var(--w-semibold);
  letter-spacing: 0.22em;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}
.rb-group-name-input {
  font-size: 17px;
  font-weight: var(--w-semibold);
  letter-spacing: -0.012em;
  background: transparent;
  border: 1px solid transparent;
  padding: 4px 6px;
  border-radius: 3px;
  font-family: inherit;
  color: var(--ink);
  width: 100%;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.rb-group-name-input:hover {
  border-color: var(--line);
  background: var(--bg-soft);
}
.rb-group-name-input:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.rb-group-total {
  font-size: 13px;
  font-weight: var(--w-semibold);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  letter-spacing: -0.005em;
  white-space: nowrap;
}
.rb-members {
  list-style: none;
  margin: 0;
  padding: 0;
}
.rb-member {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 22px;
  gap: 12px;
  align-items: baseline;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
}
.rb-member:last-of-type { border-bottom: 0; }
.rb-member-label {
  font-weight: var(--w-medium);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
}
.rb-member-tag {
  display: inline-block;
  font-size: 9px;
  font-weight: var(--w-semibold);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 2px 5px;
  border-radius: 2px;
  margin-left: 6px;
  vertical-align: 2px;
}
.rb-member-value {
  font-weight: var(--w-semibold);
  font-variant-numeric: tabular-nums;
  color: var(--ink-secondary);
  text-align: right;
}
.rb-member-x {
  background: none;
  border: 0;
  padding: 0 4px;
  color: var(--ink-muted);
  font-size: 16px;
  border-radius: 2px;
  cursor: pointer;
  line-height: 1;
  font-family: inherit;
  transition: color 0.12s ease, background 0.12s ease;
}
.rb-member-x:hover {
  color: var(--negative);
  background: var(--bg-soft);
}
.rb-member-empty {
  font-size: 12px;
  color: var(--ink-muted);
  font-style: italic;
  padding: 14px 0;
  text-align: center;
  letter-spacing: 0.04em;
}
.rb-add {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}
.rb-add-select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 12px;
  font-weight: var(--w-medium);
  background: white;
  font-family: inherit;
  color: var(--ink-secondary);
  cursor: pointer;
  transition: border-color 0.12s ease, color 0.12s ease;
}
.rb-add-select:hover { border-color: var(--ink-secondary); color: var(--ink); }
.rb-add-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

/* TARGET — 큰 underline-only % 입력 + 우측 KRW */
.rb-target { margin-bottom: 6px; }
.rb-target-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) 100px 12px 130px;
  gap: 14px;
  align-items: baseline;
  padding: 18px 0;
  border-bottom: 1px solid var(--line-soft);
}
.rb-target-row:last-of-type { border-bottom: 0; }
.rb-target-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  align-self: center;
}
.rb-target-name {
  font-size: 14px;
  font-weight: var(--w-semibold);
  letter-spacing: -0.005em;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rb-target-input {
  font-size: 26px;
  font-weight: var(--w-semibold);
  letter-spacing: -0.022em;
  font-variant-numeric: tabular-nums;
  text-align: right;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 4px 6px;
  font-family: inherit;
  color: var(--ink);
  width: 100%;
  transition: border-color 0.18s ease;
}
.rb-target-input::-webkit-inner-spin-button,
.rb-target-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.rb-target-input { -moz-appearance: textfield; }
.rb-target-input:focus {
  outline: none;
  border-bottom-color: var(--primary);
}
.rb-target-input:hover:not(:focus) {
  border-bottom-color: var(--ink-secondary);
}
.rb-target-unit {
  font-size: 12px;
  color: var(--ink-muted);
  font-weight: var(--w-medium);
}
.rb-target-krw {
  text-align: right;
  font-size: 13px;
  font-weight: var(--w-semibold);
  font-variant-numeric: tabular-nums;
  color: var(--ink-secondary);
}
.rb-target-sum {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 6px;
  padding-top: 14px;
  border-top: 1px solid var(--ink);
}
.rb-target-sum-label {
  font-size: 10px;
  font-weight: var(--w-semibold);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink);
}
.rb-target-sum-value {
  font-size: 18px;
  font-weight: var(--w-semibold);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.012em;
  color: var(--ink);
}
.rb-target-sum-value.invalid { color: var(--negative); }

/* DESTINATION — 번호 prefix + arrow row */
.rb-dest-list { display: flex; flex-direction: column; }
.rb-dest-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 22px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 18px 0;
  border-bottom: 1px solid var(--line-soft);
}
.rb-dest-row:last-of-type { border-bottom: 0; }
.rb-dest-num {
  font-size: 10px;
  font-weight: var(--w-semibold);
  letter-spacing: 0.18em;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}
.rb-dest-from, .rb-dest-to {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: var(--w-semibold);
  letter-spacing: -0.005em;
  min-width: 0;
}
.rb-dest-from-dot, .rb-dest-to-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.rb-dest-from span, .rb-dest-to span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rb-dest-arrow {
  font-size: 18px;
  color: var(--ink);
  font-weight: var(--w-medium);
  text-align: center;
}
.rb-dest-amount {
  font-size: 16px;
  font-weight: var(--w-semibold);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.012em;
  color: var(--ink);
  white-space: nowrap;
}
.rb-dest-empty {
  text-align: center;
  padding: 36px 0;
  font-size: 13px;
  color: var(--ink-muted);
  font-style: italic;
  border: 1px dashed var(--line);
  border-radius: 3px;
}

/* Stagger 페이드업 — 자산 리포트와 같은 entry 패턴 */
.rb-top, .rb-col-left, .rb-col-right {
  opacity: 0;
  animation: fadeUp 0.6s cubic-bezier(0.2, 0.6, 0.2, 1) forwards;
}
.rb-top      { animation-delay: 0.04s; }
.rb-col-left { animation-delay: 0.12s; }
.rb-col-right{ animation-delay: 0.20s; }

/* Responsive */
@media (max-width: 1100px) {
  .rb-body {
    grid-template-columns: 1fr;
    gap: 56px;
  }
  .rb-col-left { position: static; }
}
@media (max-width: 880px) {
  .rb-target-row {
    grid-template-columns: 10px 1fr 80px 10px;
  }
  .rb-target-krw { display: none; }
  .rb-dest-row {
    grid-template-columns: 18px 1fr auto;
    grid-auto-flow: row;
  }
  .rb-dest-arrow { display: none; }
  .rb-dest-to { grid-column: 2 / 3; padding-left: 18px; }
  .rb-dest-amount { grid-column: 3 / 4; grid-row: 1 / 3; }
}

/* === Two-column body: overview (sticky) + detail === */
.report-body {
  display: grid;
  grid-template-columns: var(--overview-w) 1fr;
  gap: var(--gap-cols);
  align-items: start;
  margin-bottom: 96px;
}

.overview {
  position: sticky;
  top: 32px;
}

.allocation-chart {
  position: relative;
  width: 100%;
  max-width: 440px;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
}
.allocation-chart canvas {
  width: 100% !important;
  height: 100% !important;
}
.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.donut-center.dimmed { opacity: 0; }
.donut-center-label {
  font-size: 10px;
  font-weight: var(--w-medium);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-secondary);
  margin-bottom: 4px;
}
.donut-center-value {
  font-size: 22px;
  font-weight: var(--w-semibold);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.allocation-list {
  display: flex;
  flex-direction: column;
  margin-top: 32px;
}
.allocation-row {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
}
.allocation-row:last-child { border-bottom: 0; }
.allocation-color {
  width: 14px;
  height: 14px;
  border-radius: 3px;
}
.allocation-label-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.allocation-label {
  font-size: 14px;
  font-weight: var(--w-medium);
}
.allocation-label .placeholder-tag {
  font-size: 10px;
  color: var(--ink-muted);
  margin-left: 6px;
  letter-spacing: 0.04em;
}
.allocation-value {
  font-size: 12px;
  color: var(--ink-secondary);
  font-variant-numeric: tabular-nums;
  font-weight: var(--w-medium);
}
.allocation-pct {
  font-size: 18px;
  font-weight: var(--w-semibold);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.allocation-meta-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.allocation-pnl {
  font-size: 12px;
  font-weight: var(--w-medium);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

/* === Detail (right column) === */
.detail {
  display: flex;
  flex-direction: column;
  gap: 56px;
}
.source-block { scroll-margin-top: 32px; }
.source-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-top: 1px solid var(--line);
  padding-top: 20px;
  margin-bottom: 24px;
}
.source-block:first-child .source-head {
  border-top: 0;
  padding-top: 0;
}
.source-title {
  display: flex;
  align-items: center;
  gap: 12px;
}
.source-color-block {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}
.source-name {
  font-size: 22px;
  font-weight: var(--w-semibold);
  letter-spacing: -0.02em;
}
.source-ratio-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.source-ratio {
  font-size: 11px;
  font-weight: var(--w-medium);
  color: var(--ink-secondary);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}
.source-as-of {
  font-size: 10px;
  font-weight: var(--w-medium);
  color: var(--ink-muted);
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.source-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}
.summary-cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.summary-label {
  font-size: 10px;
  font-weight: var(--w-medium);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-secondary);
}
.summary-value {
  font-size: 22px;
  font-weight: var(--w-semibold);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.summary-secondary {
  font-size: 13px;
  color: var(--ink-secondary);
  font-variant-numeric: tabular-nums;
  font-weight: var(--w-medium);
}
/* PnL/Daily PnL 셀의 % 옆에 표시되는 USD 값 — 손익 색 무시하고 검은색으로 강제.
   크기는 secondary(13px)에 맞추고 굵기는 % 와 동일한 SemiBold 유지. */
.value-aux-usd {
  color: var(--ink);
  font-size: 13px;
  font-weight: var(--w-semibold);
  margin-left: 8px;
  letter-spacing: 0;
}
.curr-paren {
  font-size: 0.62em;
  color: var(--ink-muted);
  font-weight: var(--w-medium);
  margin-left: 4px;
  letter-spacing: 0;
}
/* 좌측 allocation list: USD와 같은 크기, 인라인 유지, 색연함으로 차별 */
.allocation-value .curr-paren {
  font-size: 1em;
  margin-left: 6px;
}
/* 우측 source-summary: 작은 크기 그대로, 아래 줄로 분리 */
.summary-value .curr-paren {
  display: block;
  margin-left: 0;
  margin-top: 4px;
}

/* === Holdings table === */
.holdings-table {
  width: 100%;
  border-collapse: collapse;
}
.holdings-table th, .holdings-table td {
  padding: 12px 8px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
}
.holdings-table th {
  font-size: 10px;
  font-weight: var(--w-medium);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-secondary);
  border-bottom: 1px solid var(--line);
}
.holdings-table td {
  font-size: 14px;
  font-weight: var(--w-medium);
}
.holdings-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: var(--w-semibold);
}
.holdings-table .symbol {
  font-weight: var(--w-semibold);
  letter-spacing: -0.005em;
}
.holdings-table .name {
  color: var(--ink-secondary);
}
.holdings-table tr.holding-row:hover { background: var(--bg-soft); }
.holdings-table tr:last-child td { border-bottom: 0; }
.holdings-empty {
  font-size: 13px;
  color: var(--ink-muted);
  font-style: italic;
  padding: 16px 0;
}

/* 집계 행 (parent) — 평균/합계 보여주는 메인 row */
.holdings-table .col-expand {
  width: 36px;
  padding-right: 4px;
}
.expand-btn {
  background: none;
  border: 0;
  font-size: 18px;
  line-height: 1;
  color: var(--ink-muted);
  cursor: pointer;
  padding: 4px 6px;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  transition: color 0.15s ease, background 0.1s ease;
  font-variant-numeric: normal;
}
.expand-btn:hover {
  color: var(--ink);
  background: var(--bg-soft);
}
.expand-btn[aria-expanded="true"] {
  color: var(--ink);
}
.expand-spacer {
  display: inline-block;
  width: 32px;
}
.avg-tag {
  font-size: 9px;
  font-weight: var(--w-medium);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-left: 6px;
}

/* 자식 lot 행 — 서브 레벨 시각 강도 낮춤 */
.holding-child {
  background: var(--bg-soft);
}
.holding-child td {
  font-size: 12px;
  color: var(--ink-secondary);
  padding-top: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-soft);
}
.holding-child .symbol-child {
  text-align: center;
  color: var(--ink-muted);
  font-weight: var(--w-medium);
  width: 24px;
}
.holding-child .lot-date {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.holding-child .num {
  font-weight: var(--w-medium);
  color: var(--ink-secondary);
}
.holding-child:hover { background: #f1f1f3; }

/* === Forms === */
.add-form-toggle {
  margin-top: 16px;
  background: none;
  border: 1px dashed var(--line);
  color: var(--ink-secondary);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: var(--w-medium);
  letter-spacing: 0.04em;
  width: 100%;
  transition: all 0.15s ease;
}
.add-form-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--bg-soft);
}

.add-form {
  display: none;
  margin-top: 12px;
  padding: 18px;
  background: var(--bg-soft);
  border-radius: var(--radius-md);
}
.add-form.open { display: block; }
.add-form-row {
  display: grid;
  grid-template-columns: 1.6fr 0.8fr 0.9fr 1fr auto;
  gap: 8px;
  align-items: stretch;
}
.add-form input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: var(--w-medium);
  background: white;
  font-variant-numeric: tabular-nums;
}
.add-form input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.add-form .btn-primary { white-space: nowrap; }

/* === Search dropdown ===
   다음 source-block의 stacking context로 인해 dropdown이 가려지던 문제 →
   dropdown을 viewport 레벨 fixed로 띄우고 JS가 input 좌표 계산해 top/left/width를 set.
   stacking context와 무관하게 항상 최상위. */
.search-dropdown { position: relative; }
.search-results {
  display: none;
  position: fixed;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  max-height: 240px;
  overflow-y: auto;
  z-index: 999;
  box-shadow: 0 12px 32px rgba(0,0,0,0.16);
}
.search-results.open { display: block; }
.search-result-item {
  padding: 10px 12px;
  cursor: pointer;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  font-size: 13px;
  font-weight: var(--w-medium);
  border-bottom: 1px solid var(--line-soft);
}
.search-result-item:last-child { border-bottom: 0; }
.search-result-item:hover { background: var(--bg-soft); }
.search-result-symbol {
  font-weight: var(--w-semibold);
  color: var(--ink);
}
.search-result-name {
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-result-market {
  color: var(--ink-muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* === Buttons === */
.btn-primary {
  background: var(--primary);
  color: white;
  border: 0;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: var(--w-semibold);
  letter-spacing: 0.02em;
  transition: background 0.15s ease;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { background: var(--ink-muted); cursor: not-allowed; }

.btn-ghost {
  background: white;
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: var(--w-medium);
  transition: all 0.15s ease;
}
.btn-ghost:hover {
  border-color: var(--ink);
  background: var(--bg-soft);
}

.btn-icon {
  background: none;
  border: 0;
  padding: 4px 6px;
  color: var(--ink-muted);
  font-size: 16px;
  border-radius: var(--radius-sm);
  transition: all 0.1s ease;
}
.btn-icon:hover { color: var(--negative); background: var(--bg-soft); }

/* === Cash 섹션 === */
.cash-summary {
  margin-bottom: 24px;
}
.cash-form {
  display: none;
  margin-top: 12px;
  padding: 18px;
  background: var(--bg-soft);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--c-cash);
}
.cash-form.open { display: block; }
.cash-form-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 12px;
}
.cash-input {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: var(--w-semibold);
  font-variant-numeric: tabular-nums;
  background: white;
}
.cash-input:focus {
  outline: none;
  border-color: var(--c-cash);
  box-shadow: 0 0 0 3px rgba(113, 113, 122, 0.18);
}

/* === Cash 추가/인출 폼 (ROGUP 스타일 grid) === */
.cash-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 12px;
}
.cash-edit-field { display: flex; flex-direction: column; gap: 6px; }
.cash-edit-label {
  font-size: 10px;
  font-weight: var(--w-medium);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-secondary);
}
.cash-edit-input {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: var(--w-semibold);
  font-variant-numeric: tabular-nums;
  background: white;
  font-family: inherit;
}
.cash-edit-input:focus {
  outline: none;
  border-color: var(--c-cash);
  box-shadow: 0 0 0 3px rgba(113, 113, 122, 0.18);
}
.cash-edit-display {
  padding: 12px 14px;
  font-size: 16px;
  font-weight: var(--w-semibold);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: white;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
}
.cash-save-btn {
  width: 100%;
  padding: 12px 16px;
  font-size: 13px;
}

/* === Detail tabs (현재 보유 / 매도 기록) === */
.detail-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 32px;
}
.detail-tab-btn {
  background: none;
  border: 0;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: var(--w-medium);
  color: var(--ink-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s ease, border-color 0.15s ease;
  font-family: inherit;
}
.detail-tab-btn:hover { color: var(--ink); }
.detail-tab-btn.active {
  color: var(--ink);
  border-bottom-color: var(--primary);
  font-weight: var(--w-semibold);
}
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* === Sells history pane === */
.sells-summary {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.sells-total-label {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-secondary);
  font-weight: var(--w-medium);
  margin-bottom: 12px;
}
.sells-total-value {
  font-size: clamp(32px, 5vw, 44px);
  font-weight: var(--w-semibold);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.sells-total-secondary {
  margin-top: 8px;
  font-size: 12px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}
.sells-table {
  width: 100%;
  border-collapse: collapse;
}
.sells-table th, .sells-table td {
  padding: 12px 8px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
  font-size: 14px;
  font-weight: var(--w-medium);
}
.sells-table th {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-secondary);
  font-weight: var(--w-medium);
  border-bottom: 1px solid var(--line);
}
.sells-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: var(--w-semibold);
}
.sells-table .symbol { font-weight: var(--w-semibold); }
.sells-table .name { color: var(--ink-secondary); }
.sells-table tr:last-child td { border-bottom: 0; }
.sells-table tr:hover { background: var(--bg-soft); }
.sells-empty {
  font-size: 13px;
  color: var(--ink-muted);
  font-style: italic;
  padding: 32px 0;
  text-align: center;
}

/* === cash_realized source-block (자동 관리, 편집 폼 없음) === */
.cash-realized-summary {
  margin-bottom: 16px;
}
.cash-realized-hint {
  font-size: 11px;
  color: var(--ink-muted);
  font-weight: var(--w-medium);
  letter-spacing: 0.02em;
  padding: 12px 16px;
  background: var(--bg-soft);
  border-left: 3px solid var(--c-cash-realized, #10b981);
  border-radius: var(--radius-sm);
}

/* === Sell modal === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
.modal-overlay[hidden] { display: none; }
.modal-overlay:not([hidden]) {
  opacity: 1;
  pointer-events: auto;
}
.modal {
  background: white;
  border-radius: var(--radius-lg);
  max-width: 480px;
  width: 92%;
  padding: 28px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  gap: 12px;
}
.modal-header h3 {
  font-size: 16px;
  font-weight: var(--w-semibold);
  margin: 0;
  letter-spacing: -0.01em;
}
.modal-header h3 #sellModalSymbol { color: var(--ink); }
.modal-header h3 #sellModalName { color: var(--ink-secondary); font-weight: var(--w-medium); margin-left: 4px; }
.modal-close {
  background: none;
  border: 0;
  font-size: 22px;
  color: var(--ink-muted);
  cursor: pointer;
  padding: 0 8px;
  line-height: 1;
  border-radius: var(--radius-sm);
}
.modal-close:hover { color: var(--ink); background: var(--bg-soft); }
.modal-info {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  background: var(--bg-soft);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  font-size: 12px;
  color: var(--ink-secondary);
}
.modal-info strong {
  color: var(--ink);
  font-weight: var(--w-semibold);
  font-variant-numeric: tabular-nums;
  margin-left: 6px;
}
.form-field { margin-bottom: 14px; }
.form-field label {
  display: block;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-secondary);
  margin-bottom: 6px;
  font-weight: var(--w-medium);
}
.form-field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: var(--w-medium);
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  background: white;
}
.form-field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 8px;
}

/* === Sell button on holding rows (× 옆) === */
.btn-sell-holding {
  background: white;
  border: 1px solid var(--line);
  padding: 4px 12px;
  margin-right: 4px;
  color: var(--ink);
  font-size: 12px;
  font-weight: var(--w-semibold);
  letter-spacing: 0.04em;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.12s ease;
  font-family: inherit;
  vertical-align: middle;
}
.btn-sell-holding:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

/* === Cancel-sell button (매도 기록 행 끝) === */
.btn-cancel-sell {
  background: none;
  border: 0;
  padding: 4px 8px;
  color: var(--ink-muted);
  font-size: 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.1s ease;
  font-family: inherit;
}
.btn-cancel-sell:hover {
  color: var(--primary);
  background: var(--bg-soft);
}

/* === Loading banner (ROGUP 자동 갱신 중) === */
.loading-banner {
  position: fixed;
  top: 16px;
  right: 16px;
  max-width: 360px;
  padding: 12px 16px 12px 36px;
  background: var(--ink);
  color: #ffffff;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: var(--w-medium);
  letter-spacing: 0.01em;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 999;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  pointer-events: none;
}
.loading-banner.visible {
  opacity: 1;
  transform: translateX(0);
}
.loading-banner::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: banner-spin 0.8s linear infinite;
}
@keyframes banner-spin {
  to { transform: rotate(360deg); }
}

/* === Rogup edit (토글식 폼) === */
.rogup-form {
  display: none;
  margin-top: 12px;
  padding: 18px;
  background: var(--bg-soft);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--c-rogup);
}
.rogup-form.open { display: block; }
.rogup-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 12px;
}
.rogup-edit-field { display: flex; flex-direction: column; gap: 6px; }
.rogup-edit-label {
  font-size: 10px;
  font-weight: var(--w-medium);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-secondary);
}
.rogup-edit-input {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: var(--w-semibold);
  font-variant-numeric: tabular-nums;
  background: white;
}
.rogup-edit-input:focus {
  outline: none;
  border-color: var(--c-rogup);
  box-shadow: 0 0 0 3px rgba(255, 120, 0, 0.15);
}
.rogup-edit-display {
  padding: 12px 14px;
  font-size: 16px;
  font-weight: var(--w-semibold);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: white;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
}
.rogup-edit-hint {
  font-size: 11px;
  color: var(--ink-muted);
  font-weight: var(--w-medium);
  margin-bottom: 12px;
  letter-spacing: 0.01em;
}
.rogup-save-btn {
  width: 100%;
  padding: 12px 16px;
  font-size: 13px;
}

/* === Crypto placeholder === */
.crypto-placeholder {
  padding: 36px 24px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  text-align: center;
  color: var(--ink-muted);
  font-size: 13px;
  font-weight: var(--w-medium);
  letter-spacing: 0.04em;
}

/* === Footer === */
.report-foot {
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: var(--w-medium);
  color: var(--ink-secondary);
}
.footer-meta { display: flex; gap: 12px; align-items: center; }
.footer-meta strong {
  font-weight: var(--w-semibold);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.footer-divider { color: var(--ink-muted); }

/* === Error banner === */
.error-banner {
  position: fixed;
  top: 16px;
  right: 16px;
  max-width: 360px;
  padding: 12px 16px;
  background: var(--negative);
  color: #ffffff;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: var(--w-medium);
  letter-spacing: 0.01em;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 1000;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  pointer-events: none;
}
.error-banner.visible {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

/* === Animations === */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.report-head, .hero, .overview, .report-foot {
  opacity: 0;
  animation: fadeUp 0.6s cubic-bezier(0.2, 0.6, 0.2, 1) forwards;
}
/* source-block은 fadeUp 대신 fadeIn — translateY transform이 영구 stacking context를
   만들어 검색 dropdown이 다음 source-block 위로 못 올라가던 문제 해결. opacity만 페이드. */
.source-block {
  opacity: 0;
  animation: fadeIn 0.6s cubic-bezier(0.2, 0.6, 0.2, 1) forwards;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.report-head { animation-delay: 0s; }
.hero        { animation-delay: 0.06s; }
.overview    { animation-delay: 0.12s; }
.detail .source-block:nth-child(1) { animation-delay: 0.18s; }
.detail .source-block:nth-child(2) { animation-delay: 0.24s; }
.detail .source-block:nth-child(3) { animation-delay: 0.30s; }
.detail .source-block:nth-child(4) { animation-delay: 0.36s; }
.report-foot { animation-delay: 0.42s; }

/* === Responsive === */
@media (max-width: 1100px) {
  :root {
    --pad-x: 32px;
    --overview-w: 300px;
    --gap-cols: 40px;
  }
}

@media (max-width: 880px) {
  .report { padding: 40px 24px 64px; }
  .report-body {
    grid-template-columns: 1fr;
    gap: 56px;
  }
  .overview { position: static; }
  .allocation-chart { max-width: 280px; }
  .source-summary { grid-template-columns: 1fr; gap: 16px; }
  .add-form-row { grid-template-columns: 1fr; }
  .holdings-table { font-size: 13px; }
  .holdings-table th, .holdings-table td { padding: 8px 4px; }
  .source-name { font-size: 20px; }
  .rogup-edit { grid-template-columns: 1fr; }
}

/* ====================================================================
   MOBILE — iPhone 16 Pro (≤480px) + 더 좁은 폰 (≤390px)
   완전 재설계: editorial 정신 유지 + iOS native ergonomics
   (sticky page-tabs + bottom sheet modal + safe-area + 44px hit area).
   ==================================================================== */

@media (max-width: 480px) {

  /* ---------- container ---------- */
  .report {
    padding: 24px max(16px, env(safe-area-inset-left, 16px))
             88px max(16px, env(safe-area-inset-right, 16px));
    padding-top: max(24px, env(safe-area-inset-top, 24px));
    padding-bottom: max(88px, calc(72px + env(safe-area-inset-bottom, 0px)));
  }

  /* ---------- header ---------- */
  .report-head {
    margin-bottom: 24px;
    padding-bottom: 12px;
  }
  .report-eyebrow-label,
  .report-eyebrow-date {
    font-size: 9px;
    letter-spacing: 0.20em;
  }

  /* ---------- hero ---------- */
  .hero {
    margin-bottom: 18px;
  }
  .hero-eyebrow {
    font-size: 9px;
    letter-spacing: 0.22em;
    margin-bottom: 6px;
  }
  .hero-amount {
    font-size: clamp(40px, 12vw, 56px);
    line-height: 0.98;
    letter-spacing: -0.025em;
    margin-bottom: 8px;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
    font-weight: 600;
  }
  .hero-amount-principal {
    font-size: clamp(11px, 2.8vw, 13px);
    color: var(--ink-muted);
    font-weight: 500;
  }
  .hero-stats {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 12px 0;
    margin-top: 12px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }
  .hero-stat-cell {
    gap: 4px;
  }
  .hero-stat-cell-label {
    font-size: 9px;
    letter-spacing: 0.16em;
  }
  .hero-stat-cell-label-sub {
    font-size: 9px;
    letter-spacing: 0.06em;
  }
  .hero-stat-cell-value {
    font-size: clamp(22px, 7vw, 28px);
    line-height: 1.05;
    margin: 2px 0;
  }
  .hero-stat-cell-secondary {
    font-size: 11px;
  }
  .hero-actual-cash {
    margin-top: 14px;
    padding: 11px 14px;
    background: rgba(0, 0, 0, 0.025);
    border-radius: 10px;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    font-size: 11px;
  }
  .hero-actual-cash-label {
    font-size: 10px;
    letter-spacing: 0.14em;
    color: var(--ink-muted);
  }
  .hero-actual-cash strong {
    font-size: 14px;
    font-weight: 600;
  }
  .hero-actual-cash-note {
    font-size: 9.5px;
    color: var(--ink-muted);
    margin-left: auto;
  }

  /* ---------- page tabs (sticky + blur) ---------- */
  .page-tabs {
    position: sticky;
    top: 0;
    z-index: 30;
    margin: 0 calc(-1 * max(16px, env(safe-area-inset-left, 16px))) 16px;
    padding: 0 max(16px, env(safe-area-inset-left, 16px));
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: saturate(1.6) blur(14px);
    -webkit-backdrop-filter: saturate(1.6) blur(14px);
    border-bottom: 1px solid var(--line);
    gap: 0;
  }
  .page-tab-btn {
    flex: 1;
    padding: 14px 8px;
    font-size: 14px;
    min-height: 48px;
    text-align: center;
    border-radius: 0;
  }

  /* ---------- body 1열 ---------- */
  .report-body {
    grid-template-columns: 1fr;
    gap: 24px;
    margin-bottom: 32px;
  }
  .overview {
    position: static;
    top: auto;
    margin-bottom: 0;
  }

  /* ---------- donut ---------- */
  .allocation-chart {
    max-width: 280px;
    margin: 0 auto;
  }
  .donut-center-label {
    font-size: 8px;
    letter-spacing: 0.18em;
  }
  .donut-center-value {
    font-size: 13px;
    letter-spacing: -0.01em;
  }

  /* ---------- allocation list (hairline 분리) ---------- */
  .allocation-list {
    margin-top: 14px;
    border-top: 1px solid var(--line);
  }
  .allocation-row {
    grid-template-columns: 8px 1fr auto;
    gap: 10px;
    padding: 6px 0;
    min-height: 30px;
    border-bottom: 1px solid var(--line);
  }
  .allocation-color {
    width: 8px;
    height: 8px;
  }
  .allocation-label {
    font-size: 11.5px;
  }
  .allocation-value {
    font-size: 10px;
    color: var(--ink-muted);
  }
  .allocation-pct {
    font-size: 13px;
    font-weight: 600;
  }

  /* ---------- section eyebrow ---------- */
  .section-eyebrow {
    font-size: 9px;
    letter-spacing: 0.20em;
    margin-bottom: 10px;
  }

  /* ---------- detail tabs ---------- */
  .detail-tabs {
    margin-bottom: 16px;
  }
  .detail-tab-btn {
    padding: 12px 8px;
    font-size: 13px;
    min-height: 44px;
  }

  /* ---------- source block ---------- */
  .detail {
    gap: 22px;
  }
  .source-block {
    padding-top: 0;
  }
  .source-head {
    padding-top: 6px;
    margin-bottom: 10px;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 6px 10px;
  }
  .source-color-block {
    width: 8px;
    height: 8px;
    margin-top: 5px;
  }
  .source-name {
    font-size: 14.5px;
    font-weight: 600;
    flex: 1;
  }
  .source-ratio-block {
    align-items: flex-end;
    gap: 2px;
  }
  .source-ratio {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.04em;
  }
  .source-as-of {
    font-size: 8.5px;
    color: var(--ink-muted);
  }

  /* ---------- source summary 2x2 (hairline 위아래) ---------- */
  .source-summary {
    grid-template-columns: 1fr 1fr;
    gap: 8px 14px;
    padding: 8px 0;
    margin-bottom: 10px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }
  .summary-cell {
    gap: 3px;
  }
  .summary-label {
    font-size: 8.5px;
    letter-spacing: 0.14em;
  }
  .summary-value {
    font-size: 14px;
    line-height: 1.1;
  }
  .summary-secondary {
    font-size: 9.5px;
  }
  .summary-value .curr-paren {
    font-size: 0.6em;
  }
  .value-aux-usd {
    font-size: 9.5px;
    margin-left: 3px;
  }

  /* ---------- holdings table (가로 스크롤 fallback) ---------- */
  .holdings-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .holdings-table {
    font-size: 12px;
    width: 100%;
    min-width: 560px;
  }
  .holdings-table th {
    font-size: 9px;
    letter-spacing: 0.06em;
    padding: 10px 6px;
  }
  .holdings-table td {
    padding: 10px 6px;
    font-size: 12px;
  }
  .col-expand {
    width: 28px;
  }
  .expand-btn,
  .expand-spacer {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }
  .holding-symbol {
    font-size: 13px;
    font-weight: 600;
  }
  .holding-name {
    font-size: 11px;
  }
  .btn-sell-holding {
    padding: 6px 10px;
    font-size: 11px;
    min-height: 32px;
    min-width: 44px;
  }
  .btn-icon {
    padding: 4px;
    min-width: 32px;
    min-height: 32px;
    font-size: 16px;
  }

  /* ---------- add form ---------- */
  .add-form-toggle {
    padding: 14px 16px;
    font-size: 13px;
    min-height: 48px;
  }
  .add-form {
    padding: 16px;
  }
  .add-form-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .add-form input,
  .add-form select {
    padding: 13px 14px;
    font-size: 16px;
    min-height: 48px;
  }
  .add-form .btn-primary {
    padding: 14px;
    font-size: 14px;
    min-height: 48px;
  }

  /* ---------- cash / reserve / rogup forms ---------- */
  .cash-edit-grid,
  .rogup-edit-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .cash-edit-input,
  .rogup-edit-input,
  .cash-input {
    padding: 14px;
    font-size: 16px;
    min-height: 48px;
  }
  .cash-save-btn,
  .rogup-save-btn {
    padding: 14px;
    font-size: 14px;
    min-height: 48px;
  }

  /* ---------- sells history ---------- */
  .sells-summary {
    margin-bottom: 24px;
    padding-bottom: 18px;
  }
  .sells-total-label {
    font-size: 10px;
    letter-spacing: 0.18em;
  }
  .sells-total-value {
    font-size: clamp(22px, 6.5vw, 28px);
  }
  .sells-total-secondary {
    font-size: 10.5px;
  }
  .sells-table {
    font-size: 12px;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    width: 100%;
  }
  .sells-table thead,
  .sells-table tbody {
    display: table;
    width: 100%;
    min-width: 580px;
  }
  .sells-table th {
    font-size: 9px;
    letter-spacing: 0.06em;
    padding: 10px 6px;
  }
  .sells-table td {
    padding: 10px 6px;
    font-size: 12px;
  }

  /* ---------- modal: TRUE bottom sheet ---------- */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .modal {
    max-width: none;
    width: 100%;
    border-radius: 18px 18px 0 0;
    padding: 8px 18px 24px;
    padding-bottom: max(24px, calc(20px + env(safe-area-inset-bottom, 0px)));
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 -10px 32px rgba(0, 0, 0, 0.10);
  }
  .modal-overlay:not([hidden]) .modal {
    animation: slideUpSheet 0.36s cubic-bezier(0.32, 0.72, 0, 1);
  }
  @keyframes slideUpSheet {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }
  .modal::before {
    content: "";
    display: block;
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: rgba(0, 0, 0, 0.18);
    margin: 0 auto 14px;
  }
  .modal-header h3 {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
  }
  .modal-close {
    width: 32px;
    height: 32px;
    font-size: 24px;
    flex-shrink: 0;
  }
  .modal-info {
    flex-direction: column;
    gap: 8px;
    padding: 14px 16px;
    align-items: stretch;
    background: rgba(0, 0, 0, 0.025);
    border-radius: 10px;
    margin-bottom: 18px;
    border: none;
  }
  .modal-info-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
  }
  .form-field {
    margin-bottom: 14px;
  }
  .form-field label {
    font-size: 11px;
    letter-spacing: 0.10em;
    margin-bottom: 6px;
  }
  .form-field input {
    padding: 14px;
    font-size: 16px;
    min-height: 48px;
  }
  .modal-footer {
    flex-direction: column-reverse;
    gap: 10px;
    margin-top: 20px;
  }
  .modal-footer .btn-primary,
  .modal-footer .btn-ghost {
    width: 100%;
    padding: 15px;
    font-size: 15px;
    min-height: 50px;
    border-radius: 12px;
  }

  /* ---------- footer ---------- */
  .report-foot {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    font-size: 11px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
  }
  .footer-meta {
    flex-wrap: wrap;
    gap: 4px 8px;
  }
  #refreshBtn {
    align-self: stretch;
    padding: 14px;
    font-size: 13px;
    min-height: 48px;
  }

  /* ---------- rebalance ---------- */
  .rb-top {
    margin-bottom: 32px;
  }
  .rb-top-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 14px;
  }
  .rb-top-eyebrow {
    font-size: 10px;
    letter-spacing: 0.24em;
    padding-left: 22px;
  }
  .rb-top-eyebrow::before {
    width: 14px;
  }
  .rb-top-total {
    text-align: left;
  }
  .rb-top-total-label {
    font-size: 9px;
    letter-spacing: 0.22em;
    margin-bottom: 4px;
  }
  .rb-top-total-amount {
    font-size: clamp(26px, 8vw, 34px);
  }
  .rb-result-bar {
    height: 44px;
  }
  .rb-result-segment {
    font-size: 11px;
    padding: 0 8px;
  }

  .rb-body {
    grid-template-columns: 1fr;
    gap: 36px;
  }
  .rb-col-left {
    position: static;
    gap: 14px;
  }

  .rb-section-head {
    margin-bottom: 16px;
    padding-bottom: 10px;
  }
  .rb-section-head--inline {
    margin-top: 32px;
  }
  .rb-section-num {
    font-size: 10px;
    letter-spacing: 0.22em;
  }
  .rb-section-num strong {
    margin-right: 10px;
    min-width: 14px;
  }
  .rb-section-meta {
    font-size: 10px;
  }

  .rb-group {
    padding: 16px 16px 14px 22px;
  }
  .rb-group::before {
    top: 12px;
    bottom: 12px;
    width: 3px;
  }
  .rb-group-head {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 8px;
    margin-bottom: 10px;
  }
  .rb-group-marker {
    font-size: 9px;
    letter-spacing: 0.14em;
  }
  .rb-group-name-input {
    font-size: 14px;
    padding: 4px 6px;
  }
  .rb-group-total {
    font-size: 11px;
  }
  .rb-member {
    grid-template-columns: minmax(0, 1fr) auto 32px;
    font-size: 12px;
    padding: 10px 0;
    gap: 10px;
    min-height: 44px;
    align-items: center;
  }
  .rb-member-tag {
    font-size: 8px;
    letter-spacing: 0.12em;
    padding: 1px 4px;
  }
  .rb-add-select {
    padding: 12px 12px;
    font-size: 13px;
    min-height: 44px;
  }
  .rb-member-x {
    font-size: 18px;
    padding: 6px;
    min-width: 32px;
    min-height: 32px;
  }

  .rb-target-row {
    grid-template-columns: 8px minmax(0, 1fr) 70px 8px 80px;
    gap: 8px;
    padding: 14px 0;
    align-items: center;
    min-height: 48px;
  }
  .rb-target-name {
    font-size: 13px;
  }
  .rb-target-input {
    font-size: 22px;
    padding: 4px;
  }
  .rb-target-unit {
    font-size: 11px;
  }
  .rb-target-krw {
    font-size: 11px;
  }
  .rb-target-sum {
    margin-top: 12px;
    padding-top: 10px;
  }
  .rb-target-sum-label {
    font-size: 9px;
    letter-spacing: 0.22em;
  }
  .rb-target-sum-value {
    font-size: 16px;
  }

  /* destination — from / to / amount 세로 stack */
  .rb-dest-row {
    grid-template-columns: 18px 1fr;
    grid-template-rows: auto auto auto;
    gap: 4px 12px;
    padding: 14px 0;
  }
  .rb-dest-num {
    font-size: 9px;
    grid-row: 1 / 4;
    align-self: start;
    padding-top: 2px;
  }
  .rb-dest-from {
    grid-column: 2;
    grid-row: 1;
    font-size: 13px;
  }
  .rb-dest-arrow {
    display: none;
  }
  .rb-dest-to {
    grid-column: 2;
    grid-row: 2;
    font-size: 13px;
    padding-left: 16px;
    position: relative;
  }
  .rb-dest-to::before {
    content: "→";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ink-muted);
    font-size: 12px;
  }
  .rb-dest-amount {
    grid-column: 2;
    grid-row: 3;
    font-size: 14px;
    font-weight: 600;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed var(--line);
  }
  .rb-dest-from-dot,
  .rb-dest-to-dot {
    width: 7px;
    height: 7px;
  }

  /* ---------- search dropdown ---------- */
  .search-result-item {
    padding: 14px;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    min-height: 56px;
    align-items: center;
  }
  .search-result-symbol {
    font-size: 13px;
  }
  .search-result-name {
    font-size: 12px;
  }
  .search-result-market {
    font-size: 10px;
  }

  /* ---------- banners ---------- */
  .loading-banner,
  .error-banner {
    top: max(12px, env(safe-area-inset-top, 12px));
    right: 12px;
    left: 12px;
    max-width: none;
    font-size: 12px;
  }
}

@media (max-width: 390px) {
  .report {
    padding-left: max(14px, env(safe-area-inset-left, 14px));
    padding-right: max(14px, env(safe-area-inset-right, 14px));
  }
  .hero-amount {
    font-size: clamp(34px, 10vw, 42px);
  }
  .hero-stat-cell-value {
    font-size: clamp(20px, 6.4vw, 24px);
  }
  .source-summary {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .rb-target-row {
    grid-template-columns: 8px minmax(0, 1fr) 60px 8px;
  }
  .rb-target-row .rb-target-krw {
    display: none;
  }
  .page-tab-btn {
    padding: 12px 8px;
    font-size: 13px;
  }
  .detail-tab-btn {
    padding: 12px 8px;
    font-size: 12px;
  }
}
