:root {
  color-scheme: dark;
  --bg: #050505;
  --surface: #0b0d10;
  --surface-2: #111419;
  --surface-3: #171b21;
  --line: #252a31;
  --line-soft: #1b1f25;
  --text: #eceff3;
  --muted: #89919d;
  --dim: #5f6670;
  --green: #43f07e;
  --cyan: #27c6df;
  --red: #ff4d4d;
  --amber: #ffab17;
  --blue: #5c8cff;
  --purple: #8b5cf6;
  --font-mono: "SF Mono", "Monaco", "Cascadia Code", "Fira Code", "PingFang SC", "Microsoft YaHei", monospace;
  --font-ui: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
  min-width: 0;
}

html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
}

body {
  font-family: var(--font-ui);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 460px);
  min-height: 100vh;
  background: #050505;
}

.auth-preview {
  display: grid;
  grid-template-rows: minmax(300px, 1fr) auto;
  gap: 8px;
  padding: 14px;
  overflow: hidden;
  font-family: var(--font-mono);
}

.preview-topbar,
.monitor-topbar,
.monitor-tabs,
.monitor-cluster,
.map-head,
.wm-panel-head {
  display: flex;
  align-items: center;
}

.preview-topbar {
  gap: 18px;
  border: 1px solid var(--line);
  padding: 0 16px;
  background: #0b0d10;
}

.preview-topbar strong,
.monitor-title {
  font-size: 22px;
  letter-spacing: 0.08em;
}

.world-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border: 1px solid #17472d;
  border-radius: 3px;
  padding: 6px 10px;
  color: var(--green);
  background: #082014;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.live-dot {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.live-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 14px rgba(67, 240, 126, 0.8);
}

.preview-map {
  position: relative;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  overflow: hidden;
  background:
    radial-gradient(circle at 48% 42%, rgba(67, 240, 126, 0.08), transparent 35%),
    #11161a;
}

.world-map-svg {
  width: min(100%, 1280px);
  height: min(100%, 620px);
  min-height: 360px;
  padding: 20px;
  filter: drop-shadow(0 18px 46px rgba(0, 0, 0, 0.34));
}

.world-ocean {
  fill: #151a1f;
}

.world-grid line {
  stroke: rgba(137, 145, 157, 0.16);
  stroke-width: 1;
}

.world-land {
  fill: #2a3035;
  stroke: rgba(236, 239, 243, 0.18);
  stroke-width: 0.9;
  vector-effect: non-scaling-stroke;
}

.world-points circle {
  fill: var(--green);
  stroke: rgba(216, 255, 240, 0.82);
  stroke-width: 1.4;
  filter: drop-shadow(0 0 9px rgba(67, 240, 126, 0.85));
}

.world-labels text {
  fill: rgba(236, 239, 243, 0.28);
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-anchor: middle;
}

.auth-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 20px;
  border: 1px solid var(--line);
  padding: 22px;
  background:
    linear-gradient(90deg, rgba(67, 240, 126, 0.12), transparent 42%),
    #0b0d10;
}

.auth-intro span {
  color: var(--green);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.auth-intro h1 {
  max-width: 760px;
  margin: 8px 0 12px;
  font-family: var(--font-ui);
  font-size: clamp(24px, 3vw, 42px);
  line-height: 1.12;
  letter-spacing: 0;
}

.auth-intro p {
  max-width: 780px;
  margin: 0;
  color: #c9d1dc;
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.78;
}

.auth-intro ul {
  display: grid;
  gap: 10px;
  align-content: center;
  margin: 0;
  padding: 0;
  list-style: none;
}

.auth-intro li {
  border: 1px solid var(--line-soft);
  padding: 11px 12px;
  background: rgba(17, 20, 25, 0.72);
}

.auth-intro li strong,
.auth-intro li span {
  display: block;
}

.auth-intro li strong {
  margin-bottom: 6px;
  color: var(--text);
}

.auth-intro li span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.55;
}

.auth-side {
  display: grid;
  align-content: center;
  border-left: 1px solid var(--line);
  padding: 28px;
  background: #090b0f;
}

.auth-card {
  display: grid;
  gap: 16px;
  width: min(100%, 560px);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 22px;
  background: #0b0d10;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 54px;
}

.brand-mark {
  display: grid;
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid #17472d;
  border-radius: 4px;
  background: #082014;
  color: var(--green);
  font-family: var(--font-mono);
  font-weight: 900;
}

