:root {
  --ink: #102337;
  --ink-soft: #566473;
  --paper: #f4f1e9;
  --paper-deep: #e9e4d8;
  --white: #fffdfa;
  --line: rgba(16, 35, 55, 0.14);
  --accent: #f05a3c;
  --accent-dark: #cb3e24;
  --teal: #087d75;
  --teal-soft: #d8efeb;
  --amber: #b66a18;
  --amber-soft: #fff0d7;
  --danger: #a33c2f;
  --shadow: 0 20px 50px rgba(24, 38, 50, 0.08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 90% 8%, rgba(240, 90, 60, 0.08), transparent 22rem),
    var(--paper);
  font-family: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.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;
}

.app-shell { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10;
  width: 248px;
  display: flex;
  flex-direction: column;
  padding: 30px 22px;
  color: #f7f3e9;
  background: var(--ink);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar::after {
  content: "";
  position: absolute;
  right: -1px;
  bottom: 0;
  width: 82px;
  height: 180px;
  opacity: 0.45;
  background: repeating-linear-gradient(135deg, transparent 0 12px, rgba(255,255,255,.07) 12px 13px);
  pointer-events: none;
}

.brand {
  display: flex;
  gap: 13px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand strong, .brand small { display: block; }
.brand strong { font-size: 17px; letter-spacing: -0.02em; }
.brand small { margin-top: 2px; color: rgba(255,255,255,.58); font-size: 11px; letter-spacing: .04em; }

.brand-mark {
  position: relative;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 50%;
}

.brand-mark i {
  position: absolute;
  left: 8px;
  height: 2px;
  border-radius: 9px;
  background: var(--accent);
  transform-origin: left center;
}
.brand-mark i:nth-child(1) { top: 12px; width: 13px; transform: rotate(10deg); }
.brand-mark i:nth-child(2) { top: 18px; width: 20px; transform: rotate(-8deg); }
.brand-mark i:nth-child(3) { top: 24px; width: 10px; transform: rotate(13deg); }

.nav-list { display: grid; gap: 7px; margin-top: 58px; }
.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 13px;
  color: rgba(255,255,255,.61);
  background: transparent;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  text-align: left;
  transition: .2s ease;
}
.nav-item:hover, .nav-item:focus-visible { color: #fff; background: rgba(255,255,255,.07); outline: none; }
.nav-item.is-active { color: #fff; background: rgba(255,255,255,.1); }
.nav-item span { width: 20px; color: var(--accent); font-size: 20px; text-align: center; }

.sidebar-note {
  position: relative;
  z-index: 1;
  margin-top: auto;
  padding: 17px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 13px;
}
.sidebar-note .eyebrow { color: #ffa18e; }
.sidebar-note strong { display: block; margin: 8px 0; font-size: 13px; }
.sidebar-note p { margin: 0; color: rgba(255,255,255,.56); font-size: 11px; line-height: 1.65; }

.main-content { min-width: 0; margin-left: 248px; padding: 0 48px 42px; }
.topbar {
  min-height: 105px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}
.topbar h1 { margin: 4px 0 0; font-size: 24px; letter-spacing: -.04em; }
.eyebrow { margin: 0; color: var(--ink-soft); font-size: 10px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.live-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  color: var(--ink-soft);
  font-size: 12px;
  background: rgba(255,255,255,.54);
  border: 1px solid var(--line);
  border-radius: 9px;
}
.status-dot { width: 7px; height: 7px; background: var(--amber); border-radius: 50%; box-shadow: 0 0 0 4px rgba(182,106,24,.12); }
.live-status.is-online .status-dot { background: var(--teal); box-shadow: 0 0 0 4px rgba(8,125,117,.12); }
.live-status.is-error .status-dot { background: var(--danger); box-shadow: 0 0 0 4px rgba(163,60,47,.12); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 41px;
  padding: 0 16px;
  border-radius: 9px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 750;
  font-size: 12px;
  transition: transform .18s ease, background .18s ease;
}
.button:hover { transform: translateY(-1px); }
.button:focus-visible { outline: 3px solid rgba(240,90,60,.25); outline-offset: 2px; }
.button:disabled { cursor: wait; opacity: .6; transform: none; }
.button-primary { color: white; background: var(--accent); box-shadow: 0 8px 20px rgba(240,90,60,.2); }
.button-primary:hover { background: var(--accent-dark); }

.hero {
  min-height: 330px;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr);
  align-items: center;
  gap: 52px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}
.hero-copy { max-width: 680px; padding: 40px 0; }
.hero-kicker { color: var(--accent); font-size: 10px; font-weight: 900; letter-spacing: .18em; }
.hero h2 { margin: 14px 0 18px; font-family: Georgia, "Songti SC", serif; font-size: clamp(42px, 5vw, 70px); line-height: .99; letter-spacing: -.055em; font-weight: 500; }
.hero h2 em { color: var(--accent); font-style: italic; }
.hero-copy > p { max-width: 580px; margin: 0; color: var(--ink-soft); font-size: 14px; line-height: 1.8; }
.updated-line { display: flex; align-items: center; gap: 12px; margin-top: 23px; color: var(--ink-soft); font-size: 11px; }
.updated-line span { padding-right: 12px; border-right: 1px solid var(--line); }
.updated-line strong { color: var(--ink); font-weight: 700; }

.hero-radar {
  position: relative;
  justify-self: end;
  width: min(28vw, 330px);
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: repeating-radial-gradient(circle, transparent 0 24%, rgba(16,35,55,.06) 24.3% 24.7%, transparent 25% 49%);
}
.hero-radar::before, .hero-radar::after { content: ""; position: absolute; background: var(--line); }
.hero-radar::before { inset: 50% 0 auto; height: 1px; }
.hero-radar::after { inset: 0 auto 0 50%; width: 1px; }
.orbit { position: absolute; border: 1px solid rgba(16,35,55,.11); border-radius: 50%; }
.orbit-one { inset: 21%; }
.orbit-two { inset: 36%; }
.radar-line { position: absolute; inset: 50% 50% auto auto; width: 43%; height: 2px; background: linear-gradient(90deg, var(--accent), transparent); transform-origin: right center; animation: sweep 7s linear infinite; }
.radar-point { position: absolute; width: 8px; height: 8px; background: var(--accent); border: 2px solid var(--paper); border-radius: 50%; box-shadow: 0 0 0 5px rgba(240,90,60,.13); }
.point-one { top: 23%; left: 58%; }
.point-two { top: 63%; left: 23%; }
.point-three { top: 72%; left: 70%; width: 6px; height: 6px; }
.radar-center { position: absolute; inset: 50% auto auto 50%; width: 28px; height: 28px; display: grid; place-items: center; background: var(--ink); border: 5px solid var(--paper); border-radius: 50%; transform: translate(-50%,-50%); z-index: 2; }
.radar-center span { width: 4px; height: 4px; background: var(--accent); border-radius: 50%; }
@keyframes sweep { to { transform: rotate(360deg); } }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; padding: 26px 0; }
.metric-card { min-height: 138px; display: flex; flex-direction: column; justify-content: space-between; padding: 20px; background: rgba(255,253,250,.72); border: 1px solid var(--line); border-radius: 13px; box-shadow: 0 10px 30px rgba(24,38,50,.025); }
.metric-card > span { color: var(--ink-soft); font-size: 11px; font-weight: 750; }
.metric-card strong { margin: 8px 0 2px; font-family: Georgia, serif; font-size: 41px; font-weight: 500; line-height: 1; }
.metric-card small { color: var(--ink-soft); font-size: 10px; }
.metric-dark { color: white; background: var(--ink); border-color: var(--ink); }
.metric-dark > span, .metric-dark small { color: rgba(255,255,255,.58); }
.metric-alert strong { color: var(--teal); }
.metric-alert.has-errors strong { color: var(--danger); }

.panel { margin-top: 8px; background: var(--white); border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--shadow); overflow: hidden; }
.panel-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding: 27px 28px 22px; border-bottom: 1px solid var(--line); }
.panel-heading h2, .source-section h2 { margin: 7px 0 5px; font-size: 25px; letter-spacing: -.04em; }
.panel-heading p:not(.eyebrow) { margin: 0; color: var(--ink-soft); font-size: 11px; }
.result-count { padding: 7px 10px; color: var(--teal); background: var(--teal-soft); border-radius: 999px; font-size: 11px; font-weight: 750; white-space: nowrap; }

