:root {
  color-scheme: dark;
  --bg: #080c12;
  --surface: #0d131c;
  --surface-raised: #111925;
  --surface-soft: #151e2a;
  --line: rgba(173, 193, 216, 0.14);
  --line-strong: rgba(190, 209, 231, 0.24);
  --text: #f3f6fa;
  --muted: #92a0b2;
  --muted-strong: #b7c2cf;
  --blue: #6ebde9;
  --blue-soft: #9bd5f3;
  --gold: #d4ab65;
  --green: #65c7a3;
  --danger: #e29a8b;
  --radius-lg: 24px;
  --radius-md: 16px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 75% 12%, rgba(71, 113, 150, 0.13), transparent 34rem),
    linear-gradient(145deg, #080c12 0%, #0a1018 48%, #070b10 100%);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  color: inherit;
}

button {
  cursor: pointer;
}

.hidden,
[hidden] {
  display: none !important;
}

.portal-root,
.app-panel {
  min-height: 100vh;
}

/* Login */
.login-panel {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  overflow: hidden;
  position: relative;
}

.login-panel::before {
  content: "";
  position: absolute;
  width: min(70vw, 940px);
  aspect-ratio: 1.8;
  border: 1px solid rgba(126, 171, 204, 0.1);
  border-radius: 50%;
  transform: rotate(-12deg);
  box-shadow: 0 0 120px rgba(54, 108, 145, 0.09) inset;
}

.login-card {
  width: min(720px, 100%);
  position: relative;
  z-index: 1;
  padding: clamp(34px, 6vw, 76px);
  border: 1px solid var(--line);
  border-radius: 30px;
  background: linear-gradient(155deg, rgba(19, 27, 39, 0.98), rgba(10, 15, 23, 0.98));
  box-shadow: var(--shadow);
}

.login-brand {
  color: var(--muted-strong);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.login-eyebrow,
.section-eyebrow,
.station-kicker {
  margin: 30px 0 14px;
  color: var(--blue-soft);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.18em;
}

.login-card h1 {
  margin: 0;
  max-width: 620px;
  font-size: clamp(44px, 7vw, 78px);
  line-height: 1.04;
  letter-spacing: -0.055em;
}

.login-copy {
  margin: 22px 0 34px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.8;
}

.login-form label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted-strong);
  font-size: 12px;
}

.login-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.login-input-row input,
select {
  min-height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  outline: none;
  background: rgba(5, 9, 14, 0.72);
}

.login-input-row input {
  min-width: 0;
  padding: 0 16px;
  color: var(--text);
}

.login-input-row input:focus,
select:focus-visible,
button:focus-visible {
  border-color: rgba(110, 189, 233, 0.7);
  box-shadow: 0 0 0 3px rgba(110, 189, 233, 0.12);
  outline: none;
}

.login-input-row button {
  min-width: 112px;
  border: 0;
  border-radius: 12px;
  color: #071019;
  background: #d9edf8;
  font-weight: 650;
}

.login-input-row button:hover {
  background: #f3f9fc;
}

.error-text {
  min-height: 20px;
  margin-top: 12px;
  color: var(--danger);
  font-size: 13px;
}

.creator-credit {
  color: var(--muted-strong);
  font-size: 11px;
  letter-spacing: 0.05em;
}

.login-credit {
  margin: 20px 0 0;
}

/* Shell */
.app-panel {
  display: flex;
  flex-direction: column;
}

.portal-header {
  height: 68px;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto minmax(260px, 1fr);
  align-items: center;
  gap: 24px;
  padding: 0 clamp(20px, 3vw, 48px);
  border-bottom: 1px solid var(--line);
  background: #0a0f16;
}

.portal-brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #e8edf3;
  font-size: 14px;
  letter-spacing: 0.04em;
}

.portal-brand-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(156, 201, 229, 0.42);
  border-radius: 9px;
  color: var(--blue-soft);
  font-size: 12px;
  font-weight: 700;
}

.portal-nav {
  display: flex;
  gap: 5px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #070b10;
}

.nav-item,
.text-button {
  border: 0;
  background: transparent;
}

.nav-item {
  min-height: 34px;
  padding: 0 17px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
}

.nav-item:hover,
.nav-item.active {
  color: var(--text);
  background: var(--surface-soft);
}

.portal-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  font-size: 12px;
}

.data-stamp strong {
  color: var(--muted-strong);
  font-weight: 600;
}

.text-button {
  padding: 7px 0;
  color: var(--muted-strong);
}

