:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  --bg: #f4f7f6;
  --surface: #ffffff;
  --ink: #172126;
  --muted: #66757d;
  --line: #dde7e4;
  --blue: #2563a8;
  --blue-soft: #eaf4f1;
  --teal: #176b6a;
  --green: #16825d;
  --amber: #b7791f;
  --gold: #b8860b;
  --red: #b84a3a;
  --shadow: 0 16px 40px rgba(23, 33, 38, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
}

.topbar {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 28px 32px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(28, 37, 41, 0.04);
}

.topbar-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  flex-wrap: wrap;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  font-weight: 750;
}

h2 {
  font-size: 18px;
}

.topbar p,
.panel-title span,
dt,
.metrics span,
.message {
  color: var(--muted);
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.account-area {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-left: auto;
}

.access-badge {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #cfe0ea;
  border-radius: 999px;
  background: var(--blue-soft);
  color: #24506f;
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}

.public-readonly .actions,
.public-readonly .maintenance-panel {
  display: none;
}

button,
.button {
  border: 1px solid var(--teal);
  background: var(--teal);
  color: #fff;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
}

button:disabled {
  opacity: 0.65;
  cursor: wait;
}

.secondary {
  color: var(--teal);
  background: #fff;
}

.small-button,
.range-button {
  padding: 7px 10px;
  font-size: 13px;
}

.range-button.active {
  background: var(--teal);
  color: #fff;
}

.range-button.locked {
  border-color: #d8d1c5;
  color: #8a6d2f;
  background: #fffaf0;
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 22px auto 36px;
}

.site-footer {
  width: min(1180px, calc(100% - 32px));
  margin: -8px auto 28px;
  color: var(--muted);
  font-size: 13px;
}

.visit-stats {
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
}

.visit-stats span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.visit-stats strong {
  color: var(--teal);
  font-weight: 750;
}

.brief-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 18px;
  margin-bottom: 16px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff 0%, #f0faf8 100%);
  box-shadow: var(--shadow);
}

.brief-hero h2 {
  margin-top: 6px;
  font-size: 26px;
  line-height: 1.25;
}

.brief-hero p {
  margin-top: 8px;
  color: var(--muted);
}

.eyebrow {
  color: var(--teal);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brief-action {
  min-width: 132px;
  background: var(--gold);
  border-color: var(--gold);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.source-filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
}

.source-filter[hidden] {
  display: none;
}

.segmented-control {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f7fafb;
}

.segmented-control button {
  min-width: 128px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
}

.segmented-control button.active {
  background: var(--teal);
  color: #fff;
}

.metrics article,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metrics article {
  padding: 18px;
  border-top: 3px solid #eaf4f1;
}

.metrics strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.metrics article:first-child {
  border-top-color: var(--blue);
}

.metrics article:nth-child(3) {
  border-top-color: var(--amber);
}

.metrics article:last-child {
  border-top-color: var(--green);
}

.panel {
  padding: 18px;
  margin-bottom: 16px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.panel-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
}

.panel-tools select,
.panel-tools input[type="date"] {
  width: auto;
  min-width: 136px;
  padding: 7px 10px;
  font-size: 13px;
}

.chart-range {
  justify-content: flex-end;
}

.chart-range input {
  width: auto;
  min-width: 132px;
  padding: 7px 10px;
  font-size: 13px;
}

.chart-range input[type="number"] {
  min-width: 96px;
}

.maintenance-panel {
  min-height: 250px;
}

.admin-status[hidden],
.account-auth-form[hidden],
#authForms[hidden] {
  display: none;
}

[data-admin-only] {
  display: none;
}

.is-admin [data-admin-only] {
  display: revert;
}

.is-admin th[data-admin-only],
.is-admin td[data-admin-only] {
  display: table-cell;
}

.admin-status {
  display: grid;
  gap: 16px;
}

