:root {
  --bg: #02050a;
  --panel: rgba(3, 11, 18, .76);
  --panel-strong: rgba(5, 16, 26, .94);
  --line: rgba(132, 249, 255, .2);
  --line-strong: rgba(157, 255, 255, .62);
  --text: #e9fbff;
  --muted: #8ea9b7;
  --cyan: #a8fbff;
  --cyan-hot: #35f8ff;
  --blue: #69adff;
  --violet: #b476ff;
  --amber: #ffd75a;
  --green: #20f0ad;
  --red: #ff4f5f;
  --ocean: #030b14;
  --land: rgba(64, 84, 101, .66);
  --active: #12d69c;
  --shadow: 0 28px 90px rgba(0, 0, 0, .58);
}

body.light {
  --bg: #eaf6fb;
  --panel: rgba(245, 253, 255, .78);
  --panel-strong: rgba(255, 255, 255, .96);
  --line: rgba(18, 125, 150, .22);
  --line-strong: rgba(20, 172, 198, .5);
  --text: #07121c;
  --muted: #586f80;
  --cyan: #07121c;
  --cyan-hot: #07121c;
  --blue: #07121c;
  --violet: #07121c;
  --green: #07121c;
  --ocean: #030b14;
  --land: rgba(64, 84, 101, .66);
  --shadow: 0 24px 68px rgba(45, 92, 118, .18);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 12%, rgba(35, 248, 255, .14), transparent 26%),
    radial-gradient(circle at 76% 9%, rgba(79, 80, 255, .15), transparent 32%),
    radial-gradient(circle at 50% 100%, rgba(20, 160, 255, .13), transparent 42%),
    var(--bg);
  font-family: Manrope, Inter, Segoe UI, Arial, sans-serif;
  letter-spacing: 0;
  overflow-x: hidden;
}

#starfield {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -3;
}

.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  opacity: .22;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.055) 0 1px, transparent 1px 5px),
    linear-gradient(90deg, rgba(67,244,255,.035) 1px, transparent 1px);
  background-size: 100% 5px, 44px 44px;
  mask-image: radial-gradient(circle at center, #000, transparent 88%);
}

.deck {
  width: min(1860px, calc(100vw - 22px));
  margin: 0 auto;
  padding: 12px 0 28px;
}

.command-bar,
.card,
.header-stat,
.ghost-button,
.side-toggle,
.filter {
  position: relative;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(120, 255, 255, .035), rgba(0, 0, 0, .04)), var(--panel);
  box-shadow: var(--shadow), inset 0 1px rgba(255,255,255,.08);
}

.command-bar {
  display: grid;
  grid-template-columns: minmax(310px, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 42px;
  padding: 4px 12px;
  border-radius: 8px;
  overflow: hidden;
  clip-path: polygon(0 0, calc(100% - 26px) 0, 100% 26px, 100% 100%, 22px 100%, 0 calc(100% - 22px));
}

.command-bar:before,
.card:before {
  content: "";
  position: absolute;
  inset: 8px;
  pointer-events: none;
  border: 1px solid rgba(132, 249, 255, .07);
  clip-path: polygon(0 0, 82px 0, 82px 1px, 1px 1px, 1px 46px, 0 46px, 0 0, 100% 0, 100% 46px, calc(100% - 1px) 46px, calc(100% - 1px) 1px, calc(100% - 82px) 1px, calc(100% - 82px) 0);
}

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

.eyebrow {
  color: var(--cyan-hot);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .18em;
}

h1, h2, p { margin: 0; }

.star-title {
  margin-top: 1px;
  font-family: Manrope, "Arial Narrow", Arial, sans-serif;
  font-size: clamp(17px, 1.3vw, 24px);
  line-height: 1.05;
  text-transform: uppercase;
  letter-spacing: .055em;
  color: var(--cyan);
  font-weight: 800;
  -webkit-text-stroke: 0;
  text-shadow:
    0 0 10px rgba(168, 251, 255, .34),
    0 0 22px rgba(53, 248, 255, .16);
}

body.light .eyebrow,
body.light .star-title,
body.light .filter.active,
body.light .ghost-button.active,
body.light .ghost-button:hover,
body.light .status-pill,
body.light .status-pill.needs_review,
body.light .status-pill.ready_to_send,
body.light .status-pill.parsed,
body.light .status-pill.paused,
body.light .route-box svg text,
body.light .scope-line {
  color: #07121c;
  text-shadow: none;
}

.command-bar p {
  margin-top: 1px;
  color: var(--muted);
  max-width: 590px;
  font-size: 11px;
}

.command-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.header-stats {
  display: flex;
  gap: 8px;
}

.header-stat {
  width: 118px;
  min-height: 38px;
  padding: 4px 10px;
  border-radius: 0;
  overflow: hidden;
  clip-path: polygon(12px 0, 100% 0, calc(100% - 12px) 100%, 0 100%, 0 12px);
}

.header-stat:after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  top: 0;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 0 20px var(--accent);
}