.data-status {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px clamp(20px, 3vw, 48px);
  border-bottom: 1px solid rgba(173, 193, 216, 0.08);
  color: #7f8c9c;
  background: rgba(6, 10, 15, 0.72);
  font-size: 11px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
}

.data-status[data-status="ok"] .status-dot,
.data-status[data-status="fresh"] .status-dot {
  background: var(--green);
}

.view {
  width: 100%;
}

.dashboard-view {
  flex: 1;
  padding: 18px clamp(20px, 3vw, 48px) 22px;
}

/* Lifetime first */
.lifetime-summary {
  display: grid;
  grid-template-columns: minmax(230px, 0.8fr) minmax(620px, 2.2fr);
  align-items: stretch;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: linear-gradient(110deg, #0f1620, #0b1119);
}

.summary-context {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 9px;
  padding: 18px 22px;
  border-right: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.summary-context strong {
  color: var(--text);
  font-size: 15px;
  font-weight: 650;
}

.summary-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.summary-metric {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 14px 26px;
  position: relative;
}

.summary-metric + .summary-metric::before {
  content: "";
  width: 1px;
  height: 44px;
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  background: var(--line-strong);
}

.summary-metric > div {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.metric-number {
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: clamp(25px, 2.2vw, 38px);
  font-weight: 650;
  line-height: 1;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}

.metric-unit,
.summary-metric small {
  color: var(--muted);
  font-size: 11px;
}

.dashboard-mode-switch {
  width: max-content;
  display: flex;
  gap: 4px;
  margin: 14px 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #080d13;
}

.dashboard-mode-switch button {
  min-height: 32px;
  padding: 0 17px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
}

.dashboard-mode-switch button[aria-pressed="true"] {
  color: var(--text);
  background: var(--surface-soft);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2);
}

/* Presentation */
.leadership-stage {
  min-height: 390px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(90deg, rgba(10, 16, 24, 0.98), rgba(13, 21, 31, 0.93)),
    var(--surface);
  box-shadow: var(--shadow);
}

.presentation-layer {
  min-height: 390px;
  display: grid;
  grid-template-columns: minmax(390px, 0.92fr) minmax(520px, 1.28fr);
  align-items: stretch;
}

.presentation-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(30px, 4vw, 64px);
  position: relative;
}

.presentation-copy::after {
  content: "";
  width: 1px;
  position: absolute;
  top: 10%;
  right: 0;
  bottom: 10%;
  background: linear-gradient(transparent, var(--line-strong), transparent);
}

.presentation-copy .section-eyebrow {
  margin: 0 0 16px;
  color: #7598b1;
}

.presentation-copy h1 {
  max-width: 570px;
  margin: 0;
  font-size: clamp(42px, 4.1vw, 72px);
  font-weight: 690;
  line-height: 1.08;
  letter-spacing: -0.055em;
}

.presentation-copy h1 span {
  color: #aab7c6;
}

.annual-metrics,
.city-detail {
  min-height: 92px;
  margin-top: clamp(26px, 4vh, 44px);
}

.annual-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(14px, 2.3vw, 36px);
}

.annual-metrics > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.annual-metrics strong {
  white-space: nowrap;
  font-size: clamp(18px, 1.8vw, 28px);
  font-weight: 620;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.025em;
}

.annual-metrics > div > span {
  color: var(--muted);
  font-size: 11px;
}

.city-detail {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
}

.city-detail-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.city-detail-heading > div {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.city-detail-heading strong {
  font-size: 18px;
  font-weight: 620;
}

.city-detail-heading span {
  color: var(--muted);
  font-size: 11px;
}

.city-detail-heading b {
  font-size: 34px;
  font-weight: 640;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.city-station-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px;
}

.city-station-list span {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted-strong);
  font-size: 11px;
  line-height: 1.35;
}

.city-station-list i {
  width: 5px;
  height: 5px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--blue-soft);
  box-shadow: 0 0 0 3px rgba(110, 189, 233, 0.1);
}

.map-panel {
  min-width: 0;
  margin: 0;
  padding: 22px clamp(24px, 3vw, 48px) 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: radial-gradient(circle at 55% 45%, rgba(58, 112, 148, 0.11), transparent 19rem);
}

