:root {
  --bg: #f6f0e6;
  --surface: rgba(255, 252, 247, 0.9);
  --surface-strong: #fffdf9;
  --ink: #132339;
  --muted: #627084;
  --line: rgba(19, 35, 57, 0.12);
  --accent: #0f766e;
  --shadow: 0 18px 46px rgba(24, 36, 58, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Sans KR", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.12), transparent 28%),
    radial-gradient(circle at top right, rgba(189, 120, 52, 0.1), transparent 24%),
    linear-gradient(180deg, #f8f4ed 0%, #efe6da 100%);
}

body.mobile-sheet-open {
  overflow: hidden;
}

.page-shell {
  width: min(1520px, calc(100vw - 28px));
  margin: 18px auto 30px;
}

.hero,
.list-panel,
.detail-panel,
.etf-card,
.detail-card {
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px;
}

.eyebrow {
  margin: 0 0 8px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
}

h1 {
  font-size: clamp(2rem, 3vw, 3.6rem);
}

.hero-controls {
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hero-controls label,
.section-head span,
.detail-kicker,
.card-change span {
  color: var(--muted);
  font-size: 0.88rem;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-strong);
  color: var(--ink);
}

.layout {
  display: grid;
  grid-template-columns: minmax(330px, 420px) minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
  align-items: start;
}

.list-panel,
.detail-panel {
  padding: 18px;
}

.detail-panel {
  position: sticky;
  top: 12px;
  min-height: calc(100vh - 54px);
}

.mobile-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(19, 35, 57, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.mobile-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.etf-grid {
  display: grid;
  gap: 12px;
}

.etf-card {
  padding: 14px 16px;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease;
}

.etf-card:hover,
.etf-card.active {
  transform: translateY(-2px);
  border-color: rgba(15, 118, 110, 0.4);
}

.etf-card h3 {
  font-size: 0.98rem;
  line-height: 1.35;
  display: flex;
  align-items: center;
  flex: 1;
}

.card-main {
  display: flex;
  align-items: center;
  gap: 14px;
}

.card-metrics {
  min-width: 128px;
  text-align: right;
}

.card-price {
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.25rem, 1.7vw, 1.8rem);
  line-height: 1;
}

.card-change,
.detail-change {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  border-radius: 999px;
  padding: 7px 12px;
  font-weight: 600;
}

.card-change {
  margin-top: 8px;
  padding: 5px 10px;
  font-size: 0.92rem;
}

.up {
  background: rgba(21, 128, 61, 0.12);
  color: #15803d;
}

.down {
  background: rgba(220, 38, 38, 0.11);
  color: #b91c1c;
}

.flat {
  background: rgba(100, 116, 139, 0.12);
  color: #64748b;
}

.detail-empty {
  min-height: 220px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
}

.mobile-sheet-close,
.mobile-sheet-handle {
  display: none;
}

.mobile-sheet-close {
  border: 0;
  background: rgba(19, 35, 57, 0.06);
  color: var(--ink);
  width: 38px;
  height: 38px;
  border-radius: 999px;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.mobile-sheet-handle {
  width: 68px;
  height: 6px;
  border-radius: 999px;
  background: rgba(19, 35, 57, 0.16);
  margin: 2px auto 14px;
}

.detail-top {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.detail-card {
  padding: 18px;
}

.detail-kicker {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.detail-top h2 {
  font-size: clamp(1.6rem, 2.3vw, 2.5rem);
  line-height: 1.18;
}

.detail-price-wrap {
  text-align: right;
}

.detail-price {
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(2rem, 2.8vw, 3rem);
  line-height: 1;
}

.detail-duo {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.section-head-chart {
  align-items: flex-start;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 14px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  cursor: pointer;
}

.pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.donut {
  width: 100%;
  height: auto;
}

.donut-value,
.chart-value {
  fill: var(--ink);
  font-family: "Space Grotesk", sans-serif;
  font-size: 18px;
  font-weight: 700;
}

.donut-sub {
  font-size: 13px;
  font-weight: 600;
}

.history-chart {
  width: 100%;
  height: 278px;
}

.chart-label {
  fill: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.chart-baseline {
  stroke: rgba(19, 35, 57, 0.18);
  stroke-dasharray: 5 7;
}

.chart-baseline-tag {
  fill: var(--muted);
  font-size: 10px;
}

.chart-extreme {
  fill: var(--ink);
  font-family: "Space Grotesk", sans-serif;
  font-size: 11px;
  font-weight: 700;
}

.range-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.range-tab {
  border: 1px solid rgba(19, 35, 57, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--muted);
  padding: 7px 11px;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 140ms ease;
}

.range-tab:hover {
  border-color: rgba(15, 118, 110, 0.28);
  color: var(--ink);
}

.range-tab.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.empty-chart {
  min-height: 220px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.58);
}

.weight-index {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.weight-index li {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.weight-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.weight-name,
.weight-value {
  font-size: 0.92rem;
}

.weight-name {
  min-width: 0;
  line-height: 1.25;
}

.weight-value {
  color: var(--muted);
  white-space: nowrap;
}

.holding-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.holding-list li {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(19, 35, 57, 0.08);
}

.holding-list li:last-child {
  border-bottom: 0;
}

.holding-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.holding-name {
  min-width: 0;
  line-height: 1.35;
}

.holding-meta {
  white-space: nowrap;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.detail-panel > section + section,
.detail-panel > .detail-duo + section,
.detail-panel > section + .detail-duo {
  margin-top: 16px;
}

@media (max-width: 1160px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
    min-height: auto;
  }
}

@media (max-width: 820px) {
  .hero {
    flex-direction: column;
    align-items: stretch;
  }

  .detail-top {
    flex-direction: column;
    align-items: start;
  }

  .detail-price-wrap {
    text-align: left;
  }

  .detail-duo {
    grid-template-columns: 1fr;
  }

  .section-head-chart {
    gap: 12px;
  }

  .range-tabs {
    justify-content: flex-start;
  }

  .holding-list li {
    grid-template-columns: 14px 1fr;
  }

  .holding-meta {
    grid-column: 2;
  }

  .card-main {
    align-items: flex-start;
  }

  .card-metrics {
    min-width: 108px;
  }

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

  .detail-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 30;
    min-height: 0;
    max-height: 88vh;
    overflow: auto;
    padding: 14px;
    border-radius: 28px 28px 0 0;
    transform: translateY(calc(100% + 24px));
    transition: transform 220ms ease;
    box-shadow: 0 -16px 40px rgba(24, 36, 58, 0.16);
  }

  .detail-panel.mobile-open {
    transform: translateY(0);
  }

  .detail-panel::before {
    content: "";
    position: sticky;
    top: -14px;
    display: block;
    height: 12px;
    margin: -14px -14px 4px;
    background:
      radial-gradient(circle at 10px 0, transparent 10px, rgba(255, 252, 247, 0.98) 10px) 0 0 / 24px 12px repeat-x;
  }

  .mobile-sheet-close,
  .mobile-sheet-handle {
    display: block;
  }

  .mobile-sheet-close {
    position: sticky;
    top: 8px;
    margin-left: auto;
    z-index: 1;
  }
}