.brand-lockup strong,
.brand-lockup span {
  display: block;
}

.brand-lockup strong {
  font-size: 18px;
  line-height: 1.3;
}

.brand-lockup span {
  margin-top: 3px;
  line-height: 1.25;
}

.brand-lockup span,
.eyebrow,
.message,
label {
  color: var(--muted);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.auth-card h1 {
  margin: 7px 0 0;
  font-size: 24px;
  letter-spacing: 0;
}

.auth-tabs,
.auth-methods {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.auth-tabs button,
.auth-methods button,
.ghost-button,
.primary-button,
.icon-button,
.select-button,
.search-button,
.subscription-chip,
.map-tools button,
.time-strip button,
.source-tabs button,
.panel-action,
.panel-icon {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text);
  padding: 9px 11px;
}

.auth-tabs button.active,
.auth-methods button.active,
.primary-button {
  border-color: var(--green);
  background: var(--green);
  color: #061008;
  font-weight: 800;
}

.code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.code-row .ghost-button {
  height: 42px;
  white-space: nowrap;
}

label {
  display: grid;
  gap: 7px;
  font-size: 13px;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  outline: none;
  padding: 11px 12px;
  background: #06080b;
  color: var(--text);
}

input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(67, 240, 126, 0.12);
}

.message {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 10px 12px;
  background: rgba(17, 20, 25, 0.82);
}

.message.error,
.error {
  border-color: rgba(255, 77, 77, 0.6);
  color: #ffd1d1;
}

.monitor-shell {
  display: grid;
  grid-template-rows: 54px 42px minmax(0, 1fr);
  height: 100vh;
  min-height: 620px;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
}

.monitor-topbar {
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 7px 12px;
  background: #0c0d10;
}

.monitor-cluster {
  gap: 10px;
}

.center-cluster {
  flex: 1;
  justify-content: center;
}

.right-cluster {
  justify-content: flex-end;
}

.icon-button {
  display: grid;
  width: 38px;
  height: 34px;
  place-items: center;
  padding: 0;
  color: var(--muted);
}

.icon-button.active {
  border-color: #17472d;
  color: var(--green);
  background: #082014;
}

.version,
.operator {
  color: var(--muted);
}

.select-button {
  min-width: 160px;
  display: inline-flex;
  justify-content: space-between;
  gap: 24px;
}

.region-select {
  position: relative;
}

.region-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  z-index: 70;
  display: grid;
  width: 260px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #0b0d10;
  box-shadow: 0 22px 52px rgba(0, 0, 0, 0.56);
  transform: translateX(-50%);
}

.region-menu button {
  display: grid;
  gap: 4px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  padding: 11px 12px;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.region-menu button:last-child {
  border-bottom: 0;
}

.region-menu button.active,
.region-menu button:hover {
  background: #102119;
}

.region-menu span {
  color: var(--muted);
  font-size: 11px;
}

.defcon {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #275242;
  border-radius: 5px;
  padding: 8px 12px;
  color: #d8fff0;
  background: #102119;
  font-weight: 800;
}

.defcon small {
  color: var(--muted);
  font-weight: 600;
}

.subscription-chip {
  border-color: #235b39;
  color: var(--green);
  background: #0b1b13;
  font-weight: 800;
}

.search-button {
  min-width: 126px;
  color: #e9edf4;
}

.ghost-button.compact {
  padding: 8px 10px;
}

.monitor-tabs {
  gap: 6px;
  border-bottom: 1px solid var(--line);
  padding: 6px 12px;
  overflow-x: auto;
  background: #08090b;
}

.monitor-tabs button {
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 7px 10px;
  color: var(--muted);
  background: #101216;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 12px;
}

.monitor-tabs button.active {
  border-color: var(--green);
  color: #061008;
  background: var(--green);
  font-weight: 900;
}

.monitor-content {
  min-height: 0;
  overflow: hidden;
}

.worldmonitor-layout {
  display: grid;
  grid-template-rows: minmax(360px, 56fr) minmax(270px, 44fr);
  height: 100%;
  min-height: 0;
  gap: 8px;
  padding: 8px;
}

.map-stage,
.wm-panel {
  position: relative;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 3px;
  overflow: hidden;
  background: #0b0d10;
}

.map-shell {
  position: absolute;
  inset: 40px 0 0;
  overflow: hidden;
  background: #171a1d;
}

.leaflet-map {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: #171a1d;
}

.leaflet-container {
  background: #171a1d;
  font-family: var(--font-mono);
}

.leaflet-control-attribution {
  border: 1px solid rgba(37, 42, 49, 0.72);
  color: rgba(236, 239, 243, 0.7);
  background: rgba(5, 5, 5, 0.76) !important;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  border: 1px solid var(--line);
  background: #0b0d10;
  color: var(--text);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.45);
}

