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

:root {
  --bg: #0a0a0f;
  --surface: #12121a;
  --surface-hover: #1a1a26;
  --border: #1e1e2a;
  --text: #e8e8ed;
  --muted: #8686a0;
  --accent: #00e5a0;
  --accent-dim: #00e5a015;
  --accent-glow: #00e5a040;
  --warm: #ff6b4a;
  --warn: #febc2e;
  --success: #28c840;
  --danger: #ff5f57;
  --radius: 10px;
}

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

.space { font-family: 'Space Grotesk', sans-serif; }

/* === LAYOUT === */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.5rem 0;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  z-index: 50;
}

.sidebar-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  padding: 0 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.sidebar-logo span { color: var(--accent); }

.nav-items { list-style: none; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1.25rem;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 0.88rem;
  border-left: 3px solid transparent;
}

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

.nav-item.active {
  color: var(--accent);
  background: var(--accent-dim);
  border-left-color: var(--accent);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--muted);
}

.main-content {
  margin-left: 240px;
  flex: 1;
  padding: 2rem;
  max-width: 1200px;
}

/* === HEADER === */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.page-header h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.header-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
}

.btn:hover { background: var(--surface-hover); }

.btn-primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.btn-primary:hover { opacity: 0.9; }

.btn-danger {
  color: var(--danger);
  border-color: var(--danger);
}

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.78rem; }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* === CARDS === */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.card-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

/* === STAT GRID === */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
  font-family: 'Space Grotesk', sans-serif;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  font-family: 'Space Grotesk', sans-serif;
  line-height: 1;
}

.stat-value.accent { color: var(--accent); }
.stat-value.warn { color: var(--warn); }
.stat-value.danger { color: var(--danger); }

.stat-sub {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.35rem;
}

/* === TABLES === */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  font-family: 'Space Grotesk', sans-serif;
}

.data-table td {
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.data-table tr:hover td { background: var(--surface-hover); }

.data-table a {
  color: var(--accent);
  text-decoration: none;
}

.data-table a:hover { text-decoration: underline; }

/* === BADGES === */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-stale { background: var(--danger); color: var(--bg); }
.badge-approved { background: var(--success); color: var(--bg); }
.badge-pending { background: var(--warn); color: var(--bg); }
.badge-changes { background: var(--warm); color: var(--bg); }
.badge-conflict { background: #8b5cf6; color: var(--bg); }

/* === FORMS === */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.form-input {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.88rem;
  font-family: inherit;
  transition: border-color 0.15s;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
}

.form-input::placeholder { color: var(--muted); }

.form-hint {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.3rem;
}

/* === TOGGLE === */
.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.toggle-info h4 { font-size: 0.88rem; font-weight: 500; }
.toggle-info p { font-size: 0.75rem; color: var(--muted); }

.toggle {
  width: 42px;
  height: 24px;
  background: var(--border);
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle.active { background: var(--accent); }

.toggle::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform 0.2s;
}

.toggle.active::after { transform: translateX(18px); }

/* === EMPTY STATE === */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--muted);
}

.empty-state h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.2rem;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.empty-state p {
  font-size: 0.9rem;
  max-width: 400px;
  margin: 0 auto 1.5rem;
}

/* === AUTH FORMS === */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

.auth-card {
  width: 100%;
  max-width: 380px;
}

.auth-card .logo {
  text-align: center;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.auth-card .logo span { color: var(--accent); }

.auth-subtitle {
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 2rem;
}

.auth-toggle {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.auth-toggle a {
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
}

.auth-error {
  background: #ff5f5720;
  border: 1px solid #ff5f5740;
  color: var(--danger);
  padding: 0.6rem 0.85rem;
  border-radius: 8px;
  font-size: 0.82rem;
  margin-bottom: 1rem;
}

/* === CONNECT FLOW === */
.connect-card {
  max-width: 500px;
  margin: 2rem auto;
}

.connect-step {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.connect-step-num {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--bg);
  border-radius: 50%;
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
  font-family: 'Space Grotesk', sans-serif;
}

.connect-step-text h4 {
  font-size: 0.92rem;
  margin-bottom: 0.25rem;
}

.connect-step-text p {
  font-size: 0.8rem;
  color: var(--muted);
}

/* === REPO LIST === */
.repo-list {
  list-style: none;
  max-height: 400px;
  overflow-y: auto;
}

.repo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
}

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

.repo-item.selected { background: var(--accent-dim); }

.repo-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.repo-name { font-size: 0.88rem; font-weight: 500; }

.repo-lang {
  font-size: 0.7rem;
  color: var(--muted);
  background: var(--bg);
  padding: 0.15rem 0.5rem;
  border-radius: 100px;
}

.repo-check {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.repo-item.selected .repo-check {
  background: var(--accent);
  border-color: var(--accent);
}

/* === SUMMARY === */
.summary-content {
  font-size: 0.88rem;
  line-height: 1.8;
  white-space: pre-wrap;
}

.summary-content h1 { font-size: 1.2rem; font-family: 'Space Grotesk', sans-serif; margin-bottom: 0.5rem; }
.summary-content h2 { font-size: 1rem; font-family: 'Space Grotesk', sans-serif; color: var(--accent); margin: 1.5rem 0 0.5rem; }

/* === DEVELOPER CARDS === */
.dev-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.dev-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.dev-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--border);
}

.dev-info h4 { font-size: 0.9rem; }
.dev-info p { font-size: 0.75rem; color: var(--muted); }

.dev-stats {
  margin-left: auto;
  text-align: right;
}

.dev-prs {
  font-size: 1.1rem;
  font-weight: 700;
  font-family: 'Space Grotesk', sans-serif;
}

.dev-prs.low { color: var(--success); }
.dev-prs.mid { color: var(--warn); }
.dev-prs.high { color: var(--danger); }

/* === LOADING === */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--muted);
  gap: 0.5rem;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* === TOAST === */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-size: 0.85rem;
  z-index: 1000;
  animation: slideUp 0.3s ease;
}

.toast.success { border-color: var(--accent); color: var(--accent); }
.toast.error { border-color: var(--danger); color: var(--danger); }

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* === FOCUS INDICATORS === */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.nav-item:focus-visible,
.toggle:focus-visible,
.form-input:focus-visible,
.repo-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.form-input:focus-visible {
  outline-offset: -1px;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding: 1rem; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .dev-grid { grid-template-columns: 1fr; }
}
