/* ── BRUISER AI WORKFORCE — MISSION CONTROL STYLES ── */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border-radius: 0 !important;
}

:root {
  --bg: #0D0D0D;
  --red: #CC0000;
  --text: #F5F0E8;
  --dim: #666666;
  --rule: #333333;
  --green: #00CC66;
  --yellow: #CCAA00;
  --bebas: 'Bebas Neue', sans-serif;
  --mono: 'JetBrains Mono', monospace;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Scanline overlay */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.08) 2px,
    rgba(0,0,0,0.08) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

/* ── TITLE BAR ── */
.title-bar {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 2px solid var(--red);
  background: var(--bg);
}

.title-bar .logo {
  font-family: var(--bebas);
  font-size: 28px;
  letter-spacing: 3px;
  color: var(--text);
}

.title-bar .logo span {
  color: var(--red);
}

.title-bar .center-title {
  font-family: var(--bebas);
  font-size: 20px;
  letter-spacing: 4px;
  color: var(--dim);
  text-align: center;
}

.title-bar .meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
  text-align: right;
  letter-spacing: 1px;
  line-height: 1.6;
}

/* ── LIVE STATUS BAR ── */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 24px;
  background: #111;
  border-bottom: 1px solid var(--rule);
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--dim);
  gap: 16px;
  flex-wrap: wrap;
}

.status-bar .sb-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-bar .sb-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* ── LIVE DOTS ── */
.live-dot {
  width: 6px;
  height: 6px;
  background: var(--green);
  display: inline-block;
  animation: pulse-dot 2s ease-in-out infinite;
  flex-shrink: 0;
}

.live-dot.stale  { background: var(--yellow); }
.live-dot.dead   { background: var(--red); animation: none; }
.live-dot.gray   { background: #444; animation: none; }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* ── OPEN BRAIN LINK ── */
.open-brain-link {
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--red);
  text-decoration: none;
  border: 1px solid var(--red);
  padding: 2px 8px;
  text-transform: uppercase;
  transition: background 0.2s;
}
.open-brain-link:hover {
  background: var(--red);
  color: var(--bg);
}

/* ── STATUS UNAVAILABLE NOTICE ── */
.status-unavailable {
  display: none;
  background: #1a0000;
  border: 1px solid #440000;
  padding: 8px 16px;
  font-size: 9px;
  letter-spacing: 2px;
  color: #AA4444;
  text-align: center;
  margin: 8px 24px 0;
}

/* ── MAIN LAYOUT ── */
.diagram {
  padding: 0 24px 24px;
  max-width: 1600px;
  margin: 0 auto;
}

/* ── SECTION LABELS ── */
.section-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--red);
  text-transform: uppercase;
  padding: 20px 0 12px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--rule);
}

/* ── AGENT ROW ── */
.agent-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 0;
}