.header-stat.cyan { --accent: var(--cyan-hot); }
.header-stat.blue { --accent: var(--blue); }
.header-stat span {
  display: block;
  color: var(--muted);
  font-size: 10px;
}
.header-stat strong {
  display: block;
  margin-top: 1px;
  font-size: 19px;
  line-height: 1;
}

.sync-stack {
  display: grid;
  gap: 4px;
  justify-items: end;
}

.sync-pill,
.ghost-button {
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255,255,255,.035);
  padding: 4px 10px;
  font: inherit;
  font-size: 11px;
}

.sync-pill {
  display: inline-flex;
  border-radius: 999px;
  white-space: nowrap;
}

.ghost-button {
  border-radius: 0;
  cursor: pointer;
  clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%, 0 10px);
  transition: border .16s ease, box-shadow .16s ease, color .16s ease;
}

.ghost-button:hover,
.ghost-button.active {
  color: var(--cyan);
  border-color: var(--line-strong);
  box-shadow: 0 0 24px rgba(67,244,255,.16);
}

.side-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 172px;
  padding: 3px 9px;
  border-radius: 999px;
  color: var(--text);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.side-toggle b { font-weight: 800; }

.side-track {
  position: relative;
  width: 42px;
  height: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(168, 251, 255, .08);
}

.side-track i {
  position: absolute;
  top: 2px;
  left: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 14px var(--cyan);
  transition: transform .2s ease, background .2s ease;
}

body.light .side-track i {
  transform: translateX(21px);
  background: var(--amber);
  box-shadow: 0 0 14px var(--amber);
}

.command-grid {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr) 310px;
  gap: 14px;
  align-items: stretch;
  margin-top: 14px;
}

.card {
  border-radius: 8px;
  overflow: hidden;
  backdrop-filter: blur(18px);
}

.sector-list,
.sector-panel {
  min-height: 720px;
  padding: 16px;
}

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

.card-title span {
  font-size: 16px;
  font-weight: 800;
}

.card-title b,
.panel-kicker {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .14em;
}

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

.filter {
  padding: 7px 10px;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%, 0 8px);
}

.filter.active {
  color: var(--cyan);
  border-color: var(--line-strong);
  background: rgba(67,244,255,.08);
}

.country-list {
  display: grid;
  gap: 8px;
  max-height: 615px;
  overflow: auto;
  padding-right: 4px;
}

.country-row {
  border: 1px solid transparent;
  padding: 10px;
  background: rgba(255,255,255,.035);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%, 0 10px);
}

.country-row:hover,
.country-row.active {
  border-color: var(--line-strong);
  background: rgba(67,244,255,.08);
}

.country-row strong {
  display: block;
  font-size: 13px;
}

.country-row small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.holo-stage {
  min-height: 720px;
  padding: 16px 16px 0;
  background:
    radial-gradient(circle at 50% 45%, rgba(67,244,255,.08), transparent 24%),
    radial-gradient(circle at 50% 66%, rgba(39,245,178,.09), transparent 22%),
    var(--panel);
}

.stage-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.stage-header h2 {
  margin-top: 4px;
  font-size: 21px;
}

.stage-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.globe-wrap {
  position: relative;
  min-height: 650px;
  margin-top: 8px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(132, 249, 255, .08);
  border-radius: 10px;
  background:
    radial-gradient(circle at 24% 18%, rgba(78, 111, 255, .17), transparent 24%),
    radial-gradient(circle at 78% 30%, rgba(255, 215, 90, .08), transparent 18%),
    #030914;
}