.panel.admin-status {
  margin-top: 0;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.admin-user-tools {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.user-role-form {
  grid-template-columns: 1fr;
}

.admin-user-list {
  margin-top: 12px;
}

.user-list {
  display: grid;
  gap: 8px;
}

.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.user-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(28, 37, 41, 0.28);
  backdrop-filter: blur(3px);
}

.modal-overlay[hidden],
.account-drawer[hidden] {
  display: none;
}

.account-drawer {
  position: fixed;
  top: 8vh;
  left: 50%;
  z-index: 41;
  width: min(420px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(28, 37, 41, 0.24);
  transform: translate(-50%, 0);
}

body .account-drawer {
  position: fixed;
  top: 8vh;
  left: 50%;
  transform: translate(-50%, 0);
}

.drawer-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.drawer-title p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  margin-bottom: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f7fafb;
}

.auth-tabs button {
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
}

.auth-tabs button.active {
  background: var(--teal);
  color: #fff;
}

.upgrade-card {
  display: grid;
  gap: 5px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid #e2d5a8;
  border-radius: 8px;
  background: #fffaf0;
  color: #6f5212;
}

.upgrade-card[hidden] {
  display: none;
}

.upgrade-card span {
  color: #7f6a3d;
  font-size: 13px;
}

.account-auth-form {
  grid-template-columns: 1fr;
}

.maintenance-section[hidden] {
  display: none;
}

.section-note {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
}

.chart-panel {
  min-height: 350px;
}

#chart {
  width: 100%;
  height: 285px;
  display: block;
}

.combined-chart-panel {
  min-height: 390px;
}

.chart-heading-tools {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.chart-title-picker,
.table-title-picker {
  min-width: 190px;
}

.chart-title-picker select,
.table-title-picker select {
  min-width: 180px;
  min-height: 42px;
  border-color: rgba(62, 231, 215, 0.44);
  background:
    linear-gradient(135deg, rgba(62, 231, 215, 0.16), rgba(247, 197, 107, 0.08)),
    rgba(5, 14, 20, 0.58);
  color: #f4fbfc;
  font-size: 17px;
  font-weight: 800;
}

[data-table-view][hidden],
[data-table-tools][hidden] {
  display: none !important;
}

.combined-chart-stage {
  position: relative;
}

.combined-chart-stage svg {
  width: 100%;
  height: 300px;
  display: block;
}

.combined-chart-stage svg[hidden],
[data-chart-tools][hidden] {
  display: none !important;
}

.combined-chart-stage [hidden] {
  display: none !important;
}

.line-toggle-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  flex: 0 0 auto;
  width: fit-content;
}

.line-toggle-group label {
  display: inline-flex;
  grid-template-columns: none;
  justify-content: center;
  align-items: center;
  gap: 3px;
  flex: 0 0 auto;
  box-sizing: border-box;
  width: 60px;
  min-width: 60px;
  height: 40px;
  min-height: 40px;
  padding: 0 4px;
  border: 1px solid rgba(134, 219, 220, 0.22);
  border-radius: 999px;
  background: rgba(5, 14, 20, 0.36);
  color: #c8e7eb;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
}

.line-toggle-group label:has([data-daily-series="average"]) {
  min-width: 60px;
}

.line-toggle-group input {
  width: 10px;
  height: 10px;
  accent-color: var(--teal);
  padding: 0;
}

.line-toggle-group label:has(input:checked) {
  border-color: rgba(62, 231, 215, 0.58);
  background: rgba(62, 231, 215, 0.12);
  color: #f4fbfc;
}

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

.compact-chart {
  min-height: 320px;
}

#monthlyChart,
#yearlyChart {
  width: 100%;
  height: 250px;
  display: block;
}

.combined-chart-stage svg[hidden],
.combined-chart-stage [hidden],
[data-chart-tools][hidden] {
  display: none !important;
}

.axis-label {
  fill: #405057;
  font-size: 12px;
  font-weight: 650;
}

.axis-line {
  shape-rendering: crispEdges;
}

.chart-point,
.chart-hit-point,
.chart-hit-line,
.chart-bar {
  cursor: default;
}

.chart-hit-line {
  pointer-events: stroke;
}

.chart-hit-point {
  pointer-events: all;
}

.chart-hover-layer {
  pointer-events: none;
}

.chart-hover-capture {
  cursor: default;
  pointer-events: all;
}

.chart-hover-html-capture {
  position: absolute;
  inset: 0;
  z-index: 5;
  cursor: default;
  background: transparent;
}

.official-chart-hover-capture {
  inset: auto;
}

.chart-hover-vline {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 4;
  width: 2px;
  transform: translateX(-1px);
  background: rgba(62, 231, 215, 0.78);
  box-shadow: 0 0 12px rgba(62, 231, 215, 0.35);
  pointer-events: none;
}

.official-chart-vline {
  bottom: auto;
}

.chart-hover-readout {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  margin: -4px 0 12px auto;
  padding: 8px 10px;
  border: 1px solid rgba(62, 231, 215, 0.24);
  border-radius: 6px;
  background: rgba(8, 18, 26, 0.9);
  color: #edf7f8;
  font-size: 12px;
  line-height: 1.2;
  pointer-events: none;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(10px);
}