.toolbar { display: grid; grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(130px, .36fr)); gap: 10px; padding: 15px 18px; background: #f9f7f2; border-bottom: 1px solid var(--line); }
.search-field, .select-field { min-width: 0; height: 43px; display: flex; align-items: center; gap: 9px; padding: 0 12px; background: var(--white); border: 1px solid var(--line); border-radius: 9px; }
.search-field:focus-within, .select-field:focus-within { border-color: rgba(8,125,117,.55); box-shadow: 0 0 0 3px rgba(8,125,117,.09); }
.search-field > span { color: var(--ink-soft); font-size: 20px; }
.search-field input, .select-field select { width: 100%; color: var(--ink); background: transparent; border: 0; outline: 0; font-size: 12px; }
.select-field span { color: var(--ink-soft); font-size: 9px; font-weight: 800; white-space: nowrap; }
.select-field select { cursor: pointer; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 1240px; }
th { padding: 13px 18px; color: var(--ink-soft); font-size: 9px; letter-spacing: .08em; text-align: left; text-transform: uppercase; background: #fcfbf8; border-bottom: 1px solid var(--line); }
th small { display: block; margin-top: 3px; font-size: 8px; font-weight: 500; letter-spacing: 0; text-transform: none; }
td { padding: 17px 18px; border-bottom: 1px solid rgba(16,35,55,.08); vertical-align: middle; }
tbody tr { transition: background .18s ease; }
tbody tr:hover { background: #faf8f3; }
tbody tr:last-child td { border-bottom: 0; }
.model-cell { display: grid; grid-template-columns: 36px minmax(0,1fr); gap: 11px; align-items: center; min-width: 260px; }
.channel-avatar { width: 36px; height: 36px; display: grid; place-items: center; color: white; background: var(--ink); border-radius: 9px; font-family: Georgia, serif; font-size: 16px; }
.model-cell strong, .model-cell small { display: block; }
.model-cell strong { font-size: 12px; }
.model-cell small { max-width: 270px; margin-top: 4px; color: var(--ink-soft); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.price-pair { white-space: nowrap; }
.price-pair strong { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.price-pair small { display: block; margin-top: 4px; color: var(--ink-soft); font-size: 9px; }
.saving { display: inline-flex; align-items: center; gap: 5px; color: var(--teal); font-weight: 850; font-size: 13px; }
.saving::before { content: "↓"; font-size: 11px; }
.status-chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 9px; border-radius: 999px; font-size: 9px; font-weight: 800; white-space: nowrap; }
.status-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.status-chip.is-eligible { color: var(--teal); background: var(--teal-soft); }
.status-chip.is-eligible::before { background: var(--teal); }
.status-chip.is-review { color: var(--amber); background: var(--amber-soft); }
.status-chip.is-review::before { background: var(--amber); }
.row-action { width: 34px; height: 34px; color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.row-action:hover, .row-action:focus-visible { color: white; background: var(--ink); outline: none; }
.empty-state { padding: 64px 20px; text-align: center; }
.empty-state > span { display: block; color: var(--accent); font-size: 42px; }
.empty-state strong { display: block; margin: 9px 0; }
.empty-state p { margin: 0; color: var(--ink-soft); font-size: 12px; }

.view-tabs {
  display: flex;
  gap: 7px;
  padding: 13px 18px 0;
  overflow-x: auto;
  background: #f9f7f2;
}
.view-tab {
  flex: 0 0 auto;
  padding: 9px 13px;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 800;
}
.view-tab:hover, .view-tab:focus-visible { color: var(--ink); outline: none; border-color: var(--line); }
.view-tab.is-active { color: white; background: var(--ink); }

.inline-detail {
  display: block;
  margin: 7px 0 0;
  padding: 0;
  color: var(--teal);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 9px;
  font-weight: 800;
}
.inline-detail:hover { text-decoration: underline; }
.cached-price { color: var(--teal) !important; }
.effective-price { white-space: nowrap; }
.effective-price strong, .effective-price small { display: block; }
.effective-price strong { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 15px; }
.effective-price small { margin-top: 4px; color: var(--ink-soft); font-size: 9px; }

.comparison-cell, .safety-cell, .purchase-actions { display: grid; justify-items: start; gap: 7px; }
.comparison-cell small { max-width: 210px; color: var(--ink-soft); font-size: 8px; line-height: 1.45; }
.comparison-chip, .safety-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 8px;
  border-radius: 999px;
  font-size: 8px;
  font-weight: 850;
  white-space: nowrap;
}
.comparison-chip.is-cheaper { color: var(--teal); background: var(--teal-soft); }
.comparison-chip.is-higher, .safety-chip.is-prohibited { color: var(--danger); background: #f7dfda; }
.comparison-chip.is-same, .comparison-chip.is-unmatched, .safety-chip.is-unverified { color: var(--ink-soft); background: #ece9e2; }
.safety-chip.is-verified, .safety-chip.is-resale-ok { color: var(--teal); background: var(--teal-soft); }
.safety-chip.is-contract { color: var(--amber); background: var(--amber-soft); }

.purchase-link, .model-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 11px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 9px;
  font-weight: 850;
  white-space: nowrap;
}
.purchase-link { color: white; background: var(--accent); box-shadow: 0 7px 16px rgba(240,90,60,.16); }
.purchase-link:hover { background: var(--accent-dark); }
.model-link { color: var(--ink); border: 1px solid var(--line); }
.model-link:hover { color: white; background: var(--ink); }

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 18px;
  color: var(--ink-soft);
  background: #f9f7f2;
  border-top: 1px solid var(--line);
  font-size: 10px;
}
.pagination label { display: flex; align-items: center; gap: 7px; }
.pagination select, .pagination button { color: var(--ink); background: var(--white); border: 1px solid var(--line); border-radius: 7px; }
.pagination select { padding: 6px; }
.pagination div { display: flex; gap: 7px; }
.pagination button { padding: 8px 11px; cursor: pointer; font-size: 9px; font-weight: 800; }
.pagination button:hover:not(:disabled) { color: white; background: var(--ink); }
.pagination button:disabled { cursor: default; opacity: .4; }

.detail-safety { margin-top: 16px; padding: 15px; background: #f8f6f1; border-left: 3px solid var(--teal); border-radius: 8px; }
.detail-safety strong { color: var(--teal); font-size: 12px; }
.detail-safety p { margin: 7px 0 0; color: var(--ink-soft); font-size: 10px; line-height: 1.7; }
.detail-safety .billing-note { color: var(--ink); }
.detail-links a.is-primary { color: white; background: var(--accent); border-color: var(--accent); }
.detail-links a.is-primary:hover { background: var(--accent-dark); }

.source-section { display: grid; grid-template-columns: .55fr 1.45fr; gap: 42px; padding: 66px 0 48px; }
.source-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.source-grid article { min-height: 195px; padding: 20px; background: transparent; border: 1px solid var(--line); border-radius: 12px; }
.source-number { color: var(--accent); font-family: Georgia, serif; font-size: 13px; }
.source-grid h3 { margin: 33px 0 10px; font-size: 13px; }
.source-grid p { margin: 0; color: var(--ink-soft); font-size: 11px; line-height: 1.7; overflow-wrap: anywhere; }
.source-grid small { display: block; margin-top: 11px; color: var(--ink-soft); font-family: ui-monospace, monospace; font-size: 8px; overflow-wrap: anywhere; }
footer { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding-top: 25px; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 9px; }
footer span { color: var(--ink); font-weight: 800; }
footer p { margin: 0; }

dialog { width: min(620px, calc(100% - 28px)); padding: 0; color: var(--ink); background: transparent; border: 0; }
dialog::backdrop { background: rgba(8,22,36,.65); backdrop-filter: blur(5px); }
.dialog-card { position: relative; padding: 30px; background: var(--white); border-radius: 16px; box-shadow: 0 30px 80px rgba(0,0,0,.25); }
.dialog-card h2 { margin: 7px 0 24px; font-size: 26px; letter-spacing: -.04em; }
.dialog-close { position: absolute; top: 16px; right: 16px; width: 34px; height: 34px; color: var(--ink-soft); background: transparent; border: 1px solid var(--line); border-radius: 50%; cursor: pointer; font-size: 20px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.detail-item { padding: 13px; background: #f8f6f1; border-radius: 9px; }
.detail-item span, .detail-item strong { display: block; }
.detail-item span { color: var(--ink-soft); font-size: 9px; }
.detail-item strong { margin-top: 6px; font-size: 12px; overflow-wrap: anywhere; }
.detail-warning { margin: 16px 0 0; padding: 14px; color: #784712; background: var(--amber-soft); border-left: 3px solid var(--amber); font-size: 11px; line-height: 1.7; }
.detail-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.detail-links a { padding: 9px 12px; color: var(--ink); text-decoration: none; border: 1px solid var(--line); border-radius: 8px; font-size: 10px; font-weight: 750; }
.detail-links a:hover { color: white; background: var(--ink); }

.toast { position: fixed; z-index: 30; right: 24px; bottom: 24px; max-width: 360px; padding: 13px 16px; color: white; background: var(--ink); border-radius: 10px; box-shadow: 0 15px 40px rgba(0,0,0,.2); font-size: 11px; opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }

@media (max-width: 1100px) {
  .main-content { padding-inline: 28px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .source-section { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .sidebar { position: static; width: auto; height: auto; padding: 18px 18px 12px; }
  .sidebar::after, .sidebar-note { display: none; }
  .nav-list { display: flex; margin-top: 15px; overflow-x: auto; }
  .nav-item { width: auto; flex: 0 0 auto; padding: 8px 10px; font-size: 11px; }
  .nav-item span { width: 15px; font-size: 15px; }
  .main-content { margin-left: 0; padding: 0 16px 30px; }
  .topbar { min-height: 88px; }
  .topbar h1 { font-size: 20px; }
  .live-status { display: none; }
  .button { padding-inline: 12px; }
  .hero { min-height: 0; grid-template-columns: 1fr; }
  .hero-copy { padding: 42px 0 36px; }
  .hero h2 { font-size: clamp(41px, 13vw, 58px); }
  .hero-radar { display: none; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 9px; padding: 17px 0; }
  .metric-card { min-height: 124px; padding: 16px; }
  .metric-card strong { font-size: 34px; }
  .panel-heading { align-items: flex-start; padding: 22px 18px; }
  .toolbar { grid-template-columns: 1fr; padding: 12px; }
  .view-tabs { padding-inline: 12px; }
  .pagination { align-items: stretch; flex-direction: column; }
  .pagination div { display: grid; grid-template-columns: 1fr 1fr; }
  .source-section { padding-top: 45px; }
  .source-grid { grid-template-columns: 1fr; }
  .source-grid article { min-height: 150px; }
  .source-grid h3 { margin-top: 20px; }
  footer { align-items: flex-start; flex-direction: column; }
  .detail-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
