/* ─────────────────────────────────────────────────────────────
 * Deal List — 메인페이지 (index.html) 전용 스타일
 * deallist.css 다음에 import.
 * ───────────────────────────────────────────────────────────── */

/* ============ Hero ============ */
.v1-hero {
  padding: 56px 24px 36px;
  text-align: center;
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
}
.v1-hero .kicker {
  font-size: 14px; font-weight: 600; letter-spacing: 0.28em;
  color: var(--muted); text-transform: uppercase;
  margin-bottom: 14px;
}
.v1-hero h1 {
  margin: 0; font-size: 80px; font-weight: 800;
  letter-spacing: -0.035em; color: var(--text);
  /* Numbers 로고 + Pool 텍스트 수평 정렬 */
  display: inline-flex; align-items: center; gap: 0.25em;
}
/* Pool 글자는 로고 내부 NUMBERS 텍스트와 시각적 크기 맞춤 (h1 의 78%) */
.v1-hero h1 .accent {
  color: var(--accent);
  font-size: 0.78em;
}
/* Numbers 로고 이미지 — h1 폰트 사이즈 비례 (em 단위, 자동 스케일) */
.v1-hero h1 .hero-logo-img {
  height: 1.3em; width: auto; max-width: 100%; display: block;
}
/* 라이트/다크 모드별 별도 PNG */
.v1-hero h1 .dark-only { display: none; }
:root[data-theme="dark"] .v1-hero h1 .light-only { display: none; }
:root[data-theme="dark"] .v1-hero h1 .dark-only { display: block; }
.v1-hero .lead {
  margin: 14px auto 0; max-width: 560px;
  color: var(--text-2); font-size: 15px; line-height: 1.6;
}

/* ============ DCM/ECM context tabs ============ */
.v1-section-tabs {
  display: flex; justify-content: center; gap: 6px;
  padding: 24px 24px 0;
}
.v1-section-tab {
  padding: 10px 24px; border-radius: 999px;
  font-size: 14px; font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  display: flex; align-items: center; gap: 8px;
  cursor: pointer;
}
.v1-section-tab.active {
  background: var(--accent); border-color: var(--accent); color: white;
}
.v1-section-tab .badge {
  font-size: 10px; font-weight: 600; padding: 2px 6px;
  background: rgba(255,255,255,0.2); border-radius: 4px;
  letter-spacing: 0.05em;
}
.v1-section-tab:not(.active) .badge {
  background: var(--amber-bg); color: var(--amber);
}

/* ============ Main ============ */
.v1-main {
  max-width: 1180px; margin: 0 auto;
  padding: 32px 24px 60px; width: 100%;
}

/* ─── KPI cards ─── */
.v1-kpis {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
  margin-bottom: 28px;
}
/* ECM 위젯은 5칸 (지난달 IPO/유증 + 올해 주관1위/최대 IPO/최대 유증) */
#ecm-kpi-grid { grid-template-columns: repeat(5, 1fr); }
a.v1-kpi:hover { border-color: var(--accent); background: var(--surface-2); }
.v1-kpi {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 18px 20px;
  position: relative;
  /* anchor 화 — 색 inherit, 밑줄 제거, hover 시 살짝 강조 */
  text-decoration: none; color: inherit;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.v1-kpi .label {
  font-size: 12px; color: var(--muted); font-weight: 500;
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 10px;
  white-space: nowrap;
}
.v1-kpi .label svg { width: 14px; height: 14px; flex-shrink: 0; }
.v1-kpi .value {
  font-size: 28px; font-weight: 700; letter-spacing: -0.02em;
  color: var(--text); font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.v1-kpi .value.compact { font-size: 22px; }
.v1-kpi .value small { font-size: 14px; color: var(--muted); font-weight: 500; }
.v1-kpi .sub {
  margin-top: 8px; font-size: 12px;
  display: flex; align-items: center; gap: 6px;
}
.v1-kpi .delta {
  padding: 2px 7px; border-radius: 4px; font-weight: 600;
  font-size: 11px; display: inline-flex; align-items: center; gap: 3px;
}
.v1-kpi .delta.down { background: var(--red-bg); color: var(--red); }
.v1-kpi .delta.up { background: var(--green-bg); color: var(--green); }
.v1-kpi .sub-text { color: var(--muted); }
.v1-kpi .mini-bars {
  margin-top: 12px; display: flex; align-items: end; gap: 3px; height: 22px;
}
.v1-kpi .mini-bars span {
  flex: 1;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-2) 100%);
  border-radius: 2px 2px 0 0; opacity: 0.85;
}

