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

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

#app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #21262d;
  margin-bottom: 16px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.badge.active {
  background: #238636;
  color: #fff;
  animation: pulse 2s infinite;
}

.badge.inactive {
  background: #30363d;
  color: #8b949e;
}

.badge.ended {
  background: #da3633;
  color: #fff;
}

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

select {
  background: #21262d;
  color: #e6edf3;
  border: 1px solid #30363d;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}

button {
  background: #21262d;
  color: #e6edf3;
  border: 1px solid #30363d;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

button:hover {
  background: #30363d;
}

/* Stats */
#stats-bar {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.stat {
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 8px;
  padding: 10px 16px;
  flex: 1;
  min-width: 120px;
}

.stat-label {
  display: block;
  font-size: 11px;
  color: #8b949e;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat-value.hr { color: #f85149; }
.stat-value.power { color: #d29922; }

/* Map */
#map {
  height: 400px;
  border-radius: 8px;
  border: 1px solid #21262d;
  margin-bottom: 16px;
  z-index: 1;
}

/* Charts */
#charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.chart-container {
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 8px;
  padding: 12px;
  height: 220px;
}

/* Sessions panel */
#sessions-panel {
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 8px;
  padding: 16px;
}

#sessions-panel h3 {
  font-size: 14px;
  margin-bottom: 12px;
  color: #8b949e;
}

.session-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 4px;
}

.session-item:hover {
  background: #21262d;
}

.session-item.selected {
  background: #1f6feb33;
  border: 1px solid #1f6feb;
}

.session-id {
  font-family: monospace;
  font-size: 13px;
}

.session-meta {
  font-size: 11px;
  color: #8b949e;
}

/* Dialog */
dialog {
  background: #161b22;
  color: #e6edf3;
  border: 1px solid #30363d;
  border-radius: 12px;
  padding: 24px;
  min-width: 320px;
}

dialog::backdrop {
  background: rgba(0,0,0,0.6);
}

dialog h3 {
  margin-bottom: 12px;
}

dialog input {
  width: 100%;
  background: #0d1117;
  color: #e6edf3;
  border: 1px solid #30363d;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  margin-bottom: 16px;
}

.dialog-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

#msg-send {
  background: #238636;
  border-color: #238636;
}

.hidden { display: none; }

/* Responsive */
@media (max-width: 768px) {
  #charts {
    grid-template-columns: 1fr;
  }
  #map {
    height: 300px;
  }
}
