:root {
  color-scheme: light;
  --bg: #f3f5f7;
  --surface: #ffffff;
  --surface-subtle: #f8fafb;
  --text: #17202e;
  --muted: #667085;
  --line: #dfe4ea;
  --line-strong: #c9d1dc;
  --teal: #087f6d;
  --teal-dark: #056253;
  --blue: #2f66d0;
  --amber: #b86e12;
  --danger: #b42318;
  --shadow: 0 12px 36px rgba(26, 39, 58, 0.08);
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

.topbar {
  height: 58px;
  background: #15222d;
  color: #fff;
  border-bottom: 3px solid var(--teal);
}

.topbar-inner {
  width: min(1180px, calc(100% - 32px));
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 750;
}

.brand-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: var(--teal);
  border-radius: 6px;
  font-size: 14px;
}

.topbar-note {
  color: #b8c5d0;
  font-size: 13px;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.query-panel {
  display: grid;
  grid-template-columns: minmax(220px, 0.72fr) minmax(420px, 1.28fr);
  gap: 32px;
  align-items: end;
  padding: 26px 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--teal);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: 28px;
  line-height: 1.2;
}

h2 {
  margin-bottom: 5px;
  font-size: 20px;
  line-height: 1.3;
}

h3 {
  margin-bottom: 0;
  font-size: 16px;
}

.lede,
.muted,
small {
  color: var(--muted);
}

.lede {
  margin-bottom: 0;
  font-size: 14px;
}

.query-form {
  display: grid;
  gap: 9px;
}

label {
  color: #475467;
  font-size: 12px;
  font-weight: 700;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  gap: 8px;
}

input,
select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  outline: none;
}

input {
  padding: 0 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
}

select {
  padding: 0 34px 0 11px;
}

input:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 102, 208, 0.12);
}

button {
  height: 42px;
  border: 0;
  border-radius: 6px;
  background: var(--teal);
  color: #fff;
  font-weight: 750;
  padding: 0 16px;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

button:hover:not(:disabled) {
  background: var(--teal-dark);
}

button:focus-visible {
  outline: 3px solid rgba(47, 102, 208, 0.22);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.icon-button {
  padding: 0;
  background: var(--surface-subtle);
  border: 1px solid var(--line-strong);
  color: #475467;
  font-size: 12px;
}

.icon-button:hover:not(:disabled) {
  background: #eef2f5;
  color: var(--text);
}

.toolbar {
  display: grid;
  grid-template-columns: auto minmax(116px, 150px) 104px;
  gap: 9px;
  align-items: center;
}

.state {
  margin-top: 14px;
  padding: 13px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--blue);
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
}

.state.is-error {
  border-left-color: var(--danger);
  color: var(--danger);
}

.dashboard {
  margin-top: 18px;
}

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

.tabs {
  height: 48px;
  display: flex;
  align-items: end;
  gap: 24px;
  border-bottom: 1px solid var(--line-strong);
}

.tab {
  position: relative;
  width: auto;
  height: 47px;
  padding: 0 2px;
  background: transparent;
  border-radius: 0;
  color: var(--muted);
  font-size: 14px;
}

.tab:hover:not(:disabled) {
  background: transparent;
  color: var(--text);
}

.tab.is-active {
  color: var(--text);
}

.tab.is-active::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 3px;
  background: var(--teal);
}

.tab-panel {
  padding: 20px 0 0;
}

.key-card {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding: 18px 20px;
  background: #eaf4f1;
  border: 1px solid #bedbd4;
  border-radius: 8px;
}

.key-card p {
  margin-bottom: 0;
  font-size: 13px;
}

