:root {
  --ink: #202431;
  --muted: #727887;
  --line: #e1e3e8;
  --blue: #3b55b9;
  --orange: #f1a03b;
  --warm: #fbfaf4;
  --cool: #f3f6fa;
  --surface: #fff;
  --page-bg: #f1f2f4;
  --shadow: 0 2px 10px rgba(25, 29, 40, 0.06);
}

* { box-sizing: border-box; }
html { background: var(--page-bg); }
body {
  margin: 0;
  color: var(--ink);
  background: var(--page-bg);
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-variant-numeric: tabular-nums lining-nums;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { cursor: pointer; }

.page-shell { min-height: 100vh; }
.topbar {
  padding: 0 clamp(18px, 3vw, 46px);
  color: #fff;
  background: #0f1118;
  border-bottom: 1px solid #222631;
}
.brand-block { display: flex; align-items: center; justify-content: space-between; gap: 22px; min-height: 72px; max-width: 1600px; margin: 0 auto; }
.brand-identity { display: flex; align-items: center; gap: 15px; min-width: 0; }
.brand-mark {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 7px;
  background: linear-gradient(145deg, #4965cf 0%, #2f48a7 72%, #263c94 100%);
  border: 1px solid #6178d2; box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 4px 12px rgba(18,35,103,.26);
}
.brand-mark svg { width: 35px; height: 35px; overflow: visible; }
.brand-mark .logo-orbit { fill: none; stroke: rgba(255,255,255,.46); stroke-width: 1.4; stroke-linecap: round; }
.brand-mark .logo-core { fill: none; stroke: #fff; stroke-width: 3.3; stroke-linecap: round; stroke-linejoin: round; }
.brand-mark circle { fill: #f6ad42; stroke: #fff; stroke-width: 1.2; }
h1 { margin: 0; font-size: clamp(22px, 2.4vw, 28px); letter-spacing: .02em; white-space: nowrap; }
.brand-copy { width: auto; min-width: clamp(135px, 14.7vw, 171px); }
.subtitle {
  width: 100%; margin: 3px 0 0; color: #c9ceda; font-size: 16px; letter-spacing: 0;
  white-space: nowrap; text-align: justify; text-align-last: justify;
}
.header-action {
  flex: 0 0 auto; padding: 10px 16px; color: #f5f6fa; background: #252933; border: 1px solid #3a3f4b;
  border-radius: 5px; font-size: 12px; font-weight: 700; text-decoration: none; transition: .18s ease;
}
.header-action:hover { color: #fff; background: #323744; border-color: #596178; }
.filter-row-action { margin-left: auto; color: #fff; background: var(--blue); border-color: var(--blue); }
.filter-row-action:hover { background: #3049a8; border-color: #3049a8; }

main { max-width: 1600px; margin: 0 auto; }
.filter-panel {
  margin: 0;
  padding: 9px clamp(18px, 3vw, 38px);
  background: var(--surface);
  border: 0;
  border-bottom: 1px solid #dfe1e6;
  border-radius: 0;
  box-shadow: 0 2px 8px rgba(25, 29, 40, .06);
}
.filter-row { display: flex; align-items: center; min-height: 43px; gap: 14px; border-bottom: 1px solid #eff0f3; }
.filter-row:last-child { border-bottom: 0; }
.filter-label { flex: 0 0 74px; color: #383d4a; font-size: 12px; font-weight: 700; }
.segmented-control { display: flex; align-items: center; gap: 0; flex-wrap: wrap; padding: 3px; background: #f1f2f4; border-radius: 6px; }
.segment-button {
  min-width: 72px; padding: 7px 14px; color: #666c79; background: transparent;
  border: 0; border-radius: 4px; font-size: 12px; transition: .18s ease;
}
.segment-button:hover { color: var(--blue); background: rgba(255,255,255,.58); }
.segment-button.is-active { color: var(--blue); background: #fff; box-shadow: 0 2px 7px rgba(40,46,64,.12); font-weight: 700; }
.custom-date-fields { display: flex; align-items: center; gap: 7px; margin-left: 0; }
.custom-date-fields input {
  width: 138px; padding: 7px 8px; color: #4f5665; background: #fff; border: 1px solid #d8dae0; border-radius: 5px; font-size: 11px; text-align: center;
}
.custom-date-fields input::-webkit-datetime-edit { text-align: center; }
.custom-date-fields input:disabled { color: #9ba0aa; background: #f3f4f6; }
.date-separator { color: #8b98a9; font-size: 11px; }
.ai-query-form { display: flex; flex: 1; gap: 9px; }
.ai-query-form input {
  flex: 1; min-width: 200px; padding: 9px 12px; color: #343946; background: #f6f7f8;
  border: 1px solid #d9dbe1; border-radius: 5px; outline: none; font-size: 12px;
}
.ai-query-form input::placeholder { color: #9297a1; font-size: 12px; }
.ai-query-form input:focus { border-color: #7184cf; box-shadow: 0 0 0 3px rgba(59,85,185,.1); }
.ai-query-button {
  padding: 8px 16px; color: #fff; background: var(--blue); border: 0; border-radius: 5px; font-size: 12px; font-weight: 700;
}

.context-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  margin: 0; padding: 10px clamp(18px, 3vw, 38px); color: var(--muted); background: #f7f7f8; border-bottom: 1px solid #e4e5e9; font-size: 11px;
}
.context-copy { display: flex; align-items: center; gap: 8px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #39ae75; box-shadow: 0 0 0 4px rgba(57,174,117,.12); }
.data-date { font-weight: 700; }

.dashboard-sections { display: grid; gap: 0; background: var(--page-bg); }
.chart-section { padding: 20px clamp(14px, 3vw, 38px); }
.chart-section-warm { background: var(--warm); }
.chart-section-cool { background: var(--cool); }
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.chart-card {
  min-width: 0; overflow: hidden; background: var(--surface); border: 1px solid #e0e2e7;
  border-radius: 6px; box-shadow: var(--shadow);
}
.chart-header {
  position: relative; display: flex; align-items: center; justify-content: center; min-height: 56px;
  padding: 13px 52px 10px; border-bottom: 1px solid #eceef1;
}
.chart-header::before { content: ""; position: absolute; left: 0; top: 15px; bottom: 15px; width: 3px; background: var(--blue); border-radius: 0 2px 2px 0; }
.chart-header h2 { margin: 0; color: #282d39; font-size: 15px; font-weight: 700; text-align: center; line-height: 1.45; }
.download-button {
  position: absolute; right: 16px; top: 15px; display: grid; place-items: center; width: 26px; height: 26px;
  padding: 0; background: #fff; border: 1px solid #dcdfe5; border-radius: 4px;
}
.download-button:hover { background: #f2f4fb; border-color: #aab4d8; }
.download-glyph { position: relative; width: 10px; height: 11px; border-bottom: 1.5px solid #4f5e92; }
.download-glyph::before { content: ""; position: absolute; left: 50%; top: 0; width: 1.5px; height: 6px; background: #4f5e92; transform: translateX(-50%); }
.download-glyph::after { content: ""; position: absolute; left: 50%; top: 3px; width: 4px; height: 4px; border-right: 1.5px solid #4f5e92; border-bottom: 1.5px solid #4f5e92; transform: translateX(-50%) rotate(45deg); transform-origin: center; }
.chart { width: 100%; height: 410px; }

.ai-result-section { margin: 18px clamp(14px, 3vw, 38px); }
.ai-result-card { border-color: #cbd2ea; }
.ai-result-chart { height: 440px; }
.ai-interpretation { min-height: 31px; padding: 8px 18px 0; color: #6a7c92; font-size: 11px; text-align: center; }
.region-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 320px;
  margin: 22px clamp(14px, 3vw, 38px); color: #7a808c; background: #fff; border: 1px dashed #c7cad1; border-radius: 6px;
}
.region-placeholder strong { margin-bottom: 8px; color: #3d5570; font-size: 22px; }

.loading-overlay {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: rgba(241,242,244,.76); backdrop-filter: blur(2px);
}
.loading-overlay[hidden] { display: none; }
.loading-panel { display: flex; align-items: center; gap: 11px; padding: 15px 20px; color: #404653; background: #fff; border: 1px solid #e0e2e7; border-radius: 6px; box-shadow: 0 8px 28px rgba(25,29,40,.13); font-size: 12px; }
.spinner { width: 18px; height: 18px; border: 2px solid #d7e4f2; border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast {
  position: fixed; left: 50%; bottom: 30px; z-index: 120; padding: 9px 15px; color: #fff; background: rgba(28,47,70,.94);
  border-radius: 5px; font-size: 11px; opacity: 0; pointer-events: none; transform: translate(-50%, 10px); transition: .2s ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  .chart-grid { grid-template-columns: 1fr; }
  .filter-row { align-items: flex-start; flex-wrap: wrap; padding: 9px 0; }
  .filter-label { padding-top: 7px; }
  .ai-query-form { min-width: calc(100% - 84px); }
  .chart { height: 390px; }
}

@media (max-width: 560px) {
  .topbar { padding: 18px 15px; }
  .brand-mark { width: 43px; height: 43px; }
  .subtitle { font-size: 14px; }
  .brand-block { align-items: flex-start; flex-direction: column; }
  .header-action { align-self: stretch; text-align: center; }
  .filter-panel { margin: 13px 10px 8px; padding: 12px; }
  .filter-label { flex-basis: 100%; }
  .ai-query-form { min-width: 100%; flex-direction: column; }
  .custom-date-fields { width: 100%; }
  .filter-row-action { width: 100%; margin-left: 0; text-align: center; }
  .custom-date-fields input { width: 100%; }
  .context-bar { margin: 0 11px 8px; align-items: flex-start; flex-direction: column; gap: 5px; }
  .chart-section { padding: 17px 10px; }
  .chart-header { padding-inline: 40px; }
  .chart-header h2 { font-size: 14px; }
  .chart { height: 360px; }
}
