/* ============================================================
   Team Dashboard — Application Styles
   Minimal CSS: no external UI lib, dev-tool aesthetic
   ============================================================ */

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

:root {
  --color-bg: #0f1117;
  --color-surface: #1a1d27;
  --color-surface-2: #22263a;
  --color-border: #2e3250;
  --color-text: #c8ccd8;
  --color-text-dim: #6b7280;
  --color-accent: #6c8ff8;
  --color-green: #34d399;
  --color-yellow: #fbbf24;
  --color-red: #f87171;
  --color-purple: #a78bfa;
  --color-blue: #38bdf8;
  --radius: 6px;
  --font-mono: "SFMono-Regular", "Menlo", "Monaco", "Consolas", monospace;
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

ul {
  list-style: none;
}

/* ============================================================
   Layout
   ============================================================ */

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ---- Header ---- */

.app-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 12px 16px;
  flex-shrink: 0;
}

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

.feature-desc {
  font-size: 16px;
  font-weight: 600;
  color: #e2e8f0;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.meta-lead {
  font-size: 12px;
  color: var(--color-yellow);
  font-weight: 500;
}

.teammates-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.teammate-chip {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1px 8px;
  font-size: 11px;
  color: var(--color-accent);
}

.meta-sid {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-text-dim);
  margin-left: auto;
}

.meta-loading {
  font-size: 12px;
  color: var(--color-text-dim);
}

.meta-warn {
  font-size: 12px;
  color: var(--color-yellow);
}

/* ---- Worktree strip ---- */

.header-worktree {
  margin-top: 6px;
  border-top: 1px solid var(--color-border);
  padding-top: 6px;
}

.worktree-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.worktree-entry {
  display: flex;
  gap: 4px;
  font-size: 11px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 2px 6px;
}

.worktree-branch {
  color: var(--color-green);
  font-family: var(--font-mono);
}

.worktree-path {
  color: var(--color-text-dim);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Connection badge ---- */

.conn-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid transparent;
}

.conn-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.conn-connecting {
  color: var(--color-yellow);
  border-color: var(--color-yellow);
}
.conn-connecting .conn-dot {
  background: var(--color-yellow);
  animation: pulse 1.2s infinite;
}

.conn-open {
  color: var(--color-green);
  border-color: var(--color-green);
}
.conn-open .conn-dot {
  background: var(--color-green);
}

.conn-reconnecting {
  color: var(--color-red);
  border-color: var(--color-red);
}
.conn-reconnecting .conn-dot {
  background: var(--color-red);
  animation: pulse 0.8s infinite;
}

.conn-closed {
  color: var(--color-text-dim);
  border-color: var(--color-border);
}
.conn-closed .conn-dot {
  background: var(--color-text-dim);
}

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

/* ---- 3-column body ---- */

.dashboard-body {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 0;
  flex: 1;
  overflow: hidden;
}

/* ============================================================
   Panel base
   ============================================================ */

.panel {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--color-border);
  overflow: hidden;
}

.panel:last-child {
  border-right: none;
}

.panel-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-dim);
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.panel-badge {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 0 6px;
  font-size: 10px;
  color: var(--color-text);
}

.panel-empty {
  padding: 16px 12px;
  color: var(--color-text-dim);
  font-size: 12px;
  font-style: italic;
}

/* ============================================================
   Tasks panel
   ============================================================ */

.task-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.task-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.task-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.task-status {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 5px;
  border-radius: 4px;
}

.status-pending {
  background: rgba(251, 191, 36, 0.1);
  color: var(--color-yellow);
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.status-in-progress {
  background: rgba(108, 143, 248, 0.1);
  color: var(--color-accent);
  border: 1px solid rgba(108, 143, 248, 0.3);
}

.status-completed {
  background: rgba(52, 211, 153, 0.1);
  color: var(--color-green);
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.status-deleted {
  background: rgba(107, 114, 128, 0.1);
  color: var(--color-text-dim);
  border: 1px solid var(--color-border);
}

.task-id {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--color-text-dim);
}

.task-subject {
  font-size: 13px;
  color: #e2e8f0;
  line-height: 1.4;
}

.task-owner {
  font-size: 11px;
  color: var(--color-accent);
}

.task-active-form {
  font-size: 11px;
  color: var(--color-text-dim);
  font-style: italic;
}

.task-blocked {
  font-size: 11px;
  color: var(--color-red);
}

/* ============================================================
   Timeline panel
   ============================================================ */

.timeline-list {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.timeline-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border);
  transition: background 0.1s;
}

.timeline-item:hover {
  background: var(--color-surface);
}

.timeline-icon {
  font-size: 14px;
  flex-shrink: 0;
  line-height: 1.4;
}

.timeline-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.timeline-type {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-dim);
}

.timeline-send_message .timeline-type { color: var(--color-blue); }
.timeline-task_create .timeline-type { color: var(--color-green); }
.timeline-task_update .timeline-type { color: var(--color-yellow); }
.timeline-agent_spawn .timeline-type { color: var(--color-purple); }
.timeline-assistant_message .timeline-type { color: var(--color-accent); }

.timeline-summary {
  font-size: 12px;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-time {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--color-text-dim);
  flex-shrink: 0;
  padding-top: 2px;
}

/* ============================================================
   Artifacts panel
   ============================================================ */

.artifact-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.artifact-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 6px 10px;
}

.artifact-type {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--color-accent);
  flex-shrink: 0;
}

.artifact-path {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.artifact-mtime {
  font-size: 10px;
  color: var(--color-text-dim);
  flex-shrink: 0;
}

/* ============================================================
   Waiting screen (no sid)
   ============================================================ */

.waiting-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  gap: 16px;
  padding: 24px;
  text-align: center;
}

.waiting-screen h1 {
  font-size: 24px;
  color: #e2e8f0;
}

.waiting-msg {
  font-size: 14px;
  color: var(--color-text-dim);
  line-height: 2;
}

.waiting-msg code {
  font-family: var(--font-mono);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--color-accent);
}

/* ============================================================
   Scrollbar (webkit)
   ============================================================ */

::-webkit-scrollbar {
  width: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 2px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-dim);
}
