*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #242733;
  --border: #2e3140;
  --text: #e4e4e7;
  --text-muted: #8b8d98;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #eab308;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

header h1 span { color: var(--accent); }

.meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.info-banner {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 20px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.82rem;
}

.info-banner strong { color: var(--text); }

.info-banner a {
  color: var(--accent);
  text-decoration: none;
}

.info-banner a:hover { text-decoration: underline; }

.info-banner code {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 0.78rem;
  color: var(--text);
}

.controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

input, select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.15s;
}

input:focus, select:focus {
  border-color: var(--accent);
}

input::placeholder { color: var(--text-muted); }

.search-input { flex: 1; min-width: 200px; }

select { min-width: 140px; cursor: pointer; }

.pill-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.pill {
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 0.75rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}

.pill:hover { border-color: var(--accent); color: var(--text); }
.pill.active { background: var(--accent); border-color: var(--accent); color: white; }

.stats {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.stats strong { color: var(--text); }

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  white-space: nowrap;
}

th, td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--surface2);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  user-select: none;
  position: sticky;
  top: 0;
  z-index: 1;
}

th:hover { color: var(--text); }
th .sort-arrow { margin-left: 4px; opacity: 0.5; }
th.sorted .sort-arrow { opacity: 1; color: var(--accent); }

tr:hover td { background: var(--surface2); }
tr:last-child td { border-bottom: none; }

td.model-name {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.cost { font-variant-numeric: tabular-nums; }

.cost-input { color: var(--green); }
.cost-output { color: var(--yellow); }

.badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--surface2);
  color: var(--text-muted);
  margin-right: 2px;
}

.badge.vision { background: #1e3a5f; color: #60a5fa; }
.badge.tools { background: #1a3330; color: #34d399; }
.badge.reasoning { background: #3b1f4a; color: #c084fc; }
.badge.caching { background: #3d2f0d; color: #fbbf24; }

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.pagination button {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.82rem;
  transition: all 0.15s;
}

.pagination button:hover:not(:disabled) {
  border-color: var(--accent);
}

.pagination button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.api-link {
  display: inline-block;
  margin-top: 20px;
  padding: 8px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.82rem;
  transition: border-color 0.15s;
}

.api-link:hover { border-color: var(--accent); }

.loading {
  text-align: center;
  padding: 60px;
  color: var(--text-muted);
}

.footer {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.footer a { color: var(--accent); text-decoration: none; }
.footer a:hover { text-decoration: underline; }

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 100;
  justify-content: center;
  align-items: start;
  padding: 40px 20px;
  overflow-y: auto;
}

.overlay.open { display: flex; }

.detail-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 720px;
  width: 100%;
  padding: 28px;
  position: relative;
  animation: slideUp 0.15s ease-out;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.detail-panel .close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.detail-panel .close-btn:hover { color: var(--text); border-color: var(--accent); }

.detail-panel h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 4px;
  padding-right: 40px;
  word-break: break-all;
}

.detail-panel .subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.detail-section {
  margin-bottom: 20px;
}

.detail-section h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 600;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.detail-item {
  background: var(--surface2);
  border-radius: 8px;
  padding: 10px 12px;
}

.detail-item .label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 2px;
}

.detail-item .value {
  font-size: 0.85rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.detail-item .value.green { color: var(--green); }
.detail-item .value.yellow { color: var(--yellow); }

.detail-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.detail-badges .badge { font-size: 0.75rem; padding: 4px 10px; }

.detail-raw {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  font-size: 0.75rem;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  overflow-x: auto;
  max-height: 300px;
  overflow-y: auto;
  white-space: pre;
  color: var(--text-muted);
  line-height: 1.6;
}

tr[data-clickable] { cursor: pointer; }