.agent-box {
  border: 1px solid var(--red);
  padding: 16px 14px 14px;
  position: relative;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.agent-box:hover { background: #111; }

.agent-box.inactive {
  border: 1px dashed var(--dim);
  opacity: 0.65;
}

.agent-box .agent-name {
  font-family: var(--bebas);
  font-size: 42px;
  letter-spacing: 2px;
  line-height: 1;
  color: var(--text);
}

.agent-box.inactive .agent-name { color: var(--dim); }

.agent-box .agent-role {
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--dim);
  text-transform: uppercase;
  line-height: 1.4;
  border-top: 1px solid var(--rule);
  padding-top: 8px;
}

.agent-box .status-badge {
  font-size: 9px;
  letter-spacing: 2px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 6px;
  border: 1px solid var(--red);
  color: var(--red);
  text-transform: uppercase;
  width: fit-content;
}

.agent-box.inactive .status-badge {
  border-color: var(--dim);
  color: var(--dim);
}

.agent-box .tool-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.tag {
  font-size: 8.5px;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  background: #111;
  border: 1px solid var(--rule);
  color: var(--dim);
  white-space: nowrap;
  text-transform: uppercase;
}

.tag.accent {
  border-color: #440000;
  color: #AA4444;
}

.agent-box.inactive .tag {
  border-color: #222;
  color: #444;
  background: #0A0A0A;
}

/* ── AGENT LIVE STATS ── */
.agent-live-stats {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 2px;
  border-top: 1px solid var(--rule);
  padding-top: 6px;
  font-size: 9px;
  color: var(--dim);
  line-height: 1.5;
}

.agent-live-stats .stat-row {
  display: flex;
  justify-content: space-between;
  gap: 4px;
}

.agent-live-stats .stat-label {
  color: #444;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 8px;
}

.agent-live-stats .stat-val { color: var(--dim); text-align: right; }
.agent-live-stats .stat-val.green  { color: var(--green); }
.agent-live-stats .stat-val.yellow { color: var(--yellow); }
.agent-live-stats .stat-val.red    { color: var(--red); }

/* ── CONNECTOR AREA ── */
.connector-area {
  position: relative;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-around;
}

.connector-line {
  width: 1px;
  height: 60px;
  background: var(--red);
  position: relative;
  flex: 1;
  max-width: 1px;
  margin: 0 auto;
}

.connector-line::after {
  content: '▼';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--red);
  font-size: 8px;
}

.connector-line.dim-line { background: var(--rule); }
.connector-line.dim-line::after { color: var(--rule); }

.connector-spacer {
  flex: 1;
  display: flex;
  justify-content: center;
}

/* ── NERVOUS SYSTEM LAYER ── */
.nervous-system {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 0;
  align-items: stretch;
}

.ns-box {
  border: 1px solid var(--red);
  padding: 16px 14px;
  background: var(--bg);
  position: relative;
  cursor: pointer;
  transition: background 0.15s;
}

.ns-box:hover { background: #111; }

.ns-box.secondary { border-color: var(--rule); }

.ns-box.dim {
  border: 1px dashed var(--rule);
  opacity: 0.55;
}

.ns-box .ns-title {
  font-family: var(--bebas);
  font-size: 26px;
  letter-spacing: 2px;
  color: var(--text);
  line-height: 1;
  margin-bottom: 6px;
}

.ns-box.secondary .ns-title,
.ns-box.dim .ns-title {
  color: var(--dim);
  font-size: 22px;
}

.ns-box .ns-sub {
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--dim);
  text-transform: uppercase;
  margin-bottom: 12px;
}

.ns-box .ns-desc {
  font-size: 10px;
  color: var(--dim);
  line-height: 1.7;
}

.ns-box .ns-desc em {
  color: #AA4444;
  font-style: normal;
}

.ns-badge {
  font-size: 8px;
  letter-spacing: 1.5px;
  padding: 2px 6px;
  border: 1px solid var(--red);
  color: var(--red);
  display: inline-block;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.ns-box.secondary .ns-badge {
  border-color: var(--rule);
  color: var(--dim);
}

.ns-box.dim .ns-badge {
  border-color: #222;
  color: #444;
}

/* ── CONNECTOR UP AREA ── */
.connector-up-area {
  position: relative;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
}

.connector-up-line {
  width: 1px;
  height: 48px;
  background: var(--rule);
  position: relative;
}

.connector-up-line::before {
  content: '▲';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--dim);
  font-size: 8px;
}

.connector-up-wrapper {
  width: 50%;
  display: flex;
  justify-content: center;
}

/* ── BRAIN DETAIL ── */
.brain-details {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.brain-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 9px;
  color: var(--dim);
}

.brain-row .dot {
  width: 4px;
  height: 4px;
  background: var(--red);
  flex-shrink: 0;
}

/* ── OWNS LABEL ── */
.owns-label {
  font-size: 8px;
  letter-spacing: 1.5px;
  color: #444;
  text-transform: uppercase;
  margin-top: 4px;
}

