:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-soft: #f9fafb;
  --text: #121826;
  --muted: #647084;
  --line: #e5e7ef;
  --blue: #155eef;
  --blue-dark: #0f3e99;
  --green: #078565;
  --amber: #b45309;
  --rose: #c01048;
  --purple: #6d28d9;
  --shadow: 0 16px 44px rgba(18, 24, 38, .08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

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

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
}

.filter-rail {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  border-right: 1px solid var(--line);
  background: #fbfcfe;
  padding: 18px 16px 24px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  margin-bottom: 22px;
}

.brand-mark,
.provider-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #edf4ff;
  color: var(--blue-dark);
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(18, 24, 38, .08);
  flex: 0 0 auto;
}

.brand-mark {
  background: #ffffff;
  overflow: hidden;
  padding: 2px;
}

.brand-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.provider-icon.openai {
  background: #eff6ff;
  color: #1e3a8a;
}

.provider-icon.anthropic {
  background: #fff4ec;
  color: #c2410c;
}

.provider-icon.image {
  background: #ecfdf3;
  color: #067647;
}

.brand-row strong {
  display: block;
  font-size: 18px;
  line-height: 1.1;
}

.brand-row span,
.summary-band p,
.muted-text {
  color: var(--muted);
}

.filter-head,
.toolbar-actions,
.summary-metrics,
.drawer-title-row,
.copy-row,
.endpoint-line,
.active-filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-head {
  justify-content: space-between;
}

.filter-head h2,
.filter-section h3,
.summary-band h1,
.drawer-section h3 {
  margin: 0;
}

.filter-head h2 {
  font-size: 20px;
}

.filter-section {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin-top: 18px;
}

.filter-section h3 {
  font-size: 15px;
  margin-bottom: 10px;
}

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

.chip-grid.wide {
  grid-template-columns: 1fr;
}

.chip,
.ghost-button,
.segmented-control button,
.icon-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: #30394b;
  border-radius: 8px;
  min-height: 38px;
  padding: 8px 10px;
  font-weight: 700;
  transition: border-color .16s ease, box-shadow .16s ease, color .16s ease, background .16s ease;
}

.chip {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip.is-active {
  background: #eef4ff;
  border-color: #b8ccff;
  color: var(--blue-dark);
}

.chip[data-tone="green"].is-active {
  background: #ecfdf3;
  border-color: #a7f3d0;
  color: var(--green);
}

.chip[data-tone="amber"].is-active {
  background: #fff7ed;
  border-color: #fed7aa;
  color: var(--amber);
}

.chip[data-tone="rose"].is-active {
  background: #fff1f3;
  border-color: #fecdd3;
  color: var(--rose);
}

.pricing-main {
  min-width: 0;
  padding: 24px;
}

.summary-band {
  min-height: 142px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 24px;
  border-radius: 8px;
  color: #ffffff;
  background:
    linear-gradient(120deg, rgba(15, 62, 153, .94), rgba(21, 94, 239, .90)),
    url("data:image/svg+xml,%3Csvg width='1200' height='240' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.22'%3E%3Cpath d='M30 220 C240 20 360 260 570 80 S920 190 1160 30'/%3E%3Cpath d='M80 30 C260 110 390 20 550 160 S840 230 1120 100'/%3E%3Cpath d='M180 240 C360 130 470 50 690 130 S980 190 1180 70'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover;
  overflow: hidden;
}

.summary-band h1 {
  margin-top: 6px;
  font-size: 28px;
  line-height: 1.1;
}

.summary-band p {
  color: rgba(255, 255, 255, .78);
  margin: 12px 0 0;
  max-width: 720px;
}

.eyebrow {
  color: rgba(255, 255, 255, .72);
  font-size: 13px;
  font-weight: 800;
}

.summary-metrics {
  flex-wrap: wrap;
  align-content: flex-start;
  justify-content: flex-end;
}

.summary-metrics span {
  border-radius: 999px;
  background: rgba(255, 255, 255, .15);
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.toolbar {
  margin-top: 12px;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(18, 24, 38, .04);
}

.search-box {
  position: relative;
  display: block;
}

.search-box svg {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.search-box input {
  width: 100%;
  height: 42px;
  border: 0;
  outline: none;
  border-radius: 8px;
  background: #f2f4f7;
  padding: 0 14px 0 40px;
  color: var(--text);
}

.toolbar-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #ffffff;
}

.ghost-button svg,
.segmented-control svg,
.icon-button svg {
  width: 17px;
  height: 17px;
}

.compact-button {
  min-height: 34px;
  padding: 6px 10px;
}

.icon-text-button {
  white-space: nowrap;
}

.segmented-control {
  display: inline-grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f3f4f8;
}

.segmented-control button {
  min-height: 34px;
  border: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  background: transparent;
}

.segmented-control button.is-active {
  background: #ffffff;
  color: var(--blue-dark);
  box-shadow: 0 4px 12px rgba(18, 24, 38, .08);
}

.active-filter-row {
  min-height: 28px;
  flex-wrap: wrap;
  margin: 14px 0 10px;
}

.active-filter-row span {
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 999px;
  padding: 5px 9px;
  color: #354153;
  font-size: 13px;
  font-weight: 700;
}

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

.model-card {
  min-height: 214px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
  box-shadow: 0 8px 24px rgba(18, 24, 38, .04);
  text-align: left;
  color: inherit;
}

.model-card:hover,
.model-card:focus-visible,
.chip:hover,
.ghost-button:hover,
.icon-button:hover {
  border-color: #b9c4d8;
  box-shadow: 0 10px 26px rgba(18, 24, 38, .08);
}

.model-card:focus-visible,
.chip:focus-visible,
.ghost-button:focus-visible,
.icon-button:focus-visible,
.segmented-control button:focus-visible {
  outline: 3px solid rgba(21, 94, 239, .18);
  outline-offset: 2px;
}

.model-card-head {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.model-card h2,
.drawer-title-row h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.22;
  overflow-wrap: anywhere;
}

.card-actions {
  display: inline-flex;
  gap: 6px;
}

.icon-button {
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  background: #ffffff;
}

.price-lines {
  display: grid;
  gap: 5px;
  color: #344054;
  font-size: 14px;
  line-height: 1.35;
}

.price-lines strong,
.price-summary strong {
  color: #111827;
}

.tag-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
  color: var(--purple);
  background: #f3edff;
  white-space: nowrap;
}

.pill.green {
  color: var(--green);
  background: #e9fbf3;
}

.pill.amber {
  color: var(--amber);
  background: #fff3e6;
}

.pill.rose {
  color: var(--rose);
  background: #fff0f3;
}

.model-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.model-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
}

.model-table th,
.model-table td {
  border-bottom: 1px solid var(--line);
  padding: 13px 14px;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

.model-table th {
  background: #f8fafc;
  color: #475467;
  font-size: 13px;
}

.table-model-button {
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  color: var(--blue-dark);
  font-weight: 800;
}

.empty-state,
.error-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  background: #ffffff;
  color: var(--muted);
}

.error-state {
  color: var(--rose);
  border-color: #fecdd3;
}

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, .52);
  z-index: 30;
}

