/* SyncBrain Admin — Phase 1 */

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface-hover: #222636;
  --border: #2a2e3d;
  --text: #e0e0e6;
  --text-dim: #8a8f9d;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --green: #22c55e;
  --yellow: #eab308;
  --red: #ef4444;
  --radius: 8px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* Nav */
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.nav-brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent);
}
.nav-links { display: flex; gap: 16px; }
.nav-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 4px 8px;
  border-radius: 4px;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); background: var(--surface-hover); }
.nav-links a.logout { color: var(--red); }
.nav-links a.logout:hover { background: rgba(239,68,68,0.1); }

/* Main */
main { max-width: 1100px; margin: 0 auto; padding: 24px; }

h1 { font-size: 1.5rem; margin-bottom: 16px; }
h2 { font-size: 1.2rem; margin: 24px 0 12px; }
h3 { font-size: 1rem; margin-bottom: 8px; color: var(--text-dim); }

/* Flash */
.flash-messages { margin-bottom: 16px; }
.flash {
  padding: 10px 16px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  font-size: 0.9rem;
}
.flash.success { background: rgba(34,197,94,0.15); color: var(--green); border: 1px solid rgba(34,197,94,0.3); }
.flash.error { background: rgba(239,68,68,0.15); color: var(--red); border: 1px solid rgba(239,68,68,0.3); }
.flash.warning { background: rgba(234,179,8,0.15); color: var(--yellow); border: 1px solid rgba(234,179,8,0.3); }

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}
.stat-number { font-size: 2rem; font-weight: 700; }
.stat-label { font-size: 0.8rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-card.active .stat-number { color: var(--green); }
.stat-card.idle .stat-number { color: var(--yellow); }
.stat-card.stale .stat-number { color: var(--red); }

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 0.9rem;
}
thead { background: var(--surface-hover); }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); }
th { font-size: 0.8rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
tbody tr:hover { background: var(--surface-hover); }
td a { color: var(--accent); text-decoration: none; }
td a:hover { color: var(--accent-hover); }
.empty { text-align: center; color: var(--text-dim); padding: 24px; }

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  background: var(--surface-hover);
}
.badge.active { background: rgba(34,197,94,0.15); color: var(--green); }
.badge.idle { background: rgba(234,179,8,0.15); color: var(--yellow); }
.badge.stale { background: rgba(239,68,68,0.15); color: var(--red); }
.badge.suspended { background: rgba(239,68,68,0.15); color: var(--red); }
.badge.new { background: rgba(99,102,241,0.15); color: var(--accent); }

/* Progress Bar */
.progress-bar {
  width: 80px;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}
.progress-fill {
  height: 100%;
  background: var(--green);
  border-radius: 3px;
  transition: width 0.3s;
}
.progress-fill.warning { background: var(--yellow); }
.progress-fill.danger { background: var(--red); }

/* Login */
.login-box {
  max-width: 360px;
  margin: 120px auto;
  background: var(--surface);
  padding: 32px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  text-align: center;
}
.login-box h1 { margin-bottom: 24px; }
.login-box input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 0.95rem;
  margin-bottom: 12px;
}
.login-box input:focus { outline: none; border-color: var(--accent); }
.login-box button {
  width: 100%;
  padding: 10px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 0.95rem;
  cursor: pointer;
}
.login-box button:hover { background: var(--accent-hover); }

/* Forms */
.form { max-width: 500px; }
.form label {
  display: block;
  margin-bottom: 14px;
  font-size: 0.85rem;
  color: var(--text-dim);
}
.form input, .form select, .form textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 0.9rem;
}
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--accent); }
.form-actions { display: flex; gap: 10px; margin-top: 20px; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 8px 16px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 4px;
  text-decoration: none;
  font-size: 0.9rem;
  cursor: pointer;
}
.btn:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface-hover); color: var(--text); }
.btn-secondary:hover { background: var(--border); }

/* Page Header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.page-header h1 { margin-bottom: 0; }

/* Detail */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.detail-card.full-width { grid-column: 1 / -1; }
dl { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; }
dt { color: var(--text-dim); font-size: 0.85rem; }
dd { font-size: 0.9rem; }

/* Responsive */
@media (max-width: 768px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  table { font-size: 0.8rem; }
  th, td { padding: 6px 8px; }
  main { padding: 12px; }
}