.stellar-backdrop {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  opacity: .9;
}

.rebel-mark {
  position: absolute;
  left: 50%;
  top: 52%;
  width: min(78vw, 850px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  opacity: .035;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 51%, transparent 0 20%, rgba(255,255,255,.85) 21% 23%, transparent 24%),
    conic-gradient(from 18deg, transparent 0 34deg, rgba(255,255,255,.9) 35deg 60deg, transparent 61deg 145deg, rgba(255,255,255,.9) 146deg 172deg, transparent 173deg 213deg, rgba(255,255,255,.9) 214deg 239deg, transparent 240deg 326deg, rgba(255,255,255,.9) 327deg 352deg, transparent 353deg);
  filter: blur(.2px);
}

.planet {
  position: absolute;
  display: block;
  border-radius: 50%;
  opacity: .22;
  filter: blur(.2px);
}

.planet-a {
  left: 6%;
  top: 12%;
  width: 80px;
  height: 80px;
  background: radial-gradient(circle at 35% 28%, #fff, #7cc7ff 20%, #11496a 68%, transparent 70%);
}
.planet-b {
  right: 9%;
  top: 17%;
  width: 46px;
  height: 46px;
  background: radial-gradient(circle at 35% 30%, #fff4bd, #d99139 34%, #58331c 72%);
}
.planet-c {
  left: 14%;
  bottom: 12%;
  width: 36px;
  height: 36px;
  background: radial-gradient(circle at 35% 28%, #d9fff7, #2ce1b2 35%, #064536 74%);
}
.planet-d {
  right: 18%;
  bottom: 10%;
  width: 118px;
  height: 42px;
  border: 2px solid rgba(168,251,255,.22);
  transform: rotate(-12deg);
}
.planet-d:before {
  content: "";
  position: absolute;
  left: 36px;
  top: -24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 25%, #fff, #86a0ff 28%, #20224a 76%);
}

#globe {
  position: relative;
  z-index: 1;
  width: min(100%, 1080px);
  height: min(72vh, 690px);
  min-height: 610px;
  display: block;
  filter: drop-shadow(0 0 40px rgba(67,244,255,.14));
  cursor: grab;
}

#globe:active { cursor: grabbing; }

.sphere {
  fill: var(--ocean);
  stroke: rgba(67,244,255,.34);
  stroke-width: 1.2;
}

.graticule {
  fill: none;
  stroke: rgba(112, 231, 255, .16);
  stroke-width: .55;
}

.country {
  fill: var(--land);
  stroke: rgba(206, 246, 255, .24);
  stroke-linejoin: round;
  stroke-linecap: round;
  stroke-width: .35;
  cursor: default;
}

.country.has-data {
  fill: rgba(34, 185, 134, .52);
  stroke: rgba(177, 255, 236, .42);
  cursor: pointer;
}

.country.sent { fill: rgba(25, 179, 130, .58); }
.country.ready_to_send { fill: rgba(255, 191, 87, .44); }
.country.needs_review { fill: rgba(255, 90, 111, .5); }
.country.parsed { fill: rgba(88, 166, 255, .5); }
.country.paused { fill: rgba(137, 151, 172, .42); }

.country.active,
.country.has-data:hover {
  fill: rgba(28, 226, 175, .94);
  stroke: #f1fffb;
  stroke-width: .9;
  filter: drop-shadow(0 0 11px rgba(67,244,255,.75));
}

.route {
  fill: none;
  stroke: var(--amber);
  stroke-width: 1.15;
  stroke-dasharray: 6 7;
  filter: drop-shadow(0 0 8px rgba(255,191,87,.7));
  animation: dash 1.8s linear infinite;
}

.pulse-dot {
  fill: #fff;
  stroke: var(--cyan);
  stroke-width: 2;
  filter: drop-shadow(0 0 8px rgba(67,244,255,.9));
}

body.light .globe-wrap {
  background:
    radial-gradient(circle at 50% 50%, rgba(31, 220, 190, .13), transparent 42%),
    radial-gradient(circle at 14% 18%, rgba(54, 96, 182, .34), transparent 18%),
    radial-gradient(circle at 86% 20%, rgba(220, 160, 80, .18), transparent 14%),
    #030914;
}

body.light .stellar-backdrop {
  opacity: .78;
}

body.light .sphere {
  fill: #030b14;
  stroke: rgba(67,244,255,.34);
}

body.light .graticule {
  stroke: rgba(112, 231, 255, .16);
}

body.light .country {
  fill: rgba(64, 84, 101, .66);
  stroke: rgba(206, 246, 255, .24);
}

body.light .country.has-data {
  fill: rgba(34, 185, 134, .52);
  stroke: rgba(177, 255, 236, .42);
}

body.light .country.sent { fill: rgba(25, 179, 130, .58); }
body.light .country.ready_to_send { fill: rgba(255, 191, 87, .44); }
body.light .country.needs_review { fill: rgba(255, 90, 111, .5); }
body.light .country.parsed { fill: rgba(88, 166, 255, .5); }
body.light .country.paused { fill: rgba(137, 151, 172, .42); }

body.light .country.active,
body.light .country.has-data:hover {
  fill: rgba(28, 226, 175, .94);
  stroke: #f1fffb;
}

body.light .pulse-dot {
  fill: #fff;
  stroke: #35f8ff;
}

@keyframes dash { to { stroke-dashoffset: -26; } }

.reticle,
.orbit {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  border-radius: 50%;
  border: 1px solid rgba(67,244,255,.17);
}

.reticle {
  width: min(60vw, 610px);
  height: min(60vw, 610px);
  max-height: 610px;
  box-shadow:
    inset 0 0 0 18px rgba(67,244,255,.015),
    inset 0 0 0 82px rgba(67,244,255,.012),
    0 0 70px rgba(67,244,255,.08);
}

.reticle:before {
  content: "";
  position: absolute;
  left: 50%;
  top: -7%;
  width: 2px;
  height: 114%;
  background: linear-gradient(transparent, rgba(67,244,255,.34), transparent);
  animation: scan 4.8s ease-in-out infinite;
}

@keyframes scan {
  0%, 100% { transform: translateX(-50%) rotate(0deg); opacity: .08; }
  50% { transform: translateX(-50%) rotate(180deg); opacity: .62; }
}

.orbit-a {
  width: min(76vw, 800px);
  height: min(29vw, 300px);
  transform: rotate(-12deg);
}

.orbit-b {
  width: min(72vw, 720px);
  height: min(22vw, 220px);
  transform: rotate(24deg);
  border-color: rgba(180,118,255,.15);
}

.tooltip {
  position: absolute;
  z-index: 5;
  min-width: 220px;
  padding: 13px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(3, 10, 20, .9);
  color: var(--text);
  box-shadow: 0 18px 48px rgba(0,0,0,.45), 0 0 34px rgba(67,244,255,.12);
  pointer-events: none;
}

body.light .tooltip { background: rgba(255,255,255,.94); }
.tooltip strong { display: block; font-size: 15px; }
.tooltip span { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }

.sector-panel h2 {
  margin: 8px 0;
  font-size: 28px;
  line-height: 1;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  color: var(--green);
  padding: 8px 11px;
  background: rgba(39,245,178,.08);
  font-size: 12px;
  font-weight: 800;
  clip-path: polygon(9px 0, 100% 0, calc(100% - 9px) 100%, 0 100%, 0 9px);
}

.status-pill.needs_review { color: var(--red); background: rgba(255,90,111,.1); }
.status-pill.ready_to_send { color: var(--amber); background: rgba(255,191,87,.1); }
.status-pill.parsed { color: var(--blue); background: rgba(88,166,255,.1); }
.status-pill.paused { color: var(--muted); background: rgba(145,166,189,.1); }

.readouts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 18px 0;
}

.readouts div,
.route-box {
  border: 1px solid var(--line);
  padding: 12px;
  background: rgba(255,255,255,.035);
  clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%, 0 10px);
}