.model-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(720px, 100vw);
  background: var(--surface);
  z-index: 40;
  transform: translateX(102%);
  transition: transform .2s ease;
  box-shadow: -22px 0 56px rgba(17, 24, 39, .16);
  overflow: auto;
}

.model-drawer.is-open {
  transform: translateX(0);
}

.drawer-inner {
  min-height: 100%;
  display: grid;
  align-content: start;
}

.drawer-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 28px;
}

.drawer-title-row {
  justify-content: space-between;
  align-items: flex-start;
}

.drawer-title-left {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
}

.drawer-title-left .provider-icon {
  width: 46px;
  height: 46px;
}

.drawer-actions {
  display: inline-flex;
  gap: 8px;
  flex: 0 0 auto;
}

.drawer-body {
  display: grid;
  gap: 18px;
  padding: 20px 28px 28px;
}

.drawer-section {
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.drawer-section:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.section-title {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.section-icon {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
}

.section-icon.blue {
  background: #53a6ff;
}

.section-icon.purple {
  background: #c05adb;
}

.section-icon.amber {
  background: #f59e0b;
}

.section-icon.green {
  background: #12b76a;
}

.section-title h3 {
  font-size: 16px;
}

.section-title p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.info-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-soft);
}

.info-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.info-item strong {
  display: block;
  margin-top: 5px;
  overflow-wrap: anywhere;
}

.feature-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.feature-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  color: #344054;
  background: #ffffff;
  font-size: 13px;
  font-weight: 700;
}

.feature-chip.is-on {
  border-color: #a7f3d0;
  background: #ecfdf3;
  color: var(--green);
}

.endpoint-line {
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-soft);
}

.endpoint-line code,
.code-block {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.endpoint-line code {
  overflow-wrap: anywhere;
}

.endpoint-line span {
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 900;
}

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

.price-table th,
.price-table td {
  border-bottom: 1px solid var(--line);
  padding: 13px 10px;
  text-align: left;
  vertical-align: top;
}

.price-table th {
  color: #475467;
  font-size: 13px;
}

.price-summary {
  display: grid;
  gap: 5px;
}

.interval-list {
  display: grid;
  gap: 8px;
}

.interval-item {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: var(--surface-soft);
}

.interval-label {
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 900;
}

.interval-values {
  display: grid;
  gap: 4px;
}

.code-block-wrap {
  border: 1px solid #d7dfec;
  border-radius: 8px;
  overflow: hidden;
  background: #101828;
}

.code-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #1d2939;
  color: #ffffff;
}

.code-toolbar button {
  border-color: rgba(255, 255, 255, .22);
  background: rgba(255, 255, 255, .08);
  color: #ffffff;
}

.code-block {
  margin: 0;
  padding: 14px;
  overflow: auto;
  color: #f8fafc;
  font-size: 13px;
  line-height: 1.55;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  background: #111827;
  color: #ffffff;
  border-radius: 8px;
  padding: 10px 13px;
  font-weight: 800;
  z-index: 60;
  transition: opacity .18s ease, transform .18s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .filter-rail {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .chip-grid {
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  }

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

  .toolbar-actions {
    justify-content: space-between;
  }
}

@media (max-width: 640px) {
  .pricing-main,
  .filter-rail,
  .drawer-header,
  .drawer-body {
    padding-left: 14px;
    padding-right: 14px;
  }

  .pricing-main {
    padding-top: 14px;
  }

  .summary-band {
    display: grid;
    padding: 18px;
  }

  .summary-band h1 {
    font-size: 24px;
  }

  .summary-metrics {
    justify-content: flex-start;
  }

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

  .toolbar-actions,
  .copy-row,
  .endpoint-line {
    display: grid;
    grid-template-columns: 1fr;
  }

  .segmented-control {
    width: 100%;
  }

  .drawer-title-row {
    display: grid;
  }

  .drawer-actions {
    justify-content: end;
  }

  .price-table th:nth-child(2),
  .price-table td:nth-child(2) {
    display: none;
  }
}
