.models-page { min-height: calc(100vh - 180px); padding: 58px 0 80px; }
.models-heading { max-width: 720px; margin-bottom: 30px; }
.models-heading h1 { margin: 8px 0 12px; font-size: clamp(32px, 5vw, 48px); letter-spacing: -.045em; }
.models-heading p { max-width: 620px; color: var(--muted); }
.model-browser {
  overflow: hidden; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.model-toolbar {
  display: flex; align-items: end; gap: 12px; flex-wrap: wrap;
  padding: 16px; border-bottom: 1px solid var(--border);
}
.model-search {
  display: flex; align-items: center; gap: 10px; flex: 1 1 260px;
  min-width: min(100%, 220px); min-height: 42px; padding: 0 12px;
  color: var(--muted); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.model-search:focus-within { border-color: var(--accent); }
.model-search input {
  width: 100%; min-width: 0; padding: 9px 0;
  color: var(--heading); background: transparent; border: 0; outline: 0;
  font: inherit; font-size: 13px;
}
.model-search input::placeholder { color: var(--muted); }
.model-control { display: grid; gap: 5px; color: var(--muted); font-size: 10px; font-weight: 700; }
.model-control select {
  min-height: 42px; max-width: 190px; padding: 8px 28px 8px 10px;
  color: var(--heading); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font: inherit; font-size: 12px;
}
.model-view-toggle { display: flex; align-items: center; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.model-view-toggle button {
  min-height: 34px; padding: 6px 11px; color: var(--muted); background: transparent;
  border: 0; border-radius: 6px; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
}
.model-view-toggle button[aria-pressed="true"] { color: var(--heading); background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.18); }
.model-results-bar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px 0; }
.model-results-bar p { margin: 0; color: var(--muted); font-size: 12px; }
.model-catalog-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px; padding: 16px;
}
.model-catalog-grid[hidden], .model-table-wrap[hidden], .catalog-loading[hidden], .catalog-error[hidden] { display: none !important; }
.model-card {
  display: flex; flex-direction: column; min-width: 0; min-height: 245px; padding: 17px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.model-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.provider-identity, .provider-table-cell { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.provider-logo { display: block; flex: 0 0 auto; width: 24px; height: 24px; padding: 2px; object-fit: contain; background: #fff; border: 1px solid var(--border); border-radius: 6px; }
.provider-logo[src$="/tencent.svg"] { filter: grayscale(1) contrast(2.5); }
.provider-table-cell .provider-logo { width: 20px; height: 20px; }
.provider-logo-fallback { display: inline-grid; flex: 0 0 auto; width: 24px; height: 24px; place-items: center; color: var(--accent); background: var(--badge-bg); border: 1px solid var(--border); border-radius: 6px; font-size: 11px; font-weight: 800; }
.provider-table-cell .provider-logo-fallback { width: 20px; height: 20px; }
.provider-pill, .context-pill { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.provider-pill {
  padding: 4px 8px; color: var(--accent); background: var(--badge-bg);
  border-radius: 4px; font-family: var(--font-mono); font-size: 10px; font-weight: 700;
}
.context-pill { color: var(--muted); font-size: 10px; }
.model-card h2 {
  margin: 14px 0 8px; overflow-wrap: anywhere;
  color: var(--heading); font-family: var(--font-mono); font-size: 14px; line-height: 1.45;
}
.model-description {
  display: -webkit-box; overflow: hidden; margin: 0 0 18px;
  color: var(--muted); font-size: 12px; line-height: 1.6;
  -webkit-box-orient: vertical; -webkit-line-clamp: 3;
}
.model-card-prices { display: grid; gap: 8px; margin: auto 0 0; padding-top: 12px; border-top: 1px solid var(--border); }
.model-card-prices > div, .model-price-item { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.model-card-prices dt { color: var(--muted); font-size: 10px; }
.model-card-prices dd { margin: 0; color: var(--body); font-family: var(--font-mono); font-size: 10px; text-align: right; white-space: nowrap; }
.model-table-wrap { overflow-x: auto; padding: 16px; }
.model-table { width: 100%; border-collapse: collapse; font-size: 12px; text-align: left; }
.model-table th, .model-table td { padding: 12px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.model-table thead th { color: var(--muted); font-family: var(--font-mono); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.model-table tbody th { color: var(--heading); font-family: var(--font-mono); font-size: 11px; font-weight: 600; }
.model-table tbody td:nth-child(n+3) { color: var(--body); font-family: var(--font-mono); font-size: 11px; text-align: right; }
.model-table tbody tr:hover { background: var(--surface-2); }
.catalog-status { color: var(--accent); }
.catalog-empty { padding: 50px 20px; color: var(--muted); text-align: center; }
.catalog-empty[hidden], .catalog-sentinel[hidden] { display: none; }
.catalog-loading, .catalog-error { display: flex; justify-content: center; align-items: center; gap: 10px; padding: 18px; color: var(--muted); font-size: 12px; }
.catalog-error { justify-content: space-between; color: var(--error); border-top: 1px solid var(--border); }
.catalog-error button { padding: 6px 10px; color: var(--heading); background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; cursor: pointer; }
.loading-spinner { width: 14px; height: 14px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: catalog-spin .75s linear infinite; }
.catalog-sentinel { height: 1px; }
.models-footer { padding: 18px 0; color: var(--muted); border-top: 1px solid var(--border); font-size: 11px; }
.models-footer .container { display: flex; justify-content: space-between; gap: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@keyframes catalog-spin { to { transform: rotate(360deg); } }
@media (max-width: 900px) { .model-catalog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) {
  .models-page { padding: 38px 0 56px; }
  .model-toolbar { align-items: stretch; }
  .model-search { flex-basis: 100%; }
  .model-control { flex: 1 1 140px; }
  .model-control select { width: 100%; max-width: none; }
  .model-view-toggle { align-self: end; }
  .model-catalog-grid { gap: 10px; padding: 12px; }
  .model-card { padding: 14px; }
}
@media (max-width: 520px) {
  .model-catalog-grid { grid-template-columns: minmax(0, 1fr); }
  .model-card { min-height: 0; }
  .models-footer .container { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { .loading-spinner { animation-duration: 2s; } }