.readouts b {
  display: block;
  font-size: 20px;
  line-height: 1.1;
}

.readouts span,
.route-box span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

#routeScope {
  width: 100%;
  height: 90px;
  margin-top: 8px;
}

.scope-line {
  stroke: var(--cyan);
  stroke-width: 2;
  fill: none;
  stroke-dasharray: 4 6;
  animation: dash 1.4s linear infinite;
}

.scope-node {
  fill: var(--panel-strong);
  stroke: var(--cyan);
  stroke-width: 2;
}

body.light .scope-line,
body.light .scope-node {
  stroke: #07121c;
}

.mission-log {
  margin-top: 14px;
  padding: 16px;
}

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

.campaign {
  border: 1px solid var(--line);
  padding: 13px;
  background: rgba(255,255,255,.035);
  clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%, 0 10px);
}

.campaign strong {
  display: block;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.campaign small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.5;
}

@media (max-width: 1280px) {
  .command-bar { grid-template-columns: 1fr; }
  .command-actions { justify-content: space-between; }
  .command-grid { grid-template-columns: 1fr; }
  .sector-list, .sector-panel, .holo-stage { min-height: auto; }
  .country-list { max-height: 240px; }
  .campaign-log { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 780px) {
  .deck { width: min(100vw - 14px, 1860px); padding-top: 8px; }
  .command-actions { align-items: stretch; flex-direction: column; }
  .header-stat { flex: 1; width: auto; }
  .sync-stack { justify-items: stretch; }
  .side-toggle { width: 100%; justify-content: center; }
  .campaign-log { grid-template-columns: 1fr; }
  #globe { min-height: 460px; }
  .globe-wrap { min-height: 500px; }
}

.crm-overview {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.metric-card {
  position: relative;
  min-height: 104px;
  padding: 14px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(120, 255, 255, .055), rgba(0, 0, 0, .02)),
    var(--panel);
  box-shadow: var(--shadow), inset 0 1px rgba(255,255,255,.08);
  overflow: hidden;
  clip-path: polygon(12px 0, 100% 0, calc(100% - 12px) 100%, 0 100%, 0 12px);
}

.metric-card:before {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  top: 0;
  height: 2px;
  background: var(--accent, var(--cyan-hot));
  box-shadow: 0 0 18px var(--accent, var(--cyan-hot));
}

.metric-card.success { --accent: var(--green); }
.metric-card.offer { --accent: var(--amber); }
.metric-card.review { --accent: var(--violet); }

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .1em;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(24px, 2.3vw, 42px);
  line-height: 1;
}