.official-chart-readout {
  margin: 0 0 10px auto;
}

.chart-hover-readout strong {
  color: var(--teal);
}

.chart-hover-guide {
  stroke: rgba(37, 99, 168, 0.52);
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
}

.chart-hover-point {
  fill: #ffffff;
  stroke: #2364aa;
  stroke-width: 2;
}

.chart-legend {
  font-size: 14px;
  font-weight: 700;
}

.chart-tooltip {
  position: fixed;
  z-index: 20;
  max-width: min(320px, calc(100vw - 24px));
  padding: 10px 12px;
  border: 1px solid rgba(28, 37, 41, 0.16);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 28px rgba(28, 37, 41, 0.16);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.55;
  pointer-events: none;
  opacity: 0;
  transform: translate(-9999px, -9999px);
  transition: opacity 0.12s ease;
}

.chart-tooltip.visible {
  opacity: 1;
}

.chart-tooltip strong {
  display: block;
  margin-bottom: 4px;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr);
  gap: 16px;
}

form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

textarea {
  resize: vertical;
}

form button {
  align-self: end;
}

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

.message {
  min-height: 20px;
  margin-top: 10px;
  font-size: 13px;
}

dl {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 12px;
  margin: 0;
}

dd {
  margin: 0;
  word-break: break-all;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.history-table-wrap {
  max-height: 430px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.history-cards {
  display: none;
}

.history-card {
  display: grid;
  gap: 10px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.history-card > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.history-card > div span {
  color: var(--teal);
  font-weight: 750;
}

.history-card dl {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.history-card dt {
  font-size: 12px;
}

.history-card dd {
  font-size: 13px;
  word-break: normal;
}

.monthly-table-wrap {
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.official-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -2px 0 12px;
}

.official-summary span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid #cfe0ea;
  border-radius: 6px;
  background: #f7fafb;
  color: var(--muted);
  font-size: 13px;
}

.official-summary strong {
  color: var(--teal);
}

.history-table-wrap table,
.monthly-table-wrap table {
  min-width: 900px;
}

.history-table-wrap thead th,
.monthly-table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  box-shadow: 0 1px 0 var(--line);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-weight: 650;
}

.table-empty {
  padding: 22px 10px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 860px) {
  .topbar,
  .topbar-main,
  .panel-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .chart-heading-tools {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .account-area {
    width: 100%;
    justify-content: flex-start;
  }

  .section-nav {
    flex: 0 1 auto;
    width: max-content;
    max-width: 100%;
    min-width: 0;
    margin: 0;
  }

  .metrics,
  .trend-grid,
  .grid,
  form,
  .brief-hero {
    grid-template-columns: 1fr;
  }

  .brief-action {
    width: 100%;
  }

  .brief-hero h2 {
    font-size: 22px;
  }

  .panel-tools,
  .chart-range {
    width: 100%;
    justify-content: flex-start;
  }

  .chart-range input {
    flex: 1 1 140px;
    min-width: 0;
  }
}

@media (max-width: 640px) {
  body {
    background: var(--surface);
  }

  .topbar {
    gap: 8px;
    padding: 18px 16px 14px;
  }

  .topbar-main {
    gap: 8px;
    width: 100%;
    margin: 0;
  }

  h1 {
    font-size: 22px;
    line-height: 1.25;
  }

  h2 {
    font-size: 16px;
  }

  .topbar p {
    margin-top: 6px;
    font-size: 13px;
  }

  main {
    width: 100%;
    margin: 0;
  }

  .brief-hero {
    margin: 0;
    padding: 16px;
    border-width: 0 0 1px;
    border-radius: 0;
    box-shadow: none;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    margin: 0;
    background: var(--line);
    border-bottom: 1px solid var(--line);
  }

  .source-filter {
    align-items: stretch;
    flex-direction: column;
    margin: 0;
    padding: 14px 16px;
    border-width: 0 0 1px;
    border-radius: 0;
  }

  .segmented-control {
    width: 100%;
  }

  .segmented-control button {
    min-width: 0;
    min-height: 40px;
    padding-inline: 8px;
    font-size: 13px;
  }

  .metrics article {
    min-height: 96px;
    padding: 14px 12px;
    border: 0;
    border-radius: 0;
  }

  .metrics article:last-child {
    grid-column: 1 / -1;
  }

  .metrics span {
    font-size: 12px;
  }

  .metrics strong {
    margin-top: 7px;
    font-size: 24px;
    line-height: 1.15;
    overflow-wrap: anywhere;
  }

  .panel {
    margin: 0;
    padding: 16px;
    border-width: 0 0 1px;
    border-radius: 0;
  }

  .panel-title {
    gap: 10px;
    margin-bottom: 12px;
  }

  .chart-heading-tools {
    width: 100%;
  }

  .panel-tools {
    gap: 8px;
    font-size: 12px;
  }

  .small-button,
  .range-button {
    min-height: 38px;
  }

  .panel-tools select,
  .chart-range input {
    min-height: 40px;
    font-size: 14px;
  }

  .line-toggle-group label {
    width: 60px;
    min-width: 60px;
    height: 40px;
    min-height: 40px;
    padding: 0 4px;
    font-size: 12px;
  }

  .line-toggle-group label:has([data-daily-series="average"]) {
    min-width: 60px;
  }

  .chart-panel {
    min-height: 300px;
  }

  #chart {
    height: 245px;
  }

  .combined-chart-panel {
    min-height: 340px;
  }

  .chart-title-picker,
  .chart-title-picker select,
  .table-title-picker,
  .table-title-picker select {
    width: 100%;
  }

  .combined-chart-stage svg {
    height: 250px;
  }

  .compact-chart {
    min-height: 280px;
  }

  #monthlyChart,
  #yearlyChart {
    height: 220px;
  }

  .history-table-wrap,
  .monthly-table-wrap {
    max-height: 360px;
    margin-inline: -16px;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }

  .history-table-wrap {
    display: none;
  }

  .history-cards {
    display: block;
  }

  table,
  .history-table-wrap table,
  .monthly-table-wrap table {
    min-width: 760px;
  }

  th,
  td {
    padding: 10px 9px;
    font-size: 13px;
  }

  .chart-tooltip {
    font-size: 12px;
  }

  body .account-drawer,
  .account-drawer {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    max-height: 86vh;
    overflow-y: auto;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
    border-radius: 8px 8px 0 0;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    transform: none;
    animation-name: mobileDrawerUp;
  }

  .drawer-title {
    align-items: flex-start;
    gap: 10px;
  }

  .drawer-title h2 {
    font-size: 18px;
  }

  .drawer-title p {
    font-size: 12px;
  }

  .account-auth-form {
    gap: 12px;
  }

  .account-auth-form input,
  .account-auth-form button,
  .auth-tabs,
  .upgrade-card {
    width: 100%;
    min-width: 0;
  }

  .account-auth-form button {
    min-height: 44px;
  }
}

@media (max-width: 380px) {
  .metrics {
    grid-template-columns: 1fr;
  }

  .metrics article:last-child {
    grid-column: auto;
  }
}

/* Premium cockpit theme */
:root {
  color-scheme: dark;
  --bg: #071016;
  --surface: rgba(13, 27, 37, 0.78);
  --surface-strong: rgba(18, 37, 50, 0.9);
  --ink: #edf7f8;
  --muted: #91aab4;
  --line: rgba(134, 219, 220, 0.18);
  --blue: #52a9ff;
  --blue-soft: rgba(82, 169, 255, 0.14);
  --teal: #3ee7d7;
  --green: #48d597;
  --amber: #f7c56b;
  --gold: #d7a94f;
  --red: #f06e69;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.34);
  --glow: 0 0 28px rgba(62, 231, 215, 0.18);
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 12%, rgba(62, 231, 215, 0.16), transparent 28%),
    radial-gradient(circle at 88% 4%, rgba(247, 197, 107, 0.12), transparent 24%),
    linear-gradient(135deg, #071016 0%, #0c1a25 46%, #0a1118 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(rgba(134, 219, 220, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(134, 219, 220, 0.05) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.82), transparent 82%);
}

body::after {
  content: "";
  position: fixed;
  inset: auto 0 0;
  z-index: -1;
  height: 190px;
  background:
    linear-gradient(to top, rgba(6, 13, 19, 0.98), transparent),
    repeating-linear-gradient(90deg, rgba(62, 231, 215, 0.16) 0 2px, transparent 2px 36px);
  opacity: 0.28;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom-color: rgba(134, 219, 220, 0.18);
  background: rgba(8, 18, 26, 0.74);
  box-shadow: 0 14px 42px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(18px);
}

h1,
h2,
th {
  letter-spacing: 0;
}

h1 {
  color: #f7fdff;
  text-shadow: 0 0 24px rgba(62, 231, 215, 0.22);
}

main {
  animation: pageEnter 0.58s cubic-bezier(0.22, 1, 0.36, 1) both;
}

[data-page][hidden] {
  display: none !important;
}

.section-nav {
  position: relative;
  top: auto;
  z-index: 1;
  display: inline-flex;
  gap: 8px;
  flex: 0 1 auto;
  width: max-content;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  padding: 10px;
  overflow-x: auto;
  border: 1px solid rgba(134, 219, 220, 0.18);
  border-radius: 8px;
  background: rgba(8, 18, 26, 0.68);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(16px);
}

.section-nav a {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 9px 12px;
  border: 1px solid rgba(134, 219, 220, 0.18);
  border-radius: 7px;
  color: #c8e7eb;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease;
}

.section-nav a:hover,
.section-nav a.active {
  color: #041116;
  border-color: rgba(62, 231, 215, 0.72);
  background: linear-gradient(135deg, rgba(62, 231, 215, 0.96), rgba(247, 197, 107, 0.86));
  box-shadow: 0 0 22px rgba(62, 231, 215, 0.18);
  transform: translateY(-1px);
}

button,
.button,
input,
textarea,
select {
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease,
    color 0.18s ease;
}

button,
.button {
  position: relative;
  overflow: hidden;
  border-color: rgba(62, 231, 215, 0.7);
  background: linear-gradient(135deg, rgba(44, 205, 194, 0.96), rgba(31, 111, 194, 0.92));
  box-shadow: 0 10px 26px rgba(31, 111, 194, 0.22);
  font-weight: 700;
}

button::after,
.button::after {
  content: "";
  position: absolute;
  inset: -2px auto -2px -80%;
  width: 48%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.28), transparent);
  transform: skewX(-18deg);
  transition: left 0.45s ease;
}