.map-panel figcaption {
  margin-bottom: -10px;
  color: var(--muted-strong);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.shandong-map {
  width: 100%;
  min-height: 290px;
  display: grid;
  place-items: center;
}

.shandong-map svg {
  width: 100%;
  height: min(46vh, 390px);
  min-height: 286px;
  overflow: visible;
}

.shandong-map .map-region {
  fill: #162332;
  stroke: #34475a;
  stroke-width: 1.35;
  vector-effect: non-scaling-stroke;
  transition: fill 180ms ease, filter 180ms ease, stroke 180ms ease;
}

.shandong-map .map-region--370100 {
  fill: #2a708f;
  stroke: #78bee2;
}

.shandong-map .map-region--370600 {
  fill: #9a7441;
  stroke: #ddb66e;
}

.shandong-map .map-region--370100:hover,
.shandong-map .map-region--370100:focus,
.shandong-map .map-region--370100.is-active,
.shandong-map .map-region--370600:hover,
.shandong-map .map-region--370600:focus,
.shandong-map .map-region--370600.is-active {
  filter: brightness(1.16) drop-shadow(0 8px 12px rgba(0, 0, 0, 0.3));
  stroke: #eef7fc;
  stroke-width: 1.8;
  outline: none;
}

.shandong-map .map-city {
  pointer-events: none;
}

.shandong-map .map-city-dot {
  display: none;
}

.shandong-map .map-city-name {
  fill: #f1f4f7;
  paint-order: stroke;
  stroke: rgba(6, 10, 16, 0.75);
  stroke-width: 3px;
  stroke-linejoin: round;
  text-anchor: middle;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  font-size: 13px;
  font-weight: 620;
  letter-spacing: 0.04em;
}

.shandong-map .map-station-group {
  pointer-events: none;
}

.shandong-map .map-station-node {
  fill: #d9f1fd;
  stroke: #09111a;
  stroke-width: 1.8;
  opacity: 0.76;
  vector-effect: non-scaling-stroke;
  transition: opacity 160ms ease, filter 160ms ease;
}

.shandong-map .map-station-group--370600 .map-station-node {
  fill: #f4d494;
}

.shandong-map .map-station-group.is-active .map-station-node {
  opacity: 1;
  filter: drop-shadow(0 0 5px rgba(238, 247, 252, 0.7));
}

.map-source {
  margin: -5px 0 0;
  color: #647181;
  font-size: 9px;
  text-align: right;
}

.map-error {
  color: var(--muted);
  font-size: 13px;
}

/* Operations */
.operations-layer {
  min-height: 390px;
  padding: clamp(26px, 3vw, 44px);
}

.operations-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 24px;
}

.operations-heading .section-eyebrow {
  margin: 0 0 10px;
  color: #7598b1;
}

.operations-heading h2,
.toolbar h2 {
  margin: 0;
  font-size: clamp(26px, 2.3vw, 36px);
  letter-spacing: -0.035em;
}

.operations-heading p:not(.section-eyebrow) {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.daily-total {
  display: flex;
  align-items: baseline;
  gap: 16px;
  white-space: nowrap;
}

.daily-total strong {
  font-size: 24px;
  font-weight: 620;
}

.daily-total > span {
  color: var(--muted);
  font-size: 12px;
}

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

.station-card {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #0b1119;
}

.station-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
}

.station-kicker {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 9px;
}

.station-head h3 {
  margin: 0 0 5px;
  font-size: 22px;
}

.station-head p:not(.station-kicker) {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.station-total {
  display: flex;
  flex-direction: column;
  align-items: end;
  gap: 5px;
}

.station-total strong {
  font-size: 30px;
  font-weight: 630;
  font-variant-numeric: tabular-nums;
}

.station-total span,
.station-stats span,
.operation-detail > span,
.anomaly-line span {
  color: var(--muted);
  font-size: 10px;
}

.station-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 18px 0;
  border-block: 1px solid var(--line);
}

.station-stats > div {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 14px 0;
}

