:root {
  --bg: #f3f5f7;
  --bg-accent: #edf2f1;
  --surface: rgba(255, 255, 255, 0.84);
  --surface-strong: #ffffff;
  --surface-alt: #f7faf9;
  --text: #101828;
  --muted: #5f6c7b;
  --muted-soft: #8b98a7;
  --line: rgba(15, 23, 42, 0.05);
  --line-strong: rgba(15, 23, 42, 0.08);
  --accent: #0f766e;
  --accent-soft: rgba(15, 118, 110, 0.12);
  --accent-strong: #0b5e58;
  --success: #0f8a65;
  --success-soft: rgba(15, 138, 101, 0.12);
  --danger: #c05621;
  --danger-soft: rgba(192, 86, 33, 0.1);
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.035);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.1), transparent 28%),
    linear-gradient(180deg, #fbfcfd 0%, var(--bg) 48%, #eef2f3 100%);
}

button,
input,
select {
  font: inherit;
}

.page-shell {
  width: min(1400px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 18px 0 32px;
}

.panel {
  backdrop-filter: blur(18px);
  background: var(--surface);
  border: 0;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.hero {
  padding: 16px 18px 18px;
  position: relative;
  overflow: hidden;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.hero-toolbar,
.compare-modal-head,
.selector-head,
.compare-selector-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.hero-toolbar {
  margin-bottom: 4px;
  min-height: 0;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -8% -28% auto;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(15, 118, 110, 0.12), rgba(15, 118, 110, 0));
  pointer-events: none;
}

.eyebrow,
.section-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 800;
}

.hero h1,
.hero-toolbar-copy h2,
.section-head h2,
.chart-head h3 {
  margin: 0;
  letter-spacing: -0.04em;
}

.hero-toolbar-copy h2 {
  margin-top: 6px;
  font-size: 1rem;
}

.hero h1 {
  margin-top: 16px;
  font-size: clamp(2.3rem, 4vw, 4.4rem);
  line-height: 0.94;
  max-width: 11ch;
}

.hero-description,
.section-copy,
.chart-head p,
.data-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
  font-size: 15px;
}

.hero-description {
  max-width: 62ch;
  margin-top: 18px;
}

.hero-actions {
  margin-top: 24px;
  display: grid;
  gap: 16px;
}

.metric-switch {
  display: inline-flex;
  width: fit-content;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(15, 23, 42, 0.06);
}

.metric-switch button,
.sort-button,
.compare-button,
.tag,
.chip-button {
  transition:
    transform 160ms ease,
    background-color 160ms ease,
    color 160ms ease,
    border-color 160ms ease,
    opacity 160ms ease;
}

.metric-switch button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.metric-switch button.active {
  background: var(--accent);
  color: white;
}

.hero-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.88fr) minmax(380px, 0.72fr);
  gap: 18px;
  align-items: start;
}

.summary-card,
.compare-card,
.timeline-card,
.snapshot-card,
.event-item {
  border-radius: var(--radius-lg);
  background: transparent;
  border: 0;
}

.summary-card {
  padding: 10px 10px 12px;
  min-height: 70px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: none;
}

.summary-label,
.mono-label,
.table-hint,
.timeline-date,
.event-date,
.value-caption,
.mini-stat-label,
.badge-label {
  font-family: "IBM Plex Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 10px;
  color: var(--muted-soft);
}

.summary-value {
  font-size: clamp(1rem, 1.2vw, 1.35rem);
  font-weight: 700;
  letter-spacing: -0.04em;
}

.summary-detail {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.hero-changelog {
  position: relative;
  padding: 10px 4px 4px 14px;
  border-left: 1px solid rgba(15, 23, 42, 0.08);
}

.change-log-head,
.change-drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.change-log-head h3,
.change-drawer-head h2 {
  margin: 4px 0 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.change-log-link {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  font-size: 12px;
}

.change-log-list,
.change-drawer-list {
  margin-top: 10px;
  display: grid;
  gap: 0;
}

.change-event-item,
.change-drawer-item {
  position: relative;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 10px;
  padding: 0 0 14px;
  cursor: pointer;
}

.change-event-item::before,
.change-drawer-item::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 14px;
  bottom: -2px;
  width: 1px;
  background: rgba(15, 23, 42, 0.12);
}

.change-event-item:last-child::before,
.change-drawer-item:last-child::before {
  display: none;
}

.change-event-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cfd8e3;
  margin-top: 6px;
  margin-left: 4px;
  position: relative;
  z-index: 1;
}

.change-event-body {
  min-width: 0;
}

