/* 全球總經雷達：所有選擇器以 gm- 命名，與既有儀表板隔離。 */
.global-macro-btn {
  color: #7ee7ff;
  border-color: #7ee7ff;
  margin-left: 4px;
  background: linear-gradient(135deg, rgba(77, 214, 255, 0.08), rgba(193, 145, 255, 0.08));
}

.global-macro-btn:hover,
.global-macro-btn:focus-visible {
  color: #fff;
  border-color: #fff;
  background: linear-gradient(135deg, rgba(77, 214, 255, 0.24), rgba(193, 145, 255, 0.18));
}

body.gm-lock {
  overflow: hidden;
}

.gm-modal[hidden] {
  display: none !important;
}

.gm-modal {
  --gm-bg: #030816;
  --gm-panel: #08142c;
  --gm-panel-2: #0c1c39;
  --gm-border: #23477c;
  --gm-muted: #8da2c8;
  --gm-cyan: #61dcff;
  --gm-green: #43dc91;
  --gm-yellow: #ffd763;
  --gm-red: #ff7575;
  --gm-purple: #bda2ff;
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: grid;
  place-items: center;
  padding: 12px;
  color: #edf4ff;
  font-size: 14px;
}

.gm-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: rgba(0, 3, 12, 0.82);
  backdrop-filter: blur(8px);
  cursor: default;
}

.gm-shell {
  position: relative;
  width: min(1480px, calc(100vw - 24px));
  height: min(920px, calc(100vh - 24px));
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(97, 220, 255, 0.45);
  border-radius: 14px;
  background:
    radial-gradient(circle at 8% 0%, rgba(77, 214, 255, 0.11), transparent 32%),
    radial-gradient(circle at 94% 10%, rgba(189, 162, 255, 0.10), transparent 30%),
    var(--gm-bg);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.65);
}

.gm-header {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 24px 18px;
  border-bottom: 1px solid var(--gm-border);
  background: rgba(8, 20, 44, 0.92);
}

.gm-header h2,
.gm-header p,
.gm-section h3,
.gm-score-card h3,
.gm-method h3 {
  margin: 0;
}

.gm-header h2 {
  margin-top: 3px;
  font-size: clamp(24px, 2.2vw, 34px);
  letter-spacing: 0.04em;
  color: #fff;
}

.gm-header p {
  max-width: 820px;
  margin-top: 6px;
  color: var(--gm-muted);
  line-height: 1.55;
}

.gm-eyebrow,
.gm-section-kicker {
  display: block;
  color: var(--gm-cyan);
  font-family: Consolas, "Segoe UI", sans-serif;
  font-size: 11px;
  letter-spacing: 0.18em;
}

.gm-close {
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid var(--gm-border);
  border-radius: 50%;
  background: rgba(3, 8, 22, 0.72);
  color: var(--gm-muted);
  font: 300 32px/1 "Segoe UI", sans-serif;
  cursor: pointer;
}

.gm-close:hover,
.gm-close:focus-visible {
  border-color: var(--gm-red);
  color: #fff;
  background: rgba(255, 117, 117, 0.16);
}

.gm-body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px 24px 28px;
  scrollbar-color: var(--gm-border) transparent;
}

.gm-live-status {
  min-height: 20px;
  margin-bottom: 10px;
  color: var(--gm-muted);
  font-size: 12px;
}

.gm-live-status.is-loading::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--gm-cyan);
  box-shadow: 0 0 12px var(--gm-cyan);
  animation: gm-pulse 1.2s ease-in-out infinite;
}

.gm-live-status.is-error {
  color: var(--gm-red);
}

@keyframes gm-pulse {
  50% { opacity: 0.35; transform: scale(0.72); }
}

.gm-overview {
  display: grid;
  grid-template-columns: minmax(340px, 1.15fr) minmax(420px, 1fr);
  gap: 14px;
}

.gm-score-card,
.gm-stat-grid,
.gm-section,
.gm-method {
  border: 1px solid var(--gm-border);
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(12, 28, 57, 0.92), rgba(8, 20, 44, 0.78));
}

.gm-score-card {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 18px 20px;
}

.gm-score-ring {
  --gm-score: 0;
  --gm-tone: var(--gm-cyan);
  position: relative;
  flex: 0 0 112px;
  width: 112px;
  height: 112px;
  display: grid;
  place-content: center;
  text-align: center;
  border: 8px solid rgba(97, 220, 255, 0.18);
  border-radius: 50%;
  background: var(--gm-bg);
  box-shadow: inset 0 0 26px rgba(97, 220, 255, 0.08), 0 0 22px rgba(97, 220, 255, 0.08);
}