.leaflet-popup-content {
  margin: 10px 12px;
  line-height: 1.6;
}

.gia-map-marker {
  border: 0;
  background: transparent;
}

.gia-map-marker span {
  display: block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.88);
  border-radius: 999px;
  background: var(--marker-color);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--marker-color) 22%, transparent), 0 0 22px var(--marker-color);
}

.map-unavailable {
  display: grid;
  height: 100%;
  place-items: center;
  color: var(--muted);
}

.map-head,
.wm-panel-head {
  position: relative;
  z-index: 5;
  min-height: 40px;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  background: rgba(12, 13, 16, 0.96);
  letter-spacing: 0.06em;
}

.map-head span,
.wm-panel-head span {
  color: var(--muted);
}

.map-tools {
  display: flex;
  gap: 4px;
}

.map-tools button {
  min-width: 36px;
  padding: 6px 8px;
}

.map-tools button.active {
  border-color: var(--green);
  color: #061008;
  background: var(--green);
  font-weight: 900;
}

.time-strip {
  position: absolute;
  z-index: 6;
  top: 20px;
  left: 14px;
  display: flex;
  gap: 4px;
}

.time-strip button {
  min-width: 45px;
  padding: 8px 10px;
  color: var(--muted);
  background: #0d1014;
}

.time-strip button.active {
  border-color: var(--green);
  color: #061008;
  background: var(--green);
  font-weight: 900;
}

.layer-panel {
  position: absolute;
  z-index: 6;
  top: 61px;
  left: 14px;
  width: 300px;
  border: 1px solid var(--line);
  border-radius: 3px;
  overflow: hidden;
  background: rgba(3, 5, 7, 0.94);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.layer-title {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.layer-row {
  display: grid;
  width: 100%;
  border: 0;
  border-bottom: 1px solid rgba(37, 42, 49, 0.35);
  grid-template-columns: 24px 24px 1fr;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  color: var(--muted);
  background: transparent;
  text-transform: uppercase;
  text-align: left;
}

.layer-row.enabled {
  color: var(--text);
}

.check {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 2px solid #2b3139;
  border-radius: 4px;
  color: #061008;
}

.layer-row.enabled .check {
  border-color: var(--green);
  background: var(--green);
  font-weight: 900;
}

.layer-icon {
  color: var(--muted);
  text-align: center;
}

.layer-footer {
  border-top: 1px solid #12303a;
  padding: 9px 12px;
  color: var(--cyan);
  letter-spacing: 0.1em;
}

.map-zoom {
  position: absolute;
  z-index: 7;
  right: 12px;
  top: 38px;
  display: grid;
}

.map-zoom button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  color: #fff;
  background: #050608;
  font-size: 20px;
}

.map-legend {
  position: absolute;
  z-index: 7;
  right: 28%;
  bottom: 16px;
  left: 30%;
  display: flex;
  justify-content: center;
  gap: 13px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px 10px;
  background: rgba(4, 5, 7, 0.92);
  color: var(--muted);
  white-space: nowrap;
}

.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.map-legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--amber);
}

.map-legend .high { background: var(--red); }
.map-legend .elevated { background: var(--amber); }
.map-legend .monitoring { background: #f5e900; }
.map-legend .base { background: var(--blue); border-radius: 0; transform: rotate(45deg); }
.map-legend .nuclear { background: #e4d34c; }
.map-legend .datacenter { background: var(--purple); }
.map-legend .aircraft { background: #9d74ff; }

.map-status-card {
  position: absolute;
  right: 12px;
  bottom: 66px;
  z-index: 7;
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 10px 12px;
  background: rgba(4, 5, 7, 0.92);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.38);
}

.map-status-card span {
  color: var(--muted);
}

.bottom-deck {
  display: grid;
  grid-template-columns: 1fr 1fr 0.5fr;
  gap: 8px;
  min-height: 0;
}

.wm-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.panel-icon,
.panel-action {
  padding: 5px 8px;
  color: var(--muted);
  background: #0e1115;
}

.source-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  overflow-x: auto;
  background: #08090b;
}

.source-tabs button {
  padding: 8px 10px;
  color: var(--muted);
  background: #101216;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 12px;
}

.source-tabs button.active {
  border-color: var(--green);
  color: #061008;
  background: var(--green);
  font-weight: 900;
}

.source-tabs button.danger {
  border-color: var(--red);
  color: #fff;
  background: var(--red);
}

.broadcast-frame {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36%;
  min-height: 150px;
  border-bottom: 1px solid var(--line);
}

.broadcast-main,
.broadcast-stack div,
.webcam-card {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.14), transparent 32%),
    radial-gradient(circle at 65% 40%, rgba(255, 174, 80, 0.28), transparent 26%),
    linear-gradient(180deg, #2f3436, #101318);
}