.change-event-time {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.change-event-title {
  margin-top: 2px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.change-event-copy {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.timeline-panel,
.table-panel,
.detail-panel {
  padding: 18px 20px;
}

.timeline-panel,
.workspace-grid {
  margin-top: 14px;
}

.workspace-block {
  margin-top: 14px;
  padding-top: 20px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

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

.section-head h2 {
  margin-top: 6px;
  font-size: clamp(1.2rem, 1.7vw, 1.75rem);
  font-weight: 400;
}

.section-copy {
  max-width: 40ch;
  font-size: 13px;
}

.compare-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.compare-launch-button,
.compare-modal-close,
.compare-selector-button {
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
}

.compare-launch-button,
.compare-modal-close {
  border: 0;
  background: rgba(15, 118, 110, 0.1);
  color: var(--accent-strong);
  padding: 10px 14px;
  white-space: nowrap;
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.08);
}

.compare-launch-button {
  min-width: 178px;
  text-align: center;
}

.compare-card {
  padding: 18px;
  display: grid;
  gap: 14px;
}

.compare-card.selected {
  border-color: rgba(15, 118, 110, 0.36);
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.12);
}

.compare-top,
.mini-stat-row,
.chart-head,
.event-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.model-name {
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.provider-name,
.subtle-copy {
  color: var(--muted);
  font-size: 14px;
}

.tag-row,
.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  color: var(--muted);
  font-size: 13px;
}

.bar-track {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

.bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(15, 118, 110, 0.88), rgba(15, 118, 110, 0.46));
}

.compare-price {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.05em;
}

.mini-stat-row {
  align-items: end;
}

.mini-stat-value {
  font-size: 1rem;
  font-weight: 700;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(360px, 0.9fr);
  gap: 22px;
}

.table-tools {
  display: flex;
  gap: 10px;
  align-items: center;
}

.search-input {
  border: 0;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.86);
  padding: 11px 14px;
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
  outline: none;
}

.compact-search-input {
  width: 260px;
}

.active-compare {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.compare-modal-chips {
  min-height: 40px;
}

.chip-button {
  border: 1px solid rgba(15, 118, 110, 0.16);
  background: rgba(15, 118, 110, 0.08);
  color: var(--accent-strong);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
  border-radius: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.price-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

.price-table th,
.price-table td {
  padding: 14px 14px;
  text-align: left;
  border-bottom: 0;
  vertical-align: middle;
  font-size: 14px;
  font-weight: 400;
}

.price-table tbody tr {
  cursor: pointer;
}

.price-table tbody tr:hover,
.price-table tbody tr.is-selected {
  background: rgba(15, 118, 110, 0.06);
}

.price-table tbody tr.is-compared {
  background: rgba(15, 118, 110, 0.04);
}

.price-table tbody tr:last-child td {
  border-bottom: 0;
}

.price-table .model-name,
.price-table .provider-name,
.price-table .price-value,
.price-table .change-value,
.price-table .price-subtext,
.price-table .change-badge,
.price-table .history-button {
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0;
}

.price-table .price-subtext {
  margin-top: 2px;
}

.sort-button {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-family: "Manrope", sans-serif;
  text-transform: none;
  letter-spacing: 0;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted-soft);
}

.sort-button.active {
  color: var(--accent);
}

.model-cell {
  display: grid;
  gap: 2px;
}

.model-secondary {
  font-size: 12px;
  color: var(--muted);
}

.price-value {
  font-weight: 800;
  letter-spacing: -0.03em;
  font-size: 0.96rem;
}

.price-subtext {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted-soft);
}

.change-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border-radius: 0;
  font-size: 14px;
  font-weight: 400;
  background: transparent;
}

.change-badge.down {
  color: var(--success);
}

.change-badge.up {
  color: var(--danger);
}

.change-badge.flat {
  color: var(--muted);
}

.change-value {
  display: inline-flex;
  align-items: center;
  font-size: 14px;
  font-weight: 400;
  color: var(--muted);
}

.change-value.down {
  color: var(--success);
}

.change-value.up {
  color: var(--danger);
}

.compare-button {
  border: 0;
  background: white;
  border-radius: 999px;
  padding: 9px 12px;
  cursor: pointer;
  font-weight: 700;
  box-shadow: none;
}

.compare-button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.history-button {
  border: 0;
  background: rgba(15, 23, 42, 0.04);
  border-radius: 999px;
  padding: 9px 12px;
  cursor: pointer;
  font-weight: 700;
  color: var(--text);
  box-shadow: none;
}

.detail-panel {
  display: grid;
  gap: 18px;
  align-content: start;
}

.snapshot-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.snapshot-card {
  padding: 10px 12px;
  background: var(--surface-alt);
}

.snapshot-value {
  margin-top: 6px;
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.snapshot-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.chart-card,
.events-card {
  border: 0;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.78);
  padding: 14px 16px;
  box-shadow: none;
}