.gm-score-ring::after {
  content: "";
  position: absolute;
  inset: -8px;
  border: 8px solid var(--gm-tone);
  border-left-color: transparent;
  border-bottom-color: transparent;
  border-radius: 50%;
  transform: rotate(calc(-135deg + (var(--gm-score) * 1.8deg)));
  transition: transform 500ms ease;
}

.gm-score-ring strong {
  color: var(--gm-tone);
  font: 700 36px/1 Consolas, monospace;
}

.gm-score-ring span {
  margin-top: 3px;
  color: var(--gm-muted);
  font-size: 11px;
}

.gm-score-card h3 {
  margin-top: 5px;
  font-size: 21px;
  color: #fff;
}

.gm-score-card p {
  margin: 6px 0 0;
  color: var(--gm-muted);
  line-height: 1.55;
}

.gm-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
  overflow: hidden;
}

.gm-stat-grid > div {
  display: grid;
  align-content: center;
  min-height: 118px;
  padding: 14px;
  text-align: center;
  border-left: 1px solid var(--gm-border);
}

.gm-stat-grid > div:first-child {
  border-left: 0;
}

.gm-stat-grid dt {
  color: var(--gm-muted);
  font-size: 11px;
}

.gm-stat-grid dd {
  margin: 8px 0 0;
  color: var(--gm-cyan);
  font: 700 22px/1 Consolas, monospace;
}

.gm-warning {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 215, 99, 0.45);
  border-left: 4px solid var(--gm-yellow);
  border-radius: 6px;
  background: rgba(255, 215, 99, 0.08);
  color: #ffe7a0;
  line-height: 1.55;
}

.gm-section {
  margin-top: 14px;
  padding: 18px;
}

.gm-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.gm-section h3,
.gm-method h3 {
  margin-top: 4px;
  font-size: 18px;
  color: #fff;
}

.gm-cycle-section {
  background:
    linear-gradient(135deg, rgba(97, 220, 255, 0.055), rgba(189, 162, 255, 0.045)),
    var(--gm-panel);
}

.gm-cycle-status {
  color: var(--gm-muted);
  font: 11px/1.4 Consolas, monospace;
  text-align: right;
}

.gm-cycle-status.is-loading {
  color: var(--gm-cyan);
}

.gm-cycle-status.is-error,
.gm-source-error {
  color: var(--gm-red);
}

.gm-cycle-summary {
  margin: -4px 0 14px;
  color: #cbd9f1;
  font-size: 12px;
  line-height: 1.55;
}

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

.gm-cycle-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(97, 220, 255, 0.28);
  border-radius: 8px;
  background: rgba(3, 8, 22, 0.72);
}

.gm-cycle-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.gm-cycle-badge {
  flex: 0 0 auto;
  padding: 4px 7px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font: 9px/1 Consolas, monospace;
}

.gm-cycle-badge.is-ok {
  color: var(--gm-green);
}

.gm-cycle-badge.is-watch {
  color: var(--gm-yellow);
}

.gm-cycle-badge.is-error {
  color: var(--gm-red);
}

.gm-cycle-signal {
  margin-top: 10px;
  color: var(--gm-cyan);
  font-weight: 700;
}

.gm-cycle-explainer,
.gm-cycle-transmission,
.gm-source-error {
  margin: 5px 0 0;
  color: var(--gm-muted);
  font-size: 10px;
  line-height: 1.55;
}

.gm-cycle-transmission {
  margin-top: 10px;
  color: #cbd9f1;
}

.gm-cycle-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 12px 0 0;
}

.gm-cycle-metric,
.gm-cycle-no-data {
  min-width: 0;
  padding: 8px;
  border-radius: 5px;
  background: rgba(12, 28, 57, 0.78);
}

.gm-cycle-metric dt {
  color: var(--gm-muted);
  font-size: 9px;
}

.gm-cycle-metric dd {
  margin: 4px 0 0;
  color: #fff;
  font: 700 14px/1.2 Consolas, monospace;
}

.gm-cycle-metric small,
.gm-cycle-no-data {
  display: block;
  margin-top: 3px;
  color: var(--gm-muted);
  font-size: 8px;
  line-height: 1.4;
}

