:root {
  --bg: #080c17;
  --panel: #0f172a;
  --panel-border: #1e293b;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --cyan: #38bdf8;
  --amber: #f59e0b;
  --violet: #a855f7;
  --green: #10b981;
  --red: #ef4444;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(circle at top left, #111b33 0%, var(--bg) 55%);
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hidden { display: none !important; }

/* Auth Overlay */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 16, 0.9);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--panel);
  border: 1px solid #334155;
  border-radius: 14px;
  padding: 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
}

.login-badge {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.1em;
  font-weight: 700;
  color: var(--cyan);
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 12px;
}

.login-card h1 {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 700;
}

.login-sub {
  margin: 0 0 18px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}

.login-card label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin: 12px 0 6px;
}

.login-card input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #0b1222;
  color: var(--text);
  font-size: 14px;
}

.login-card input:focus {
  outline: none;
  border-color: var(--cyan);
}

.login-error {
  margin-top: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #fca5a5;
  font-size: 12px;
}

.btn-primary {
  margin-top: 18px;
  width: 100%;
  padding: 11px 16px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

.btn-primary:hover { filter: brightness(1.1); }

/* Header HUD */
.hud-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  background: rgba(15, 23, 42, 0.9);
  border-bottom: 1px solid var(--panel-border);
}

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

.pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 10px var(--amber);
}

.pulse-dot.online {
  background: var(--green);
  box-shadow: 0 0 12px var(--green);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.2); }
}

.hud-title {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.08em;
}

.hud-sub {
  font-size: 11px;
  color: var(--muted);
}

.hud-controls, .hud-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.btn-group {
  display: flex;
  background: #0b1222;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 2px;
}

.btn-filter {
  background: transparent;
  color: var(--muted);
  border: none;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.btn-filter.active {
  background: #1e293b;
  color: #fff;
}

.btn-ghost {
  background: #0b1222;
  color: var(--text);
  border: 1px solid var(--panel-border);
  padding: 6px 11px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
}

.btn-ghost:hover { border-color: #475569; }

.stat-pill {
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: #0b1222;
  border: 1px solid var(--panel-border);
}

.stat-work { color: #34d399; border-color: rgba(16, 185, 129, 0.35); }
.stat-idle { color: #7dd3fc; border-color: rgba(56, 189, 248, 0.3); }
.stat-alert { color: #fca5a5; border-color: rgba(239, 68, 68, 0.35); }
.stat-spend { color: #fcd34d; border-color: rgba(245, 158, 11, 0.35); }

.btn-hq {
  background: rgba(56, 189, 248, 0.14);
  color: var(--cyan);
  border: 1px solid rgba(56, 189, 248, 0.4);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

.btn-hq:hover { background: rgba(56, 189, 248, 0.24); }

/* Main Grid */
.main-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 350px;
  gap: 16px;
  padding: 16px 20px;
  align-items: start;
}

.stage-panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.45);
}

.canvas-wrap {
  width: 100%;
  background: #070b14;
  display: flex;
  justify-content: center;
  align-items: center;
}

#office-canvas {
  width: 100%;
  height: auto;
  display: block;
  cursor: pointer;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.legend-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  background: #0b1222;
  border-top: 1px solid var(--panel-border);
  font-size: 12px;
  color: var(--muted);
}

.legend-bar span { display: inline-flex; align-items: center; gap: 6px; }
.legend-tip { margin-left: auto; color: #cbd5e1; }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-work { background: var(--green); box-shadow: 0 0 8px var(--green); }
.dot-idle { background: var(--cyan); }
.dot-lounge { background: var(--amber); }
.dot-alert { background: var(--red); }
.dot-fw { background: #f43f5e; box-shadow: 0 0 8px #f43f5e; }

/* Sidebar */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 14px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 10px;
}

.wing-badge {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #1e293b;
  color: var(--text);
}

.wing-badge.inf { background: rgba(56, 189, 248, 0.16); color: #7dd3fc; }
.wing-badge.crt { background: rgba(168, 85, 247, 0.18); color: #d8b4fe; }

.empty-note {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.insp-top {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

#insp-avatar {
  background: #0b1222;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  image-rendering: pixelated;
}

.insp-name { font-weight: 700; font-size: 15px; }
.insp-title { font-size: 12px; color: var(--muted); margin: 2px 0 6px; }
.insp-badges { display: flex; gap: 6px; flex-wrap: wrap; }

.role-badge, .status-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 6px;
}

.role-badge { background: #1e293b; color: #cbd5e1; }
.status-badge.working { background: rgba(16, 185, 129, 0.18); color: #34d399; }
.status-badge.idle { background: rgba(56, 189, 248, 0.15); color: #7dd3fc; }
.status-badge.alert { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }

.budget-box { margin-bottom: 12px; }
.budget-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 5px;
}
.budget-track {
  height: 6px;
  background: #0b1222;
  border-radius: 999px;
  overflow: hidden;
}
.budget-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--cyan), var(--green));
  transition: width 0.3s ease;
}

.insp-actions { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.insp-subactions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

.btn-action {
  display: block;
  text-align: center;
  padding: 7px 10px;
  border-radius: 8px;
  background: #0b1222;
  border: 1px solid #334155;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

.btn-action:hover { border-color: #64748b; }
.btn-cyan {
  background: rgba(56, 189, 248, 0.14);
  border-color: rgba(56, 189, 248, 0.4);
  color: #7dd3fc;
}

.sub-heading {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.mini-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 165px;
  overflow-y: auto;
}

.mini-list li {
  background: #0b1222;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 7px 9px;
  font-size: 12px;
  line-height: 1.35;
}

.mini-list .item-meta {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
}

.roster-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}

.roster-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 9px;
  border-radius: 8px;
  background: #0b1222;
  border: 1px solid var(--panel-border);
  cursor: pointer;
  font-size: 12px;
}

.roster-item:hover { border-color: #475569; }
.roster-item.selected { border-color: var(--cyan); background: rgba(56, 189, 248, 0.08); }
.roster-left { display: flex; align-items: center; gap: 8px; }
.roster-role { font-size: 10px; color: var(--muted); }

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