:root {
  --ink: #1d2924;
  --muted: #68736d;
  --faint: #8c9690;
  --paper: #f3f5f1;
  --surface: #ffffff;
  --line: #dfe5df;
  --line-strong: #cbd4cc;
  --forest: #173f34;
  --forest-2: #0d6b4e;
  --forest-soft: #e7f2ec;
  --orange: #df7130;
  --orange-soft: #fff0e6;
  --rose: #c34d60;
  --rose-soft: #fbecef;
  --diesel: #496456;
  --diesel-soft: #edf2ee;
  --amber: #a66114;
  --amber-soft: #fff5dd;
  --shadow: 0 18px 42px rgba(27, 55, 43, 0.09);
  --radius: 8px;
  --max: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(223, 113, 48, 0.36);
  outline-offset: 2px;
}

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

.topbar {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 74px;
  padding: 12px max(22px, calc((100vw - var(--max)) / 2));
  background: var(--surface);
  border-bottom: 1px solid rgba(223, 229, 223, 0.75);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 7px;
  background: var(--orange);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 7px 18px rgba(223, 113, 48, 0.24);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-copy strong {
  font-size: 17px;
  font-weight: 750;
}

.brand-copy small {
  margin-top: 3px;
  color: var(--faint);
  font-size: 10px;
  font-weight: 650;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafbf9;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--forest-2);
  box-shadow: 0 0 0 3px rgba(13, 107, 78, 0.12);
}

.sync-badge.is-loading .sync-dot {
  background: var(--amber);
  box-shadow: 0 0 0 3px rgba(166, 97, 20, 0.13);
  animation: pulse 1.2s ease-in-out infinite;
}

.sync-badge.is-fallback {
  border-color: #efd9a8;
  background: var(--amber-soft);
  color: #7b4b0f;
}

.sync-badge.is-fallback .sync-dot {
  background: var(--amber);
  box-shadow: none;
}

.refresh-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  border: 1px solid var(--forest);
  border-radius: 6px;
  background: var(--forest);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  transition: background 160ms ease, transform 160ms ease;
}

.refresh-button:hover {
  background: #205345;
}

.refresh-button:active {
  transform: translateY(1px);
}

.refresh-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.refresh-button svg,
.refresh-button i {
  width: 16px;
  height: 16px;
}

.refresh-button.is-spinning svg,
.refresh-button.is-spinning i {
  animation: spin 800ms linear infinite;
}

.hero {
  position: relative;
  overflow: hidden;
  background: var(--forest);
  color: #fff;
}

.hero::after {
  position: absolute;
  top: 0;
  right: -140px;
  width: 560px;
  height: 100%;
  border-left: 1px solid rgba(255, 255, 255, 0.07);
  background-image: repeating-linear-gradient(
    118deg,
    transparent 0,
    transparent 34px,
    rgba(255, 255, 255, 0.045) 35px,
    rgba(255, 255, 255, 0.045) 36px
  );
  content: "";
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
  display: grid;
  max-width: var(--max);
  min-height: 224px;
  margin: 0 auto;
  padding: 40px 22px 78px;
  grid-template-columns: minmax(0, 1fr) 330px;
  align-items: end;
  gap: 54px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 7px;
  color: var(--orange);
  font-size: 11px;
  font-weight: 780;
  text-transform: uppercase;
}

.hero .eyebrow {
  color: #f5a06f;
}

.hero h1 {
  max-width: 620px;
  margin: 0;
  color: #fff;
  font-size: 64px;
  font-weight: 780;
  line-height: 0.98;
}

.hero-note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.66);
  font-size: 13px;
  font-weight: 550;
}

.dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.34);
}

.region-picker {
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(6px);
}

.region-picker > label {
  display: block;
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 11px;
  font-weight: 700;
}

.select-wrap {
  position: relative;
  display: block;
}

.select-wrap select {
  width: 100%;
  min-height: 48px;
  padding: 10px 42px 10px 13px;
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 18px;
  font-weight: 750;
}

