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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #0f1923;
  color: #e0e6ed;
  min-height: 100vh;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: #1a2332;
  border-bottom: 1px solid #2a3a4a;
}

header h1 { font-size: 20px; }

.legend {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 13px;
  color: #8899aa;
}

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

.dot.idle { background: #4ade80; }
.dot.working { background: #fbbf24; animation: pulse 1.5s infinite; }
.dot.busy { background: #f87171; animation: pulse 1s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

main {
  display: flex;
  padding: 24px;
  gap: 24px;
  height: calc(100vh - 60px);
}

.office-container {
  flex: 1;
  position: relative;
  background: #1a2332;
  border-radius: 12px;
  border: 1px solid #2a3a4a;
  overflow: hidden;
}

.flow-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

#office-map {
  position: relative;
  width: 100%;
  height: 100%;
}

/* 房間 */
.room {
  position: absolute;
  border-radius: 10px;
  border: 2px solid #3a4a5a;
  background: #1e2d3d;
  transition: border-color 0.3s;
  overflow: hidden;
}

.room:hover {
  border-color: #5a8abf;
}

.room-header {
  padding: 8px 12px;
  background: #253545;
  font-size: 13px;
  font-weight: 600;
  border-bottom: 1px solid #3a4a5a;
  display: flex;
  align-items: center;
  gap: 6px;
}

.room-body {
  padding: 10px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* 員工 */
.agent-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px;
  border-radius: 8px;
  background: #253545;
  min-width: 80px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.agent-card:hover {
  background: #2e4558;
  transform: translateY(-2px);
}

.agent-avatar {
  font-size: 28px;
  margin-bottom: 4px;
}

.agent-name {
  font-size: 11px;
  font-weight: 600;
  text-align: center;
}

.agent-role {
  font-size: 9px;
  color: #7799aa;
  text-align: center;
}

.agent-status {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.agent-task-badge {
  margin-top: 4px;
  font-size: 9px;
  background: #fbbf24;
  color: #1a2332;
  padding: 2px 6px;
  border-radius: 4px;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 任務面板 */
#task-panel {
  width: 320px;
  background: #1a2332;
  border-radius: 12px;
  border: 1px solid #2a3a4a;
  padding: 16px;
  overflow-y: auto;
}

#task-panel h2 {
  font-size: 15px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #2a3a4a;
}

.task-card {
  background: #253545;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  border-left: 3px solid #5a8abf;
}

.task-card.done { border-left-color: #4ade80; }
.task-card.in_progress { border-left-color: #fbbf24; }
.task-card.pending { border-left-color: #8899aa; }

.task-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}

.task-meta {
  font-size: 11px;
  color: #7799aa;
}

.task-status-badge {
  display: inline-block;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  margin-top: 6px;
}

.task-status-badge.done { background: #166534; color: #4ade80; }
.task-status-badge.in_progress { background: #713f12; color: #fbbf24; }
.task-status-badge.pending { background: #374151; color: #8899aa; }
.task-status-badge.assigned { background: #1e3a5f; color: #5a8abf; }

/* 流轉記錄 */
.flow-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  font-size: 12px;
  border-bottom: 1px solid #2a3a4a;
}

.flow-arrow {
  color: #fbbf24;
  font-weight: bold;
}

.flow-action {
  font-size: 10px;
  color: #7799aa;
}

/* SVG 流動線 */
.flow-line {
  fill: none;
  stroke: #fbbf24;
  stroke-width: 2;
  stroke-dasharray: 8 4;
  animation: dash 1s linear infinite;
  opacity: 0.6;
}

.flow-line.active {
  stroke: #4ade80;
  stroke-width: 3;
  opacity: 1;
}

@keyframes dash {
  to { stroke-dashoffset: -12; }
}

/* 流動線上的小球 */
.flow-dot {
  fill: #fbbf24;
  r: 4;
}

.flow-dot.active {
  fill: #4ade80;
  r: 5;
}
