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

:root {
  --bg: #0a0a0a;
  --card: #1a1a1a;
  --border: #2a2a2a;
  --accent: #6366f1;
  --accent-dim: #4f46e5;
  --text: #e5e5e5;
  --text-dim: #737373;
  --green: #22c55e;
  --yellow: #eab308;
  --red: #ef4444;
  --blue: #3b82f6;
  --radius: 8px;
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.hidden { display: none !important; }

/* Login */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3rem;
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.login-icon { font-size: 3rem; margin-bottom: 0.5rem; }

.login-card h1 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 2rem;
  color: var(--text);
}

.login-card input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  margin-bottom: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.login-card input:focus { border-color: var(--accent); }

.login-card button {
  width: 100%;
  padding: 0.75rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s;
}

.login-card button:hover { background: var(--accent-dim); }

.error {
  color: var(--red);
  font-size: 0.85rem;
  margin-top: 0.75rem;
}

/* Header */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--card);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-left { display: flex; align-items: center; gap: 0.75rem; }
.logo { font-size: 1.5rem; }
header h1 { font-size: 1.1rem; font-weight: 600; }
.header-right { display: flex; align-items: center; gap: 1.25rem; }

.clock {
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.btn-ghost {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-ghost:hover { border-color: var(--text-dim); color: var(--text); }

/* Grid — Row 1: Projects full width, Row 2: 3 equal columns */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  padding: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
}

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.card.span-full { grid-column: 1 / -1; }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}

.card-header h2 { font-size: 0.85rem; font-weight: 600; }

.badge {
  background: var(--accent);
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
}

.card-body {
  padding: 1rem;
  max-height: 350px;
  overflow-y: auto;
}

.card-body-tall { max-height: 600px; }

.loading {
  color: var(--text-dim);
  font-size: 0.85rem;
  text-align: center;
  padding: 2rem 0;
}

/* Placeholder message */
.placeholder-message {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-dim);
}

.placeholder-icon { font-size: 2rem; display: block; margin-bottom: 0.5rem; }
.placeholder-message p { font-size: 0.9rem; font-weight: 500; }
.placeholder-sub { font-size: 0.75rem; margin-top: 0.25rem; opacity: 0.7; }

/* Status dots */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 6px;
}

.status-dot.green { background: var(--green); }
.status-dot.yellow { background: var(--yellow); }
.status-dot.red { background: var(--red); }
.status-dot.blue { background: var(--blue); }
.status-dot.gray { background: var(--text-dim); }

/* Project accordion */
.project-item {
  border-bottom: 1px solid var(--border);
}

.project-item:last-child { border-bottom: none; }

.project-summary {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0.25rem;
  cursor: pointer;
  transition: background 0.15s;
  border-radius: 4px;
}

.project-summary:hover { background: rgba(255,255,255,0.03); }

.project-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 1;
  min-width: 0;
}

.project-info { min-width: 0; }

.project-name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.15rem;
}

.progress-label {
  font-size: 0.7rem;
  color: var(--text-dim);
}

.progress-bar-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 280px;
  flex-shrink: 0;
}

.progress-track {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s;
}

.progress-fill.green { background: var(--green); }
.progress-fill.yellow { background: var(--yellow); }
.progress-fill.red { background: var(--red); }
.progress-fill.blue { background: var(--blue); }
.progress-fill.gray { background: var(--text-dim); }

.progress-pct {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  width: 30px;
  text-align: right;
}

.updated-label {
  font-size: 0.65rem;
  color: var(--text-dim);
  white-space: nowrap;
  flex-shrink: 0;
}