.gm-cycle-no-data {
  grid-column: 1 / -1;
  margin-top: 0;
  font-size: 10px;
}

.gm-official-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  margin-top: 10px;
  color: var(--gm-cyan);
  font-size: 10px;
}

.gm-source-health-wrap {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--gm-border);
}

.gm-source-health-wrap h4 {
  margin: 0 0 8px;
  color: #fff;
  font-size: 12px;
}

.gm-source-health {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.gm-source-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 8px;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--gm-border);
  border-radius: 6px;
  background: rgba(3, 8, 22, 0.55);
}

.gm-source-row > a {
  display: flex;
  align-items: center;
  min-height: 36px;
  overflow: hidden;
  color: #fff;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gm-source-row > small,
.gm-source-row > p {
  grid-column: 1 / -1;
  margin: 0;
}

.gm-source-row > small {
  color: var(--gm-muted);
  font-size: 8px;
  line-height: 1.4;
}

.gm-search-label {
  display: grid;
  gap: 5px;
  width: min(260px, 100%);
  color: var(--gm-muted);
  font-size: 11px;
}

.gm-search-label input {
  min-height: 42px;
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--gm-border);
  border-radius: 6px;
  background: var(--gm-bg);
  color: #fff;
  font: inherit;
}

.gm-region-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 14px;
}

.gm-filter,
.gm-method-actions button,
.gm-method-actions a {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--gm-border);
  border-radius: 999px;
  background: rgba(3, 8, 22, 0.72);
  color: var(--gm-muted);
  font: inherit;
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
}

.gm-filter:hover,
.gm-filter:focus-visible,
.gm-filter.is-active {
  border-color: var(--gm-cyan);
  color: #fff;
  background: rgba(97, 220, 255, 0.13);
}

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

.gm-economy-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--gm-border);
  border-top: 3px solid var(--gm-tone, var(--gm-cyan));
  border-radius: 8px;
  background: rgba(3, 8, 22, 0.68);
}

.gm-economy-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.gm-economy-name {
  min-width: 0;
}

.gm-economy-name strong {
  display: block;
  color: #fff;
  font-size: 16px;
}

.gm-economy-name span {
  display: block;
  margin-top: 3px;
  color: var(--gm-muted);
  font: 11px Consolas, monospace;
}

.gm-economy-score {
  color: var(--gm-tone, var(--gm-cyan));
  font: 700 25px/1 Consolas, monospace;
}

.gm-pulse-label {
  margin-top: 8px;
  color: var(--gm-tone, var(--gm-cyan));
  font-size: 12px;
}

.gm-confidence {
  margin-top: 4px;
  color: var(--gm-muted);
  font-size: 10px;
}

.gm-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 12px 0 0;
}

.gm-metric {
  min-width: 0;
  padding: 8px;
  border-radius: 5px;
  background: rgba(12, 28, 57, 0.74);
}

.gm-metric dt {
  color: var(--gm-muted);
  font-size: 10px;
}

.gm-metric dd {
  margin: 4px 0 0;
  color: #fff;
  font: 700 14px Consolas, monospace;
}

.gm-metric small {
  display: block;
  margin-top: 2px;
  color: var(--gm-muted);
  font-size: 9px;
}

.gm-channels {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 11px;
}

.gm-tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 7px;
  border: 1px solid rgba(141, 162, 200, 0.32);
  border-radius: 999px;
  color: var(--gm-muted);
  font-size: 9px;
}

.gm-empty {
  padding: 32px;
  text-align: center;
  color: var(--gm-muted);
}

.gm-two-col {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 14px;
}

.gm-risk-list,
.gm-channel-list {
  display: grid;
  gap: 8px;
}

.gm-risk-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--gm-border);
  border-left: 3px solid var(--gm-tone, var(--gm-yellow));
  border-radius: 6px;
  background: rgba(3, 8, 22, 0.55);
}

.gm-risk-severity {
  min-width: 44px;
  color: var(--gm-tone, var(--gm-yellow));
  font-size: 10px;
  text-transform: uppercase;
}

.gm-risk-copy strong {
  color: #fff;
}

.gm-risk-copy span {
  display: block;
  margin-top: 3px;
  color: var(--gm-muted);
  font-size: 11px;
}

.gm-risk-value {
  color: var(--gm-tone, var(--gm-yellow));
  font: 700 14px Consolas, monospace;
  white-space: nowrap;
}

