:root {
  color-scheme: light;
  --ink: #18202a;
  --muted: #667085;
  --line: #d8dee8;
  --panel: #ffffff;
  --bg: #f4f7f9;
  --agoda: #d94864;
  --meituan: #1f9d7a;
  --accent: #2d5f9a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

.app {
  width: min(1440px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 0 22px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1.15;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
}

.topbar p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

.live-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #3c6250;
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}

.live-status i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2f8a5f;
  box-shadow: 0 0 0 4px rgb(47 138 95 / 12%);
}

.hotel-tabs {
  display: flex;
  gap: 28px;
  margin: 0 0 16px;
  border-bottom: 1px solid #cad4cd;
  overflow-x: auto;
  scrollbar-width: thin;
}

.hotel-tabs button {
  appearance: none;
  position: relative;
  flex: 0 0 auto;
  min-width: 220px;
  padding: 12px 2px 13px;
  border: 0;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.hotel-tabs button::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 3px;
  background: transparent;
}

.hotel-tabs button small {
  display: block;
  margin-top: 4px;
  color: #7b8794;
  font-size: 11px;
  font-weight: 500;
}

.hotel-tabs button.active {
  color: var(--ink);
}

.hotel-tabs button.active::after {
  background: #2f6b4f;
}

.hotel-tabs button:focus-visible {
  outline: 2px solid #2f6b4f;
  outline-offset: 3px;
}

.summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.metric,
.period,
.chart-panel,
.table-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric,
.period {
  padding: 14px;
  min-height: 94px;
}

.label {
  color: var(--muted);
  font-size: 12px;
}

.value {
  margin-top: 8px;
  font-size: 24px;
  font-weight: 750;
}

.sub {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.chart-panel,
.table-panel {
  padding: 16px;
  margin-bottom: 14px;
}

.chart-panel {
  border-color: #ced9d2;
  box-shadow: 0 8px 24px rgb(47 107 79 / 7%);
}

.chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.chart-key {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 14px;
  color: var(--muted);
  font-size: 12px;
  flex-wrap: wrap;
}

.key-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.key-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: var(--key-color);
}

.key-line {
  display: inline-block;
  width: 28px;
  height: 3px;
  flex: 0 0 28px;
  border-radius: 2px;
  background: #40564b;
}

.key-line.dashed {
  height: 2px;
  background: repeating-linear-gradient(90deg, #40564b 0 8px, transparent 8px 13px);
}

.key-line.dotted {
  height: 2px;
  background: repeating-linear-gradient(90deg, #40564b 0 2px, transparent 2px 7px);
}

.key-low {
  width: 11px;
  height: 11px;
  flex: 0 0 11px;
  border: 3px solid #40564b;
  border-radius: 50%;
  background: #ffffff;
}

.chart-body {
  position: relative;
  width: 100%;
  height: 420px;
}

#priceChart {
  display: block;
}

.period {
  grid-column: span 1;
  border-top: 4px solid var(--period-color);
  box-shadow: 0 5px 14px rgb(24 32 42 / 5%);
}

.period h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 15px;
}

.period-swatch {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-radius: 50%;
  background: var(--period-color);
}

.price-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  border-top: 1px solid #edf0f4;
  font-size: 14px;
}

.period .price-line strong {
  color: var(--period-color);
}

.weekly-low {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 3px 10px;
  margin: 2px 0 10px;
  padding: 10px 11px;
  border-left: 3px solid var(--period-color);
  background: color-mix(in srgb, var(--period-color) 8%, white);
}

.weekly-low span {
  color: #526157;
  font-size: 12px;
  font-weight: 650;
}

.weekly-low strong {
  color: var(--period-color);
  font-size: 18px;
}

.weekly-low time {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
}

.price-entry + .price-entry {
  margin-top: 14px;
  padding-top: 4px;
  border-top: 1px solid #dfe5ed;
}

.status-ok {
  color: #167255;
}

.status-bad {
  color: #a23b45;
}

.evidence-link {
  color: var(--accent);
  font-weight: 650;
}

.evidence-thumb {
  display: block;
  margin-top: 10px;
  border: 1px solid #edf0f4;
  border-radius: 6px;
  overflow: hidden;
  max-height: 340px;
  background: #f9fbfd;
}

.evidence-thumb img {
  display: block;
  width: 100%;
  height: 340px;
  object-fit: contain;
  object-position: center;
}

.table-wrap {
  overflow: auto;
  max-height: 360px;
  margin-top: 12px;
  border: 1px solid #e5e9f0;
  border-radius: 6px;
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid #edf0f4;
}

th {
  position: sticky;
  top: 0;
  background: #f9fbfd;
  color: #536071;
  font-weight: 650;
}

@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .summary,
  .grid {
    grid-template-columns: 1fr;
  }

  .hotel-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    overflow: visible;
  }

  .hotel-tabs button {
    min-width: 0;
    font-size: 13px;
  }

  .hotel-tabs button small {
    line-height: 1.3;
    white-space: normal;
  }

  .chart-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .chart-key {
    justify-content: flex-start;
  }

  .chart-body {
    height: 360px;
  }
}
