:root {
  --bg: #070e19;
  --surface: #0e1a2c;
  --border: rgba(0, 174, 239, 0.24);
  --text: #edf5ff;
  --dim: #8da4c2;
  --c9: #00aeef;
  --val: #ff4655;
  --gold: #f5b942;
  --emerald: #10b981;
  --violet: #a78bfa;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(circle at 15% 0%, #102542 0%, #070e19 55%, #04080f 100%);
  color: var(--text);
  min-height: 100vh;
}

.shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 18px 22px 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
}

.c9-badge {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 1.1rem;
  background: linear-gradient(135deg, #00aeef, #0066cc);
  color: #fff;
  box-shadow: 0 0 20px rgba(0, 174, 239, 0.45);
}

.brand h1 {
  font-size: 1.55rem;
  letter-spacing: 0.02em;
}

.sub {
  font-size: 0.82rem;
  color: var(--dim);
}

.top-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

select, .btn-ghost, .btn-cyan, .btn-cyan-sm {
  background: rgba(14, 26, 44, 0.92);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 12px;
  font-size: 0.82rem;
  cursor: pointer;
}

.btn-cyan, .btn-cyan-sm {
  background: linear-gradient(135deg, rgba(0, 174, 239, 0.28), rgba(0, 119, 204, 0.32));
  border-color: var(--c9);
  font-weight: 700;
}

.btn-cyan-sm { padding: 5px 10px; font-size: 0.76rem; }

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.card {
  background: rgba(14, 26, 44, 0.88);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 15px 17px;
  backdrop-filter: blur(10px);
}

.kpi {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-left: 3px solid var(--c9);
}

.kpi-gold { border-left-color: var(--gold); }
.kpi-crimson { border-left-color: var(--val); }
.kpi-emerald { border-left-color: var(--emerald); }

.kpi-lbl { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--dim); }
.kpi-val { font-size: 1.65rem; font-weight: 800; }
.kpi-cyan .kpi-val { color: var(--c9); }
.kpi-gold .kpi-val { color: var(--gold); }
.kpi-crimson .kpi-val { color: var(--val); }
.kpi-emerald .kpi-val { color: var(--emerald); }
.kpi-sub { font-size: 0.76rem; color: var(--dim); }

.tactical-grid {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 16px;
  align-items: start;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.panel-head h2 { font-size: 1.08rem; }
.hint { font-size: 0.78rem; color: var(--dim); margin-top: 2px; }

.filter-bar { display: flex; gap: 6px; flex-wrap: wrap; }

.canvas-frame {
  background: #060b14;
  border: 1px solid rgba(0, 174, 239, 0.3);
  border-radius: 12px;
  overflow: hidden;
}

#tactical-canvas {
  width: 100%;
  height: auto;
  display: block;
  cursor: crosshair;
}

.legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-size: 0.76rem;
  color: var(--dim);
}

.swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 5px;
}

.sw-smoke { background: #38bdf8; }
.sw-flash { background: #f5b942; }
.sw-recon { background: #a78bfa; }
.sw-molly { background: #fb7185; }
.sw-op { background: #ff4655; }
.sw-blind { background: #f97316; border: 1px dashed #fff; }

.right-col { display: flex; flex-direction: column; gap: 14px; }

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

.panel-head-sm h3 { font-size: 0.96rem; }

.badge {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: 0.08em;
}

.badge-critical { background: rgba(255, 70, 85, 0.22); color: #ff7a86; border: 1px solid var(--val); }
.badge-moderate { background: rgba(245, 185, 66, 0.2); color: var(--gold); border: 1px solid var(--gold); }
.badge-contained { background: rgba(16, 185, 129, 0.2); color: var(--emerald); border: 1px solid var(--emerald); }

.protocol-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.protocol-list li {
  background: rgba(7, 14, 25, 0.72);
  border-left: 3px solid var(--c9);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.8rem;
  line-height: 1.45;
  color: #dbeafe;
}

.blind-box {
  font-size: 0.78rem;
  color: var(--dim);
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.tag-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.blind-tag {
  background: rgba(249, 115, 22, 0.18);
  color: #fdba74;
  border: 1px solid rgba(249, 115, 22, 0.5);
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
}
.clear-tag {
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.45);
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
}

.dossier-pre {
  background: rgba(5, 10, 18, 0.88);
  border: 1px solid rgba(0, 174, 239, 0.2);
  border-radius: 10px;
  padding: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.74rem;
  line-height: 1.5;
  color: #cde7ff;
  white-space: pre-wrap;
  max-height: 235px;
  overflow-y: auto;
}

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #0d1d33;
  border: 1px solid var(--c9);
  color: var(--c9);
  padding: 9px 15px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: all 0.25s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 960px) {
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
  .tactical-grid { grid-template-columns: 1fr; }
}