.select-wrap > svg,
.select-wrap > i {
  position: absolute;
  top: 50%;
  right: 13px;
  width: 17px;
  height: 17px;
  color: var(--forest);
  pointer-events: none;
  transform: translateY(-50%);
}

.region-picker p {
  margin: 10px 0 0;
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
}

.price-band {
  position: relative;
  z-index: 2;
  max-width: var(--max);
  margin: -48px auto 0;
  padding: 0 22px;
}

.price-grid {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.price-item {
  position: relative;
  min-height: 158px;
  padding: 22px 22px 19px;
}

.price-item + .price-item {
  border-left: 1px solid var(--line);
}

.price-item::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--forest-2);
  content: "";
}

.fuel-95::before {
  background: var(--orange);
}

.fuel-98::before {
  background: var(--rose);
}

.fuel-diesel::before {
  background: var(--diesel);
}

.price-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.fuel-name {
  color: var(--muted);
  font-size: 13px;
  font-weight: 680;
}

.fuel-tag {
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--forest-soft);
  color: var(--forest-2);
  font-size: 10px;
  font-weight: 700;
}

.fuel-95 .fuel-tag {
  background: var(--orange-soft);
  color: #a34f1d;
}

.fuel-98 .fuel-tag {
  background: var(--rose-soft);
  color: #9e3548;
}

.fuel-diesel .fuel-tag {
  background: var(--diesel-soft);
  color: var(--diesel);
}

.price-value {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-top: 13px;
}

.price-value > span {
  color: var(--ink);
  font-size: 41px;
  font-variant-numeric: tabular-nums;
  font-weight: 770;
  line-height: 1;
}

.price-value small {
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
}

.price-context {
  margin-top: 12px;
  color: var(--muted);
  font-size: 11px;
}

.content-shell {
  max-width: calc(var(--max) + 44px);
  margin: 0 auto;
  padding: 24px 22px 0;
}

