:root {
  --bg-dark: #0f1115;
  --bg-card: #181b21;
  --text-main: #e2e8f0;
  --text-muted: #94a3b8;
  --accent: #3b82f6;
  --status-idle: #475569;
  --status-working: #eab308;
  --status-done: #22c55e;
  --tree-line: rgba(255, 255, 255, 0.2);
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  line-height: 1.6;
}

/* --- DASHBOARD PAGE --- */
.dashboard-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header-title h1 {
  font-size: 1.8rem;
  font-weight: 700;
}

.header-title p {
  color: var(--text-muted);
  font-family: 'Space Mono', monospace;
  font-size: 0.9rem;
}

.system-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background-color: rgba(34, 197, 94, 0.1);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--status-done);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.status-dot.green {
  background-color: var(--status-done);
  box-shadow: 0 0 10px var(--status-done);
}

/* --- ORG CHART TREE --- */
.org-tree {
  display: flex;
  justify-content: center;
  overflow-x: auto;
  padding-bottom: 4rem;
}

.org-tree ul {
  padding-top: 20px;
  position: relative;
  transition: all 0.5s;
  display: flex;
  justify-content: center;
}

.org-tree li {
  float: left;
  text-align: center;
  list-style-type: none;
  position: relative;
  padding: 20px 5px 0 5px;
  transition: all 0.5s;
}

/* Connecting lines */
.org-tree li::before, .org-tree li::after {
  content: '';
  position: absolute;
  top: 0;
  right: 50%;
  border-top: 2px solid var(--tree-line);
  width: 50%;
  height: 20px;
}

.org-tree li::after {
  right: auto;
  left: 50%;
  border-left: 2px solid var(--tree-line);
}

/* We need to remove left-right connectors from elements without siblings */
.org-tree li:only-child::after, .org-tree li:only-child::before {
  display: none;
}

/* Remove space from the top of single children */
.org-tree li:only-child {
  padding-top: 0;
}

/* Remove left connector from first child and right connector from last child */
.org-tree li:first-child::before, .org-tree li:last-child::after {
  border: 0 none;
}

/* Adding back the vertical line to the last nodes */
.org-tree li:last-child::before {
  border-right: 2px solid var(--tree-line);
  border-radius: 0 5px 0 0;
}
.org-tree li:first-child::after {
  border-radius: 5px 0 0 0;
}

/* Downward connectors from parents */
.org-tree ul ul::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  border-left: 2px solid var(--tree-line);
  width: 0;
  height: 20px;
}

/* Node Styles */
.node {
  background-color: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  display: inline-block;
  padding: 1rem;
  min-width: 150px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  transition: transform 0.3s;
  position: relative;
}

.node:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  border-color: rgba(255, 255, 255, 0.3);
}

.node-title {
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
}

.node-role {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* CEO Node */
.ceo-node {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(0,0,0,0));
  border-color: var(--accent);
  padding: 1.5rem 2rem;
}
.ceo-node .node-title {
  font-size: 1.5rem;
  color: var(--accent);
}

/* Dept Node */
.dept-node {
  background: rgba(255, 255, 255, 0.05);
  padding: 0.8rem 1.5rem;
  margin-bottom: 10px;
}
.dept-node .dept-name {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Agent Node */
.agent-node {
  width: 170px;
  padding: 0;
  overflow: hidden;
  text-align: center;
}

.agent-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.8rem;
  background-color: rgba(0, 0, 0, 0.3);
}

.agent-eid {
  font-family: 'Space Mono', monospace;
  font-size: 0.65rem;
  color: var(--text-muted);
}

.agent-led {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  transition: all 0.3s;
}

.agent-led.idle { background-color: var(--status-idle); }
.agent-led.working {
  background-color: var(--status-working);
  box-shadow: 0 0 10px var(--status-working);
  animation: pulse 1.5s infinite;
}

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

.agent-avatar-wrapper {
  height: 70px;
  width: 70px;
  margin: 1rem auto 0.5rem auto;
  background-color: transparent; /* Transparent for PNG */
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
  transition: all 0.3s ease;
}

.agent-node.status-working .agent-avatar-wrapper {
  border-color: var(--status-working);
  box-shadow: 0 0 15px rgba(234, 179, 8, 0.4);
}

.agent-avatar {
  height: 90%;
  width: 90%;
  object-fit: contain;
  opacity: 0.9;
  transition: opacity 0.3s, transform 0.3s;
}
.agent-node.status-working .agent-avatar { 
  opacity: 1;
  transform: scale(1.05);
}

.agent-name {
  padding: 0.2rem 0.5rem 0;
  text-align: center;
  font-size: 0.95rem;
}
.agent-role {
  padding: 0 0.5rem 0.5rem;
  text-align: center;
  font-size: 0.75rem;
}

.agent-model-tag {
  display: inline-block;
  background-color: rgba(234, 179, 8, 0.2);
  color: #fde047;
  padding: 2px 6px;
  border-radius: 12px;
  font-size: 0.6rem;
  font-weight: 600;
  margin: 0 auto 0.8rem auto;
  border: 1px solid rgba(234, 179, 8, 0.3);
  text-align: center;
}
.agent-node {
  text-align: center;
}

.agent-status-bar {
  padding: 0.8rem;
  text-align: center;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.3s;
}

.agent-node.status-idle .agent-status-bar {
  background-color: rgba(255, 255, 255, 0.03);
  color: var(--status-idle);
}
.agent-node.status-working .agent-status-bar {
  background-color: rgba(234, 179, 8, 0.15);
  color: var(--status-working);
}