.broadcast-main {
  display: grid;
  align-content: end;
  padding: 14px;
}

.broadcast-main::before,
.broadcast-stack div::before,
.webcam-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.06) 0 1px, transparent 1px 4px),
    linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.45));
  pointer-events: none;
}

.broadcast-main span,
.broadcast-main strong,
.broadcast-main em,
.broadcast-stack span,
.broadcast-stack strong,
.webcam-card span,
.webcam-card strong,
.webcam-card em,
.webcam-card small {
  position: relative;
  z-index: 2;
}

.broadcast-main span {
  width: fit-content;
  margin-bottom: 8px;
  padding: 4px 8px;
  color: #fff;
  background: #0f1216;
  font-weight: 900;
}

.broadcast-main strong {
  display: block;
  max-width: 720px;
  padding: 8px 10px;
  color: #101010;
  background: #f5f5f5;
  font-size: 18px;
  line-height: 1.25;
}

.broadcast-main em {
  width: fit-content;
  padding: 4px 10px;
  color: #fff;
  background: #e31616;
  font-style: normal;
  font-weight: 900;
}

.broadcast-stack {
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
}

.broadcast-stack div {
  display: grid;
  align-content: end;
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 10px;
}

.broadcast-stack span {
  color: #fff;
  font-weight: 800;
}

.broadcast-stack strong {
  width: fit-content;
  margin-top: 5px;
  padding: 2px 6px;
  color: #fff;
  background: #e31616;
  font-size: 11px;
}

.news-feed,
.ai-stack,
.posture-stack,
.source-health-grid,
.source-list {
  display: grid;
  gap: 8px;
  min-height: 0;
  overflow: auto;
  padding: 10px;
}

.news-feed {
  align-content: start;
}

.news-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  gap: 11px;
  border: 1px solid rgba(37, 42, 49, 0.82);
  border-left: 4px solid var(--amber);
  padding: 8px 10px 8px 8px;
  color: var(--text);
  background: #11151b;
  text-align: left;
}

.news-row.breaking {
  border-left-color: var(--red);
}

.news-thumb {
  display: grid;
  width: 82px;
  aspect-ratio: 16 / 10;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  color: #cffff0;
  background:
    linear-gradient(135deg, rgba(67, 240, 126, 0.2), rgba(39, 198, 223, 0.1)),
    #0b1614;
  font-weight: 900;
}

.news-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.news-copy {
  display: grid;
  gap: 5px;
}

.news-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.news-row strong {
  display: block;
  line-height: 1.35;
}

.news-row span,
.news-row em,
.news-row p,
.news-source-link,
.ai-card span,
.posture-card span,
.posture-card small {
  display: block;
  color: var(--muted);
  font-style: normal;
}

.news-row p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-height: 1.48;
}

.news-source-link {
  width: fit-content;
  text-decoration: none;
  white-space: nowrap;
}

.news-source-link:hover {
  color: var(--green);
}

.news-focus-button {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 7px 9px;
  color: var(--green);
  background: #0b1b13;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.webcam-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: minmax(105px, 1fr);
  gap: 1px;
  min-height: 0;
  overflow: auto;
  padding: 8px;
  background: #050608;
}

.webcam-card {
  display: grid;
  width: 100%;
  align-content: end;
  border: 1px solid var(--line);
  padding: 10px;
  color: var(--text);
  text-align: left;
}

