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

:root {
  --bg: #0a0e14;
  --bg2: #111827;
  --panel: #1a1f2e;
  --border: #2d3748;
  --accent: #00d4ff;
  --accent2: #ffd700;
  --text: #e8eaed;
  --dim: #6b7a90;
  --green: #22c55e;
  --red: #ef4444;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  overflow: hidden;
}

/* ===== LAYOUT ===== */
.layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

/* ===== HEADER ===== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: linear-gradient(90deg, #0d1117, #161b22);
  border-bottom: 2px solid var(--accent);
  flex-shrink: 0;
  box-shadow: 0 2px 20px rgba(0,212,255,0.1);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  font-size: 28px;
  filter: drop-shadow(0 0 8px rgba(0,212,255,0.5));
}

.logo-text {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 3px;
  color: var(--accent);
  text-shadow: 0 0 12px rgba(0,212,255,0.3);
}

.logo-sub {
  font-size: 11px;
  color: var(--dim);
  font-weight: 500;
  letter-spacing: 1px;
}

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

.clock {
  font-family: 'Courier New', monospace;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 2px;
  text-shadow: 0 0 8px rgba(0,212,255,0.4);
}

.agent-counter {
  background: rgba(0,212,255,0.1);
  border: 1px solid var(--accent);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
}

/* ===== MAIN ===== */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ===== CANVAS ===== */
.canvas-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #111827, #0a0e14);
  overflow: hidden;
  min-height: 0;
}

#office {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
  border-radius: 6px;
  box-shadow: 0 0 40px rgba(0,0,0,0.5), 0 0 80px rgba(0,212,255,0.05);
}

/* ===== PANEL ===== */
.panel {
  flex-shrink: 0;
  background: var(--panel);
  border-top: 1px solid var(--border);
  height: 200px;
  display: flex;
  flex-direction: column;
}

.panel-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel-tab {
  flex: 1;
  padding: 8px;
  border: none;
  background: transparent;
  color: var(--dim);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  letter-spacing: 0.5px;
}

.panel-tab:hover { color: var(--text); background: rgba(255,255,255,0.03); }

.panel-tab.active {
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
  background: rgba(0,212,255,0.05);
}

.panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 10px 16px;
}

.panel-content::-webkit-scrollbar { width: 4px; }
.panel-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ===== AGENT LIST ===== */
.agent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.agent-item:hover { background: rgba(255,255,255,0.05); }

.agent-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 6px currentColor;
}

.agent-name {
  font-weight: 700;
  font-size: 13px;
  min-width: 80px;
}

.agent-task {
  color: var(--dim);
  font-size: 12px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-status-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
  flex-shrink: 0;
}

.badge-working { background: rgba(34,197,94,0.15); color: #22c55e; }
.badge-typing { background: rgba(59,130,246,0.15); color: #3b82f6; }
.badge-thinking { background: rgba(168,85,247,0.15); color: #a855f7; }
.badge-idle { background: rgba(107,122,144,0.15); color: #6b7a90; }
.badge-sleeping { background: rgba(107,122,144,0.1); color: #4a5568; }
.badge-reading { background: rgba(245,158,11,0.15); color: #f59e0b; }
.badge-resting { background: rgba(236,72,153,0.15); color: #ec4899; }

/* ===== LOG ===== */
.log-item {
  display: flex;
  gap: 10px;
  padding: 4px 0;
  font-size: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.log-time {
  color: var(--dim);
  font-family: monospace;
  flex-shrink: 0;
  font-size: 11px;
}

.log-agent {
  color: var(--accent);
  font-weight: 700;
  flex-shrink: 0;
}

.log-action {
  color: var(--text);
}

/* ===== STATS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.stat-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}

.stat-value {
  font-size: 24px;
  font-weight: 900;
  color: var(--accent);
}

.stat-label {
  font-size: 11px;
  color: var(--dim);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ===== POPUP ===== */
.popup { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.popup.hidden { display: none; }
.popup-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px); }
.popup-card {
  position: relative;
  background: linear-gradient(135deg, #1a2a3a, #16212b);
  border: 2px solid var(--accent);
  border-radius: 16px;
  padding: 28px 24px;
  width: 340px;
  max-width: 90vw;
  box-shadow: 0 8px 40px rgba(0,212,255,0.15);
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.popup-close {
  position: absolute; top: 10px; right: 14px;
  background: none; border: none; color: var(--dim);
  font-size: 24px; cursor: pointer;
}
.popup-close:hover { color: var(--accent); }

.popup-avatar {
  width: 80px; height: 80px; margin: 0 auto 12px;
  border-radius: 50%; border: 3px solid var(--accent);
  overflow: hidden; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
}
.popup-avatar canvas { image-rendering: pixelated; }

.popup-card h3 {
  text-align: center; color: var(--accent);
  font-size: 20px; margin-bottom: 16px;
}

.popup-info { display: flex; flex-direction: column; gap: 8px; }
.info-row { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.info-row span:first-child { width: 24px; text-align: center; flex-shrink: 0; }

.popup-progress {
  height: 6px; background: rgba(255,255,255,0.08);
  border-radius: 3px; overflow: hidden; margin-top: 12px;
}
.popup-progress-bar {
  height: 100%; border-radius: 3px;
  background: var(--accent); box-shadow: 0 0 8px var(--accent);
  transition: width 0.4s;
}

/* ===== ROOM LABELS ON CANVAS ===== */
.room-label {
  position: absolute;
  color: rgba(255,255,255,0.5);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  pointer-events: none;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .header { padding: 8px 12px; }
  .logo-text { font-size: 18px; letter-spacing: 2px; }
  .logo-sub { display: none; }
  .clock { font-size: 14px; }
  .panel { height: 170px; }
  .panel-tab { font-size: 12px; padding: 6px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-height: 900px) {
  .panel { height: 250px; }
}