/* ─── Section title ─── */
.v1-sec-title {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 36px 0 14px;
}
.v1-sec-title h2 {
  margin: 0; font-size: 18px; font-weight: 700;
  letter-spacing: -0.02em; color: var(--text);
  display: flex; align-items: baseline; gap: 10px;
}
.v1-sec-title h2 .count {
  font-size: 12px; color: var(--accent); font-weight: 500;
  padding: 2px 8px; background: var(--accent-soft);
  border-radius: 999px;
}
.v1-sec-title a {
  color: var(--accent); text-decoration: none;
  font-size: 13px; font-weight: 500;
}

/* ─── Two-col: deals + league ─── */
.v1-two-col {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px;
  align-items: stretch;
}
.v1-two-col > div { display: flex; flex-direction: column; }
.v1-two-col > div > .v1-deals,
.v1-two-col > div > .v1-league { flex: 1; }

/* 3칸 행 (ECM 주관 TOP 10: 통합 / IPO / 유증) */
.v1-three-col {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
  align-items: start;
}
.v1-three-col > div { display: flex; flex-direction: column; }
.v1-three-col > div > .v1-league { flex: 1; }
/* 월별 추이 — 전체폭 차트 카드 간격 (DCM·ECM 공통) */
.v1-main > .v1-chart { margin-top: 28px; }

/* Recent deals */
.v1-deals {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden;
}
.v1-deals .head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.v1-deals h3 {
  margin: 0; font-size: 14px; font-weight: 700; color: var(--text);
}
.v1-deals .head-actions { display: flex; gap: 4px; }
.v1-deals .pill {
  font-size: 11px; padding: 3px 9px; border-radius: 999px;
  color: var(--muted); border: 1px solid var(--border); cursor: pointer;
  background: var(--surface);
}
.v1-deals .pill.active {
  background: var(--accent); color: white; border-color: var(--accent);
}