button:hover,
.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 34px rgba(62, 231, 215, 0.22);
}

button:hover::after,
.button:hover::after {
  left: 125%;
}

button:active,
.button:active {
  transform: translateY(0) scale(0.98);
}

.secondary,
.auth-tabs button,
.segmented-control button {
  background: rgba(255, 255, 255, 0.06);
  color: #cae4e8;
  border-color: rgba(134, 219, 220, 0.24);
  box-shadow: none;
}

.secondary:hover {
  border-color: rgba(62, 231, 215, 0.72);
  color: #ffffff;
}

.access-badge,
.official-summary span,
.upgrade-card {
  border-color: rgba(62, 231, 215, 0.28);
  background: rgba(62, 231, 215, 0.08);
  color: #c9f4f2;
  backdrop-filter: blur(14px);
}

.brief-hero,
.metrics article,
.panel,
.source-filter,
.account-drawer {
  position: relative;
  border-color: rgba(134, 219, 220, 0.2);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.025)),
    rgba(13, 27, 37, 0.74);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(18px);
}

.brief-hero::before,
.panel::before,
.metrics article::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(62, 231, 215, 0.2), transparent 34%, rgba(247, 197, 107, 0.1));
  opacity: 0.35;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  padding: 1px;
}

.brief-hero {
  overflow: hidden;
  min-height: 176px;
}

