:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #273449;
  --border: #334155;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --danger: #ef4444;
  --ok: #22c55e;
  --warn: #f59e0b;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.error-text { color: #fca5a5; margin: 8px 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.btn {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
}
.btn:hover { background: #334155; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.danger { background: #7f1d1d; border-color: var(--danger); color: #fecaca; }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn.full { width: 100%; }

input, select {
  width: 100%;
  margin-top: 6px;
  padding: 8px 10px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
}
label { display: block; margin-bottom: 12px; font-size: 13px; color: var(--muted); }

.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card { width: 100%; max-width: 360px; }
.login-card h1 { margin: 0 0 4px; font-size: 22px; }

.app-layout { display: flex; flex-direction: column; height: 100vh; }
.topbar {
  height: 54px;
  padding: 0 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; }
.dot-logo { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); display: inline-block; }
.topbar-actions { display: flex; gap: 8px; }

.workspace { display: flex; flex: 1; min-height: 0; }
.sidebar {
  width: 300px;
  border-right: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
}
.sidebar-head {
  padding: 12px;
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}
.sidebar-head input { margin-top: 0; }
.icon-btn { padding: 8px 10px; }

.agent-list { flex: 1; overflow-y: auto; padding: 8px; }
.agent-item {
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 4px;
  border: 1px solid transparent;
}
.agent-item:hover { background: var(--surface-2); }
.agent-item.active { background: var(--surface-2); border-color: var(--primary); }
.agent-row { display: flex; justify-content: space-between; align-items: center; }
.agent-meta { font-size: 12px; color: var(--muted); margin-top: 4px; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.badge.ok { background: rgba(34,197,94,0.18); color: #86efac; }
.badge.err { background: rgba(239,68,68,0.18); color: #fca5a5; }
.badge.warn { background: rgba(245,158,11,0.18); color: #fcd34d; }
.badge.muted-badge { background: rgba(148,163,184,0.18); color: var(--muted); }

.main-pane { flex: 1; overflow-y: auto; padding: 20px; }
.empty-state { text-align: center; margin-top: 100px; }

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}
.detail-header h2 { margin: 0 0 4px; }
.detail-actions { display: flex; gap: 8px; }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab {
  background: none;
  border: none;
  color: var(--muted);
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-size: 13px;
}
.tab.active { color: var(--text); border-bottom-color: var(--primary); font-weight: 600; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat-card .label { font-size: 12px; color: var(--muted); }
.stat-card .val { font-size: 18px; font-weight: 600; margin-top: 4px; }

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 8px;
  flex-wrap: wrap;
}

.console-box {
  background: #020617;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  max-height: 380px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.files-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 16px; }
@media (max-width: 960px) { .files-grid { grid-template-columns: 1fr; } }

.selected-paths { display: flex; flex-direction: column; gap: 8px; }
.path-chip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 8px 10px;
  border-radius: 6px;
  gap: 8px;
}

.fs-nav { display: flex; align-items: center; gap: 8px; }
.fs-list { max-height: 440px; overflow-y: auto; }
.fs-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 10px;
  border-bottom: 1px solid rgba(51,65,85,0.5);
  gap: 8px;
}
.fs-row:hover { background: var(--surface-2); }
.fs-name { cursor: pointer; flex: 1; display: flex; align-items: center; gap: 8px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}
.form-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(2,6,23,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-card { width: 100%; max-width: 560px; }