.webcam-card.critical {
  background:
    linear-gradient(135deg, rgba(255, 77, 77, 0.22), transparent 34%),
    radial-gradient(circle at 72% 38%, rgba(255, 255, 255, 0.18), transparent 24%),
    linear-gradient(180deg, #37363b, #101318);
}

.webcam-card.elevated {
  background:
    linear-gradient(135deg, rgba(255, 171, 23, 0.2), transparent 34%),
    radial-gradient(circle at 70% 36%, rgba(255, 255, 255, 0.16), transparent 24%),
    linear-gradient(180deg, #2f3436, #101318);
}

.webcam-card span,
.webcam-card em {
  color: #c6ccd5;
  font-size: 11px;
  font-style: normal;
}

.webcam-card strong {
  margin: 4px 0;
  color: #fff;
  font-size: 16px;
}

.webcam-card small {
  display: block;
  margin-top: 6px;
  color: rgba(230, 236, 244, 0.72);
  font-size: 11px;
  line-height: 1.45;
}

.ai-panel {
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.live-pill {
  border: 1px solid #235b39;
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--green) !important;
  background: #0b1b13;
}

.ai-card {
  width: 100%;
  border: 1px solid #263149;
  border-left: 4px solid #9cb5ff;
  border-radius: 4px;
  padding: 12px;
  color: var(--text);
  background: #151728;
  text-align: left;
}

.ai-card.critical {
  border-left-color: var(--red);
}

.ai-card div,
.posture-card div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.ai-card p,
.posture-card p {
  margin: 10px 0 0;
  color: #d9dfe8;
  font-size: 13px;
  line-height: 1.6;
}

.posture-stack {
  border-top: 1px solid var(--line);
  align-content: start;
}

.posture-card {
  width: 100%;
  border: 1px solid rgba(255, 77, 77, 0.35);
  border-left: 4px solid var(--red);
  border-radius: 8px;
  padding: 12px;
  color: var(--text);
  background: rgba(69, 20, 24, 0.78);
  text-align: left;
}

.posture-card.elevated {
  border-color: rgba(255, 171, 23, 0.35);
  border-left-color: var(--amber);
  background: rgba(55, 39, 15, 0.78);
}

.single-panel {
  height: 100%;
  padding: 8px;
}

.single-panel .wm-panel {
  height: 100%;
}

.single-panel .broadcast-frame {
  min-height: 270px;
}

.single-panel .webcam-grid {
  grid-auto-rows: minmax(170px, 1fr);
}

.single-panel .ai-panel.wide {
  grid-template-columns: 1fr 0.72fr;
  grid-template-rows: auto minmax(0, 1fr);
}

.single-panel .ai-panel.wide .wm-panel-head {
  grid-column: 1 / -1;
}

.single-panel .ai-panel.wide .posture-stack {
  border-top: 0;
  border-left: 1px solid var(--line);
}

.sources-layout,
.subscription-layout {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  height: 100%;
  padding: 8px;
  overflow: auto;
}

.source-health-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: visible;
}

.source-health,
.source-group,
.plan-card {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 12px;
  background: #111419;
}

.source-health span,
.source-health em,
.source-group span,
.source-group em,
.plan-card span,
.plan-card p,
.subscription-copy p {
  color: var(--muted);
}

.source-health strong {
  display: block;
  margin: 8px 0;
  font-size: 28px;
}

.source-health em,
.source-group em {
  color: var(--green);
  font-style: normal;
}

.source-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: visible;
}

.source-group {
  display: grid;
  gap: 10px;
}

.source-group p {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  border-top: 1px solid var(--line-soft);
  padding-top: 8px;
}

.subscription-layout {
  grid-template-rows: auto 1fr;
}

.subscription-hero {
  min-height: 190px;
}

.subscription-copy {
  padding: 24px;
}

.subscription-copy h2 {
  margin: 0 0 10px;
  font-family: var(--font-ui);
  font-size: 28px;
}

.subscription-copy p {
  max-width: 820px;
  margin: 0;
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.75;
}

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

.plan-card strong {
  display: block;
  margin: 10px 0 14px;
  font-size: 26px;
}

.plan-card.current {
  border-color: #235b39;
  background:
    linear-gradient(180deg, rgba(67, 240, 126, 0.08), transparent 48%),
    #111419;
}

.plan-card small {
  display: block;
  min-height: 18px;
  color: var(--muted);
}

.plan-card p {
  margin: 8px 0 0;
}

.plan-button {
  width: 100%;
  margin-top: 18px;
  border: 1px solid #235b39;
  border-radius: 4px;
  padding: 10px 12px;
  color: #061008;
  background: var(--green);
  font-weight: 900;
}