.metric-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.command-grid {
  grid-template-columns: 1fr;
  margin-top: 14px;
}

.holo-stage {
  min-height: calc(100vh - 360px);
  padding-bottom: 16px;
}

.globe-wrap {
  min-height: min(72vh, 760px);
}

#globe {
  height: min(72vh, 740px);
  min-height: 570px;
}

.sync-note span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .14em;
}

.sync-note strong {
  display: block;
  margin-top: 4px;
  font-size: 15px;
}

.crm-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr) minmax(260px, .7fr);
  gap: 14px;
  margin-top: 14px;
}

.pipeline-card,
.ideas-card,
.sites-card,
.sync-note {
  padding: 16px;
}

.pipeline-list {
  display: grid;
  gap: 9px;
}

.pipeline-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  min-height: 76px;
  padding: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.035);
  overflow: hidden;
  clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%, 0 10px);
}

.pipeline-row i {
  position: absolute;
  left: 0;
  bottom: 0;
  width: var(--bar);
  height: 2px;
  background: var(--cyan-hot);
  box-shadow: 0 0 16px var(--cyan-hot);
}

.pipeline-row.won i { background: var(--green); box-shadow: 0 0 16px var(--green); }
.pipeline-row.proposal i { background: var(--amber); box-shadow: 0 0 16px var(--amber); }
.pipeline-row.negotiation i { background: var(--violet); box-shadow: 0 0 16px var(--violet); }
.pipeline-row.lost i { background: var(--red); box-shadow: 0 0 16px var(--red); }

.pipeline-row strong,
.site-link strong {
  display: block;
  font-size: 14px;
}

.pipeline-row small,
.pipeline-values span,
.site-link small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.pipeline-values {
  text-align: right;
  white-space: nowrap;
}

.pipeline-values b {
  display: block;
  font-size: 24px;
}

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

.insight-item {
  min-height: 48px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255,255,255,.035);
  font-size: 13px;
  line-height: 1.35;
  clip-path: polygon(9px 0, 100% 0, calc(100% - 9px) 100%, 0 100%, 0 9px);
}

