:root{
  --bg:#0b1220;
  --panel:#0f172a;
  --panel2:#111827;
  --line:#243041;
  --soft:rgba(148,163,184,.16);
  --text:#e5e7eb;
  --muted:#94a3b8;
  --accent:#60a5fa;
  --good:#22c55e;
  --warn:#fde68a;
  --danger:#ef4444;
  --selected:#fde68a;
  --shadow:0 14px 32px rgba(0,0,0,.28);
  --radius:18px;
}

*{box-sizing:border-box}
html,body{
  margin:0;
  height:100%;
  font-family:Inter,Segoe UI,Roboto,Arial,sans-serif;
  background:var(--bg);
  color:var(--text);
}
body{overflow:hidden}

#app{
  display:grid;
  grid-template-columns:320px minmax(0,1fr) 360px;
  height:100vh;
  width:100%;
}

.panel{
  background:linear-gradient(180deg, rgba(15,23,42,.985), rgba(9,14,26,.985));
  border-right:1px solid var(--line);
  overflow:auto;
  min-width:0;
}
.panel.right{
  border-right:none;
  border-left:1px solid var(--line);
}
.inner{
  padding:16px;
  display:grid;
  gap:12px;
}

.hero,.box,.card{
  border:1px solid var(--line);
  background:rgba(13,22,40,.95);
  border-radius:20px;
  box-shadow:var(--shadow);
}

.hero{
  padding:16px;
  background:linear-gradient(180deg, rgba(96,165,250,.12), rgba(17,24,39,.85));
}

.box,.card{padding:14px}

h1,h2,h3,p{margin:0}
h1{font-size:1.12rem;line-height:1.2;margin-bottom:6px}
h2{font-size:.98rem}
h3{font-size:.93rem}
p{color:var(--muted);line-height:1.45}
.small{font-size:.875rem}
.tiny{font-size:.78rem}
.muted{color:var(--muted)}
.mono{font-family:ui-monospace,SFMono-Regular,Menlo,monospace}

.section-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:10px;
}

.controls,.stack{display:grid;gap:10px}
.row{display:grid;grid-template-columns:1fr 1fr;gap:10px}

input,button{
  width:100%;
  min-height:44px;
  padding:11px 13px;
  border-radius:14px;
  border:1px solid var(--line);
  background:#09111f;
  color:var(--text);
  font-size:14px;
}
input::placeholder{color:#73839f}

button{
  cursor:pointer;
  font-weight:700;
  background:linear-gradient(180deg,#2563eb,#1d4ed8);
  border-color:#1e40af;
}
button:hover{filter:brightness(1.05)}
button.secondary{
  background:#0a1323;
  border-color:var(--line);
  font-weight:600;
}
button.danger{
  background:#2a1015;
  border-color:#5f2029;
  color:#fecaca;
}

.badge,.pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--line);
  background:#09111f;
  color:var(--muted);
  font-size:12px;
}

.dot{
  width:10px;height:10px;border-radius:50%;
  border:1px solid rgba(255,255,255,.35);
  display:inline-block;
}

.status{
  padding:10px 12px;
  border:1px solid var(--line);
  border-radius:14px;
  background:#09111f;
  color:var(--muted);
  font-size:13px;
}

.ghost-list{
  display:grid;
  gap:10px;
  max-height:36vh;
  overflow:auto;
}

.ghost-item{
  border:1px solid var(--line);
  background:#09111f;
  border-radius:16px;
  padding:12px;
  display:grid;
  gap:8px;
}
.ghost-item.selected{
  border-color:rgba(253,230,138,.55);
  box-shadow:0 0 0 1px rgba(253,230,138,.18) inset;
}

.ghost-top{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:10px;
}

.ghost-name{
  display:flex;
  gap:10px;
  min-width:0;
}

.swatch{
  width:16px;
  height:16px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.5);
  flex:0 0 auto;
  margin-top:2px;
}

.ghost-title{font-weight:800;line-height:1.2}
.ghost-meta{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
  color:var(--muted);
  font-size:12px;
}
.ghost-actions{
  display:grid;
  grid-template-columns:1fr auto;
  gap:8px;
}
.ghost-actions button{
  min-height:38px;
  padding:8px 10px;
  font-size:13px;
}
.icon-btn{
  width:42px;
  padding:0;
}

.map-wrap{
  position:relative;
  background:#07101d;
  min-width:0;
}
#map{
  width:100%;
  height:100%;
}

.map-overlay{
  position:absolute;
  top:14px;
  left:14px;
  right:14px;
  z-index:700;
  display:flex;
  justify-content:space-between;
  gap:12px;
  pointer-events:none;
}

.map-chip{
  pointer-events:auto;
  background:rgba(11,18,32,.86);
  border:1px solid var(--line);
  border-radius:16px;
  padding:10px 12px;
  backdrop-filter:blur(8px);
  box-shadow:var(--shadow);
  max-width:370px;
}

.map-toolbar{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  justify-content:flex-end;
}
.map-toolbar button{
  width:auto;
  min-width:120px;
  min-height:40px;
  padding:9px 12px;
  pointer-events:auto;
  box-shadow:var(--shadow);
}

.stat-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
  margin-top:12px;
}

.kpi{
  border:1px solid var(--line);
  background:#09111f;
  border-radius:16px;
  padding:12px;
  min-height:86px;
}

.label{
  color:var(--muted);
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.06em;
}
.value{
  margin-top:8px;
  font-size:1.06rem;
  font-weight:800;
  color:#fff;
  line-height:1.25;
}
.sub{
  margin-top:4px;
  color:var(--muted);
  font-size:12px;
  line-height:1.35;
}

.comparison-list{
  display:grid;
  gap:0;
  margin-top:6px;
}

.comparison-line{
  display:grid;
  grid-template-columns:110px 1fr;
  gap:10px;
  padding:10px 0;
  border-top:1px solid var(--soft);
}
.comparison-line:first-child{border-top:none}
.comparison-label{
  color:#cbd5e1;
  font-size:12px;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.05em;
}
.comparison-text{
  color:var(--muted);
  font-size:13px;
  line-height:1.45;
}

.helper{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.footer-note{
  color:#73839f;
  font-size:12px;
  line-height:1.45;
}
.hidden{display:none !important}

input[type="range"]{
  padding:0;
  min-height:28px;
  border:none;
  background:transparent;
}

@media (max-width: 1180px){
  #app{grid-template-columns:300px minmax(0,1fr) 340px}
}

@media (max-width: 960px){
  body{overflow:auto}
  #app{
    grid-template-columns:1fr;
    grid-template-rows:auto 58vh auto;
    height:auto;
    min-height:100vh;
  }
  .panel{
    border-right:none;
    border-bottom:1px solid var(--line);
  }
  .panel.right{
    border-left:none;
    border-top:1px solid var(--line);
  }
  .ghost-list{max-height:none}
  .map-overlay{flex-direction:column}
  .map-toolbar{justify-content:flex-start}
}