.brief-hero::after {
  content: "";
  position: absolute;
  right: -70px;
  top: -80px;
  width: 260px;
  height: 260px;
  border: 1px solid rgba(62, 231, 215, 0.22);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(62, 231, 215, 0.16), transparent 68%);
  animation: slowPulse 6s ease-in-out infinite;
}

.brief-hero > * {
  position: relative;
  z-index: 1;
}

.brief-hero h2 {
  max-width: 760px;
  color: #f8feff;
  font-size: clamp(24px, 3vw, 38px);
}

.eyebrow {
  color: var(--teal);
  text-shadow: 0 0 18px rgba(62, 231, 215, 0.35);
}

.metrics article,
.panel,
.reveal-card {
  animation: cardEnter 0.62s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.metrics article:nth-child(2) {
  animation-delay: 0.04s;
}

.metrics article:nth-child(3) {
  animation-delay: 0.08s;
}

.metrics article:nth-child(4) {
  animation-delay: 0.12s;
}

.metrics article:nth-child(5) {
  animation-delay: 0.16s;
}

.metrics article:hover,
.panel:hover {
  transform: translateY(-2px);
  border-color: rgba(62, 231, 215, 0.36);
  box-shadow: var(--shadow), var(--glow);
}

.metrics strong {
  color: #f9feff;
  font-variant-numeric: tabular-nums;
}

.metrics article:first-child strong {
  color: #6bd7ff;
}

.metrics article:nth-child(3) strong {
  color: #f7c56b;
}

.metrics article:last-child strong {
  color: #62e6a6;
}

input,
textarea,
select {
  border-color: rgba(134, 219, 220, 0.22);
  background: rgba(5, 14, 20, 0.52);
  color: var(--ink);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(62, 231, 215, 0.78);
  box-shadow: 0 0 0 3px rgba(62, 231, 215, 0.12);
}

table {
  color: #ecf7f8;
}

th,
td {
  border-bottom-color: rgba(134, 219, 220, 0.13);
}

tbody tr {
  transition: background 0.16s ease, box-shadow 0.16s ease;
}

tbody tr:hover {
  background: rgba(62, 231, 215, 0.055);
  box-shadow: inset 3px 0 0 rgba(62, 231, 215, 0.65);
}

.history-table-wrap,
.monthly-table-wrap {
  border-color: rgba(134, 219, 220, 0.16);
  background: rgba(5, 14, 20, 0.2);
}

.history-table-wrap thead th,
.monthly-table-wrap thead th {
  background: rgba(10, 24, 34, 0.96);
  backdrop-filter: blur(12px);
}

.chart-tooltip {
  border-color: rgba(62, 231, 215, 0.3);
  background: rgba(8, 18, 26, 0.96);
  color: var(--ink);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.36), 0 0 20px rgba(62, 231, 215, 0.16);
  backdrop-filter: blur(14px);
}