.site-links {
  display: grid;
  gap: 7px;
}

.site-link {
  display: block;
  min-height: 64px;
  padding: 12px;
  border: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
  background:
    linear-gradient(90deg, rgba(67,244,255,.08), transparent),
    rgba(255,255,255,.035);
  clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%, 0 10px);
  transition: border .16s ease, transform .16s ease, background .16s ease;
}

.site-link:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
  background:
    linear-gradient(90deg, rgba(67,244,255,.15), transparent),
    rgba(255,255,255,.055);
}

.site-link.pending {
  cursor: default;
  opacity: .76;
}

.sync-note {
  margin-top: 14px;
}

@media (max-width: 1280px) {
  .crm-overview { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .crm-grid { grid-template-columns: 1fr; }
}

@media (max-width: 780px) {
  .crm-overview { grid-template-columns: 1fr; }
  .stage-header { align-items: stretch; flex-direction: column; }
  .stage-controls { justify-content: flex-start; }
  .pipeline-row { grid-template-columns: 1fr; }
  .pipeline-values { text-align: left; }
}

.command-actions {
  align-items: center;
}

.command-actions .header-stats {
  display: flex;
  gap: 8px;
}

.command-actions .header-stat {
  width: 124px;
  min-height: 38px;
}

.command-actions .header-stat strong {
  margin-top: 1px;
  font-size: 20px;
}

.command-grid {
  grid-template-columns: minmax(250px, 300px) minmax(0, 1fr) minmax(250px, 300px);
  align-items: stretch;
}

.deal-rail,
.sites-card {
  min-height: calc(100vh - 88px);
  padding: 16px;
}

.deal-rail .card-title {
  margin-bottom: 16px;
}

.deal-rail .pipeline-list {
  gap: 8px;
}

.deal-rail .pipeline-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "note note"
    "title title"
    "count amount";
  column-gap: 10px;
  row-gap: 3px;
  align-items: end;
  min-height: 58px;
  padding: 7px 10px;
  background:
    radial-gradient(circle at 92% 14%, rgba(255,255,255,.08), transparent 28%),
    linear-gradient(160deg, rgba(67,244,255,.07), rgba(255,255,255,.025)),
    rgba(255,255,255,.035);
}

.deal-rail .pipeline-row:before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--cyan-hot);
  box-shadow: 0 0 18px var(--cyan-hot);
}

.deal-rail .pipeline-row.won:before { background: var(--green); box-shadow: 0 0 18px var(--green); }
.deal-rail .pipeline-row.proposal:before { background: var(--amber); box-shadow: 0 0 18px var(--amber); }
.deal-rail .pipeline-row.negotiation:before { background: var(--violet); box-shadow: 0 0 18px var(--violet); }
.deal-rail .pipeline-row.lost:before { background: var(--red); box-shadow: 0 0 18px var(--red); }

.deal-rail .pipeline-row > span {
  grid-area: note;
  display: block;
  color: var(--muted);
  font-size: 8.5px;
  text-transform: uppercase;
  letter-spacing: .14em;
}

.deal-rail .pipeline-row > strong {
  grid-area: title;
  margin-top: 1px;
  font-size: 13px;
}

.deal-rail .pipeline-values {
  grid-area: count;
  display: flex;
  align-items: end;
  gap: 6px;
  margin-top: 2px;
  text-align: left;
}

.deal-rail .pipeline-values b {
  font-size: 22px;
  line-height: .92;
}

.deal-rail .pipeline-values small {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 10px;
}

.deal-rail .pipeline-row em {
  grid-area: amount;
  justify-self: end;
  align-self: start;
  display: block;
  margin-top: 0;
  color: var(--text);
  font-style: normal;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.15;
  text-align: right;
  white-space: nowrap;
}

.deal-rail .pipeline-row i {
  height: 3px;
}

.holo-stage {
  min-height: calc(100vh - 88px);
}

.sites-card .card-title {
  margin-bottom: 12px;
}

.site-links {
  grid-template-columns: 1fr;
}

.site-link {
  position: relative;
  min-height: 52px;
  padding: 7px 66px 7px 10px;
  overflow: hidden;
}