.gm-channel-row {
  display: grid;
  grid-template-columns: minmax(92px, 0.7fr) 2fr auto;
  gap: 10px;
  align-items: center;
}

.gm-channel-name {
  color: #fff;
  font-size: 12px;
}

.gm-channel-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(35, 71, 124, 0.45);
}

.gm-channel-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gm-cyan), var(--gm-purple));
}

.gm-channel-score {
  color: var(--gm-cyan);
  font: 11px Consolas, monospace;
}

.gm-footnote,
.gm-disclaimer {
  color: var(--gm-muted);
  font-size: 11px;
  line-height: 1.55;
}

.gm-method {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  margin-top: 14px;
  padding: 18px;
}

.gm-method p {
  margin: 6px 0 0;
  color: var(--gm-muted);
  line-height: 1.5;
}

.gm-method-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.gm-method-actions a:hover,
.gm-method-actions a:focus-visible,
.gm-method-actions button:hover,
.gm-method-actions button:focus-visible {
  color: #fff;
  border-color: var(--gm-cyan);
}

.gm-method-detail {
  grid-column: 1 / -1;
  padding-top: 14px;
  border-top: 1px dashed var(--gm-border);
  color: #cbd9f1;
  line-height: 1.65;
}

.gm-disclaimer {
  margin: 14px 2px 0;
  text-align: center;
}

.gm-modal button:focus-visible,
.gm-modal a:focus-visible,
.gm-modal input:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

@media (max-width: 1180px) {
  .gm-overview {
    grid-template-columns: 1fr;
  }

  .gm-economy-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .gm-cycle-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .gm-source-health {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .global-macro-btn {
    min-height: 44px;
    padding: 8px 12px;
  }

  .gm-modal {
    padding: 0;
  }

  .gm-shell {
    width: 100vw;
    height: 100vh;
    max-height: none;
    border: 0;
    border-radius: 0;
  }

  .gm-header,
  .gm-body {
    padding-left: 16px;
    padding-right: 16px;
  }

  .gm-economy-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gm-cycle-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gm-two-col {
    grid-template-columns: 1fr;
  }

  .gm-filter,
  .gm-method-actions button,
  .gm-method-actions a,
  .gm-search-label input,
  .gm-official-link,
  .gm-source-row > a {
    min-height: 44px;
  }
}

@media (max-width: 620px) {
  .gm-modal {
    font-size: 13px;
  }

  .gm-header {
    padding-top: max(14px, env(safe-area-inset-top));
  }

  .gm-header p {
    display: none;
  }

  .gm-close {
    flex-basis: 44px;
    width: 44px;
    height: 44px;
  }

  .gm-body {
    padding-bottom: max(24px, env(safe-area-inset-bottom));
  }

  .gm-score-card {
    align-items: flex-start;
    gap: 14px;
    padding: 14px;
  }

  .gm-score-ring {
    flex-basis: 86px;
    width: 86px;
    height: 86px;
  }

  .gm-score-ring strong {
    font-size: 28px;
  }

  .gm-score-card h3 {
    font-size: 17px;
  }

  .gm-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gm-stat-grid > div {
    min-height: 82px;
    border-top: 1px solid var(--gm-border);
  }

  .gm-stat-grid > div:nth-child(odd) {
    border-left: 0;
  }

  .gm-stat-grid > div:nth-child(-n + 2) {
    border-top: 0;
  }

  .gm-section {
    padding: 14px;
  }

  .gm-section-head {
    display: grid;
    align-items: stretch;
  }

  .gm-cycle-status {
    text-align: left;
  }

  .gm-search-label {
    width: 100%;
  }

  .gm-filter,
  .gm-method-actions button,
  .gm-method-actions a {
    min-height: 44px;
  }

  .gm-economy-grid {
    grid-template-columns: 1fr;
  }

  .gm-cycle-grid,
  .gm-source-health {
    grid-template-columns: 1fr;
  }

  .gm-risk-item {
    grid-template-columns: auto 1fr;
  }

  .gm-risk-value {
    grid-column: 2;
  }

  .gm-method {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .gm-method-actions {
    justify-content: stretch;
  }

  .gm-method-actions > * {
    flex: 1 1 100%;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gm-live-status.is-loading::before {
    animation: none;
  }

  .gm-score-ring::after {
    transition: none;
  }
}
