:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eef3f5;
  --ink: #142033;
  --muted: #667386;
  --line: #d8e0e6;
  --teal: #087d7a;
  --blue: #0f68c8;
  --blue-deep: #0b3f88;
  --blue-soft: #eaf3ff;
  --green: #2f7d4f;
  --amber: #a85f00;
  --red: #b73b3b;
  --shadow: 0 18px 50px rgba(20, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

body {
  margin: 0;
  min-height: 100vh;
}

button {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  flex: 1 1 auto;
}

.brand-icon {
  display: block;
  flex: 0 0 58px;
  width: 58px;
  height: 58px;
  object-fit: contain;
}

.brand-copy {
  min-width: 0;
}

.brand-title,
.brand-subtitle {
  margin: 0;
  color: #0067be;
  letter-spacing: 0;
}

.brand-title {
  font-size: clamp(18px, 2.4vw, 32px);
  font-weight: 850;
  line-height: 1.12;
}

.brand-subtitle {
  margin-top: 5px;
  font-size: clamp(10px, 1.1vw, 17px);
  font-weight: 760;
  line-height: 1.15;
  text-transform: uppercase;
}

.brand h1,
.panel-heading h2,
.map-toolbar h2 {
  margin: 0;
  letter-spacing: 0;
}

.brand h1 {
  font-size: 22px;
  line-height: 1.2;
}

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

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.run-state {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 0 0 auto;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  background: #f8fafb;
}

.nav-link {
  display: inline-grid;
  place-items: center;
  min-height: 34px;
  padding: 0 12px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 760;
}

.nav-link:hover,
.nav-link.is-active {
  background: var(--blue-soft);
  color: var(--blue-deep);
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--blue);
  box-shadow: 0 0 0 4px rgba(15, 104, 200, 0.12);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr) minmax(240px, 320px);
  gap: 18px;
  padding: 18px;
  min-height: calc(100vh - 177px);
}