.plan-button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.empty-feed {
  border: 1px dashed var(--line);
  border-radius: 4px;
  padding: 12px;
  color: var(--muted);
  background: rgba(17, 20, 25, 0.6);
}

.toast-message {
  position: fixed;
  right: 18px;
  top: 18px;
  z-index: 60;
  max-width: min(420px, calc(100vw - 36px));
  border: 1px solid #235b39;
  border-radius: 4px;
  padding: 10px 12px;
  color: var(--green);
  background: rgba(8, 32, 20, 0.96);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.42);
}

.toast-message.error {
  border-color: rgba(255, 77, 77, 0.62);
  color: #ffd1d1;
  background: rgba(55, 13, 17, 0.96);
}

.search-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: start center;
  padding: 96px 16px 16px;
}

.search-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.62);
}

.search-card {
  position: relative;
  z-index: 2;
  display: grid;
  width: min(720px, 100%);
  max-height: min(720px, calc(100vh - 130px));
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #0b0d10;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.62);
}

.search-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 14px;
}

.search-head strong,
.search-head span {
  display: block;
}

.search-head span {
  margin-top: 4px;
  color: var(--muted);
}

.search-field {
  padding: 14px;
}

.search-results {
  display: grid;
  gap: 8px;
  overflow: auto;
  padding: 0 14px 14px;
}

.search-result {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) minmax(160px, 0.6fr);
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 11px 12px;
  color: var(--text);
  background: #111419;
  text-align: left;
}

.search-result:hover {
  border-color: var(--green);
}

.search-result span {
  color: var(--green);
}

.search-result em {
  color: var(--muted);
  font-style: normal;
}

.monitor-loading {
  display: grid;
  place-content: center;
  gap: 10px;
  height: 100%;
  color: var(--muted);
  text-align: center;
}

.monitor-loading strong {
  color: var(--text);
  font-size: 18px;
}

.workspace-shell {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  min-height: 100vh;
  background: #050505;
  color: var(--text);
}

.workspace-top-nav {
  display: inline-flex;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px;
  background: #090b0f;
}

.workspace-top-nav button {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 4px;
  padding: 7px 10px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  white-space: nowrap;
  text-align: center;
}

.workspace-top-nav button.active {
  color: #061008;
  background: var(--green);
  font-weight: 900;
}

.workspace-main {
  min-height: 0;
  overflow: hidden;
}

.realtime-layout,
.ai-analysis-layout,
.history-layout {
  height: 100vh;
  min-height: 640px;
  overflow: hidden;
  padding: 10px;
}

.realtime-layout {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
}

.workspace-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 14px;
  background: #0f1216;
}

.realtime-toolbar {
  min-height: 58px;
  padding: 8px 10px;
}

.workspace-page-head strong {
  display: block;
  font-size: 18px;
}

.workspace-page-head span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.page-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.toolbar-group-right {
  margin-left: auto;
}

.toolbar-label {
  display: inline-flex;
  align-items: center;
  height: 30px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.range-tabs,
.region-tabs {
  display: inline-flex;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px;
  background: #090b0f;
}

.range-tabs button,
.region-tabs button {
  border: 0;
  border-radius: 4px;
  padding: 7px 10px;
  color: var(--muted);
  background: transparent;
  white-space: nowrap;
  font-size: 12px;
}

.range-tabs button.active,
.region-tabs button.active {
  color: #061008;
  background: var(--green);
  font-weight: 900;
}

.realtime-grid {
  display: grid;
  grid-template-columns: minmax(520px, 1.15fr) minmax(420px, 0.85fr);
  gap: 10px;
  min-height: 0;
}

.ai-analysis-layout {
  display: grid;
  grid-template-columns: minmax(460px, 1fr) minmax(300px, 360px);
  gap: 10px;
}

.history-layout {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
}

.conversation-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #0b0d10;
}

.conversation-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding: 14px;
  background: #0f1216;
}

.conversation-head strong {
  display: block;
  font-size: 18px;
}

.conversation-head span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.conversation-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.compact-map-stage {
  min-height: 0;
}

.compact-map-stage .map-shell {
  display: grid;
  position: absolute;
  inset: 40px 0 0;
}

.static-map-shell {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100%;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  background:
    radial-gradient(circle at 48% 42%, rgba(67, 240, 126, 0.08), transparent 35%),
    #11161a;
}

.static-map-shell.dragging {
  cursor: grabbing;
}