.status-pill {
  min-width: 54px;
  height: 27px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 9px;
  background: #fff;
  border: 1px solid #9fcfc4;
  border-radius: 999px;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 800;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.metric {
  min-height: 124px;
  display: grid;
  align-content: space-between;
  gap: 12px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric:nth-child(1) {
  border-top: 3px solid var(--teal);
}

.metric:nth-child(2) {
  border-top: 3px solid var(--blue);
}

.metric:nth-child(3) {
  border-top: 3px solid var(--amber);
}

.metric:nth-child(4) {
  border-top: 3px solid #667085;
}

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

.metric strong {
  font-size: 27px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.metric small {
  min-height: 17px;
  font-size: 12px;
}

.chart-panel {
  margin-top: 12px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.section-title {
  min-height: 30px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

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

.bars {
  display: grid;
  gap: 9px;
  margin-top: 16px;
}

.bar-row {
  min-height: 25px;
  display: grid;
  grid-template-columns: 74px minmax(120px, 1fr) 110px;
  gap: 12px;
  align-items: center;
  font-size: 12px;
}

.bar-row > span {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.bar-row strong {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.bar-track {
  width: 100%;
  height: 9px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: #e7ebf0;
  appearance: none;
}

.bar-track::-webkit-progress-bar {
  background: #e7ebf0;
  border-radius: 999px;
}

.bar-track::-webkit-progress-value {
  background: var(--blue);
  border-radius: 999px;
}

.bar-track::-moz-progress-bar {
  background: var(--blue);
  border-radius: 999px;
}

.table-wrap {
  margin-top: 12px;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

th,
td {
  height: 48px;
  padding: 10px 13px;
  border-bottom: 1px solid #e8ebef;
  text-align: left;
  vertical-align: middle;
  font-size: 12px;
}

th {
  height: 42px;
  background: var(--surface-subtle);
  color: #475467;
  font-weight: 800;
  white-space: nowrap;
}

tbody tr:hover {
  background: #f8fbfa;
}

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

.model-cell {
  max-width: 240px;
  display: block;
  overflow: hidden;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-note {
  display: block;
  margin-top: 3px;
  font-size: 10px;
}

.money-cell {
  color: var(--amber);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.pagination {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 2px;
}

.pagination-meta,
.pagination-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.pagination-meta select {
  width: 70px;
  height: 34px;
}

.page-button {
  width: 66px;
  height: 34px;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: #344054;
  font-size: 12px;
}

.page-button:hover:not(:disabled) {
  background: #eef2f5;
}

#pageInfo {
  min-width: 82px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.model-head,
.model-item {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 100px 120px 190px;
  gap: 14px;
  align-items: center;
}

.model-head {
  margin-top: 12px;
  padding: 0 14px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.model-list {
  display: grid;
  gap: 8px;
  margin-top: 7px;
}

.model-item {
  min-height: 66px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
}

.model-item:hover {
  border-color: #b8c4d2;
}

.model-name {
  font-size: 13px;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.model-item > div:not(.model-name) {
  display: grid;
  gap: 3px;
}

.model-item small {
  display: block;
  font-size: 10px;
}

.model-cost {
  color: var(--amber);
  font-size: 13px;
  font-weight: 750;
}

.model-tokens span {
  font-variant-numeric: tabular-nums;
}

.empty {
  padding: 20px;
  background: var(--surface-subtle);
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

@media (max-width: 880px) {
  .query-panel {
    grid-template-columns: 1fr;
    gap: 22px;
  }

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

  .model-head,
  .model-item {
    grid-template-columns: minmax(160px, 1fr) 88px 110px 160px;
  }
}

@media (max-width: 640px) {
  .topbar-inner,
  .app-shell {
    width: min(100% - 20px, 1180px);
  }

  .topbar-note {
    display: none;
  }

  .app-shell {
    padding-top: 16px;
  }

  .query-panel {
    padding: 20px 16px;
  }

  h1 {
    font-size: 24px;
  }

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

  .toolbar label {
    display: none;
  }

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

  .tabs {
    gap: 18px;
    overflow-x: auto;
  }

  .key-card {
    align-items: center;
  }

  .key-card .muted {
    overflow-wrap: anywhere;
  }

  .bar-row {
    grid-template-columns: 58px minmax(90px, 1fr);
  }

  .bar-row strong {
    grid-column: 2;
    text-align: left;
  }

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

  .pagination-controls {
    width: 100%;
    justify-content: space-between;
  }

  .model-head {
    display: none;
  }

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

  .model-name {
    grid-column: 1 / -1;
  }
}
