:root {
  --brand-primary: #0F4C81;
  --brand-secondary: #003366;
  --brand-accent: #2E7D32;
  --danger: #C62828;
  --warning: #F9A825;
  --info: #1565C0;
  --bg: #F6F8FB;
  --card: #FFFFFF;
  --text: #1F2937;
  --muted: #6B7280;
  --border: #E5E7EB;
  --bg-elevated: #F0F2F5;
  --card-bg: #FFFFFF;
  --radius: 14px;
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 64px;
  --topbar-height: 56px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  margin: 0;
  overflow-x: hidden;
}

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

.sidebar {
  width: var(--sidebar-width);
  background: var(--brand-primary);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 1040;
  transition: width 0.25s ease, transform 0.25s ease;
  overflow: hidden;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  padding: 16px 16px 12px 16px;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  min-height: 64px;
}

.sidebar-brand img {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  flex-shrink: 0;
  object-fit: contain;
}

.sidebar-brand-text {
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-brand-text .brand-name {
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.2;
  color: #fff;
}

.sidebar-brand-text .brand-sub {
  font-size: 0.7rem;
  opacity: 0.7;
  letter-spacing: 0.5px;
}

.sidebar.collapsed .sidebar-brand-text {
  display: none;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
}

.sidebar-nav .nav-section-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.5;
  padding: 12px 12px 4px;
  font-weight: 600;
}

.sidebar.collapsed .nav-section-label {
  display: none;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s ease;
  margin-bottom: 2px;
  white-space: nowrap;
}

.sidebar-nav .nav-link i {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-nav .nav-link:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

.sidebar-nav .nav-link.active {
  background: rgba(255,255,255,0.18);
  color: #fff;
  font-weight: 600;
}

.sidebar.collapsed .nav-link span {
  display: none;
}

.sidebar.collapsed .nav-link {
  justify-content: center;
  padding: 10px;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.12);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 0.85rem;
  transition: background 0.15s;
}

.sidebar-user:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.sidebar-user-info {
  overflow: hidden;
}

.sidebar.collapsed .sidebar-user-info {
  display: none;
}

.sidebar-user-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.7rem;
  opacity: 0.6;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  transition: margin-left 0.25s ease;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.sidebar.collapsed ~ .main-wrapper {
  margin-left: var(--sidebar-collapsed-width);
}

.topbar {
  height: var(--topbar-height);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 1030;
  gap: 12px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-sidebar-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.15s;
}

.btn-sidebar-toggle:hover {
  background: var(--bg);
  color: var(--text);
}

.main-content {
  flex: 1;
  padding: 24px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
  font-weight: 600;
}

.card-body {
  padding: 20px;
}

.kpi-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  padding: 20px;
  text-align: center;
  transition: box-shadow 0.15s ease;
}

.kpi-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  margin-bottom: 12px;
}

.kpi-icon.primary { background: rgba(15,76,129,0.1); color: var(--brand-primary); }
.kpi-icon.success { background: rgba(46,125,50,0.1); color: var(--brand-accent); }
.kpi-icon.danger  { background: rgba(198,40,40,0.1); color: var(--danger); }
.kpi-icon.warning { background: rgba(249,168,37,0.1); color: var(--warning); }
.kpi-icon.info    { background: rgba(21,101,192,0.1); color: var(--info); }
.kpi-icon.purple  { background: rgba(123,31,162,0.1); color: #7b1fa2; }

.kpi-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

.kpi-label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 500;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.status-badge.passed     { background: #e8f5e9; color: #2e7d32; }
.status-badge.rejected   { background: #ffebee; color: #c62828; }
.status-badge.hold       { background: #fff8e1; color: #e65100; }
.status-badge.interview  { background: #e3f2fd; color: #1565c0; }
.status-badge.offer      { background: #f3e5f5; color: #7b1fa2; }
.status-badge.new        { background: #e8eaf6; color: #283593; }
.status-badge.onboarding { background: #e8f5e9; color: #388e3c; }
.status-badge.closed     { background: #f5f5f5; color: #616161; }

.aging-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
}

.aging-badge.green  { background: #e8f5e9; color: #2e7d32; }
.aging-badge.yellow { background: #fff8e1; color: #e65100; }
.aging-badge.red    { background: #ffebee; color: #c62828; }
.aging-badge.gray   { background: #f5f5f5; color: #9e9e9e; }

.table {
  font-size: 0.875rem;
}

.table thead th {
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--card);
  z-index: 10;
}

.table td {
  padding: 12px 16px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}

.table tbody tr:hover {
  background: rgba(15,76,129,0.03);
}

.table-row-green  { background: rgba(46,125,50,0.04) !important; }
.table-row-yellow { background: rgba(249,168,37,0.06) !important; }
.table-row-red    { background: rgba(198,40,40,0.04) !important; }

.btn-brand {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.875rem;
  padding: 8px 16px;
}

.btn-brand:hover {
  background: var(--brand-secondary);
  border-color: var(--brand-secondary);
  color: #fff;
}

.btn-brand-outline {
  background: transparent;
  border: 1px solid var(--brand-primary);
  color: var(--brand-primary);
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.875rem;
  padding: 8px 16px;
}

.btn-brand-outline:hover {
  background: var(--brand-primary);
  color: #fff;
}

.btn-accent {
  background: var(--brand-accent);
  border-color: var(--brand-accent);
  color: #fff;
  border-radius: 8px;
  font-weight: 500;
}

.btn-accent:hover {
  background: #1b5e20;
  border-color: #1b5e20;
  color: #fff;
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}

.empty-state i {
  font-size: 3rem;
  opacity: 0.3;
  margin-bottom: 16px;
  display: block;
}

.empty-state p {
  font-size: 0.95rem;
  margin-bottom: 16px;
}

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

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  color: var(--text);
}

.filter-bar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
}

.chart-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.chart-card h6 {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.alert-panel {
  border-left: 4px solid var(--danger);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.alert-panel.warning-panel {
  border-left-color: var(--warning);
}

.kanban-wrapper {
  overflow-x: auto;
  padding-bottom: 16px;
}

.kanban-board {
  display: flex;
  gap: 12px;
  min-width: max-content;
}

.kanban-col {
  min-width: 220px;
  max-width: 240px;
  flex-shrink: 0;
}

.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 10px 10px 0 0;
  font-size: 0.78rem;
  font-weight: 700;
  gap: 8px;
}

.kanban-col-body {
  background: #f1f3f5;
  border-radius: 0 0 10px 10px;
  padding: 8px;
  min-height: 280px;
  max-height: 65vh;
  overflow-y: auto;
  transition: background 0.15s;
}

.kanban-col-body.drag-over {
  background: #e3f2fd;
  outline: 2px dashed var(--info);
  outline-offset: -2px;
}

.kanban-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: grab;
  transition: box-shadow 0.15s, opacity 0.15s;
  font-size: 0.82rem;
}

.kanban-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.kanban-card.dragging {
  opacity: 0.4;
  transform: rotate(2deg);
}

.kanban-card-name {
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kanban-card-meta {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.kanban-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.form-control, .form-select {
  border-radius: 8px;
  border-color: var(--border);
  font-size: 0.875rem;
}

.form-control:focus, .form-select:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(15,76,129,0.1);
}

.form-label {
  font-weight: 500;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 4px;
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .main-wrapper {
    margin-left: 0 !important;
  }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1039;
  }
  .sidebar-overlay.active {
    display: block;
  }
}