.site-link:before {
  content: "";
  position: absolute;
  right: -18px;
  top: -24px;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(132, 249, 255, .2);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(67,244,255,.13), transparent 62%);
}

.site-link strong {
  position: relative;
  font-size: 12px;
}

.site-link small {
  position: relative;
  min-height: 0;
  margin-top: 2px;
  font-size: 10px;
}

.site-link span {
  position: relative;
  display: inline-flex;
  max-width: 100%;
  margin-top: 4px;
  padding: 3px 6px;
  border: 1px solid rgba(132, 249, 255, .18);
  border-radius: 999px;
  color: var(--cyan);
  font-size: 10px;
  overflow-wrap: anywhere;
}

.site-logo {
  position: absolute;
  right: 14px;
  top: 50%;
  width: 42px;
  height: 42px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  border: 1px solid rgba(132, 249, 255, .34);
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, rgba(255,255,255,.1), transparent 22%),
    rgba(6, 22, 29, .72);
  box-shadow:
    inset 0 0 10px rgba(67,244,255,.08),
    0 0 20px rgba(67,244,255,.08);
  overflow: hidden;
}

.site-logo img {
  position: relative;
  z-index: 2;
  width: 34px;
  height: 34px;
  object-fit: contain;
  border-radius: 50%;
  image-rendering: auto;
  filter: saturate(1.08) contrast(1.04);
}

.site-logo i {
  position: absolute;
  z-index: 1;
  color: var(--cyan);
  font-style: normal;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
}

.site-logo:after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border: 1px solid rgba(67,244,255,.18);
  animation: scan 4.8s ease-in-out infinite;
}

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

  .deal-rail,
  .holo-stage {
    min-height: auto;
  }

  .deal-rail .pipeline-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

@media (max-width: 780px) {
  .command-actions .header-stats {
    width: 100%;
  }

  .command-actions .header-stat {
    width: auto;
  }

  .deal-rail .pipeline-list,
  .site-links {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 1101px) {
  .command-grid {
    grid-template-columns: minmax(250px, 300px) minmax(0, 1fr) minmax(250px, 300px);
  }

  .deal-rail,
  .sites-card,
  .holo-stage {
    min-height: calc(100vh - 88px);
  }

  .deal-rail .pipeline-list {
    grid-template-columns: 1fr;
  }
}

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

  .deal-rail,
  .sites-card,
  .holo-stage {
    min-height: auto;
  }

  .deal-rail .pipeline-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .site-links {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .command-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .sync-stack {
    justify-items: stretch;
  }

  .side-toggle {
    justify-content: center;
  }
}

@media (max-width: 780px) {
  .deck {
    width: calc(100vw - 28px);
  }

  .command-bar,
  .card,
  .deal-rail .pipeline-row,
  .site-link {
    max-width: 100%;
  }
}

.holo-stage {
  padding: 10px;
}

.holo-stage .stage-header {
  position: absolute;
  left: 24px;
  right: 24px;
  top: 20px;
  z-index: 6;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.holo-stage .stage-controls {
  pointer-events: auto;
}

.holo-stage .globe-wrap {
  margin-top: 0;
}

@media (max-width: 780px) {
  .holo-stage .stage-header {
    left: 18px;
    right: 18px;
    top: 16px;
  }
}

@media (max-width: 780px) {
  .deal-rail .pipeline-list {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .deal-rail .pipeline-row {
    grid-template-columns: auto minmax(0, 1fr);
    min-height: 64px;
  }

  .deal-rail .pipeline-row > span {
    font-size: 8px;
    letter-spacing: .11em;
  }

  .deal-rail .pipeline-row > strong {
    font-size: 14px;
    line-height: 1.16;
  }

  .deal-rail .pipeline-values b {
    font-size: 21px;
  }

  .deal-rail .pipeline-row em {
    font-size: 19px;
    max-width: 100%;
    white-space: nowrap;
  }

  .site-links {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .site-link {
    min-height: 62px;
    padding: 10px 66px 10px 12px;
  }

  .site-link strong {
    font-size: 13px;
    line-height: 1.2;
  }

  .site-link small {
    font-size: 11px;
  }

  .site-link span {
    max-width: calc(100% - 4px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    overflow-wrap: normal;
  }

  .site-logo {
    right: 12px;
  }
}