.static-map-viewport {
  position: relative;
  width: min(100%, 1180px);
  aspect-ratio: 1000 / 520;
  max-height: calc(100% - 18px);
  transform-origin: center center;
  transition: transform 180ms ease;
}

.static-map-shell .world-map-svg {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 10px;
}

.static-map-points {
  position: absolute;
  inset: 0;
  z-index: 4;
}

.static-map-point {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 170px;
  border: 0;
  padding: 0;
  color: #d8fff0;
  background: transparent;
  transform: translate(-50%, -50%);
}

.static-map-point span {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 6px rgba(67, 240, 126, 0.12), 0 0 18px rgba(67, 240, 126, 0.7);
}

.static-map-point.critical span {
  background: var(--red);
  box-shadow: 0 0 0 6px rgba(255, 77, 77, 0.13), 0 0 18px rgba(255, 77, 77, 0.7);
}

.static-map-point.elevated span,
.static-map-point.hot span {
  background: var(--amber);
  box-shadow: 0 0 0 6px rgba(255, 171, 23, 0.13), 0 0 18px rgba(255, 171, 23, 0.7);
}

.static-map-point strong {
  overflow: hidden;
  padding: 3px 6px;
  border: 1px solid rgba(37, 42, 49, 0.78);
  border-radius: 4px;
  background: rgba(5, 5, 5, 0.72);
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-color-legend {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 8;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  max-width: min(760px, calc(100% - 24px));
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--muted);
  background: rgba(4, 5, 7, 0.88);
  font-size: 12px;
}

.map-color-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.map-color-legend i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--green);
}

.map-color-legend .legend-critical { background: var(--red); }
.map-color-legend .legend-elevated { background: var(--amber); }
.map-color-legend .legend-monitoring { background: var(--green); }
.map-color-legend .legend-base { background: var(--blue); border-radius: 2px; }
.map-color-legend .legend-datacenter { background: var(--purple); }

.compact-news-panel {
  min-height: 0;
}

.compact-news-panel .news-feed {
  padding-bottom: 14px;
}

.ai-side-panel {
  display: grid;
  grid-template-rows: 1fr;
  gap: 10px;
  min-height: 0;
}

.ai-side-panel .wm-panel {
  height: 100%;
}

.ai-source-list {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow: auto;
  padding: 10px;
}

.ai-source-item {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px;
  color: var(--text);
  background: #111419;
  text-decoration: none;
}

.ai-source-item:hover {
  border-color: #235b39;
  background: #102119;
}

.ai-source-item span,
.ai-source-item em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.ai-source-item strong {
  line-height: 1.45;
}

.history-list {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow: auto;
  padding: 10px;
}

.history-page-panel {
  min-height: 0;
}

.history-list-page {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: auto;
}

.history-item {
  display: grid;
  gap: 5px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  color: var(--text);
  background: #111419;
  text-align: left;
}

.history-item.active,
.history-item:hover {
  border-color: #235b39;
  background: #102119;
}

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

.history-item em {
  color: var(--green);
  font-size: 12px;
  font-style: normal;
}

.chat-feed {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 0;
  overflow: auto;
  padding: 14px;
}

.assistant-message,
.user-message {
  max-width: 86%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  line-height: 1.65;
}

.assistant-message {
  justify-self: start;
  background: #111419;
}

.user-message {
  justify-self: end;
  border-color: #235b39;
  background: #0b1b13;
}

.assistant-message p,
.user-message p {
  margin: 0;
  white-space: pre-wrap;
}

.markdown-answer {
  display: grid;
  gap: 9px;
}

.markdown-answer h4 {
  margin: 6px 0 0;
  color: #d8fff0;
  font-size: 14px;
}

.markdown-answer h4:first-child {
  margin-top: 0;
}

.markdown-answer p {
  margin: 0;
  white-space: normal;
}

.markdown-answer ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 18px;
}

.markdown-answer code {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 4px;
  color: var(--green);
  background: #090b0f;
}

.typing-cursor {
  display: inline-flex;
  margin-top: 8px;
  color: var(--green);
  font-size: 12px;
}

.message-role,
.assistant-message small {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
}

.insight-message {
  border-left: 4px solid var(--green);
}

.insight-message.critical,
.posture-message.critical {
  border-left-color: var(--red);
}

.posture-message.elevated {
  border-left-color: var(--amber);
}

.insight-message-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.insight-message-head span {
  color: var(--green);
  font-size: 12px;
}

