:root {
  --surface-0: #090A0D;
  --surface-1: #0F1117;
  --surface-2: #151923;
  --surface-3: #1B2029;

  --lime: #C5F547;
  --lime-dim: #8FB33A;
  --cyan: #4FD8E8;
  --cyan-dim: #3AA3AF;

  --text-primary: #F2F3F5;
  --text-secondary: #9CA3AF;
  --text-tertiary: #6B7280;

  --border: rgba(255,255,255,0.08);
  --border-hover: rgba(255,255,255,0.16);

  --danger: #F5675A;
  --warning: #F5C147;
  --success: #6FE38C;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --font-display: 'Space Grotesk', 'Inter', sans-serif;
  --font-body: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
}

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

body {
  background: var(--surface-0);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

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

.sidebar {
  width: 220px;
  background: var(--surface-1);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.sidebar-brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  color: var(--text-primary);
  padding: 8px 12px 24px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-brand .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 8px var(--lime);
}

.nav-item {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}
.nav-item:hover { background: var(--surface-2); color: var(--text-primary); }
.nav-item.active { background: var(--surface-2); color: var(--lime); }

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.main {
  flex: 1;
  padding: 32px 40px;
  max-width: 1200px;
}

.page-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 4px;
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.card + .card { margin-top: 16px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-body);
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-primary {
  background: var(--lime);
  color: var(--surface-0);
}
.btn-primary:hover { background: #d4ff5c; }
.btn-primary:disabled { background: var(--surface-3); color: var(--text-tertiary); cursor: not-allowed; }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--border-hover); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { color: var(--text-primary); }

.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ---------- Forms ---------- */
label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

input, select, textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  transition: border-color 0.15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--cyan);
}
input::placeholder, textarea::placeholder { color: var(--text-tertiary); }

.field-group { margin-bottom: 16px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 700px) { .field-row { grid-template-columns: 1fr; } }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left;
  color: var(--text-tertiary);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  background: rgba(156,163,175,0.15);
  color: #C4C9D1;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #9CA3AF; }

.badge-submitted { background: rgba(156,163,175,0.15); color: #C4C9D1; }
.badge-submitted::before { background: #9CA3AF; }

.badge-shortlisted { background: rgba(79,216,232,0.15); color: var(--cyan); }
.badge-shortlisted::before { background: var(--cyan); }

.badge-client-review { background: rgba(245,193,71,0.15); color: var(--warning); }
.badge-client-review::before { background: var(--warning); }

.badge-interviewing { background: rgba(245,193,71,0.15); color: var(--warning); }
.badge-interviewing::before { background: var(--warning); }

.badge-offer { background: rgba(197,245,71,0.15); color: var(--lime); }
.badge-offer::before { background: var(--lime); }

.badge-placed { background: rgba(111,227,140,0.18); color: var(--success); }
.badge-placed::before { background: var(--success); }

.badge-rejected, .badge-dropped { background: rgba(245,103,90,0.15); color: var(--danger); }
.badge-rejected::before, .badge-dropped::before { background: var(--danger); }

.badge-open { background: rgba(79,216,232,0.15); color: var(--cyan); }
.badge-open::before { background: var(--cyan); }
.badge-in-progress { background: rgba(245,193,71,0.15); color: var(--warning); }
.badge-in-progress::before { background: var(--warning); }
.badge-filled { background: rgba(111,227,140,0.18); color: var(--success); }
.badge-filled::before { background: var(--success); }
.badge-cancelled { background: rgba(245,103,90,0.15); color: var(--danger); }
.badge-cancelled::before { background: var(--danger); }

/* ---------- Stat cards ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
}
.stat-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  color: var(--lime);
}
.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}
.empty-state .icon { font-size: 32px; margin-bottom: 12px; opacity: 0.5; }

/* ---------- Login page ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  text-align: center;
}
.login-brand {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 4px;
}
.login-sub {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 28px;
}
.login-card .field-group { text-align: left; }

.toast {
  margin-top: 16px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.toast-success { background: rgba(111,227,140,0.12); color: var(--success); }
.toast-error { background: rgba(245,103,90,0.12); color: var(--danger); }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 560px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px;
}
.modal-title { font-family: var(--font-display); font-size: 18px; font-weight: 600; }
.modal-close { cursor: pointer; color: var(--text-tertiary); font-size: 20px; background: none; border: none; }
.modal-close:hover { color: var(--text-primary); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

.hidden { display: none !important; }

.select-stage {
  min-width: 150px;
}

.mobile-toggle { display: none; }
@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 8px 0 24px rgba(0,0,0,0.4);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .main { padding: 20px; padding-top: 64px; }
  .mobile-toggle {
    display: flex;
    position: fixed;
    top: 14px; left: 14px;
    z-index: 150;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    color: var(--text-primary);
    cursor: pointer;
    align-items: center;
    gap: 6px;
    font-size: 13px;
  }
  .mobile-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 199;
  }
  .mobile-overlay.active { display: block; }
}

/* ---------- Sortable table headers ---------- */
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text-primary); }
th.sortable .sort-arrow { margin-left: 4px; opacity: 0.5; font-size: 10px; }
th.sortable.active-sort .sort-arrow { opacity: 1; color: var(--lime); }

/* ---------- Notification bell ---------- */
.notif-bell-wrap { position: relative; }
.notif-bell {
  cursor: pointer;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.notif-bell:hover { background: var(--surface-2); color: var(--text-primary); }
.notif-badge {
  background: var(--danger);
  color: white;
  font-size: 11px;
  font-weight: 700;
  border-radius: 100px;
  padding: 1px 6px;
  min-width: 18px;
  text-align: center;
}
.notif-dropdown {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  width: 320px;
  max-height: 400px;
  overflow-y: auto;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 32px rgba(0,0,0,0.4);
  z-index: 50;
}
.notif-item {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  cursor: pointer;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--surface-3); }
.notif-item.unread { border-left: 3px solid var(--cyan); }
.notif-item .notif-time { color: var(--text-tertiary); font-size: 11px; margin-top: 4px; }
.notif-empty { padding: 20px 14px; text-align: center; color: var(--text-tertiary); font-size: 13px; }

/* ---------- Pagination ---------- */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
}
.pagination-controls { display: flex; gap: 8px; align-items: center; }

/* ---------- Bulk action bar ---------- */
.bulk-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  font-size: 13px;
}
.bulk-bar select { width: auto; }

/* ---------- Danger button ---------- */
.btn-danger { background: rgba(245,103,90,0.15); color: var(--danger); }
.btn-danger:hover { background: rgba(245,103,90,0.25); }

/* ---------- Editable detail fields ---------- */
.detail-edit-input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  color: var(--text-primary);
  font-size: 13px;
}

/* ---------- Funnel bars ---------- */
.funnel-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}
.funnel-label {
  width: 140px;
  flex-shrink: 0;
  font-size: 13px;
  color: var(--text-secondary);
}
.funnel-track {
  flex: 1;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  height: 32px;
  position: relative;
  overflow: hidden;
}
.funnel-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--lime));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 10px;
  min-width: 36px;
  transition: width 0.3s ease;
}
.funnel-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--surface-0);
}
.funnel-pct {
  width: 130px;
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-tertiary);
  text-align: right;
}