.chevron {
  color: var(--text-dim);
  font-size: 0.75rem;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.project-item.expanded .chevron { transform: rotate(90deg); }

.project-expanded {
  display: none;
  padding: 0 0.25rem 1rem 1.5rem;
  font-size: 0.8rem;
  animation: slideDown 0.2s ease;
}

.project-item.expanded .project-expanded { display: block; }

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.project-phases { margin-bottom: 0.75rem; }

.phase-item {
  padding: 0.4rem 0;
  border-left: 2px solid var(--border);
  padding-left: 0.75rem;
  margin-bottom: 0.4rem;
}

.phase-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.phase-icon { font-size: 0.85rem; }

.phase-tasks {
  margin-top: 0.3rem;
  margin-left: 0.5rem;
}

.phase-task {
  color: var(--text-dim);
  font-size: 0.75rem;
  padding: 0.1rem 0;
}

.phase-task.done { text-decoration: line-through; opacity: 0.6; }
.phase-task.dim { opacity: 0.5; font-style: italic; }

.project-blockers {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 6px;
  padding: 0.6rem 0.85rem;
  margin-bottom: 0.75rem;
}

.project-blockers strong {
  color: var(--red);
}

.blocker-item {
  color: #fca5a5;
  font-size: 0.78rem;
  padding: 0.2rem 0;
}

.project-updated {
  color: var(--text-dim);
  font-size: 0.7rem;
  margin-bottom: 0.5rem;
}

.project-details-list { margin-top: 0.25rem; }
.detail-line { color: var(--text-dim); font-size: 0.75rem; padding: 0.1rem 0; }

.dim { color: var(--text-dim); font-size: 0.8rem; }

/* Table */
.mini-table {
  width: 100%;
  font-size: 0.8rem;
  border-collapse: collapse;
}

.mini-table th {
  text-align: left;
  color: var(--text-dim);
  font-weight: 500;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

.mini-table td {
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

.schedule-cell {
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Agent card */
.agent-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}

.agent-row:last-child { border-bottom: none; }
.agent-name { font-weight: 600; font-size: 0.9rem; }
.agent-detail { font-size: 0.75rem; color: var(--text-dim); }

.tag {
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-weight: 500;
  white-space: nowrap;
}

.tag-green { background: rgba(34,197,94,0.15); color: var(--green); }
.tag-yellow { background: rgba(234,179,8,0.15); color: var(--yellow); }
.tag-red { background: rgba(239,68,68,0.15); color: var(--red); }
.tag-blue { background: rgba(59,130,246,0.15); color: var(--blue); }
.tag-gray { background: rgba(115,115,115,0.15); color: var(--text-dim); }
.tag-dim { background: rgba(115,115,115,0.1); color: var(--text-dim); font-size: 0.65rem; }

/* Costs */
.costs-summary { display: flex; flex-direction: column; gap: 0.75rem; }
.costs-remaining { font-size: 1.4rem; font-weight: 700; margin-bottom: 0.4rem; }
.costs-remaining .dim { font-size: 0.8rem; font-weight: 400; }
.costs-bar-outer { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.costs-bar-inner { height: 100%; border-radius: 4px; transition: width 0.5s; }
.costs-bar-labels { display: flex; justify-content: space-between; font-size: 0.7rem; color: var(--text-dim); margin-top: 0.2rem; }
.costs-breakdown { display: flex; gap: 1.5rem; }
.costs-period { display: flex; flex-direction: column; font-size: 0.8rem; }
.costs-period .dim { font-size: 0.7rem; }
.costs-period strong { font-variant-numeric: tabular-nums; }

.costs-chart-wrap {
  margin-top: 0.75rem;
  height: 220px;
  position: relative;
}

/* Cost period toggle */
.cost-period-toggle {
  display: flex;
  gap: 2px;
  background: var(--bg);
  border-radius: 6px;
  padding: 2px;
}

.period-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 0.7rem;
  font-family: inherit;
  font-weight: 500;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.period-btn:hover { color: var(--text); }
.period-btn.active { background: var(--accent); color: white; }

/* Footer */
footer {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  color: var(--text-dim);
  font-size: 0.75rem;
  border-top: 1px solid var(--border);
}

/* Scrollbar */
.card-body::-webkit-scrollbar { width: 4px; }
.card-body::-webkit-scrollbar-track { background: transparent; }
.card-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Responsive */
@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .card.span-full { grid-column: span 1; }
  .progress-bar-wrap { width: 120px; }
}

/* Deferred count badge */
.deferred-count { font-size: 0.65rem; color: var(--text-dim); margin-left: 0.5rem; padding: 0.1rem 0.4rem; background: rgba(115,115,115,0.15); border-radius: 4px; white-space: nowrap; }