.answer-cards {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.answer-card {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  padding: 10px;
  color: var(--text);
  background: #0b0d10;
  text-decoration: none;
}

.answer-card span,
.answer-card p {
  color: var(--muted);
  font-size: 12px;
}

.chat-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding: 12px;
  background: #090b0f;
}

.chat-composer input {
  height: 46px;
}

.chat-composer .primary-button {
  min-width: 92px;
}

.subscription-only-layout {
  height: 100vh;
  align-content: start;
}

.single-plan-grid {
  max-width: 520px;
  grid-template-columns: 1fr;
}

.single-plan-grid .plan-card strong {
  font-size: 36px;
}

@media (max-width: 1180px) {
  .workspace-main,
  .realtime-layout,
  .ai-analysis-layout,
  .history-layout,
  .subscription-only-layout {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .workspace-page-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .toolbar-group {
    width: 100%;
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar-group-right {
    margin-left: 0;
  }

  .ai-analysis-layout {
    grid-template-columns: 1fr;
  }

  .realtime-grid {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(520px, auto) minmax(420px, auto);
  }

  .history-list-page {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ai-side-panel .wm-panel {
    min-height: 360px;
  }

  .monitor-shell {
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }

  .monitor-content {
    overflow: visible;
  }

  .worldmonitor-layout,
  .sources-layout,
  .subscription-layout {
    height: auto;
  }

  .worldmonitor-layout {
    grid-template-rows: auto auto;
  }

  .map-stage {
    min-height: 680px;
  }

  .bottom-deck,
  .source-health-grid,
  .source-list,
  .plan-grid {
    grid-template-columns: 1fr;
  }

  .monitor-topbar {
    flex-wrap: wrap;
    min-height: 54px;
    height: auto;
  }

  .center-cluster {
    flex: 0 0 auto;
  }

  .map-legend {
    left: 330px;
    right: 14px;
    flex-wrap: wrap;
    white-space: normal;
  }
}

@media (max-width: 760px) {
  .auth-layout {
    grid-template-columns: 1fr;
  }

  .auth-preview {
    min-height: 420px;
    grid-template-rows: 320px auto;
  }

  .auth-intro {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .auth-intro h1 {
    font-size: 26px;
  }

  .auth-side {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 16px;
  }

  .monitor-shell {
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  .range-tabs,
  .region-tabs,
  .workspace-top-nav {
    width: 100%;
  }

  .workspace-top-nav button {
    min-width: 0;
    flex: 1 0 auto;
  }

  .realtime-layout,
  .ai-analysis-layout,
  .history-layout {
    padding: 8px;
  }

  .range-tabs,
  .region-tabs,
  .workspace-top-nav {
    overflow-x: auto;
  }

  .page-actions {
    display: grid;
    gap: 8px;
  }

  .toolbar-group {
    display: grid;
    gap: 6px;
  }

  .monitor-cluster {
    flex-wrap: wrap;
  }

  .layer-panel,
  .time-strip,
  .map-zoom,
  .map-legend {
    position: relative;
    inset: auto;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    width: auto;
    margin: 10px;
  }

  .map-stage {
    display: grid;
    min-height: 560px;
    align-content: start;
  }

  .map-shell {
    position: relative;
    inset: auto;
    min-height: 460px;
  }

  .compact-map-stage .map-shell {
    position: relative;
    inset: auto;
  }

  .leaflet-map {
    min-height: 420px;
  }

  .map-zoom {
    display: flex;
  }

  .webcam-grid {
    grid-template-columns: 1fr;
  }

  .broadcast-frame {
    grid-template-columns: 1fr;
  }

  .broadcast-stack {
    min-height: 130px;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: none;
  }

  .news-row {
    grid-template-columns: 74px minmax(0, 1fr);
  }

  .news-thumb {
    width: 74px;
  }

  .news-focus-button {
    grid-column: 2;
    width: fit-content;
  }

  .source-tabs,
  .monitor-tabs {
    scrollbar-width: thin;
  }

  .history-list-page {
    grid-template-columns: 1fr;
  }

  .map-color-legend {
    right: 10px;
    font-size: 11px;
  }

  .assistant-message,
  .user-message {
    max-width: 100%;
  }

  .chat-composer {
    grid-template-columns: 1fr;
  }

  .toast-message {
    right: 10px;
    left: 10px;
    top: 10px;
    max-width: none;
  }
}