.owns-value {
  font-size: 9px;
  color: var(--dim);
  margin-top: 2px;
  line-height: 1.5;
}

/* ── INTEGRATIONS GRID ── */
.data-sources {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}

.source-box {
  border: 1px solid var(--rule);
  padding: 14px 12px;
  background: var(--bg);
  text-align: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  position: relative;
}

.source-box:hover {
  background: #111;
  border-color: #555;
}

.source-box .source-name {
  font-family: var(--bebas);
  font-size: 22px;
  letter-spacing: 3px;
  color: var(--dim);
  margin-bottom: 4px;
}

.source-box .source-type {
  font-size: 8px;
  letter-spacing: 2px;
  color: #444;
  text-transform: uppercase;
  line-height: 1.5;
}

.source-box .source-status-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 6px;
  height: 6px;
  background: #444;
}

.source-box .source-metric {
  margin-top: 6px;
  font-size: 9px;
  color: var(--red);
  letter-spacing: 1px;
}

/* ── DETAIL PANEL OVERLAY ── */
.detail-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.75);
  z-index: 10000;
  align-items: center;
  justify-content: center;
}

.detail-overlay.open { display: flex; }

.detail-panel {
  background: var(--bg);
  border: 1px solid var(--red);
  width: 480px;
  max-width: 95vw;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  font-family: var(--mono);
}

.detail-panel .dp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--red);
  background: #111;
}

.detail-panel .dp-title {
  font-family: var(--bebas);
  font-size: 32px;
  letter-spacing: 2px;
  color: var(--text);
  line-height: 1;
}

.detail-panel .dp-close {
  font-size: 18px;
  color: var(--dim);
  cursor: pointer;
  background: none;
  border: none;
  font-family: var(--mono);
  padding: 4px 8px;
  line-height: 1;
}

.detail-panel .dp-close:hover { color: var(--text); }

.detail-panel .dp-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dp-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  align-items: start;
  gap: 12px;
  font-size: 10px;
  border-bottom: 1px solid #1a1a1a;
  padding-bottom: 8px;
}

.dp-row:last-child { border-bottom: none; }

.dp-key {
  color: #444;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-size: 9px;
  padding-top: 1px;
}

.dp-val {
  color: var(--text);
  line-height: 1.5;
  word-break: break-word;
}

.dp-val.green  { color: var(--green); }
.dp-val.yellow { color: var(--yellow); }
.dp-val.red    { color: var(--red); }
.dp-val.dim    { color: var(--dim); }

.dp-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.dp-tag {
  font-size: 8px;
  letter-spacing: 1px;
  padding: 2px 6px;
  background: #111;
  border: 1px solid var(--rule);
  color: var(--dim);
  text-transform: uppercase;
}

/* ── FOOTER ── */
.footer {
  border-top: 1px solid var(--rule);
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  flex-wrap: wrap;
  gap: 8px;
}

.footer .footer-left {
  font-size: 9px;
  letter-spacing: 2px;
  color: #333;
  text-transform: uppercase;
}

.footer .footer-center {
  font-size: 9px;
  letter-spacing: 2px;
}

.footer .footer-right {
  font-size: 9px;
  color: #333;
  letter-spacing: 1px;
}

/* ── ANIMATIONS ── */
@keyframes pulse-border {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

.agent-box:not(.inactive) .status-badge {
  animation: pulse-border 3s ease-in-out infinite;
}

/* ── MOBILE ── */
@media (max-width: 900px) {
  .title-bar {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .title-bar .center-title,
  .title-bar .meta { text-align: left; }
  .agent-row         { grid-template-columns: 1fr 1fr; }
  .nervous-system    { grid-template-columns: 1fr; }
  .data-sources      { grid-template-columns: 1fr 1fr 1fr; }
}

@media (max-width: 500px) {
  .agent-row    { grid-template-columns: 1fr; }
  .data-sources { grid-template-columns: 1fr 1fr; }
}
