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

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

header {
  background: #161b22;
  border-bottom: 1px solid #30363d;
  padding: 16px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

h1 {
  font-size: 20px;
  font-weight: 600;
  color: #e6edf3;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #8b949e;
}

.connection-status .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #484f58;
}

.connection-status.connected .dot {
  background: #3fb950;
}

.connection-status.disconnected .dot {
  background: #f85149;
}

.header-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.counters {
  display: flex;
  gap: 16px;
  font-size: 14px;
}

.counter {
  display: flex;
  align-items: center;
  gap: 4px;
}

.counter b {
  color: #e6edf3;
}

.counter.online b { color: #3fb950; }
.counter.busy b { color: #d29922; }
.counter.free b { color: #58a6ff; }

.filters {
  display: flex;
  gap: 6px;
}

.filter-btn {
  background: #21262d;
  color: #8b949e;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.filter-btn:hover {
  color: #c9d1d9;
  border-color: #484f58;
}

.filter-btn.active {
  background: #388bfd26;
  color: #58a6ff;
  border-color: #388bfd;
}

main {
  padding: 24px;
  max-width: 1600px;
  margin: 0 auto;
}

.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

/* Agent card */
.agent-card {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.15s;
}

.agent-card:hover {
  border-color: #484f58;
}

.agent-card.busy {
  border-color: #d29922;
}

.agent-card.offline {
  opacity: 0.6;
}

.card-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  gap: 12px;
}

.card-avatar {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  flex-shrink: 0;
}

.card-info {
  flex: 1;
  min-width: 0;
}

.card-name {
  font-size: 16px;
  font-weight: 600;
  color: #e6edf3;
}

.card-meta {
  font-size: 12px;
  color: #8b949e;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-badge {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

.status-badge.working {
  background: #d2992226;
  color: #d29922;
}

.status-badge.idle {
  background: #3fb95026;
  color: #3fb950;
}

.status-badge.offline {
  background: #484f5826;
  color: #484f58;
}

.card-details {
  padding: 0 16px 12px;
  font-size: 13px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-top: 1px solid #21262d;
}

.detail-label {
  color: #8b949e;
}

.detail-value {
  color: #c9d1d9;
  text-align: right;
}

.task-info {
  padding: 8px 16px;
  background: #d2992210;
  border-top: 1px solid #30363d;
  font-size: 13px;
  color: #d29922;
}

/* Log section */
.log-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: #0d1117;
  border-top: 1px solid #30363d;
  cursor: pointer;
  font-size: 12px;
  color: #8b949e;
  user-select: none;
}

.log-toggle:hover {
  color: #c9d1d9;
}

.log-toggle .arrow {
  transition: transform 0.15s;
}

.log-toggle.open .arrow {
  transform: rotate(90deg);
}

.log-container {
  display: none;
  max-height: 200px;
  overflow-y: auto;
  background: #010409;
  border-top: 1px solid #30363d;
  padding: 8px 12px;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 11px;
  line-height: 1.5;
  color: #8b949e;
}

.log-container.open {
  display: block;
}

.log-container .log-line {
  white-space: pre-wrap;
  word-break: break-all;
}

/* Error banner */
.error-banner {
  background: #f8514926;
  border: 1px solid #f85149;
  color: #f85149;
  padding: 12px 24px;
  border-radius: 8px;
  text-align: center;
  margin-bottom: 16px;
  font-size: 14px;
}

/* Scrollbar */
.log-container::-webkit-scrollbar {
  width: 6px;
}

.log-container::-webkit-scrollbar-track {
  background: #010409;
}

.log-container::-webkit-scrollbar-thumb {
  background: #30363d;
  border-radius: 3px;
}

.log-container::-webkit-scrollbar-thumb:hover {
  background: #484f58;
}

/* Responsive */
@media (max-width: 600px) {
  header {
    padding: 12px 16px;
  }

  main {
    padding: 16px;
  }

  .agents-grid {
    grid-template-columns: 1fr;
  }

  .header-bottom {
    flex-direction: column;
    align-items: flex-start;
  }
}