.v1-deal-row {
  display: grid;
  grid-template-columns: 56px 1.4fr 0.6fr 0.7fr 0.7fr;
  padding: 14px 18px; align-items: center;
  border-bottom: 1px solid var(--border-soft); gap: 12px;
  text-decoration: none; color: inherit;
}
/* 주관사 숨김 카드 — 4컬럼, 금액이 우측 끝 */
.v1-deals.no-leads .v1-deal-row { grid-template-columns: 56px 1.4fr 0.6fr 1fr; }
/* 태그(IPO/유증) 숨김 카드 — 4컬럼 (태그 자리 제거) */
.v1-deals.no-tag .v1-deal-row { grid-template-columns: 56px 1.4fr 0.7fr 0.7fr; }
/* 태그+주관사 모두 숨김 — 3컬럼, 금액이 우측 끝 */
.v1-deals.no-tag.no-leads .v1-deal-row { grid-template-columns: 56px 1.4fr 1fr; }
.v1-deal-row:last-child { border-bottom: 0; }
.v1-deal-row:hover { background: var(--surface-2); }
.v1-deal-row .date {
  font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums;
  text-align: center; line-height: 1.3;
}
.v1-deal-row .date .d {
  font-size: 16px; color: var(--text); font-weight: 700; display: block;
}
.v1-deal-row .issuer { min-width: 0; }
.v1-deal-row .issuer .name {
  font-size: 14px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.v1-deal-row .issuer .series {
  font-size: 11px; color: var(--muted); margin-top: 2px;
}
.v1-deal-row .amt {
  font-size: 14px; font-weight: 700; color: var(--text);
  font-variant-numeric: tabular-nums; text-align: right;
}
.v1-deal-row .amt small {
  font-size: 10px; color: var(--muted); font-weight: 500; margin-left: 2px;
}
/* 수요예측 전 상태 표시 — 굵은 숫자 대신 muted 톤 라벨 */
.v1-deal-row .amt.pending {
  font-size: 12px; font-weight: 600; color: var(--muted);
  font-variant-numeric: normal; letter-spacing: -0.01em;
}
.v1-deal-row .leads {
  font-size: 11px; color: var(--text-2); text-align: right;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* League table */
.v1-league {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 18px;
  display: flex; flex-direction: column;
}
.v1-league h3 {
  margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--text-2);
}
.v1-league .meta {
  font-size: 11px; color: var(--muted); margin-bottom: 10px;
}
.v1-league-row {
  display: flex; align-items: center; padding: 14px 18px;
  border-bottom: 1px solid var(--border-soft);
  flex: 1 1 0;
  text-decoration: none; color: inherit;
  margin: 0 -18px;
  border-radius: 6px;
  transition: background 0.12s;
}
.v1-league-row:last-of-type { border-bottom: 0; }
.v1-league-row:hover { background: var(--surface-2); }
.v1-league-row .rank {
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--surface-2); color: var(--text-2);
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin-right: 14px; flex-shrink: 0;
}
.v1-league-row.top1 .rank { background: var(--accent); color: white; }
.v1-league-row.top2 .rank { background: #475569; color: white; }
.v1-league-row.top3 .rank { background: #94a3b8; color: white; }
.v1-league-row .name {
  font-size: 14px; font-weight: 600; flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.v1-league-row .amt {
  font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--text); margin-left: 8px;
}
.v1-league-row .share {
  font-size: 12px; color: var(--muted); margin-left: 8px;
  font-variant-numeric: tabular-nums;
}
.v1-league .footnote {
  margin-top: auto; padding-top: 14px;
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--muted);
}

/* ─── Trend chart + Upcoming ─── */
.v1-trend-row {
  /* 좌: 다가오는 청약 (작음, 1fr) / 우: 월별 발행 추이 (큼, 1.6fr) */
  display: grid; grid-template-columns: 1fr 1.6fr; gap: 16px;
  margin-top: 28px;
}
.v1-chart {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 18px;
  /* Flex column so SVG can grow and fill any extra card height */
  display: flex; flex-direction: column;
}
.v1-chart .head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 4px; flex-shrink: 0;
}
.v1-chart .head h3 {
  margin: 0; font-size: 18px; font-weight: 700;
  letter-spacing: -0.02em; color: var(--text);
}
.v1-chart .head-right {
  display: inline-flex; align-items: center; gap: 10px;
}
.v1-chart .head-link {
  font-size: 12px; color: var(--accent); text-decoration: none; font-weight: 600;
  white-space: nowrap;
}
.v1-chart .head-link:hover { text-decoration: underline; }
.v1-chart .toggle {
  display: inline-flex; border: 1px solid var(--border); border-radius: 6px;
  overflow: hidden;
}
.v1-chart .toggle span {
  padding: 3px 10px; font-size: 11px; color: var(--muted); cursor: pointer;
}
.v1-chart .toggle span.active { background: var(--accent); color: white; }
.v1-chart .meta {
  font-size: 11px; color: var(--muted); margin-bottom: 14px;
  flex-shrink: 0;
}
/* SVG grows to fill card height — viewBox + preserveAspectRatio=none in HTML
   handle the stretch. min-height keeps it usable when card is short. */