.chart-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
}

.chart-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.range-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.05);
}

.range-switch button {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
}

.range-switch button.active {
  background: white;
  color: var(--accent-strong);
}

.history-chart {
  margin-top: 10px;
}

.history-chart svg {
  width: 100%;
  height: auto;
  display: block;
}

.chart-grid-line {
  stroke: rgba(15, 23, 42, 0.08);
  stroke-width: 1;
}

.chart-label,
.point-label {
  font-family: "IBM Plex Mono", monospace;
  fill: #7c8794;
  font-size: 9px;
}

.chart-x-label {
  font-size: 8px;
}

.chart-area {
  fill: rgba(15, 118, 110, 0.12);
}

.chart-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.point-dot {
  fill: white;
  stroke: var(--accent);
  stroke-width: 2;
}

.event-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.event-item {
  padding: 12px;
  display: grid;
  gap: 8px;
}

.event-title,
.timeline-title {
  font-weight: 800;
  letter-spacing: -0.03em;
}

.event-copy,
.timeline-copy {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.market-timeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.compare-modal.hidden {
  display: none;
}

.history-modal.hidden {
  display: none;
}

.compare-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
}

.history-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
}

.change-drawer.hidden {
  display: none;
}

.change-drawer {
  position: fixed;
  inset: 0;
  z-index: 35;
}

.compare-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 24, 40, 0.36);
  backdrop-filter: blur(8px);
}

.compare-modal-dialog {
  position: relative;
  width: min(1240px, calc(100vw - 40px));
  max-height: calc(100vh - 24px);
  margin: 20px auto;
  padding: 24px;
  overflow: auto;
  background: rgba(252, 253, 253, 0.94);
}

.history-modal-dialog {
  width: min(90vw, 1600px);
  display: grid;
  gap: 10px;
  padding: 14px 16px 16px;
}

.change-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(520px, calc(100vw - 32px));
  padding: 18px 18px 22px;
  background: rgba(252, 253, 253, 0.97);
  box-shadow: -18px 0 48px rgba(15, 23, 42, 0.08);
  overflow: auto;
}

.detail-topline {
  color: var(--danger);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
}

.compare-modal-body {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.compare-selector-panel,
.compare-results-panel {
  border: 0;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.82);
  padding: 18px;
  box-shadow: none;
}

.compare-selector-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.compare-selector-item {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 0;
  border-radius: var(--radius-md);
  background: rgba(247, 250, 249, 0.9);
  box-shadow: none;
}

.compare-selector-item.is-selected {
  border-color: rgba(15, 118, 110, 0.28);
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.14);
  background: rgba(15, 118, 110, 0.06);
}

.compare-selector-copy {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.compare-selector-button {
  border: 0;
  background: white;
  color: var(--text);
  padding: 8px 12px;
  box-shadow: none;
}

.compare-selector-button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.compare-modal-board {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.timeline-card {
  padding: 16px;
  display: grid;
  gap: 10px;
  box-shadow: none;
}

.timeline-impact {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.05);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.history-modal-dialog #detailHeading {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.history-modal-dialog .compare-modal-close {
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
}

.history-modal-dialog .badge-label {
  font-size: 9px;
}

.history-modal-dialog .chart-head h3 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
}

.history-modal-dialog .chart-head p {
  font-size: 11px;
  line-height: 1.4;
}

.history-modal-dialog .event-title {
  font-size: 12px;
  font-weight: 600;
}

.history-modal-dialog .event-copy {
  font-size: 12px;
  line-height: 1.45;
}

.change-drawer-list {
  margin-top: 18px;
}

.change-drawer-item {
  padding-bottom: 18px;
}

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

  .hero-changelog {
    padding-left: 0;
    border-left: 0;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    padding-top: 14px;
  }

  .hero-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .compare-modal-body {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100vw - 20px, 100%);
    padding-top: 10px;
    padding-bottom: 22px;
  }

  .hero,
  .timeline-panel,
  .table-panel,
  .detail-panel {
    padding: 18px;
  }

  .hero-summary,
  .snapshot-grid {
    grid-template-columns: 1fr;
  }

  .section-head,
  .hero-toolbar,
  .compare-modal-head,
  .table-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .chart-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .search-input,
  .compare-launch-button {
    width: 100%;
  }

  .compare-modal-dialog {
    width: min(100vw - 20px, 100%);
    margin: 10px auto;
    padding: 18px;
  }

  .history-modal-dialog {
    width: min(100vw - 20px, 100%);
  }

  .change-drawer-panel {
    width: min(100vw - 12px, 100%);
    padding: 14px 14px 18px;
  }
}
