/* ─── Variables ──────────────────────────────────────────────────────────── */
:root {
  --sidebar-w: 232px;
  --bg: #f7f8fc;
  --surface: #ffffff;
  --border: #e4e7ef;
  --border-light: #f0f2f8;
  --text: #111827;
  --text-muted: #6b7280;
  --text-faint: #9ca3af;
  --accent: #4f46e5;
  --accent-light: #eef2ff;
  --accent-border: #c7d2fe;
  --success: #059669;
  --danger: #dc2626;
  --warning: #d97706;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
}

/* ─── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }

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

/* ─── Sidebar ────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: #0f1117;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  border-right: 1px solid rgba(255,255,255,0.05);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 18px;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  letter-spacing: -0.3px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.sidebar-brand .brand-icon {
  width: 30px; height: 30px;
  background: var(--accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
}

.sidebar-nav {
  flex: 1;
  padding: 10px 0;
  overflow-y: auto;
}

.sidebar-section {
  padding: 14px 18px 6px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: rgba(255,255,255,0.28);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 1px 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 450;
  transition: background 0.12s, color 0.12s;
}
.sidebar-link:hover {
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.9);
}
.sidebar-link.active {
  background: rgba(79,70,229,0.22);
  color: #a5b4fc;
}
.sidebar-link .icon {
  font-size: 15px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.9;
}

.sidebar-divider {
  height: 1px;
  background: rgba(255,255,255,0.07);
  margin: 6px 0;
}

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,0.07);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
}
.sidebar-avatar {
  width: 28px; height: 28px;
  background: rgba(79,70,229,0.35);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: #a5b4fc;
  flex-shrink: 0;
  text-transform: uppercase;
}
.sidebar-email {
  font-size: 12px;
  color: rgba(255,255,255,0.4);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#sidebar-logout {
  width: 100%;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.4);
  font-size: 12px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.12s;
  text-align: left;
}
#sidebar-logout:hover {
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.8);
  border-color: rgba(255,255,255,0.2);
}

/* ─── Main content ───────────────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ─── Page header ────────────────────────────────────────────────────────── */
.page-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.page-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  color: var(--text);
  letter-spacing: -0.2px;
}

.page-body {
  padding: 24px 28px;
  flex: 1;
  max-width: 1400px;
  width: 100%;
}

/* ─── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 13px 18px;
  border-bottom: 1px solid var(--border-light);
  font-weight: 600;
  font-size: 13px;
  background: transparent;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-body { padding: 20px 18px; }

/* ─── Table ──────────────────────────────────────────────────────────────── */
.table {
  margin: 0;
  font-size: 13.5px;
}
.table td, .table th {
  vertical-align: middle;
  padding: 10px 14px;
  border-color: var(--border-light);
}
.table th {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: #fafbfd;
  white-space: nowrap;
}
.table-hover tbody tr:hover { background: #f9fafb; }
.table tr:last-child td { border-bottom: 0; }
.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ─── Filters bar ────────────────────────────────────────────────────────── */
.filters-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

/* ─── Stat cards ─────────────────────────────────────────────────────────── */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.stat-label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.stat-value {
  font-size: 30px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.15;
  letter-spacing: -0.5px;
}

/* ─── Buttons overrides ──────────────────────────────────────────────────── */
.btn {
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all 0.12s;
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
}
.btn-primary:hover {
  background: #4338ca;
  border-color: #4338ca;
}
.btn-icon { padding: 4px 8px; font-size: 13px; line-height: 1.4; }

/* ─── Badge overrides ────────────────────────────────────────────────────── */
.badge {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 7px;
  border-radius: 4px;
}

/* ─── Monospace ──────────────────────────────────────────────────────────── */
.font-monospace { font-size: 12.5px; }

/* ─── Login page ─────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f1117 0%, #1e2130 100%);
}
.login-box {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 36px 32px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 28px;
  color: var(--text);
  letter-spacing: -0.3px;
}
.login-logo .logo-icon {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}

/* ─── Form enhancements ──────────────────────────────────────────────────── */
.form-control, .form-select {
  border-color: var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}

/* ─── Project cards ──────────────────────────────────────────────────────── */
.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.15s;
  height: 100%;
}
.project-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--accent-border);
  transform: translateY(-1px);
}
.project-slug {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 11.5px;
  color: var(--accent);
  background: var(--accent-light);
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
  border: 1px solid var(--accent-border);
}
.project-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 10px 0 4px;
  letter-spacing: -0.2px;
}
.project-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  min-height: 18px;
}

/* ─── Empty state ────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 56px 24px;
  color: var(--text-faint);
}
.empty-state .icon {
  font-size: 42px;
  margin-bottom: 14px;
  display: block;
  opacity: 0.5;
}
.empty-state p { margin: 0; font-size: 14px; color: var(--text-muted); }

/* ─── Modal overlay ──────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(2px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal-box {
  background: var(--surface);
  border-radius: 14px;
  width: 100%;
  max-width: 480px;
  padding: 28px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.18);
  border: 1px solid var(--border);
}
.modal-box h5 {
  margin: 0 0 22px;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.2px;
}

/* ─── Link row actions ───────────────────────────────────────────────────── */
.link-actions { display: flex; gap: 4px; align-items: center; }
.link-actions .btn { padding: 4px 9px; font-size: 12px; }

/* ─── Copy button ────────────────────────────────────────────────────────── */
.copy-btn {
  opacity: 0.4;
  transition: opacity 0.12s;
  color: var(--text-muted) !important;
  padding: 0 4px !important;
}
.copy-btn:hover { opacity: 1; }

/* ─── Status dots ────────────────────────────────────────────────────────── */
.status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 5px;
  flex-shrink: 0;
}
.status-dot.active { background: #22c55e; box-shadow: 0 0 0 2px rgba(34,197,94,0.2); }
.status-dot.inactive { background: #d1d5db; }

/* ─── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.25); }

/* ─── Utilities ──────────────────────────────────────────────────────────── */
.text-accent { color: var(--accent) !important; }
.bg-accent-light { background: var(--accent-light) !important; }