.market-strip {
  display: grid;
  margin-bottom: 18px;
  padding: 0 2px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric {
  min-width: 0;
  padding: 12px 24px;
}

.metric:first-child {
  padding-left: 4px;
}

.metric + .metric {
  border-left: 1px solid var(--line-strong);
}

.metric-label {
  display: block;
  color: var(--faint);
  font-size: 11px;
  font-weight: 650;
}

.metric strong {
  display: inline-block;
  max-width: 100%;
  margin-top: 5px;
  overflow: hidden;
  color: var(--ink);
  font-size: 18px;
  font-weight: 750;
  text-overflow: ellipsis;
  vertical-align: bottom;
  white-space: nowrap;
}

.metric small {
  margin-left: 6px;
  color: var(--muted);
  font-size: 11px;
}

.dashboard-grid {
  display: grid;
  align-items: start;
  gap: 18px;
  grid-template-columns: minmax(0, 1.72fr) minmax(300px, 0.72fr);
}

.price-table-panel,
.calculator-panel,
.ranking-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.price-table-panel {
  min-width: 0;
  overflow: hidden;
}

.panel-heading {
  display: flex;
  min-height: 82px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 17px 20px;
  border-bottom: 1px solid var(--line);
}

.panel-heading h2 {
  margin: 0;
  color: var(--ink);
  font-size: 20px;
  font-weight: 750;
}

.panel-heading .section-kicker {
  margin-bottom: 3px;
}

.table-search {
  position: relative;
  display: flex;
  width: min(210px, 44%);
  align-items: center;
}

.table-search svg,
.table-search i {
  position: absolute;
  left: 11px;
  width: 16px;
  height: 16px;
  color: var(--faint);
  pointer-events: none;
}

.table-search input {
  width: 100%;
  min-height: 39px;
  padding: 8px 12px 8px 35px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafbf9;
  color: var(--ink);
  font-size: 13px;
}

.table-search input::placeholder {
  color: var(--faint);
}

.table-wrap {
  max-height: 598px;
  overflow: auto;
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

thead {
  position: sticky;
  z-index: 1;
  top: 0;
}

th {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  background: #f8faf7;
  color: var(--faint);
  font-size: 10px;
  font-weight: 750;
  text-align: right;
  text-transform: uppercase;
}

th:first-child {
  padding-left: 20px;
  text-align: left;
}

th:last-child,
td:last-child {
  padding-right: 20px;
}

td {
  height: 49px;
  padding: 9px 12px;
  border-bottom: 1px solid #edf0ec;
  color: #324039;
  font-size: 13px;
  font-weight: 600;
  text-align: right;
}

td:first-child {
  padding-left: 20px;
  text-align: left;
}

tbody tr {
  transition: background 120ms ease;
}

tbody tr:hover,
tbody tr.is-selected {
  background: #f4f8f5;
}

tbody tr.is-selected td:first-child {
  box-shadow: inset 3px 0 0 var(--orange);
}

.region-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.region-button:hover {
  color: var(--forest-2);
}

.price-empty {
  color: #aab2ad;
  font-weight: 500;
}

.table-loading,
.table-empty {
  height: 180px;
  color: var(--muted);
  text-align: center !important;
}

.table-footer {
  display: flex;
  min-height: 43px;
  align-items: center;
  justify-content: space-between;
  padding: 9px 20px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 11px;
}

.side-stack {
  display: grid;
  gap: 18px;
}

.panel-heading.compact {
  min-height: 74px;
  padding: 15px 17px;
}

.panel-heading.compact h2 {
  font-size: 18px;
}

.panel-icon {
  width: 21px;
  height: 21px;
  color: var(--orange);
}

.calculator-panel form {
  padding: 17px;
}

.field-row {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-row label > span:first-child,
.fuel-select-row > span:first-child {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.input-shell {
  position: relative;
  display: block;
}

.input-shell input {
  width: 100%;
  min-height: 42px;
  padding: 8px 34px 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafbf9;
  color: var(--ink);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.input-shell em {
  position: absolute;
  top: 50%;
  right: 10px;
  color: var(--faint);
  font-size: 10px;
  font-style: normal;
  transform: translateY(-50%);
}

.fuel-select-row {
  display: block;
  margin-top: 13px;
}

.select-wrap.mini select {
  min-height: 40px;
  padding: 8px 36px 8px 10px;
  border-color: var(--line);
  background: #fafbf9;
  font-size: 13px;
  font-weight: 700;
}

.select-wrap.mini > svg,
.select-wrap.mini > i {
  width: 15px;
  height: 15px;
}

.estimate {
  margin: 0 17px 17px;
  padding: 15px 16px;
  border: 1px solid #cfe2d7;
  border-radius: 6px;
  background: var(--forest-soft);
}

.estimate > span {
  color: #436153;
  font-size: 11px;
  font-weight: 650;
}

.estimate > div {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 2px;
}

.estimate strong {
  color: var(--forest);
  font-size: 30px;
  font-variant-numeric: tabular-nums;
  font-weight: 780;
}

.estimate small {
  color: #547064;
  font-size: 11px;
}

.estimate p {
  margin: 5px 0 0;
  color: #61796d;
  font-size: 10px;
}

.ranking-list {
  margin: 0;
  padding: 8px 17px 16px;
  list-style: none;
}

.ranking-item {
  display: grid;
  align-items: center;
  gap: 9px;
  padding: 9px 0;
  grid-template-columns: 20px minmax(52px, auto) minmax(60px, 1fr) auto;
}

.ranking-index {
  color: var(--faint);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.ranking-name {
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
}

.ranking-bar {
  position: relative;
  height: 4px;
  overflow: hidden;
  border-radius: 2px;
  background: #edf0ec;
}

.ranking-bar i {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 2px;
  background: var(--forest-2);
}

.ranking-item:nth-child(2) .ranking-bar i {
  background: #3c806a;
}

.ranking-item:nth-child(3) .ranking-bar i {
  background: #64907e;
}

.ranking-item:nth-child(n + 4) .ranking-bar i {
  background: #8da69b;
}

.ranking-price {
  color: var(--ink);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
}

.source-note {
  display: grid;
  align-items: start;
  gap: 13px;
  margin: 18px 0 0;
  padding: 17px 18px;
  border: 1px solid #dedfcf;
  border-radius: var(--radius);
  background: #faf9f1;
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.source-icon {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 5px;
  background: #ece7cd;
  color: #7d6a24;
}

.source-icon svg,
.source-icon i {
  width: 15px;
  height: 15px;
}

.source-note strong {
  font-size: 12px;
}

.source-note p {
  max-width: 770px;
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
}

.source-note a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #6d5d20;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.source-note a:hover {
  text-decoration: underline;
}

.source-note a svg,
.source-note a i {
  width: 13px;
  height: 13px;
}

.site-footer {
  display: flex;
  max-width: var(--max);
  min-height: 86px;
  align-items: center;
  justify-content: space-between;
  margin: 0 auto;
  padding: 20px 22px;
  color: var(--faint);
  font-size: 10px;
}

.toast {
  position: fixed;
  z-index: 20;
  right: 20px;
  bottom: 20px;
  max-width: min(360px, calc(100vw - 40px));
  padding: 11px 14px;
  border-radius: 6px;
  background: #22332c;
  color: #fff;
  box-shadow: 0 12px 30px rgba(19, 37, 30, 0.24);
  font-size: 12px;
  font-weight: 600;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  50% {
    opacity: 0.4;
  }
}

@media (max-width: 980px) {
  .hero-inner {
    grid-template-columns: minmax(0, 1fr) 290px;
    gap: 30px;
  }

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

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

@media (max-width: 760px) {
  .topbar {
    min-height: 66px;
    padding: 10px 16px;
  }

  .brand-copy small {
    display: none;
  }

  .sync-badge {
    display: none;
  }

  .refresh-button {
    display: inline-flex;
    min-height: 34px;
    padding: 7px 10px;
    flex-shrink: 0;
  }

  .hero::after {
    right: -330px;
  }

  .hero-inner {
    min-height: 280px;
    padding: 32px 16px 74px;
    grid-template-columns: 1fr;
    align-items: start;
    gap: 25px;
  }

  .hero h1 {
    font-size: 48px;
  }

  .hero-note {
    margin-top: 13px;
  }

  .region-picker {
    padding: 14px;
  }

  .price-band {
    margin-top: -42px;
    padding: 0 12px;
  }

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

  .price-item {
    min-height: 136px;
    padding: 18px 16px;
  }

  .price-item:nth-child(3) {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .price-item:nth-child(4) {
    border-top: 1px solid var(--line);
  }

  .price-value > span {
    font-size: 35px;
  }

  .content-shell {
    padding: 19px 12px 0;
  }

  .market-strip {
    margin-bottom: 12px;
    padding: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric {
    padding: 10px 14px;
  }

  .metric:first-child {
    padding-left: 14px;
  }

  .metric:nth-child(3) {
    border-left: 0;
  }

  .metric:nth-child(n + 3) {
    border-top: 1px solid var(--line-strong);
  }

  .panel-heading {
    min-height: auto;
    align-items: flex-start;
    padding: 15px;
  }

  .panel-heading h2 {
    font-size: 18px;
  }

  .table-search {
    width: 150px;
  }

  th:first-child,
  td:first-child {
    padding-left: 15px;
  }

  th:last-child,
  td:last-child {
    padding-right: 15px;
  }

  .side-stack {
    grid-template-columns: 1fr;
  }

  .source-note {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .source-note a {
    grid-column: 2;
    justify-self: start;
  }

  .site-footer {
    min-height: 72px;
    padding: 18px 16px;
  }
}

@media (max-width: 520px) {
  .hero h1 {
    font-size: 43px;
  }

  .panel-heading {
    flex-direction: column;
    gap: 11px;
  }

  .table-search {
    width: 100%;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .source-note {
    padding: 15px;
  }

  .table-wrap {
    max-height: 500px;
  }
}

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