:root {
  color-scheme: light;
  --bg: #f4f6f3;
  --ink: #1d2522;
  --muted: #69736f;
  --line: #dce3df;
  --panel: #ffffff;
  --green: #25745c;
  --red: #b94b43;
  --amber: #bd7d25;
  --blue: #286b9c;
  --shadow: 0 18px 45px rgba(32, 46, 39, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(16px, 4vw, 44px);
  border-bottom: 1px solid rgba(220, 227, 223, 0.85);
  background: rgba(244, 246, 243, 0.9);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 170px;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: var(--muted);
  font-size: 12px;
}

.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
}

.tab {
  min-width: 74px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 9px 15px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
}

.tab.is-active {
  border-color: var(--line);
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 6px 18px rgba(29, 37, 34, 0.06);
}

.shell {
  width: min(1240px, calc(100% - 32px));
  margin: 26px auto 56px;
}

.panel {
  margin-bottom: 18px;
}

.is-hidden {
  display: none !important;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 24px;
  min-height: 330px;
  padding: clamp(24px, 4vw, 46px);
  border-radius: 8px;
  background:
    linear-gradient(120deg, rgba(37, 116, 92, 0.92), rgba(40, 107, 156, 0.76)),
    url("https://images.unsplash.com/photo-1516467508483-a7212febe31a?auto=format&fit=crop&w=1800&q=80");
  background-position: center;
  background-size: cover;
  color: #fff;
  box-shadow: var(--shadow);
}

.hero h1 {
  max-width: 720px;
  margin: 12px 0 30px;
  font-size: clamp(22px, 2.6vw, 34px);
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: -0.01em;
  word-break: keep-all;
}

.eyebrow {
  margin: 0;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero .eyebrow {
  color: rgba(255, 255, 255, 0.82);
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 10px;
  max-width: 760px;
}

.hero-metrics div,
.signal-board {
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  background: rgba(12, 22, 19, 0.22);
  backdrop-filter: blur(12px);
}

.hero-metrics div {
  padding: 16px;
}

.hero-metrics span,
.metric-card span,
.model-grid span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.hero-metrics span {
  color: rgba(255, 255, 255, 0.76);
}

.hero-metrics strong {
  font-size: clamp(20px, 2.5vw, 30px);
}

.signal-board {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 240px;
  padding: 22px;
}

.signal-stat {
  display: grid;
  gap: 6px;
  align-content: center;
  justify-items: center;
  flex: 1;
  text-align: center;
}

.signal-stat strong {
  font-size: 44px;
  font-weight: 800;
  line-height: 1;
}

.signal-stat small {
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-weight: 700;
}

.signal-stat span {
  color: rgba(255, 255, 255, 0.78);
  font-size: 12.5px;
}

.signal-meta {
  color: rgba(255, 255, 255, 0.72);
}

.signal-meta {
  display: grid;
  gap: 6px;
  font-size: 13px;
}

.grid {
  display: grid;
  gap: 14px;
}

.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-card,
.chart-panel,
.side-panel,
.table-wrap,
.model-grid article,
.note-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 28px rgba(29, 37, 34, 0.05);
}

.metric-card {
  min-height: 126px;
  padding: 22px;
}

.compact .metric-card {
  min-height: 102px;
}

.metric-card strong {
  display: block;
  font-size: clamp(22px, 2.4vw, 30px);
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.metric-card small {
  display: block;
  margin-top: 10px;
  color: var(--muted);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(290px, 0.85fr);
  gap: 18px;
}

.chart-stack {
  display: grid;
  gap: 18px;
  min-width: 0;
  align-content: start;
}

.basis-note {
  margin: -6px 0 18px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.basis-note strong {
  color: #31413b;
}

.chart-panel,
.side-panel,
.table-wrap {
  padding: 22px;
}

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

h2 {
  margin: 4px 0 0;
  font-size: clamp(17px, 1.7vw, 21px);
  letter-spacing: -0.01em;
}

canvas {
  display: block;
  width: 100%;
  height: min(380px, 56vw);
}

#forecastChart {
  height: min(470px, 70vw);
}

.driver-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 12px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.driver-list li {
  padding: 14px;
  border-left: 4px solid var(--green);
  border-radius: 6px;
  background: #f6faf8;
  color: #31413b;
  line-height: 1.45;
}

.select-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 13px 10px;
  text-align: right;
  white-space: nowrap;
}

th:first-child,
td:first-child,
th:last-child,
td:last-child {
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 12px;
}

.table-wrap {
  overflow-x: auto;
}

.model-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.model-grid article {
  padding: 20px;
}

.model-grid strong {
  display: block;
  font-size: 20px;
  line-height: 1.35;
}

.note-box {
  margin-top: 18px;
  padding: 22px;
  color: #42504b;
  line-height: 1.65;
}

.combined-table thead th {
  text-align: right;
}

/* Combined table's last column is numeric (오차율), so keep it right-aligned,
   overriding the global `td:last-child { text-align: left }` rule. Only 주차
   (first column) stays left-aligned. */
.combined-table th:last-child,
.combined-table td:last-child {
  text-align: right;
}

.combined-table thead tr:first-child th:first-child,
.combined-table td:first-child {
  text-align: left;
}

.combined-table thead tr:first-child th {
  text-align: center;
  border-bottom: 1px solid var(--line);
}

.combined-table .group-price {
  background: rgba(37, 116, 92, 0.06);
}

.combined-table .group-head {
  background: rgba(40, 107, 156, 0.06);
}

.combined-table td.muted {
  color: #aab2ae;
}

.combined-table td.hit-in {
  color: var(--green);
  font-weight: 700;
}

.combined-table td.hit-out {
  color: var(--red);
  font-weight: 700;
}

.metric-note {
  margin: 12px 2px 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.legend i {
  display: inline-block;
  width: 18px;
  border-top: 2.5px solid #000;
}

.legend i.dash {
  border-top-style: dashed;
}

.legend i.box {
  width: 11px;
  height: 11px;
  border-top: 0;
  border-radius: 3px;
}

.up {
  color: var(--red);
}

.down {
  color: var(--blue);
}

.flat {
  color: var(--amber);
}

@media (max-width: 860px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero,
  .content-grid,
  .three,
  .four,
  .model-grid {
    grid-template-columns: 1fr;
  }

  .hero-metrics {
    grid-template-columns: 1fr;
  }

  .signal-board {
    min-height: auto;
  }
}

@media (max-width: 520px) {
  .shell {
    width: min(100% - 20px, 1240px);
    margin-top: 14px;
  }

  .hero {
    padding: 22px;
  }

  .tab {
    min-width: 66px;
    padding: 8px 11px;
    font-size: 13px;
  }

  .chart-panel,
  .side-panel,
  .table-wrap {
    padding: 16px;
  }
}
