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

:root {
  --bg:        #0f1117;
  --card:      #1a1d27;
  --border:    #2a2d3a;
  --text:      #e2e8f0;
  --muted:     #8892a4;
  --accent:    #6366f1;
  --font-sans: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

html, body { height: 100%; background: var(--bg); color: var(--text); font-family: var(--font-sans); font-size: 14px; }

/* ─── Animations ───────────────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .35; }
}

/* ─── App shell ────────────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ─── Sidebar ──────────────────────────────────────────────────────────── */
.sidebar {
  width: 200px;
  min-width: 200px;
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.sidebar-header {
  padding: 20px 16px 14px;
  border-bottom: 1px solid var(--border);
}
.logo {
  display: block;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .04em;
  color: #fff;
}
.logo-sub {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.agent-list { padding: 12px 8px; flex: 1; }
.agent-list-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 0 8px 8px;
}
.agent-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  background: none;
  border: none;
  border-left: 3px solid transparent;
  border-radius: 0 6px 6px 0;
  color: var(--muted);
  font-size: 13px;
  font-family: var(--font-sans);
  cursor: pointer;
  text-align: left;
  transition: background .15s, color .15s;
  margin-bottom: 2px;
}
.agent-btn:hover, .agent-btn.active {
  background: rgba(255,255,255,.05);
  color: var(--text);
}
.agent-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  animation: pulse 2.5s infinite;
}
.agent-label { font-size: 12px; font-weight: 500; }

/* ─── Main panel ───────────────────────────────────────────────────────── */
.main-panel {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ─── Welcome ──────────────────────────────────────────────────────────── */
.welcome-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 12px;
  color: var(--muted);
}
.welcome-icon { font-size: 48px; }
.welcome-panel h2 { font-size: 24px; font-weight: 700; color: var(--text); }
.welcome-panel p { font-size: 14px; }

/* ─── Agent panel ──────────────────────────────────────────────────────── */
.agent-panel-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}
.agent-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  border-left: 4px solid var(--accent);
}
.agent-panel-title { font-size: 16px; font-weight: 600; color: #fff; }
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  animation: pulse 2s infinite;
}
.status-label { font-size: 11px; color: var(--muted); }

.panel-columns {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ─── Feed column ──────────────────────────────────────────────────────── */
.feed-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--border);
  min-width: 0;
}
.feed-header, .files-header, .steer-header {
  padding: 8px 16px;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .1em;
  text-transform: uppercase;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.activity-feed {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  display: flex;
  flex-direction: column;
}
.feed-loading {
  padding: 16px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* ─── Event rows ───────────────────────────────────────────────────────── */
.event-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 6px;
  padding: 7px 14px 7px 12px;
  border-left: 3px solid transparent;
  animation: fadeIn .3s ease;
  border-bottom: 1px solid rgba(255,255,255,.03);
  min-width: 0;
}
.event-row:hover { background: rgba(255,255,255,.02); }

.event-ts {
  font-size: 10px;
  color: var(--muted);
  font-family: var(--font-mono);
  flex-shrink: 0;
  margin-top: 2px;
}
.event-icon { flex-shrink: 0; }

.event-tool-name {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: #a5b4fc;
  flex-shrink: 0;
}
.event-args {
  display: block;
  width: 100%;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  background: rgba(0,0,0,.25);
  padding: 4px 8px;
  border-radius: 4px;
  margin-top: 2px;
  word-break: break-all;
  white-space: pre-wrap;
}

.event-thinking { width: 100%; }
.event-thinking summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  color: var(--muted);
  font-style: italic;
  font-size: 12px;
}
.event-thinking summary::-webkit-details-marker { display: none; }
.event-thinking-preview { color: var(--muted); font-style: italic; }
.event-thinking-full {
  margin-top: 6px;
  padding: 8px 12px;
  background: rgba(0,0,0,.2);
  border-radius: 4px;
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  line-height: 1.6;
  white-space: pre-wrap;
}

.event-text { font-size: 13px; line-height: 1.5; word-break: break-word; flex: 1; }
.event-user-text { color: #86efac; }

.event-result-name { color: #6ee7b7; }
.event-result {
  display: block;
  width: 100%;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  background: rgba(0,0,0,.2);
  padding: 4px 8px;
  border-radius: 4px;
  margin-top: 2px;
  word-break: break-all;
  white-space: pre-wrap;
}

.event-toolresult .event-icon { opacity: .7; }

.empty-state { padding: 20px; color: var(--muted); text-align: center; font-size: 13px; }

/* ─── Steering ─────────────────────────────────────────────────────────── */
.steer-section {
  border-top: 1px solid var(--border);
  background: var(--card);
}
.steer-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 14px 12px;
}
.steer-textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
  padding: 8px 10px;
  resize: vertical;
  outline: none;
  transition: border-color .15s;
}
.steer-textarea:focus { border-color: var(--accent); }
.steer-btn {
  align-self: flex-end;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: #fff;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 18px;
  cursor: pointer;
  transition: opacity .15s;
}
.steer-btn:hover { opacity: .85; }
.steer-response { padding: 0 14px 8px; font-size: 12px; }
.steer-ok { color: #6ee7b7; padding: 4px 0; }

/* ─── Files column ─────────────────────────────────────────────────────── */
.files-column {
  width: 300px;
  min-width: 250px;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--card);
}
.file-tree {
  overflow-y: auto;
  padding: 6px 0;
  flex: 0 0 auto;
  max-height: 45%;
  border-bottom: 1px solid var(--border);
}
.file-tree-inner { display: flex; flex-direction: column; }
.file-tree-path {
  font-size: 10px;
  color: var(--muted);
  padding: 2px 12px 6px;
  font-family: var(--font-mono);
}
.file-tree-back {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 11px;
  padding: 4px 12px;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-sans);
}
.file-tree-back:hover { color: var(--text); }
.file-tree-entry {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  background: none;
  border: none;
  color: var(--text);
  font-size: 12px;
  font-family: var(--font-mono);
  padding: 5px 12px;
  cursor: pointer;
  text-align: left;
  transition: background .1s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-tree-entry:hover { background: rgba(255,255,255,.06); }
.file-tree-dir { color: #93c5fd; }
.tree-icon { color: var(--muted); flex-shrink: 0; }
.file-tree-empty { padding: 10px 12px; color: var(--muted); font-size: 12px; }

.file-content-panel {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
}
.file-content-empty { padding: 16px; color: var(--muted); font-size: 12px; text-align: center; }
.file-content-header {
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
}
.file-content-pre {
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.6;
  color: #c9d1d9;
  white-space: pre;
  overflow-x: auto;
  tab-size: 2;
}

/* ─── Scrollbars ───────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a2d3a; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3a3d4a; }
