/* ── 기본 리셋 & 폰트 ── */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { overflow-x: hidden; }
body {
  min-height: 100%;
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #0d0d1e;
  color: #c0c0ee;
  overflow-x: hidden;
}

.report-wrap {
  max-width: 1000px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

/* ── 헤더 ── */
.report-header {
  margin-bottom: 36px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}
.report-header-main { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; flex: 1; }
.page-title { font-size: 1.8rem; font-weight: 900; color: #aaaaff; letter-spacing: -0.02em; }
.page-subtitle {
  display: block; font-size: 0.72rem; font-weight: 400;
  color: #5566aa; letter-spacing: 0; margin-top: 4px;
}
.report-header-right {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 8px; flex-shrink: 0; margin-left: auto;
}
.back-link a { color: #5566aa; text-decoration: none; font-size: 0.85rem; transition: color 0.2s; }
.back-link a:hover { color: #aaaaff; }
.credit-box {
  display: inline-block; background: rgba(10,10,26,0.85); border: 1px solid #2a2a5a;
  border-radius: 8px; padding: 6px 13px; font-size: 12px; color: #9999cc;
  white-space: nowrap; user-select: none;
}
.credit-box a { color: #8888ff; text-decoration: none; }
.credit-box a:hover { color: #aaaaff; text-decoration: underline; }

.member-photo {
  width: 72px; height: 72px; border-radius: 50%;
  object-fit: cover; object-position: top center;
  border: 2px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04); flex-shrink: 0;
}
.member-name-h1 {
  display: inline-flex; align-items: center; gap: 0;
  font-size: 2.6rem; font-weight: 900; color: #ffffff;
  letter-spacing: -0.02em; line-height: 1;
  overflow: hidden; border-radius: 8px;
  background: rgba(255,255,255,0.04);
}
.name-party-strip {
  display: block; width: 14px; align-self: stretch; flex-shrink: 0; margin-right: 12px;
}
.party-badge {
  display: inline-block; padding: 4px 14px; border-radius: 20px;
  font-size: 0.82rem; font-weight: bold; flex-shrink: 0;
}
.party-minjoo  { background: rgba(58,123,213,0.2); border: 1px solid rgba(58,123,213,0.5); color: #7aadff; }
.party-power   { background: rgba(224,48,48,0.2);  border: 1px solid rgba(224,48,48,0.5);  color: #ff8888; }
.party-joguk   { background: rgba(155,89,182,0.2); border: 1px solid rgba(155,89,182,0.5); color: #cc88ff; }
.party-gaehyuk { background: rgba(230,126,34,0.2); border: 1px solid rgba(230,126,34,0.5); color: #ffaa66; }
.party-other   { background: rgba(85,102,136,0.15);border: 1px solid rgba(85,102,136,0.4); color: #9999cc; }
.district-badge {
  display: inline-block; padding: 3px 10px; border-radius: 12px;
  font-size: 0.76rem; color: #7788aa;
  background: rgba(255,255,255,0.05); border: 1px solid #2a2a5a; flex-shrink: 0;
}
.report-footer {
  display: flex; justify-content: flex-end;
  margin-top: 32px; padding-top: 20px; border-top: 1px solid #1a1a3a;
}

/* ── 인덱스 히어로 헤더 ── */
.index-hero {
  position: relative;
  margin-bottom: 32px;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(180deg, #0a0a18 0%, #1a0a0a 60%, #0d0d1e 100%);
  border: 1px solid #3a1a1a;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 0 20px 20px;
  min-height: 160px;
}
.hero-svg {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none;
}
.hero-content {
  position: relative;
  z-index: 2;
}


/* ── 인덱스 컨트롤 ── */
.index-controls { margin-bottom: 24px; display: flex; flex-direction: column; gap: 10px; }
.search-row { display: flex; align-items: center; gap: 12px; }
#idx-search {
  background: rgba(255,255,255,0.06); border: 1px solid #3a3a7a;
  border-radius: 8px; padding: 9px 16px; color: #c0c0ee;
  font-size: 0.9rem; outline: none; font-family: inherit; flex: 1; max-width: 360px;
}
#idx-search::placeholder { color: #334455; }
#idx-search:focus { border-color: #5555ff; background: rgba(255,255,255,0.09); }
.idx-count { font-size: 0.78rem; color: #445566; white-space: nowrap; }
.filter-row { display: flex; align-items: flex-start; gap: 10px; }
.filter-label { font-size: 0.72rem; color: #445566; padding-top: 5px; flex-shrink: 0; min-width: 24px; }
.pf-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.pf-chip {
  display: inline-flex; align-items: center; gap: 0;
  padding: 0 10px 0 0; border-radius: 12px; font-size: 0.74rem;
  border: 1px solid #2a2a5a; background: rgba(255,255,255,0.03);
  color: #7788aa; cursor: pointer; transition: all 0.15s; user-select: none; overflow: hidden;
}
.pf-chip em { font-style: normal; color: #445566; font-size: 0.65rem; margin-left: 3px; }
.pf-party-strip { width: 14px; align-self: stretch; flex-shrink: 0; margin-right: 7px; opacity: 0.7; transition: opacity 0.15s; }
.pf-chip:hover { background: rgba(255,255,255,0.08); border-color: #5555aa; color: #aaaaff; }
.pf-chip:hover .pf-party-strip { opacity: 1; }
.pf-chip.on { background: rgba(85,85,255,0.18); border-color: #5555ff; color: #c0c0ff; font-weight: 600; }
.pf-chip.on .pf-party-strip { opacity: 1; }
#filter-gold.on { background: rgba(240,192,64,0.15); border-color: #f0c040; color: #f0d060; }
#filter-gold.on .pf-party-strip { background: #f0c040 !important; opacity: 1; }
#filter-coin.on { background: rgba(80,208,176,0.15); border-color: #50d0b0; color: #70e8c8; }
#filter-coin.on .pf-party-strip { background: #50d0b0 !important; opacity: 1; }
.coin-holdings-list { display:flex; flex-wrap:wrap; gap:4px; margin-top:7px; }
.coin-item { font-size:0.67rem; background:rgba(80,208,176,0.10); border:1px solid rgba(80,208,176,0.22); border-radius:4px; padding:2px 8px; color:#70d8b8; white-space:nowrap; line-height:1.5; }
.coin-tooltip-wrap { display:inline-block; cursor:default; }
#coin-global-tooltip {
  display:none; position:fixed; z-index:9999;
  background:#12122a; border:1px solid #3a3a70; border-radius:10px;
  padding:10px 14px; min-width:200px; max-width:340px;
  box-shadow:0 4px 24px rgba(0,0,0,0.7); pointer-events:none;
  font-family:inherit; font-size:0.78rem;
}
.coin-tooltip { display:none; }
.coin-tooltip-row { display:flex; justify-content:space-between; gap:16px; font-size:0.75rem; padding:3px 0; border-bottom:1px solid #22224a; color:#b0b0dd; }
.coin-tooltip-row:last-child { border-bottom:none; }
.coin-tooltip-row .ct-name { color:#70d8b8; font-weight:600; white-space:nowrap; }
.coin-tooltip-row .ct-qty  { color:#8888aa; font-size:0.68rem; }
.coin-tooltip-row .ct-val  { color:#e0e0ff; font-weight:700; white-space:nowrap; }

/* ── 의원 카드 그리드 ── */
.member-asset-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.member-asset-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 0 0 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid #2a2a5a;
  text-decoration: none;
  transition: all 0.15s;
  overflow: hidden;
  position: relative;
}
.member-asset-card:hover { background: rgba(255,255,255,0.08); border-color: #5555aa; transform: translateY(-1px); }

.card-strip {
  width: 100%; height: 8px; flex-shrink: 0;
}
.card-body {
  display: flex; flex-direction: column; gap: 5px;
  padding: 10px 14px 0;
  width: 100%;
}
.card-amount {
  font-size: 1.45rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.1;
  word-break: break-all;
}
.card-amount.negative { color: #ff7777 !important; }
.card-unit { font-size: 1.05em; font-weight: 900; }
.card-sub  { display: block; font-size: 0.72em; margin-top: 2px; opacity: 0.8; }

.card-info {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}
.card-photo {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top center;
  flex-shrink: 0;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
}
.card-info-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.card-name {
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-meta {
  font-size: 0.7rem;
  color: #5566aa;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-rank {
  position: absolute;
  top: 10px; right: 8px;
  font-size: 0.6rem;
  color: #3a3a6a;
  font-weight: 600;
}

/* ── 상세 페이지 요약 ── */
.stats-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 32px;
}
.stat-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid #2a2a5a;
  border-radius: 8px;
  padding: 12px 14px;
  text-align: center;
}
.stat-label { font-size: 0.68rem; color: #5566aa; margin-bottom: 4px; letter-spacing: 0.04em; }
.stat-value { font-size: 1.1rem; font-weight: 800; color: #aaaaff; letter-spacing: -0.02em; }
.stat-value.positive { color: #88ff88; }
.stat-value.negative { color: #ff7777; }

/* ── 아파트 환산 ── */
.apt-compare {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 32px;
}
.apt-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid #2a2a5a;
  border-radius: 10px;
  padding: 14px 16px;
}
.apt-card-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #8899cc;
  margin-bottom: 8px;
  line-height: 1.4;
}
.apt-count {
  font-size: 2rem;
  font-weight: 900;
  color: #ffcc55;
  letter-spacing: -0.03em;
  line-height: 1;
}
.apt-count.negative { color: #ff7777; font-size: 1.2rem; }
.apt-count-unit { font-size: 0.8rem; color: #7788aa; margin-top: 4px; }
.apt-count-detail { font-size: 0.68rem; color: #445566; margin-top: 3px; }

/* ── 재산 섹션 ── */
.asset-section { margin-bottom: 40px; }
.asset-section-title {
  font-size: 1rem; color: #7788cc; margin-bottom: 12px;
  padding-bottom: 10px; border-bottom: 1px solid #2a2a5a;
  display: flex; align-items: center; gap: 8px;
}
.asset-section-total {
  margin-left: auto; font-size: 0.82rem;
  color: #aaaaff; font-weight: 700;
}

/* ── 재산 테이블 ── */
.asset-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.asset-table th {
  text-align: left;
  padding: 8px 10px;
  font-size: 0.68rem;
  font-weight: 600;
  color: #556688;
  border-bottom: 1px solid #2a2a5a;
  white-space: nowrap;
}
.asset-table td {
  padding: 10px 10px;
  border-bottom: 1px solid #1a1a3a;
  color: #b0b0cc;
  vertical-align: top;
}
.asset-table tr:hover td { background: rgba(255,255,255,0.03); }
.asset-table tr:last-child td { border-bottom: none; }

.td-kind { white-space: nowrap; font-size: 0.72rem; color: #7788aa; }
.td-loc { line-height: 1.5; }
.td-amount { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.td-amount.changed { color: #ffbb66; }
.td-amount.positive { color: #88cc88; }
.td-amount.negative { color: #ff8888; }
.td-reason { font-size: 0.68rem; color: #445566; white-space: nowrap; }
.td-relation { font-size: 0.72rem; color: #667788; white-space: nowrap; }

/* ── 지도 버튼 ── */
.map-btns { display: flex; gap: 5px; margin-top: 6px; flex-wrap: wrap; }
.map-btn {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}
.map-btn.kakao {
  background: rgba(255,220,0,0.12);
  border: 1px solid rgba(255,220,0,0.35);
  color: #ffdd44;
}
.map-btn.kakao:hover { background: rgba(255,220,0,0.25); border-color: rgba(255,220,0,0.6); }
.map-btn.naver {
  background: rgba(0,200,80,0.12);
  border: 1px solid rgba(0,200,80,0.35);
  color: #44cc66;
}
.map-btn.naver:hover { background: rgba(0,200,80,0.22); border-color: rgba(0,200,80,0.55); }

/* ── 반응형 ── */
@media (max-width: 768px) {
  .stats-summary { grid-template-columns: repeat(3, 1fr); }
  .member-asset-grid { grid-template-columns: repeat(3, 1fr); }
  .asset-table { font-size: 0.76rem; }
  .asset-table th, .asset-table td { padding: 7px 6px; }
}
@media (max-width: 640px) {
  .stats-summary { grid-template-columns: 1fr; }
  .apt-compare { grid-template-columns: 1fr; }
  .stat-card, .apt-card { word-break: keep-all; }
  .member-asset-grid { grid-template-columns: 1fr; }
  .card-amount { word-break: keep-all; }
  .card-name, .card-meta { word-break: keep-all; }
  .asset-section-total { white-space: nowrap; }
  .report-header-right {
    flex: 0 0 100%;
    flex-direction: column;
    align-items: flex-end;
    margin-left: 0;
  }
  /* ── 테이블 모바일 3줄 레이아웃 ── */
  .asset-table thead { display: none; }
  .asset-table,
  .asset-table tbody { display: block; }
  .asset-table tr {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    border-bottom: 1px solid #2a2a5a;
    padding: 10px 0;
  }
  .asset-table tr:last-child { border-bottom: none; }
  .asset-table td {
    border-bottom: none;
    padding: 2px 5px;
    font-size: 0.78rem;
    white-space: normal;
  }
  .asset-table td.td-relation { flex: 0 0 auto; color: #667788; }
  .asset-table td.td-kind    { flex: 0 0 auto; }
  .asset-table td.td-loc {
    flex: 0 0 100%;
    padding: 5px 5px 3px;
    color: #c0c0ee;
    line-height: 1.5;
  }
  .asset-table td.td-loc .map-btns { justify-content: flex-end; }
  .asset-table td.td-amount,
  .asset-table td.td-reason {
    flex: 0 0 auto;
    text-align: left;
    white-space: nowrap;
  }
  .asset-table td:nth-child(4)::before { content: "종전 "; color: #445566; font-size: 0.65rem; }
  .asset-table td:nth-child(5)::before { content: "현재 "; color: #445566; font-size: 0.65rem; }
  .asset-table td:nth-child(6)::before { content: "증감 "; color: #445566; font-size: 0.65rem; }
  .asset-table td:nth-child(7)::before { content: "사유 "; color: #445566; font-size: 0.65rem; }
  /* 1단일 때 지역구 잘리지 않게 */
  .member-asset-grid .card-name,
  .member-asset-grid .card-meta { white-space: normal; overflow: visible; text-overflow: unset; }
}
@media (max-width: 500px) {
  .report-wrap { padding: 24px 16px 60px; }
  .member-name-h1 { font-size: 1.8rem; }
  .report-header { gap: 10px; margin-bottom: 24px; }
  .card-amount { font-size: 1.2rem; }
  .td-amount { font-size: 0.72rem; }
  #idx-search { max-width: 100%; }
}
