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

html {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: #0f172a;
  background: #f8fafc;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 32px; }

/* ── NAV ── */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: 60px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand { font-weight: 700; font-size: 1rem; color: #0f172a; letter-spacing: -0.02em; }
.nav-links { display: flex; gap: 4px; position: relative; }

/* Dropdown */
.nav-dropdown { position: relative; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 5px;
  font-size: 0.875rem;
  color: #0f172a;
  font-weight: 500;
  background: #f1f5f9;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.nav-link:hover { background: #e2e8f0; }
.nav-link svg { transition: transform 0.2s; }
.nav-link.open svg { transform: rotate(180deg); }

.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 180px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.10);
  z-index: 200;
  overflow: hidden;
}
.dropdown-menu.open { display: block; }
.dropdown-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  text-align: left;
  font-size: 0.875rem;
  color: #0f172a;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s;
}
.dropdown-item:hover { background: #f8fafc; }
.dropdown-item.active { background: #eff6ff; color: #1d4ed8; font-weight: 500; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 18px;
  font-size: 0.875rem; font-weight: 500; font-family: inherit;
  border-radius: 5px; border: 1px solid transparent;
  cursor: pointer; transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.btn-primary { background: #0f172a; color: #fff; border-color: #0f172a; }
.btn-primary:hover { background: #1e293b; }
.btn-secondary { background: #fff; color: #0f172a; border-color: #e2e8f0; }
.btn-secondary:hover { background: #f8fafc; }
.btn-sm { padding: 7px 13px; font-size: 0.8rem; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── STATS ── */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.stat-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 24px;
}
.stat-label { font-size: 0.8rem; font-weight: 500; color: #64748b; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.stat-value { font-size: 2rem; font-weight: 700; color: #0f172a; letter-spacing: -0.03em; }

/* ── CARD ── */
.card { background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; padding: 28px; }
.card-header { padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid #e2e8f0; }
.card-header h3 { font-size: 1rem; font-weight: 600; }

/* ── DEPT BREAKDOWN ── */
.dept-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
}
.dept-row:last-child { border-bottom: none; }
.dept-bar-wrap { flex: 1; margin: 0 16px; height: 6px; background: #f1f5f9; border-radius: 99px; overflow: hidden; }
.dept-bar { height: 100%; background: #3b82f6; border-radius: 99px; transition: width 0.4s; }
.dept-count { font-size: 0.8rem; font-weight: 600; color: #64748b; min-width: 24px; text-align: right; }

/* ── VIEW HEADER ── */
.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}
.view-header h2 { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.02em; }

/* ── SEARCH ── */
.search-wrap { position: relative; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #94a3b8; pointer-events: none; }
.search-input {
  padding: 9px 14px 9px 38px;
  font-size: 0.875rem;
  font-family: inherit;
  color: #0f172a;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  width: 260px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

/* ── EMPLOYEE TABLE ── */
.employee-table { width: 100%; border-collapse: collapse; }
.employee-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}
.employee-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.875rem;
  color: #0f172a;
}
.employee-table tr:last-child td { border-bottom: none; }
.employee-table tbody tr:hover td { background: #f8fafc; }
.table-wrap { background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; }

.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: #e0e7ff;
  color: #3730a3;
  font-size: 0.8rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
  flex-shrink: 0;
}
.name-cell { display: flex; align-items: center; }

.badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 99px;
  font-size: 0.75rem; font-weight: 500;
}
.badge-teknik    { background: #dbeafe; color: #1d4ed8; }
.badge-design    { background: #fce7f3; color: #9d174d; }
.badge-produkt   { background: #dcfce7; color: #15803d; }
.badge-försäljning { background: #fef3c7; color: #92400e; }
.badge-hr        { background: #f3e8ff; color: #7e22ce; }
.badge-marknadsföring { background: #ffedd5; color: #c2410c; }
.badge-default   { background: #f1f5f9; color: #475569; }

.action-btn {
  background: none; border: none; cursor: pointer;
  color: #94a3b8; padding: 4px 6px; border-radius: 4px;
  font-size: 0.85rem; transition: color 0.15s, background 0.15s;
}
.action-btn:hover { color: #ef4444; background: #fee2e2; }

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #94a3b8;
}
.empty-icon { font-size: 2.5rem; margin-bottom: 12px; }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 500;
  backdrop-filter: blur(2px);
}
.modal {
  background: #fff;
  border-radius: 10px;
  width: 100%;
  max-width: 460px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
  animation: modal-in 0.18s ease;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(-12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 24px 0;
}
.modal-header h3 { font-size: 1.05rem; font-weight: 600; }
.modal-close {
  background: none; border: none; cursor: pointer;
  font-size: 1rem; color: #94a3b8; padding: 4px 8px;
  border-radius: 4px; transition: background 0.15s;
}
.modal-close:hover { background: #f1f5f9; color: #0f172a; }

#add-form { padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 0.85rem; font-weight: 500; color: #0f172a; }
#add-form input {
  padding: 10px 14px; font-size: 0.875rem; font-family: inherit;
  color: #0f172a; background: #fff;
  border: 1px solid #e2e8f0; border-radius: 5px;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
#add-form input:focus {
  outline: none; border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}
.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding-top: 8px;
}

/* ── ALERTS ── */
.alert { padding: 12px 16px; border-radius: 5px; font-size: 0.85rem; }
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }

/* ── SETTINGS DEPT LIST ── */
.dept-tag {
  display: inline-flex; align-items: center;
  padding: 5px 12px; margin: 4px;
  background: #f1f5f9; border-radius: 99px;
  font-size: 0.8rem; font-weight: 500; color: #475569;
}

/* ── TYPOGRAPHY ── */
h2 { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.02em; }
.text-muted { color: #64748b; font-size: 0.875rem; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .container { padding: 0 16px; }
  .nav { padding: 0 16px; }
  .stats-grid { grid-template-columns: 1fr; }
  .view-header { flex-direction: column; align-items: flex-start; }
  .search-input { width: 100%; }
}