.axis-label {
  fill: #9bb4bd;
}

.axis-line {
  stroke: rgba(134, 219, 220, 0.5);
}

.official-panel {
  overflow: hidden;
}

.panel-kicker {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.official-category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin: 2px 0 14px;
}

.official-category-card {
  display: grid;
  gap: 8px;
  min-height: 108px;
  padding: 14px;
  border: 1px solid rgba(134, 219, 220, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(62, 231, 215, 0.09), rgba(82, 169, 255, 0.04)),
    rgba(255, 255, 255, 0.035);
  color: var(--ink);
  text-align: left;
  box-shadow: none;
}

.official-category-card::after {
  display: none;
}

.official-category-card:hover,
.official-category-card.active {
  border-color: rgba(62, 231, 215, 0.64);
  background:
    linear-gradient(145deg, rgba(62, 231, 215, 0.16), rgba(247, 197, 107, 0.07)),
    rgba(255, 255, 255, 0.055);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.22), 0 0 22px rgba(62, 231, 215, 0.14);
}

.official-category-card strong {
  font-size: 15px;
}

.official-category-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.official-category-card em {
  color: var(--teal);
  font-style: normal;
  font-size: 22px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.official-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.official-summary span {
  justify-content: space-between;
  min-height: 58px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(62, 231, 215, 0.1), rgba(247, 197, 107, 0.055)),
    rgba(255, 255, 255, 0.04);
}

.official-summary strong {
  color: #f7c56b;
  font-size: 18px;
}

.official-trend-wrap {
  position: relative;
  margin: 0 0 14px;
  padding: 14px;
  border: 1px solid rgba(134, 219, 220, 0.16);
  border-radius: 8px;
  background: rgba(5, 14, 20, 0.22);
}

.official-trend-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.official-trend-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.official-trend-controls select {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  max-width: none;
}

.official-trend-line-toggles {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.official-trend-line-toggles label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid rgba(62, 231, 215, 0.22);
  border-radius: 999px;
  background: rgba(5, 14, 20, 0.4);
  color: #d7f5f3;
  font-size: 13px;
  white-space: nowrap;
}

.official-trend-line-toggles input {
  margin: 0;
}

#officialTrendChart {
  display: block;
  width: 100%;
  height: 260px;
}

.modal-overlay {
  background: rgba(2, 8, 12, 0.62);
  backdrop-filter: blur(8px);
}