.v1-chart svg { width: 100%; height: auto; flex: 1; min-height: 220px; display: block; }
/* 차트 클릭/hover — SVG 내부 <a> 감싸기 (home.js renderTrend) */
.v1-chart svg a { cursor: pointer; }
.v1-chart svg rect { transition: fill 0.15s; }
.v1-chart svg a:hover rect { fill: #9c7a17; }
.v1-chart svg circle { transition: stroke-width 0.15s; }
.v1-chart svg a:hover circle { stroke-width: 3; }
.v1-chart svg a:hover polyline { stroke-width: 2.5; }
.v1-chart .legend {
  display: flex; gap: 16px; margin-top: 8px;
  font-size: 11px; color: var(--muted);
  flex-shrink: 0;
}
.v1-chart .legend span { display: inline-flex; align-items: center; gap: 5px; }
.v1-chart .legend i {
  width: 8px; height: 8px; border-radius: 2px; display: inline-block;
}

.v1-upcoming {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 18px;
}
.v1-upcoming h3 { margin: 0 0 4px; font-size: 14px; font-weight: 700; }
.v1-upcoming .meta { font-size: 11px; color: var(--muted); margin-bottom: 12px; }
/* h3 + "전체보기 →" 링크 가로 정렬 (좌:타이틀 / 우:링크) */
.v1-upcoming .head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 8px; margin-bottom: 4px;
}
.v1-upcoming .head h3 { margin: 0; }
.v1-upcoming .head-link {
  font-size: 12px; color: var(--accent); text-decoration: none; font-weight: 600;
  white-space: nowrap;
}
.v1-upcoming .head-link:hover { text-decoration: underline; }
.v1-up-row {
  display: grid; grid-template-columns: 44px 1fr auto;
  padding: 10px 12px; border-bottom: 1px solid var(--border-soft);
  align-items: center; gap: 10px;
  text-decoration: none; color: inherit;
  margin: 0 -12px;
  border-radius: 6px;
  transition: background 0.12s;
}
.v1-up-row:last-child { border-bottom: 0; }
.v1-up-row:hover { background: var(--surface-2); }
.v1-up-row .when {
  padding: 4px 6px; border-radius: 6px; background: var(--accent-soft);
  text-align: center; line-height: 1.1;
}
.v1-up-row .when .day {
  font-size: 14px; font-weight: 700; color: var(--accent-2); display: block;
}
.v1-up-row .when .month {
  font-size: 9px; color: var(--accent); letter-spacing: 0.08em;
}
.v1-up-row .info .name { font-size: 13px; font-weight: 600; }
.v1-up-row .info .meta-2 {
  font-size: 11px; color: var(--muted); margin-top: 1px;
}
.v1-up-row .amt {
  font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
}

/* ─── Quick links ─── */
.v1-quick-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  margin-top: 28px;
}
.v1-quick {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 18px 20px;
  display: flex; gap: 14px; align-items: center;
  text-decoration: none; color: var(--text);
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.v1-quick:hover {
  transform: translateY(-1px); border-color: var(--accent);
  box-shadow: 0 6px 20px rgba(29, 78, 216, 0.08);
}
.v1-quick .ic {
  width: 40px; height: 40px; border-radius: 8px;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.v1-quick .ic svg { width: 20px; height: 20px; }
.v1-quick .body .ttl { font-size: 14px; font-weight: 700; }
.v1-quick .body .desc {
  font-size: 11px; color: var(--muted); margin-top: 2px;
}
.v1-quick .arrow { margin-left: auto; color: var(--muted); }

/* ============ Responsive ============ */
@media (max-width: 900px) {
  .v1-kpis, #ecm-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .v1-two-col, .v1-three-col { grid-template-columns: 1fr; }
  .v1-trend-row { grid-template-columns: 1fr; }
  .v1-quick-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .v1-hero { padding: 36px 16px 24px; }
  /* h1 크기만 줄이면 로고·Pool 모두 em 단위라 자동 비례 축소 */
  .v1-hero h1 { font-size: 52px; }
  .v1-hero .lead { font-size: 14px; }
  .v1-main { padding: 24px 16px 40px; }
  .v1-kpis, #ecm-kpi-grid { grid-template-columns: 1fr; }
  .v1-deal-row { grid-template-columns: 50px 1.2fr 0.8fr 0.6fr; gap: 8px; padding: 12px 14px; }
  .v1-deal-row .leads { display: none; }
}