.run-switchbar {
  display: grid;
  grid-template-columns: minmax(190px, 260px) minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.run-switch-heading h2,
.run-switch-heading p {
  margin: 0;
  letter-spacing: 0;
}

.run-switch-heading h2 {
  font-size: 20px;
  line-height: 1.2;
}

.run-switch-heading p:last-child {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.control-panel,
.map-panel,
.insight-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.control-panel,
.insight-panel {
  padding: 18px;
}

.panel-heading {
  margin-bottom: 16px;
}

.panel-heading h2,
.map-toolbar h2 {
  font-size: 20px;
  line-height: 1.25;
}

.product-list {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.run-selector-block {
  padding-top: 0;
  border-top: 0;
}

.run-list {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.run-list-horizontal {
  display: flex;
  gap: 10px;
  margin-bottom: 0;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.run-button {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 62px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  background: #fbfcfd;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.run-list-horizontal .run-button {
  flex: 0 0 clamp(190px, 24vw, 300px);
  min-height: 58px;
}

.run-button:hover,
.run-button.is-active {
  border-color: #8cb9ee;
  background: var(--blue-soft);
}

.run-name {
  display: block;
  color: var(--blue-deep);
  font-size: 15px;
  font-weight: 820;
  line-height: 1.25;
}

.run-desc {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.product-button {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  gap: 12px;
  width: 100%;
  min-height: 72px;
  padding: 12px;
  border: 1px solid var(--line);
  background: #fbfcfd;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.product-button:hover,
.product-button.is-active {
  border-color: #8cb9ee;
  background: var(--blue-soft);
}

.product-stripe {
  width: 8px;
  min-height: 44px;
  background: var(--teal);
}

.product-name {
  display: block;
  font-size: 15px;
  font-weight: 760;
  line-height: 1.25;
}

.product-desc {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.meta-block {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

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

.meta-value,
.meta-copy {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
}

.map-panel {
  display: grid;
  grid-template-rows: auto minmax(260px, 1fr) auto;
  min-width: 0;
}

.map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button,
.text-button {
  height: 38px;
  border: 1px solid var(--line);
  background: #f8fafb;
  color: var(--ink);
  cursor: pointer;
}

.icon-button {
  width: 38px;
  font-size: 24px;
  line-height: 1;
}

.text-button {
  min-width: 72px;
  padding: 0 14px;
  font-weight: 700;
}

.link-button {
  display: inline-grid;
  place-items: center;
  color: var(--ink);
  text-decoration: none;
}

.icon-button:hover,
.text-button:hover {
  border-color: #8cb9ee;
  background: var(--blue-soft);
}

.icon-button:disabled,
.text-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.icon-button:disabled:hover,
.text-button:disabled:hover {
  border-color: var(--line);
  background: #f8fafb;
}

.map-stage {
  position: relative;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    linear-gradient(90deg, rgba(20, 32, 51, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(20, 32, 51, 0.05) 1px, transparent 1px), #eef3f5;
  background-size: 42px 42px;
  min-height: 480px;
}

#forecastImage {
  width: min(100%, 1280px);
  height: auto;
  max-height: min(72vh, 980px);
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
}

.map-badge {
  position: absolute;
  left: 30px;
  bottom: 30px;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.lead-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(76px, 1fr));
  gap: 8px;
  padding: 14px 18px 18px;
  border-top: 1px solid var(--line);
}

.lead-tab {
  min-height: 38px;
  border: 1px solid var(--line);
  background: #fbfcfd;
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
}

.lead-tab.is-active {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue-deep);
}

.metric-grid {
  display: grid;
  gap: 10px;
}

.metric {
  padding: 13px;
  border: 1px solid var(--line);
  background: #fbfcfd;
}

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

.metric-value {
  margin: 0;
  font-size: 22px;
  font-weight: 780;
}

.legend-block,
.product-note-block {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.legend-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.legend-bar {
  height: 14px;
  border: 1px solid rgba(20, 32, 51, 0.16);
  background: linear-gradient(90deg, #e6eef4, #7fc8e8, #2c7bb6, #36a852, #f6d64a, #ee8a35, #c33f3f);
}

.product-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.service-focus-block {
  padding: 14px;
  border: 1px solid #cfe0f4;
  background: #f6faff;
}

.legend-ticks {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
}

.service-main {
  padding: 18px;
}

.service-workspace {
  min-height: calc(100vh - 177px);
}

.service-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 18px;
}

.service-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.service-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.service-panel-header h2,
.service-title h2,
.service-card h3 {
  margin: 0;
  letter-spacing: 0;
}

.service-title h2 {
  font-size: 24px;
  line-height: 1.2;
}

.service-panel-header h2 {
  font-size: 20px;
  line-height: 1.25;
}

.service-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid #9ebfeb;
  background: var(--blue-soft);
  color: var(--blue-deep);
  font-size: 13px;
  font-weight: 760;
  white-space: nowrap;
}

.service-map {
  padding: 18px;
  background:
    linear-gradient(90deg, rgba(20, 32, 51, 0.04) 1px, transparent 1px),
    linear-gradient(rgba(20, 32, 51, 0.04) 1px, transparent 1px), #f1f5f8;
  background-size: 42px 42px;
}

.service-map img {
  display: block;
  width: 100%;
  max-height: 720px;
  object-fit: contain;
  border: 1px solid var(--line);
  background: #fff;
}

.service-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.service-card {
  padding: 16px;
  border-right: 1px solid var(--line);
  background: #fbfcfd;
}

.service-card:last-child {
  border-right: 0;
}

.service-card h3 {
  font-size: 13px;
  color: var(--muted);
  font-weight: 760;
}

.service-card p {
  margin: 8px 0 0;
  font-size: 22px;
  font-weight: 820;
  color: var(--ink);
}

.service-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.service-list li {
  display: grid;
  gap: 4px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}

.service-list li:last-child {
  border-bottom: 0;
}

.service-list strong {
  font-size: 15px;
}

.service-list span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.service-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 18px;
  border-top: 1px solid var(--line);
}

.service-link {
  display: inline-grid;
  place-items: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: #f8fafb;
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  font-weight: 760;
}

.service-link.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.service-link:hover {
  border-color: #8cb9ee;
  background: var(--blue-soft);
  color: var(--blue-deep);
}

.service-link.primary:hover {
  background: var(--blue-deep);
  color: #fff;
}

.site-footer {
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 16px;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .insight-panel {
    grid-column: 1 / -1;
  }

  .service-shell {
    grid-template-columns: 1fr;
  }
}

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

  .topbar-actions,
  .site-nav {
    width: 100%;
  }

  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .site-nav {
    justify-content: space-between;
  }

  .run-state {
    white-space: normal;
  }

  .run-switchbar {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px;
  }

  .run-list-horizontal .run-button {
    flex-basis: 230px;
  }

  .brand {
    align-items: flex-start;
    width: 100%;
  }

  .brand-icon {
    flex-basis: 46px;
    width: 46px;
    height: 46px;
  }

  .brand-copy {
    width: 100%;
  }

  .workspace {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .map-stage {
    min-height: 300px;
    padding: 12px;
  }

  .map-badge {
    left: 20px;
    right: 20px;
    bottom: 20px;
    justify-content: space-between;
  }

  .service-main {
    padding: 12px;
  }

  .service-panel-header {
    flex-direction: column;
  }

  .service-strip {
    grid-template-columns: 1fr;
  }

  .service-card {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .service-card:last-child {
    border-bottom: 0;
  }
}