.station-stats > div + div {
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.station-stats strong {
  font-size: 15px;
  font-weight: 590;
}

.operation-detail,
.anomaly-line {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  padding-top: 9px;
}

.operation-detail strong,
.anomaly-line strong {
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 480;
  line-height: 1.6;
}

.anomaly-line strong {
  color: var(--danger);
}

/* Daily and history */
.content-view {
  flex: 1;
  padding: 28px clamp(20px, 5vw, 76px) 48px;
}

.toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.toolbar .section-eyebrow {
  margin: 0 0 9px;
  color: #7598b1;
}

select {
  padding: 0 38px 0 13px;
}

.daily-text {
  max-width: 1180px;
  min-height: 380px;
  padding: clamp(24px, 4vw, 52px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  color: #c1cad5;
  background: #0c121a;
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 2;
}

.history-filters {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted-strong);
  font-size: 12px;
}

.history-filters label {
  display: flex;
  align-items: center;
  gap: 7px;
}

.pill {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 99px;
  color: var(--muted);
}

.annual-summary,
.history-list {
  display: grid;
  gap: 14px;
}

.annual-summary {
  margin-bottom: 24px;
}

.year-block {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #0d131c;
}

.year-head,
.region-card,
.history-item {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.year-head {
  align-items: center;
  margin-bottom: 14px;
}

.year-head h3,
.region-card h4 {
  margin: 0;
}

.year-head p,
.region-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.year-total {
  display: flex;
  gap: 16px;
  align-items: baseline;
}

.year-total span {
  color: var(--muted);
  font-size: 12px;
}

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

.region-card {
  align-items: center;
  padding: 14px;
  border: 1px solid rgba(173, 193, 216, 0.1);
  border-radius: 12px;
  background: #0a1017;
}

.region-metrics {
  display: flex;
  align-items: baseline;
  gap: 14px;
  color: var(--muted);
  font-size: 11px;
}

.region-metrics strong {
  color: var(--text);
  font-size: 17px;
}

.history-item {
  width: 100%;
  align-items: center;
  padding: 17px 19px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--text);
  background: #0b1119;
  text-align: left;
}

.history-item:hover {
  border-color: rgba(110, 189, 233, 0.38);
  background: #101923;
}

.history-item > div {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-item > div span,
.history-item > span,
.history-empty {
  color: var(--muted);
  font-size: 11px;
}

.history-empty {
  padding: 30px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  text-align: center;
}

.portal-footer {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(20px, 3vw, 48px);
  border-top: 1px solid rgba(173, 193, 216, 0.08);
  color: #596675;
  font-size: 9px;
  letter-spacing: 0.08em;
}

@media (max-width: 1100px) {
  .portal-header {
    grid-template-columns: 1fr auto;
  }

  .portal-nav {
    grid-row: 2;
    grid-column: 1 / -1;
    justify-self: center;
    margin-bottom: 10px;
  }

  .portal-header {
    height: auto;
    min-height: 106px;
    padding-top: 12px;
  }

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

  .summary-context {
    flex-direction: row;
    justify-content: space-between;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .presentation-layer {
    grid-template-columns: 1fr;
  }

  .presentation-copy::after {
    width: auto;
    height: 1px;
    top: auto;
    right: 8%;
    bottom: 0;
    left: 8%;
  }

  .map-panel {
    min-height: 430px;
  }

  .shandong-map svg {
    height: 390px;
  }
}

@media (max-width: 760px) {
  .portal-header {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px 16px;
  }

  .portal-actions {
    position: absolute;
    top: 19px;
    right: 16px;
  }

  .data-stamp {
    display: none;
  }

  .portal-nav {
    width: 100%;
    grid-row: auto;
    overflow-x: auto;
    margin: 0;
  }

  .nav-item {
    flex: 1 0 auto;
    padding-inline: 12px;
  }

  .data-status {
    padding-inline: 16px;
  }

  .dashboard-view,
  .content-view {
    padding-inline: 14px;
  }

  .summary-context {
    flex-direction: column;
  }

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

  .summary-metric {
    padding: 14px 18px;
  }

  .summary-metric + .summary-metric::before {
    width: auto;
    height: 1px;
    top: 0;
    right: 18px;
    left: 18px;
    transform: none;
  }

  .leadership-stage,
  .presentation-layer {
    min-height: 0;
  }

  .presentation-copy {
    padding: 32px 24px;
  }

  .presentation-copy h1 {
    font-size: clamp(38px, 12vw, 54px);
  }

  .annual-metrics {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .annual-metrics,
  .city-detail {
    min-height: 0;
  }

  .city-station-list {
    grid-template-columns: 1fr;
  }

  .map-panel {
    min-height: 340px;
    padding: 18px 12px 10px;
  }

  .shandong-map {
    min-height: 280px;
  }

  .shandong-map svg {
    min-height: 260px;
    height: 300px;
  }

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

  .operations-heading,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .operations-layer {
    padding: 24px 16px;
  }

  .history-filters,
  .region-metrics {
    flex-wrap: wrap;
  }

  .login-panel {
    padding: 14px;
  }

  .login-card {
    padding: 30px 22px;
  }

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

@media (min-width: 1500px) and (min-height: 850px) {
  .dashboard-view {
    padding-top: 24px;
  }

  .lifetime-summary {
    min-height: 110px;
  }

  .leadership-stage,
  .presentation-layer {
    min-height: 500px;
  }

  .shandong-map svg {
    height: 440px;
  }
}

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