:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #101828;
  --ink-soft: #475467;
  --muted: #98a2b3;
  --line: #eaecf0;
  --line-strong: #d0d5dd;
  --brand: #2563eb;
  --brand-soft: #eff4ff;
  --official: #667085;
  --sell: #b42318;
  --sell-bg: #fef3f2;
  --ok: #027a48;
  --ok-bg: #ecfdf3;
  --warn-bg: #fffaeb;
  --warn-ink: #b54708;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.06);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap { width: min(1200px, 100% - 32px); margin: 0 auto; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 64px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo { color: var(--brand); display: inline-flex; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-size: 16px; letter-spacing: .2px; }
.brand-text small { color: var(--muted); font-size: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.meta-updated { color: var(--muted); font-size: 12px; white-space: nowrap; }

.btn {
  appearance: none; border: 1px solid var(--line-strong); background: var(--panel);
  color: var(--ink); border-radius: 9px; padding: 7px 12px; font-size: 13px; cursor: pointer;
  transition: .15s ease;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn.ghost { background: transparent; }

/* ---------- notice ---------- */
.notice {
  margin: 16px 0 0; padding: 10px 14px; border-radius: 10px; font-size: 13px;
  background: var(--warn-bg); color: var(--warn-ink); border: 1px solid #fedf89;
}

/* ---------- hero ---------- */
.hero {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px;
  padding: 28px 0 18px; flex-wrap: wrap;
}
.hero-copy h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: -.3px; }
.hero-copy p { margin: 0; color: var(--ink-soft); }
.hero-copy b { color: var(--ink); }
.hero-stats { display: flex; gap: 10px; flex-wrap: wrap; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 16px; min-width: 92px; text-align: center; box-shadow: var(--shadow);
}
.stat b { display: block; font-size: 20px; line-height: 1.2; }
.stat span { color: var(--muted); font-size: 12px; }

/* ---------- toolbar ---------- */
.toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 6px 0 18px; flex-wrap: wrap;
}
.segmented { display: inline-flex; background: #eef0f3; border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmented button {
  appearance: none; border: 0; background: transparent; color: var(--ink-soft);
  padding: 7px 14px; border-radius: 8px; cursor: pointer; font-size: 13px; white-space: nowrap;
}
.segmented button .rate { color: var(--muted); font-size: 12px; margin-left: 4px; }
.segmented button.active { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); font-weight: 600; }
.segmented button.active .rate { color: var(--brand); }
.toolbar-right { display: flex; gap: 8px; flex-wrap: wrap; }
.select-wrap select, .search-wrap input {
  appearance: none; border: 1px solid var(--line-strong); background: var(--panel);
  border-radius: 9px; padding: 8px 12px; font-size: 13px; color: var(--ink); min-width: 140px; outline: none;
}
.search-wrap input { min-width: 220px; }
.select-wrap select:focus, .search-wrap input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

/* ---------- admin ---------- */
.admin-panel {
  border: 1px solid #b2ddff; background: linear-gradient(180deg, #f5faff, #ffffff);
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 18px;
}
.admin-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.admin-row + .admin-row { margin-top: 10px; }
.admin-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.admin-hint { color: var(--ink-soft); font-size: 12px; }
.admin-hint code { background: #eef0f3; padding: 1px 5px; border-radius: 5px; font-family: var(--mono); font-size: 12px; }
.pill {
  display: inline-flex; align-items: center; gap: 5px; background: var(--panel);
  border: 1px solid var(--line-strong); border-radius: 999px; padding: 4px 12px; font-size: 12px; color: var(--ink-soft);
}
.pill b { color: var(--ink); }
.pill.link { text-decoration: none; color: var(--brand); border-color: #b2ddff; }
.pill.link:hover { background: var(--brand-soft); }

/* ---------- content ---------- */
.loading { padding: 60px 0; text-align: center; color: var(--muted); }
.empty { padding: 60px 0; text-align: center; color: var(--muted); }

.provider { margin-bottom: 26px; }
.provider-head { display: flex; align-items: center; gap: 10px; margin: 0 2px 10px; }
.provider-swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--brand); }
.provider-head h3 { margin: 0; font-size: 15px; }
.provider-head .count { color: var(--muted); font-size: 12px; }

.models { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }

.model {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; transition: .15s ease;
}
.model:hover { border-color: var(--line-strong); }
.model.disabled { opacity: .5; }
.model-head {
  display: flex; align-items: center; gap: 8px; padding: 12px 14px 10px;
  border-bottom: 1px dashed var(--line); flex-wrap: wrap;
}
.model-name {
  font-family: var(--mono); font-size: 13.5px; font-weight: 600; color: var(--ink);
  word-break: break-all; margin-right: auto;
}
.badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); border: 1px solid #d1e0ff; white-space: nowrap; }
.badge.g20 { background: #f4f3ff; color: #5925dc; border-color: #d9d6fe; }
.badge.rate { background: #ecfdf3; color: var(--ok); border-color: #abefc6; }
.badge.aliases { background: #f9fafb; color: var(--muted); border-color: var(--line-strong); font-family: var(--mono); }

.prices { display: grid; grid-template-columns: repeat(4, 1fr); }
.pcell { padding: 10px 12px; border-right: 1px solid var(--line); }
.pcell:last-child { border-right: 0; }
.plabel { color: var(--muted); font-size: 11px; margin-bottom: 6px; }
.poff { color: var(--official); font-size: 11.5px; text-decoration: line-through; text-decoration-color: #d0d5dd; }
.psell { color: var(--sell); font-weight: 700; font-size: 14px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.psell.zero { color: var(--muted); font-weight: 600; }
.psell .gtag { font-size: 10px; font-weight: 500; color: var(--brand); background: var(--brand-soft); padding: 0 5px; border-radius: 4px; margin-right: 4px; vertical-align: 1px; }
.psell .gtag.g20 { color: #5925dc; background: #f4f3ff; }
.psell + .psell { margin-top: 4px; }

.model-foot { display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-top: 1px solid var(--line); background: #fcfcfd; flex-wrap: wrap; }
.model-foot .spacer { margin-left: auto; }
.foot-tag { font-size: 11.5px; color: var(--ink-soft); }
.foot-tag b { color: var(--ok); }

/* toggle switch */
.switch { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; user-select: none; font-size: 12px; color: var(--ink-soft); }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 34px; height: 20px; border-radius: 999px; background: var(--line-strong); position: relative; transition: .15s; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .track { background: var(--ok); }
.switch input:checked + .track::after { transform: translateX(14px); }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--line); margin-top: 30px; padding: 18px 0 40px; color: var(--muted); font-size: 12px; }
.footer .wrap { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.footer .dot { color: var(--line-strong); }

@media (max-width: 720px) {
  .hero { padding-top: 20px; }
  .hero-copy h1 { font-size: 22px; }
  .search-wrap input { min-width: 0; width: 100%; }
  .toolbar-right { width: 100%; }
  .select-wrap, .search-wrap { flex: 1 1 45%; }
  .select-wrap select, .search-wrap input { width: 100%; }
  .prices { grid-template-columns: repeat(2, 1fr); }
  .pcell:nth-child(2) { border-right: 0; }
  .pcell:nth-child(1), .pcell:nth-child(2) { border-bottom: 1px solid var(--line); }
}