.account-drawer {
  border-color: rgba(62, 231, 215, 0.26);
  animation: modalPop 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.auth-tabs,
.segmented-control {
  border-color: rgba(134, 219, 220, 0.2);
  background: rgba(5, 14, 20, 0.42);
}

.auth-tabs button.active,
.segmented-control button.active,
.range-button.active {
  background: linear-gradient(135deg, rgba(62, 231, 215, 0.95), rgba(31, 111, 194, 0.9));
  color: #041116;
}

.range-button.locked {
  border-color: rgba(247, 197, 107, 0.42);
  color: #f7d99a;
  background: rgba(247, 197, 107, 0.08);
}

@keyframes pageEnter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cardEnter {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes modalPop {
  from {
    opacity: 0;
    transform: translate(-50%, -10%) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

@keyframes mobileDrawerUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slowPulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.78;
  }
  50% {
    transform: scale(1.08);
    opacity: 1;
  }
}

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

@media (max-width: 640px) {
  body {
    background:
      radial-gradient(circle at 20% 0%, rgba(62, 231, 215, 0.16), transparent 32%),
      linear-gradient(135deg, #071016 0%, #0c1a25 100%);
  }

  .topbar {
    position: relative;
  }

  .section-nav {
    position: relative;
    top: auto;
    margin: 0;
    width: max-content;
    max-width: 100%;
    border-width: 0 0 1px;
    border-radius: 0;
  }

  .brief-hero,
  .panel {
    border-color: rgba(134, 219, 220, 0.16);
  }

  .metrics {
    background: rgba(134, 219, 220, 0.12);
  }

  .metrics article {
    min-height: 104px;
  }

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

  .official-trend-head,
  .official-trend-controls,
  .official-trend-line-toggles {
    width: 100%;
  }

  .official-trend-controls select {
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
  }

  #officialTrendChart {
    height: 220px;
  }

  .account-drawer {
    animation: sheetPop 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
  }
}

@keyframes sheetPop {
  from {
    opacity: 0;
    transform: translateY(22px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.theme-toggle {
  min-width: 58px;
}

body[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f7f6;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --ink: #172126;
  --muted: #66757d;
  --line: #dde7e4;
  --blue: #2563a8;
  --blue-soft: #eaf4f1;
  --teal: #176b6a;
  --green: #16825d;
  --amber: #b7791f;
  --gold: #b8860b;
  --red: #b84a3a;
  --shadow: 0 16px 40px rgba(23, 33, 38, 0.08);
  --glow: none;
  background:
    radial-gradient(circle at 18% 0%, rgba(23, 107, 106, 0.1), transparent 26%),
    linear-gradient(135deg, #f7faf9 0%, #eef5f3 48%, #f4f7f6 100%);
  color: var(--ink);
}

body[data-theme="light"]::before {
  background-image:
    linear-gradient(rgba(23, 107, 106, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 107, 106, 0.04) 1px, transparent 1px);
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.35), transparent 82%);
}

body[data-theme="light"]::after {
  display: none;
}

body[data-theme="light"] .topbar {
  border-bottom-color: rgba(23, 107, 106, 0.14);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 12px 34px rgba(23, 33, 38, 0.08);
}

body[data-theme="light"] h1,
body[data-theme="light"] h2,
body[data-theme="light"] .brief-hero h2,
body[data-theme="light"] .metrics strong,
body[data-theme="light"] table {
  color: var(--ink);
  text-shadow: none;
}

body[data-theme="light"] .section-nav {
  border-color: rgba(23, 107, 106, 0.14);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 10px 28px rgba(23, 33, 38, 0.08);
}

body[data-theme="light"] .section-nav a {
  border-color: rgba(23, 107, 106, 0.14);
  color: #264047;
  background: rgba(255, 255, 255, 0.62);
}

body[data-theme="light"] .section-nav a:hover,
body[data-theme="light"] .section-nav a.active,
body[data-theme="light"] button,
body[data-theme="light"] .button,
body[data-theme="light"] .auth-tabs button.active,
body[data-theme="light"] .segmented-control button.active,
body[data-theme="light"] .range-button.active {
  color: #ffffff;
  border-color: rgba(23, 107, 106, 0.45);
  background: linear-gradient(135deg, #1d807d, #2f74b7);
  box-shadow: 0 10px 24px rgba(37, 99, 168, 0.16);
}

body[data-theme="light"] .secondary,
body[data-theme="light"] .auth-tabs button,
body[data-theme="light"] .segmented-control button,
body[data-theme="light"] .small-button,
body[data-theme="light"] .range-button {
  color: #27454d;
  border-color: rgba(23, 107, 106, 0.2);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: none;
}

body[data-theme="light"] .secondary:hover {
  color: #113336;
  border-color: rgba(23, 107, 106, 0.4);
  background: rgba(234, 244, 241, 0.92);
}

body[data-theme="light"] .access-badge,
body[data-theme="light"] .official-summary span,
body[data-theme="light"] .upgrade-card {
  border-color: rgba(23, 107, 106, 0.18);
  background: rgba(234, 244, 241, 0.78);
  color: #315059;
}

body[data-theme="light"] .brief-hero,
body[data-theme="light"] .metrics article,
body[data-theme="light"] .panel,
body[data-theme="light"] .source-filter,
body[data-theme="light"] .account-drawer {
  border-color: rgba(23, 107, 106, 0.14);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.86), rgba(244, 250, 248, 0.74)),
    rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

body[data-theme="light"] .brief-hero::before,
body[data-theme="light"] .panel::before,
body[data-theme="light"] .metrics article::before {
  background: linear-gradient(135deg, rgba(23, 107, 106, 0.16), transparent 34%, rgba(183, 121, 31, 0.08));
  opacity: 0.42;
}

body[data-theme="light"] .brief-hero::after {
  border-color: rgba(23, 107, 106, 0.14);
  background: radial-gradient(circle, rgba(23, 107, 106, 0.09), transparent 68%);
}

body[data-theme="light"] .eyebrow,
body[data-theme="light"] .official-category-card em {
  color: var(--teal);
  text-shadow: none;
}

body[data-theme="light"] .metrics article:hover,
body[data-theme="light"] .panel:hover {
  border-color: rgba(23, 107, 106, 0.24);
  box-shadow: 0 18px 44px rgba(23, 33, 38, 0.12);
}

body[data-theme="light"] .metrics article:first-child strong,
body[data-theme="light"] .metrics article:nth-child(3) strong,
body[data-theme="light"] .metrics article:last-child strong {
  color: var(--teal);
}

body[data-theme="light"] input,
body[data-theme="light"] textarea,
body[data-theme="light"] select {
  border-color: rgba(23, 107, 106, 0.18);
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
}

body[data-theme="light"] input:focus,
body[data-theme="light"] textarea:focus,
body[data-theme="light"] select:focus {
  border-color: rgba(23, 107, 106, 0.48);
  box-shadow: 0 0 0 3px rgba(23, 107, 106, 0.1);
}

body[data-theme="light"] th,
body[data-theme="light"] td {
  border-bottom-color: rgba(23, 107, 106, 0.12);
}

body[data-theme="light"] tbody tr:hover {
  background: rgba(23, 107, 106, 0.045);
  box-shadow: inset 3px 0 0 rgba(23, 107, 106, 0.48);
}

body[data-theme="light"] .history-table-wrap,
body[data-theme="light"] .monthly-table-wrap,
body[data-theme="light"] .official-trend-wrap {
  border-color: rgba(23, 107, 106, 0.14);
  background: rgba(255, 255, 255, 0.58);
}

body[data-theme="light"] .history-table-wrap thead th,
body[data-theme="light"] .monthly-table-wrap thead th {
  background: rgba(235, 244, 242, 0.96);
}

body[data-theme="light"] .chart-tooltip {
  border-color: rgba(23, 107, 106, 0.22);
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  box-shadow: 0 18px 44px rgba(23, 33, 38, 0.16);
}

body[data-theme="light"] .chart-hover-readout {
  border-color: rgba(37, 99, 168, 0.22);
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  box-shadow: 0 10px 24px rgba(28, 37, 41, 0.12);
}

body[data-theme="light"] .axis-label {
  fill: #5d737a;
}

body[data-theme="light"] .axis-line {
  stroke: rgba(23, 107, 106, 0.4);
}

body[data-theme="light"] .official-category-card {
  border-color: rgba(23, 107, 106, 0.14);
  background:
    linear-gradient(145deg, rgba(23, 107, 106, 0.06), rgba(37, 99, 168, 0.03)),
    rgba(255, 255, 255, 0.7);
}

body[data-theme="light"] .official-category-card:hover,
body[data-theme="light"] .official-category-card.active {
  border-color: rgba(23, 107, 106, 0.42);
  background:
    linear-gradient(145deg, rgba(23, 107, 106, 0.11), rgba(183, 121, 31, 0.05)),
    rgba(255, 255, 255, 0.88);
  box-shadow: 0 14px 30px rgba(23, 33, 38, 0.1);
}

body[data-theme="light"] .official-trend-line-toggles label,
body[data-theme="light"] .line-toggle-group label {
  border-color: rgba(23, 107, 106, 0.18);
  background: rgba(255, 255, 255, 0.72);
  color: #315059;
}

body[data-theme="light"] .line-toggle-group label:has(input:checked),
body[data-theme="light"] .official-trend-line-toggles label:has(input:checked) {
  border-color: rgba(23, 107, 106, 0.42);
  background: rgba(23, 107, 106, 0.1);
}

body[data-theme="light"] .modal-overlay {
  background: rgba(244, 247, 246, 0.62);
}

body[data-theme="light"] .auth-tabs,
body[data-theme="light"] .segmented-control {
  border-color: rgba(23, 107, 106, 0.14);
  background: rgba(255, 255, 255, 0.64);
}

.user-row small,
body[data-theme="light"] .user-row small {
  color: rgba(255, 255, 255, 0.82);
}
