:root {
  --bg: #08111f;
  --bg-soft: #0d182b;
  --panel: rgba(12, 22, 40, 0.88);
  --panel-strong: #0f1d33;
  --line: rgba(148, 163, 184, 0.18);
  --text: #e6eef8;
  --muted: #8fa4bf;
  --good: #10b981;
  --warn: #f59e0b;
  --bad: #ef4444;
  --info: #38bdf8;
  --offline: #64748b;
  --accent: #8b5cf6;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.12), transparent 25%),
    radial-gradient(circle at top right, rgba(139, 92, 246, 0.14), transparent 22%),
    linear-gradient(180deg, #06101d 0%, #08111f 45%, #050b14 100%);
  color: var(--text);
  overflow: hidden;
}

.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  height: 100vh;
  gap: 16px;
  padding: 16px;
}

.main {
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 16px;
}

.topbar,
.summary,
.sidebar,
.office {
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
}

.title-wrap h1 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.title-wrap p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.top-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 999px;
  font-size: 0.84rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 12px currentColor;
}

.summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  padding: 12px;
}

.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 16px;
  padding: 14px;
  min-height: 90px;
}

.card .label {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.card .value {
  margin-top: 8px;
  font-size: 1.7rem;
  font-weight: 700;
}

.card .sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.86rem;
}

.office {
  position: relative;
  overflow: hidden;
  padding: 18px;
  min-height: 0;
}

.office-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.office-title h2 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.office-title p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
  font-size: 0.82rem;
  color: var(--muted);
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.office-map {
  position: relative;
  height: calc(100% - 70px);
  min-height: 560px;
  border-radius: 18px;
  overflow: auto;
  background:
    linear-gradient(rgba(148, 163, 184, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.07) 1px, transparent 1px),
    linear-gradient(180deg, #0b1628 0%, #091220 100%);
  background-size: 40px 40px, 40px 40px, cover;
  border: 1px solid rgba(148, 163, 184, 0.14);
  padding: 18px;
}

.map-canvas {
  position: relative;
  width: 1100px;
  height: 720px;
  margin: 0 auto;
}

.sector {
  position: absolute;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: linear-gradient(180deg, rgba(15, 27, 48, 0.92), rgba(11, 20, 37, 0.9));
  border-radius: 22px;
  padding: 16px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 18px 40px rgba(0,0,0,0.18);
}

.sector::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 16px;
  border: 1px dashed rgba(148, 163, 184, 0.08);
  pointer-events: none;
}

.sector h3 {
  margin: 0;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #c9d8ea;
}

.sector small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.8rem;
}

.desk {
  position: absolute;
  width: 70px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(180deg, #16304f, #0f2239);
  border: 1px solid rgba(148, 163, 184, 0.14);
  box-shadow: 0 12px 18px rgba(0,0,0,0.18);
}

.desk::after {
  content: "";
  position: absolute;
  width: 24px;
  height: 14px;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.18);
  border-radius: 6px;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
}

.agent {
  position: absolute;
  width: 84px;
  transform: translate(-50%, -50%);
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: var(--text);
  text-align: center;
  z-index: 4;
}

.agent:focus-visible {
  outline: 2px solid var(--info);
  outline-offset: 6px;
  border-radius: 18px;
}

.avatar {
  position: relative;
  width: 58px;
  height: 58px;
  margin: 0 auto 8px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.09), rgba(255,255,255,0.03));
  border: 1px solid rgba(148, 163, 184, 0.14);
  display: grid;
  place-items: center;
  box-shadow: 0 12px 24px rgba(0,0,0,0.28);
}

.avatar::before {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255,255,255,0.88);
  box-shadow: 0 20px 0 8px rgba(255,255,255,0.75);
  transform: translateY(-10px);
  opacity: 0.9;
}

.status-ring {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 3px solid #08111f;
  box-shadow: 0 0 14px currentColor;
}

.agent-name {
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.15;
}

.agent-role {
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.2;
}

.active-agent .avatar {
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.28), 0 18px 30px rgba(0,0,0,0.32);
}

.pulse {
  position: absolute;
  inset: -6px;
  border-radius: 22px;
  border: 1px solid currentColor;
  opacity: 0.18;
  animation: pulse 2.4s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.92); opacity: 0.28; }
  70% { transform: scale(1.14); opacity: 0; }
  100% { transform: scale(1.14); opacity: 0; }
}

.walkway,
.wall {
  position: absolute;
  border-radius: 999px;
  opacity: 0.7;
}

.walkway {
  background: linear-gradient(90deg, rgba(148,163,184,0.10), rgba(148,163,184,0.03));
}

.wall {
  background: rgba(148,163,184,0.08);
}

.sidebar {
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  gap: 14px;
  padding: 18px;
  min-height: 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
}

.sidebar-header h2 {
  margin: 0;
  font-size: 1rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(255,255,255,0.04);
  font-size: 0.82rem;
  color: var(--text);
}

.agent-profile {
  padding: 14px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.agent-profile h3 {
  margin: 0;
  font-size: 1.15rem;
}

.agent-profile p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.info-list {
  display: grid;
  gap: 10px;
}

.info-item {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(148, 163, 184, 0.1);
}

.info-item .k {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.info-item .v {
  font-size: 0.94rem;
  line-height: 1.45;
}

.next-steps {
  align-self: end;
  padding: 14px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.08), rgba(139, 92, 246, 0.05));
  border: 1px solid rgba(56, 189, 248, 0.12);
}

.next-steps h4 {
  margin: 0 0 10px;
  font-size: 0.92rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.next-steps p {
  margin: 0;
  color: #d4e3f3;
  line-height: 1.5;
}

.footer-note {
  color: var(--muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  line-height: 1.45;
}

.c-good { color: var(--good); }
.c-warn { color: var(--warn); }
.c-bad { color: var(--bad); }
.c-info { color: var(--info); }
.c-offline { color: var(--offline); }

@media (max-width: 1180px) {
  body { overflow: auto; }
  .app {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
  }

  .sidebar {
    min-height: auto;
  }

  .office-map {
    min-height: 500px;
  }
}

@media (max-width: 920px) {
  .summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar,
  .office,
  .sidebar {
    padding: 14px;
  }

  .topbar,
  .office-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .legend,
  .top-meta {
    justify-content: flex-start;
  }

  .map-canvas {
    width: 980px;
    height: 720px;
  }
}

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

  .app {
    padding: 10px;
    gap: 10px;
  }

  .office-map {
    padding: 10px;
  }
}
