:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --border: #2a2a2a;
  --text: #e8e8e8;
  --muted: #888;
  --accent: #5b8dee;
  --green: #3ddc84;
  --yellow: #f5c842;
  --red: #e05252;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

.top-nav {
  display: flex;
  align-items: center;
  padding: 0 24px;
  height: 52px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.nav-brand {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -0.5px;
}

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

/* ---- Project list ---- */
.project-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  transition: border-color .15s;
}
.project-card:hover { border-color: var(--accent); }
.project-card.live { border-left: 3px solid var(--green); }
.project-card.building { border-left: 3px solid var(--yellow); }
.project-card.failed { border-left: 3px solid var(--red); }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.card-header h2 { font-size: 16px; }
.card-header h2 a { color: var(--text); text-decoration: none; }
.card-header h2 a:hover { color: var(--accent); }

.status-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--border);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.status-badge.live { background: var(--green); color: #000; }
.status-badge.building { background: var(--yellow); color: #000; }
.status-badge.failed { background: var(--red); color: #fff; }

.card-links { display: flex; gap: 12px; margin-top: 8px; }
.card-links a { color: var(--accent); font-size: 12px; text-decoration: none; }
.card-links a:hover { text-decoration: underline; }

.card-updated { font-size: 11px; color: var(--muted); margin-top: 8px; }

/* ---- Phase indicator ---- */
.phase-indicator { display: flex; gap: 4px; flex-wrap: wrap; margin: 6px 0; }
.phase {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--border);
  color: var(--muted);
}
.phase.done { background: #1e3a2a; color: var(--green); }
.phase.active { background: var(--accent); color: #fff; font-weight: 700; }

/* ---- Project detail ---- */
.project-detail h1 { font-size: 24px; margin-bottom: 12px; }
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 24px;
}

/* ---- Build log ---- */
.build-log h3,
.cost-dashboard h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.build-log ul {
  list-style: none;
  font-family: monospace;
  font-size: 12px;
  max-height: 400px;
  overflow-y: auto;
  background: #111;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
}
.build-log ul li { padding: 2px 0; border-bottom: 1px solid var(--border); }
.build-log ul li:last-child { border-bottom: none; }

/* ---- Cost dashboard ---- */
.total-cost { font-size: 24px; font-weight: 700; margin-bottom: 12px; color: var(--accent); }
.cost-dashboard table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.cost-dashboard th, .cost-dashboard td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}
.cost-dashboard th { color: var(--muted); font-weight: 600; }

/* ---- Project detail layout ---- */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  margin-top: 24px;
  align-items: start;
}
.detail-sidebar { display: flex; flex-direction: column; gap: 24px; }

/* ---- Agent chat ---- */
.agent-chat h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 600px;
  overflow-y: auto;
  padding: 4px 0;
}
.chat-msg {
  display: flex;
  gap: 10px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.chat-msg.error { border-left: 3px solid var(--red); }
.chat-avatar { font-size: 20px; flex-shrink: 0; line-height: 1.4; }
.chat-body { flex: 1; min-width: 0; }
.chat-name {
  font-size: 12px;
  font-weight: 700;
  margin-right: 6px;
}
.chat-phase {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--border);
  color: var(--muted);
  margin-right: 6px;
  vertical-align: middle;
}
.chat-text { font-size: 13px; margin-top: 3px; line-height: 1.5; }
.chat-time { font-size: 10px; color: var(--muted); margin-top: 3px; display: block; }

/* ---- Empty / loading ---- */
.empty-state, .loading { color: var(--muted); text-align: center; padding: 48px; }
